From 367a50e82d7333c655953fae3706877423c4bc5f Mon Sep 17 00:00:00 2001 From: GamesTrap Date: Wed, 8 Mar 2023 01:00:21 +0100 Subject: [PATCH] Renamed badge API functions --- include/GLFW/glfw3.h | 8 +++++--- src/cocoa_init.m | 4 ++-- src/cocoa_platform.h | 4 ++-- src/cocoa_window.m | 4 ++-- src/internal.h | 4 ++-- src/null_init.c | 4 ++-- src/null_platform.h | 4 ++-- src/null_window.c | 4 ++-- src/posix_dbus.c | 2 +- src/posix_dbus.h | 2 +- src/win32_init.c | 4 ++-- src/win32_platform.h | 4 ++-- src/win32_window.c | 4 ++-- src/window.c | 8 ++++---- src/wl_init.c | 4 ++-- src/wl_platform.h | 4 ++-- src/wl_window.c | 8 ++++---- src/x11_init.c | 4 ++-- src/x11_platform.h | 4 ++-- src/x11_window.c | 6 +++--- tests/window.c | 6 +++--- 21 files changed, 49 insertions(+), 47 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 6553e60d..9b2b95ad 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -3395,10 +3395,12 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i */ GLFWAPI void glfwSetWindowTaskbarProgress(GLFWwindow* window, int progressState, double value); -//Use count = 0 to disable overlay/badge icon -GLFWAPI void glfwSetWindowTaskbarBadge(GLFWwindow* window, int count); +//TODO Documentation +//Use count = 0 to disable badge icon +GLFWAPI void glfwSetWindowBadge(GLFWwindow* window, int count); -GLFWAPI void glfwSetWindowTaskbarBadgeString(GLFWwindow* window, const char* string); +//TODO Documentation +GLFWAPI void glfwSetWindowBadgeString(GLFWwindow* window, const char* string); /*! @brief Retrieves the position of the content area of the specified window. * diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 31dd703c..80e0877a 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -529,8 +529,8 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform) _glfwSetWindowTitleCocoa, _glfwSetWindowIconCocoa, _glfwSetWindowTaskbarProgressCocoa, - _glfwSetWindowTaskbarBadgeCocoa, - _glfwSetWindowTaskbarBadgeStringCocoa, + _glfwSetWindowBadgeCocoa, + _glfwSetWindowBadgeStringCocoa, _glfwGetWindowPosCocoa, _glfwSetWindowPosCocoa, _glfwGetWindowSizeCocoa, diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index c0179372..0d0f2e9e 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -231,8 +231,8 @@ void _glfwDestroyWindowCocoa(_GLFWwindow* window); void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title); void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowTaskbarProgressCocoa(_GLFWwindow* window, int progressState, double value); -void _glfwSetWindowTaskbarBadgeCocoa(_GLFWwindow* window, int count); -void _glfwSetWindowTaskbarBadgeStringCocoa(_GLFWwindow* window, const char* string); +void _glfwSetWindowBadgeCocoa(_GLFWwindow* window, int count); +void _glfwSetWindowBadgeStringCocoa(_GLFWwindow* window, const char* string); void _glfwGetWindowPosCocoa(_GLFWwindow* window, int* xpos, int* ypos); void _glfwSetWindowPosCocoa(_GLFWwindow* window, int xpos, int ypos); void _glfwGetWindowSizeCocoa(_GLFWwindow* window, int* width, int* height); diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 8f8d947c..aee53715 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1167,7 +1167,7 @@ void _glfwSetWindowTaskbarProgressCocoa(_GLFWwindow* window, int progressState, window->ns.dockProgressIndicator.value = value; } -void _glfwSetWindowTaskbarBadgeCocoa(_GLFWwindow* window, int count) +void _glfwSetWindowBadgeCocoa(_GLFWwindow* window, int count) { if (window != NULL) { @@ -1192,7 +1192,7 @@ void _glfwSetWindowTaskbarBadgeCocoa(_GLFWwindow* window, int count) [NSApp dockTile].badgeLabel = string; } -void _glfwSetWindowTaskbarBadgeStringCocoa(_GLFWwindow* window, const char* string) +void _glfwSetWindowBadgeStringCocoa(_GLFWwindow* window, const char* string) { if (window != NULL) { diff --git a/src/internal.h b/src/internal.h index 8a08099a..a7101a4b 100644 --- a/src/internal.h +++ b/src/internal.h @@ -707,8 +707,8 @@ struct _GLFWplatform void (*setWindowTitle)(_GLFWwindow*,const char*); void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*); void (*setWindowTaskbarProgress)(_GLFWwindow*,const int,double); - void (*setWindowTaskbarBadge)(_GLFWwindow*,int); - void (*setWindowTaskbarBadgeString)(_GLFWwindow*,const char* string); + void (*setWindowBadge)(_GLFWwindow*,int); + void (*setWindowBadgeString)(_GLFWwindow*,const char* string); void (*getWindowPos)(_GLFWwindow*,int*,int*); void (*setWindowPos)(_GLFWwindow*,int,int); void (*getWindowSize)(_GLFWwindow*,int*,int*); diff --git a/src/null_init.c b/src/null_init.c index c60a54d9..0de5f6cd 100644 --- a/src/null_init.c +++ b/src/null_init.c @@ -74,8 +74,8 @@ GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform) _glfwSetWindowTitleNull, _glfwSetWindowIconNull, _glfwSetWindowTaskbarProgressNull, - _glfwSetWindowTaskbarBadgeNull, - _glfwSetWindowTaskbarBadgeStringNull, + _glfwSetWindowBadgeNull, + _glfwSetWindowBadgeStringNull, _glfwGetWindowPosNull, _glfwSetWindowPosNull, _glfwGetWindowSizeNull, diff --git a/src/null_platform.h b/src/null_platform.h index 0e767153..bdee77df 100644 --- a/src/null_platform.h +++ b/src/null_platform.h @@ -90,8 +90,8 @@ void _glfwDestroyWindowNull(_GLFWwindow* window); void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title); void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowTaskbarProgressNull(_GLFWwindow* window, int progressState, double value); -void _glfwSetWindowTaskbarBadgeNull(_GLFWwindow* window, int count); -void _glfwSetWindowTaskbarBadgeStringNull(_GLFWwindow* window, const char* string); +void _glfwSetWindowBadgeNull(_GLFWwindow* window, int count); +void _glfwSetWindowBadgeStringNull(_GLFWwindow* window, const char* string); void _glfwSetWindowMonitorNull(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); void _glfwGetWindowPosNull(_GLFWwindow* window, int* xpos, int* ypos); void _glfwSetWindowPosNull(_GLFWwindow* window, int xpos, int ypos); diff --git a/src/null_window.c b/src/null_window.c index 61b53fa8..38869897 100644 --- a/src/null_window.c +++ b/src/null_window.c @@ -191,11 +191,11 @@ void _glfwSetWindowTaskbarProgressNull(_GLFWwindow* window, int progressState, d { } -void _glfwSetWindowTaskbarBadgeNull(_GLFWwindow* window, int count) +void _glfwSetWindowBadgeNull(_GLFWwindow* window, int count) { } -void _glfwSetWindowTaskbarBadgeStringNull(_GLFWwindow* window, const char* string) +void _glfwSetWindowBadgeStringNull(_GLFWwindow* window, const char* string) { } diff --git a/src/posix_dbus.c b/src/posix_dbus.c index d755ab48..fae4f619 100644 --- a/src/posix_dbus.c +++ b/src/posix_dbus.c @@ -221,7 +221,7 @@ void _glfwUpdateTaskbarProgressDBusPOSIX(dbus_bool_t progressVisible, double pro dbus_message_unref(msg); } -void _glfwUpdateTaskbarBadgeDBusPOSIX(dbus_bool_t badgeVisible, int badgeCount) +void _glfwUpdateBadgeDBusPOSIX(dbus_bool_t badgeVisible, int badgeCount) { if(!_glfw.dbus.handle || !_glfw.dbus.connection) return; diff --git a/src/posix_dbus.h b/src/posix_dbus.h index 887cbfd5..1acbfa93 100644 --- a/src/posix_dbus.h +++ b/src/posix_dbus.h @@ -131,4 +131,4 @@ typedef struct _GLFWDBusPOSIX void _glfwInitDBusPOSIX(void); void _glfwTerminateDBusPOSIX(void); void _glfwUpdateTaskbarProgressDBusPOSIX(dbus_bool_t progressVisible, double progressValue); -void _glfwUpdateTaskbarBadgeDBusPOSIX(dbus_bool_t badgeVisible, int badgeCount); +void _glfwUpdateBadgeDBusPOSIX(dbus_bool_t badgeVisible, int badgeCount); diff --git a/src/win32_init.c b/src/win32_init.c index c24def07..ae0872b7 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -639,8 +639,8 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform) _glfwSetWindowTitleWin32, _glfwSetWindowIconWin32, _glfwSetWindowTaskbarProgressWin32, - _glfwSetWindowTaskbarBadgeWin32, - _glfwSetWindowTaskbarBadgeStringWin32, + _glfwSetWindowBadgeWin32, + _glfwSetWindowBadgeStringWin32, _glfwGetWindowPosWin32, _glfwSetWindowPosWin32, _glfwGetWindowSizeWin32, diff --git a/src/win32_platform.h b/src/win32_platform.h index 0f6460b5..d08a4634 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -619,8 +619,8 @@ void _glfwDestroyWindowWin32(_GLFWwindow* window); void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title); void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, int progressState, double value); -void _glfwSetWindowTaskbarBadgeWin32(_GLFWwindow* window, int count); -void _glfwSetWindowTaskbarBadgeStringWin32(_GLFWwindow* window, const char* string); +void _glfwSetWindowBadgeWin32(_GLFWwindow* window, int count); +void _glfwSetWindowBadgeStringWin32(_GLFWwindow* window, const char* string); void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos); void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos); void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height); diff --git a/src/win32_window.c b/src/win32_window.c index f6e5ca6b..fa8ff78b 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -2020,7 +2020,7 @@ static HICON GenerateGenericBadgeIcon(HWND hWnd) return hIcon; } -void _glfwSetWindowTaskbarBadgeWin32(_GLFWwindow* window, int count) +void _glfwSetWindowBadgeWin32(_GLFWwindow* window, int count) { HRESULT res = S_OK; HICON icon = NULL; @@ -2083,7 +2083,7 @@ void _glfwSetWindowTaskbarBadgeWin32(_GLFWwindow* window, int count) } } -void _glfwSetWindowTaskbarBadgeStringWin32(_GLFWwindow* window, const char* string) +void _glfwSetWindowBadgeStringWin32(_GLFWwindow* window, const char* string) { _glfwInputError(GLFW_FEATURE_UNAVAILABLE, "Win32: Unable to set a string badge. Only integer badges are supported"); diff --git a/src/window.c b/src/window.c index 366531ac..522025eb 100644 --- a/src/window.c +++ b/src/window.c @@ -583,7 +583,7 @@ GLFWAPI void glfwSetWindowTaskbarProgress(GLFWwindow* handle, int progressState, _glfw.platform.setWindowTaskbarProgress(window, progressState, value); } -GLFWAPI void glfwSetWindowTaskbarBadge(GLFWwindow* handle, int count) +GLFWAPI void glfwSetWindowBadge(GLFWwindow* handle, int count) { _GLFWwindow* window = (_GLFWwindow*)handle; @@ -595,16 +595,16 @@ GLFWAPI void glfwSetWindowTaskbarBadge(GLFWwindow* handle, int count) return; } - _glfw.platform.setWindowTaskbarBadge(window, count); + _glfw.platform.setWindowBadge(window, count); } -GLFWAPI void glfwSetWindowTaskbarBadgeString(GLFWwindow* handle, const char* string) +GLFWAPI void glfwSetWindowBadgeString(GLFWwindow* handle, const char* string) { _GLFWwindow* window = (_GLFWwindow*)handle; _GLFW_REQUIRE_INIT(); - _glfw.platform.setWindowTaskbarBadgeString(window, string); + _glfw.platform.setWindowBadgeString(window, string); } GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos) diff --git a/src/wl_init.c b/src/wl_init.c index 71887d34..73947c28 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -420,8 +420,8 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform) _glfwSetWindowTitleWayland, _glfwSetWindowIconWayland, _glfwSetWindowTaskbarProgressWayland, - _glfwSetWindowTaskbarBadgeWayland, - _glfwSetWindowTaskbarBadgeStringWayland, + _glfwSetWindowBadgeWayland, + _glfwSetWindowBadgeStringWayland, _glfwGetWindowPosWayland, _glfwSetWindowPosWayland, _glfwGetWindowSizeWayland, diff --git a/src/wl_platform.h b/src/wl_platform.h index 1745706c..2986f716 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -447,8 +447,8 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window); void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title); void _glfwSetWindowIconWayland(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowTaskbarProgressWayland(_GLFWwindow* window, int progressState, double value); -void _glfwSetWindowTaskbarBadgeWayland(_GLFWwindow* window, int count); -void _glfwSetWindowTaskbarBadgeStringWayland(_GLFWwindow* window, const char* string); +void _glfwSetWindowBadgeWayland(_GLFWwindow* window, int count); +void _glfwSetWindowBadgeStringWayland(_GLFWwindow* window, const char* string); void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos); void _glfwSetWindowPosWayland(_GLFWwindow* window, int xpos, int ypos); void _glfwGetWindowSizeWayland(_GLFWwindow* window, int* width, int* height); diff --git a/src/wl_window.c b/src/wl_window.c index 80a12c96..600e40f5 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1911,7 +1911,7 @@ void _glfwSetWindowTaskbarProgressWayland(_GLFWwindow* window, const int progres _glfwUpdateTaskbarProgressDBusPOSIX(progressVisible, value); } -void _glfwSetWindowTaskbarBadgeWayland(_GLFWwindow* window, int count) +void _glfwSetWindowBadgeWayland(_GLFWwindow* window, int count) { if (window != NULL) { @@ -1919,13 +1919,13 @@ void _glfwSetWindowTaskbarBadgeWayland(_GLFWwindow* window, int count) "Wayland: Cannot set a badge for a window. Pass NULL to set the application's shared badge."); return; } - + const dbus_bool_t badgeVisible = (count > 0); - _glfwUpdateTaskbarBadgeDBusPOSIX(badgeVisible, count); + _glfwUpdateBadgeDBusPOSIX(badgeVisible, count); } -void _glfwSetWindowTaskbarBadgeStringWayland(_GLFWwindow* window, const char* string) +void _glfwSetWindowBadgeStringWayland(_GLFWwindow* window, const char* string) { _glfwInputError(GLFW_FEATURE_UNAVAILABLE, "Wayland: Unable to set a string badge. Only integer badges are supported."); diff --git a/src/x11_init.c b/src/x11_init.c index 166b80bc..da8d84cc 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -1210,8 +1210,8 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform) _glfwSetWindowTitleX11, _glfwSetWindowIconX11, _glfwSetWindowTaskbarProgressX11, - _glfwSetWindowTaskbarBadgeX11, - _glfwSetWindowTaskbarBadgeStringX11, + _glfwSetWindowBadgeX11, + _glfwSetWindowBadgeStringX11, _glfwGetWindowPosX11, _glfwSetWindowPosX11, _glfwGetWindowSizeX11, diff --git a/src/x11_platform.h b/src/x11_platform.h index b01556de..0f9f2690 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -906,8 +906,8 @@ void _glfwDestroyWindowX11(_GLFWwindow* window); void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title); void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowTaskbarProgressX11(_GLFWwindow* window, int progressState, double value); -void _glfwSetWindowTaskbarBadgeX11(_GLFWwindow* window, int count); -void _glfwSetWindowTaskbarBadgeStringX11(_GLFWwindow* window, const char* string); +void _glfwSetWindowBadgeX11(_GLFWwindow* window, int count); +void _glfwSetWindowBadgeStringX11(_GLFWwindow* window, const char* string); void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos); void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos); void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height); diff --git a/src/x11_window.c b/src/x11_window.c index 7b76a167..92cb15fa 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2161,7 +2161,7 @@ void _glfwSetWindowTaskbarProgressX11(_GLFWwindow* window, int progressState, do _glfwUpdateTaskbarProgressDBusPOSIX(progressVisible, value); } -void _glfwSetWindowTaskbarBadgeX11(_GLFWwindow* window, int count) +void _glfwSetWindowBadgeX11(_GLFWwindow* window, int count) { if (window != NULL) { @@ -2172,10 +2172,10 @@ void _glfwSetWindowTaskbarBadgeX11(_GLFWwindow* window, int count) const dbus_bool_t badgeVisible = (count > 0); - _glfwUpdateTaskbarBadgeDBusPOSIX(badgeVisible, count); + _glfwUpdateBadgeDBusPOSIX(badgeVisible, count); } -void _glfwSetWindowTaskbarBadgeStringX11(_GLFWwindow* window, const char* string) +void _glfwSetWindowBadgeStringX11(_GLFWwindow* window, const char* string) { _glfwInputError(GLFW_FEATURE_UNAVAILABLE, "X11: Unable to set a string badge. Only integer badges are supported."); diff --git a/tests/window.c b/tests/window.c index 0fd1aef9..527fa283 100644 --- a/tests/window.c +++ b/tests/window.c @@ -441,7 +441,7 @@ int main(int argc, char** argv) nk_layout_row_dynamic(nk, 30, 1); - nk_label(nk, "Taskbar Badge", NK_TEXT_CENTERED); + nk_label(nk, "Badge", NK_TEXT_CENTERED); static int badgeCount = 0; nk_layout_row_begin(nk, NK_DYNAMIC, 30, 3); @@ -450,8 +450,8 @@ int main(int argc, char** argv) nk_layout_row_push(nk, 2.f / 3.f); if (nk_slider_int(nk, 0, &badgeCount, 10000, 1)) { - glfwSetWindowTaskbarBadge(window, badgeCount); - glfwSetWindowTaskbarBadge(NULL, badgeCount); + glfwSetWindowBadge(window, badgeCount); + glfwSetWindowBadge(NULL, badgeCount); } nk_layout_row_end(nk); }