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