mirror of
				https://github.com/glfw/glfw.git
				synced 2025-11-03 22:04:15 +00:00 
			
		
		
		
	Added GLFW_WIN32_GENERIC_BADGE window hint
This commit is contained in:
		
							parent
							
								
									367a50e82d
								
							
						
					
					
						commit
						de81fae268
					
				@ -1117,6 +1117,7 @@ extern "C" {
 | 
			
		||||
 */
 | 
			
		||||
#define GLFW_X11_INSTANCE_NAME      0x00024002
 | 
			
		||||
#define GLFW_WIN32_KEYBOARD_MENU    0x00025001
 | 
			
		||||
#define GLFW_WIN32_GENERIC_BADGE    0x00025002
 | 
			
		||||
/*! @brief Wayland specific
 | 
			
		||||
 *  [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
 | 
			
		||||
 *  
 | 
			
		||||
 | 
			
		||||
@ -415,6 +415,7 @@ struct _GLFWwndconfig
 | 
			
		||||
    } x11;
 | 
			
		||||
    struct {
 | 
			
		||||
        GLFWbool  keymenu;
 | 
			
		||||
        GLFWbool  genericBadge;
 | 
			
		||||
    } win32;
 | 
			
		||||
    struct {
 | 
			
		||||
        char      appId[256];
 | 
			
		||||
 | 
			
		||||
@ -497,6 +497,7 @@ typedef struct _GLFWwindowWin32
 | 
			
		||||
    GLFWbool            transparent;
 | 
			
		||||
    GLFWbool            scaleToMonitor;
 | 
			
		||||
    GLFWbool            keymenu;
 | 
			
		||||
    GLFWbool            genericBadge;
 | 
			
		||||
 | 
			
		||||
    // Cached size used to filter out duplicate events
 | 
			
		||||
    int                 width, height;
 | 
			
		||||
 | 
			
		||||
@ -1384,6 +1384,7 @@ static int createNativeWindow(_GLFWwindow* window,
 | 
			
		||||
 | 
			
		||||
    window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
 | 
			
		||||
    window->win32.keymenu = wndconfig->win32.keymenu;
 | 
			
		||||
    window->win32.genericBadge = wndconfig->win32.genericBadge;
 | 
			
		||||
 | 
			
		||||
    if (!window->monitor)
 | 
			
		||||
    {
 | 
			
		||||
@ -2046,20 +2047,25 @@ void _glfwSetWindowBadgeWin32(_GLFWwindow* window, int count)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    count = min(count, 999);
 | 
			
		||||
 | 
			
		||||
    if (count > 0)
 | 
			
		||||
    {
 | 
			
		||||
        //Convert count to string (its guaranteed to be at max 3 digits)
 | 
			
		||||
        memset(countStr, 0, 4 * sizeof(char));
 | 
			
		||||
        sprintf(countStr, "%d", count);
 | 
			
		||||
        countWStr = _glfwCreateWideStringFromUTF8Win32(countStr);
 | 
			
		||||
        if (!countWStr)
 | 
			
		||||
        if (window->win32.genericBadge)
 | 
			
		||||
            icon = GenerateGenericBadgeIcon(window->win32.handle);
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to set taskbar badge count");
 | 
			
		||||
            return;
 | 
			
		||||
            //Convert count to string (its guaranteed to be at max 3 digits)
 | 
			
		||||
            memset(countStr, 0, 4 * sizeof(char));
 | 
			
		||||
            sprintf(countStr, "%d", count);
 | 
			
		||||
            countWStr = _glfwCreateWideStringFromUTF8Win32(countStr);
 | 
			
		||||
            if (!countWStr)
 | 
			
		||||
            {
 | 
			
		||||
                _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to set taskbar badge count");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            icon = GenerateTextBadgeIcon(window->win32.handle, countWStr);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        icon = GenerateTextBadgeIcon(window->win32.handle, countWStr);
 | 
			
		||||
        if (!icon)
 | 
			
		||||
        {
 | 
			
		||||
            _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to set taskbar badge count");
 | 
			
		||||
 | 
			
		||||
@ -382,6 +382,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
 | 
			
		||||
        case GLFW_WIN32_KEYBOARD_MENU:
 | 
			
		||||
            _glfw.hints.window.win32.keymenu = value ? GLFW_TRUE : GLFW_FALSE;
 | 
			
		||||
            return;
 | 
			
		||||
        case GLFW_WIN32_GENERIC_BADGE:
 | 
			
		||||
            _glfw.hints.window.win32.genericBadge = value ? GLFW_TRUE : GLFW_FALSE;
 | 
			
		||||
            return;
 | 
			
		||||
        case GLFW_COCOA_GRAPHICS_SWITCHING:
 | 
			
		||||
            _glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user