glfwSetWindowTaskbarProgress Changed value type from int to double

This commit is contained in:
GamesTrap 2023-03-02 13:50:16 +01:00
parent e387ef3fdf
commit 0f142e3a1a
No known key found for this signature in database
GPG Key ID: 31DFD452434ECDA3
15 changed files with 28 additions and 29 deletions

View File

@ -1176,7 +1176,7 @@ There are different taskbar progress states available for you to use:
- @ref GLFW_TASKBAR_PROGRESS_PAUSED - @ref GLFW_TASKBAR_PROGRESS_PAUSED
The last argument is the progress percentage to display. The last argument is the progress percentage to display.
It has a valid range of 0 to 100. It has a valid range of 0.0 to 1.0.
@subsection window_refresh Window damage and refresh @subsection window_refresh Window damage and refresh

View File

@ -3365,7 +3365,7 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i
* @ref GLFW_TASKBAR_PROGRESS_DISABLED, @ref GLFW_TASKBAR_PROGRESS_INDETERMINATE, * @ref GLFW_TASKBAR_PROGRESS_DISABLED, @ref GLFW_TASKBAR_PROGRESS_INDETERMINATE,
* @ref GLFW_TASKBAR_PROGRESS_NORMAL, @ref GLFW_TASKBAR_PROGRESS_ERROR * @ref GLFW_TASKBAR_PROGRESS_NORMAL, @ref GLFW_TASKBAR_PROGRESS_ERROR
* and @ref GLFW_TASKBAR_PROGRESS_PAUSED. * and @ref GLFW_TASKBAR_PROGRESS_PAUSED.
* @param[in] value The amount of completed progress to set. Valid range is 0 to 100. * @param[in] value The amount of completed progress to set. Valid range is 0.0 to 1.0.
* This is ignored if progressState is set to @ref GLFW_TASKBAR_PROGRESS_DISABLED. * This is ignored if progressState is set to @ref GLFW_TASKBAR_PROGRESS_DISABLED.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
@ -3391,7 +3391,7 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i
* *
* @ingroup window * @ingroup window
*/ */
GLFWAPI void glfwSetWindowTaskbarProgress(GLFWwindow* window, const int progressState, int value); GLFWAPI void glfwSetWindowTaskbarProgress(GLFWwindow* window, const int progressState, double value);
/*! @brief Retrieves the position of the content area of the specified window. /*! @brief Retrieves the position of the content area of the specified window.
* *

View File

@ -218,7 +218,7 @@ GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, const _GLFWwndconfig* wndco
void _glfwDestroyWindowCocoa(_GLFWwindow* window); void _glfwDestroyWindowCocoa(_GLFWwindow* window);
void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title); void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title);
void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images);
void _glfwSetWindowTaskbarProgressCocoa(_GLFWwindow* window, const int taskbarState, int value); void _glfwSetWindowTaskbarProgressCocoa(_GLFWwindow* window, const int taskbarState, double value);
void _glfwGetWindowPosCocoa(_GLFWwindow* window, int* xpos, int* ypos); void _glfwGetWindowPosCocoa(_GLFWwindow* window, int* xpos, int* ypos);
void _glfwSetWindowPosCocoa(_GLFWwindow* window, int xpos, int ypos); void _glfwSetWindowPosCocoa(_GLFWwindow* window, int xpos, int ypos);
void _glfwGetWindowSizeCocoa(_GLFWwindow* window, int* width, int* height); void _glfwGetWindowSizeCocoa(_GLFWwindow* window, int* width, int* height);

View File

@ -1032,7 +1032,7 @@ void _glfwSetWindowIconCocoa(_GLFWwindow* window,
"Cocoa: Regular windows do not have icons on macOS"); "Cocoa: Regular windows do not have icons on macOS");
} }
void _glfwSetWindowTaskbarProgressCocoa(_GLFWwindow* window, const int progressState, int value) void _glfwSetWindowTaskbarProgressCocoa(_GLFWwindow* window, const int progressState, double value)
{ {
_glfwInputError(GLFW_FEATURE_UNIMPLEMENTED, _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED,
"Cocoa: Window taskbar progress is not implemented"); "Cocoa: Window taskbar progress is not implemented");

View File

@ -706,7 +706,7 @@ struct _GLFWplatform
void (*destroyWindow)(_GLFWwindow*); void (*destroyWindow)(_GLFWwindow*);
void (*setWindowTitle)(_GLFWwindow*,const char*); void (*setWindowTitle)(_GLFWwindow*,const char*);
void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*); void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*);
void (*setWindowTaskbarProgress)(_GLFWwindow*,const int,int); void (*setWindowTaskbarProgress)(_GLFWwindow*,const int,double);
void (*getWindowPos)(_GLFWwindow*,int*,int*); void (*getWindowPos)(_GLFWwindow*,int*,int*);
void (*setWindowPos)(_GLFWwindow*,int,int); void (*setWindowPos)(_GLFWwindow*,int,int);
void (*getWindowSize)(_GLFWwindow*,int*,int*); void (*getWindowSize)(_GLFWwindow*,int*,int*);

View File

@ -89,7 +89,7 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, const _GLFWwndconfig* wndcon
void _glfwDestroyWindowNull(_GLFWwindow* window); void _glfwDestroyWindowNull(_GLFWwindow* window);
void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title); void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title);
void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images);
void _glfwSetWindowTaskbarProgressNull(_GLFWwindow* window, const int taskbarState, int value); void _glfwSetWindowTaskbarProgressNull(_GLFWwindow* window, const int taskbarState, double value);
void _glfwSetWindowMonitorNull(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); 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 _glfwGetWindowPosNull(_GLFWwindow* window, int* xpos, int* ypos);
void _glfwSetWindowPosNull(_GLFWwindow* window, int xpos, int ypos); void _glfwSetWindowPosNull(_GLFWwindow* window, int xpos, int ypos);

View File

@ -187,7 +187,7 @@ void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* ima
{ {
} }
void _glfwSetWindowTaskbarProgressNull(_GLFWwindow* window, const int progressState, int value) void _glfwSetWindowTaskbarProgressNull(_GLFWwindow* window, const int progressState, double value)
{ {
} }

View File

@ -618,7 +618,7 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndco
void _glfwDestroyWindowWin32(_GLFWwindow* window); void _glfwDestroyWindowWin32(_GLFWwindow* window);
void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title); void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title);
void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images);
void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, const int taskbarState, int value); void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, const int taskbarState, double value);
void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos); void _glfwGetWindowPosWin32(_GLFWwindow* window, int* xpos, int* ypos);
void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos); void _glfwSetWindowPosWin32(_GLFWwindow* window, int xpos, int ypos);
void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height); void _glfwGetWindowSizeWin32(_GLFWwindow* window, int* width, int* height);

View File

@ -1596,10 +1596,11 @@ void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* im
} }
} }
void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, const int progressState, int value) void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, const int progressState, double value)
{ {
HRESULT res = S_OK; HRESULT res = S_OK;
int32_t winProgressState = 0; int winProgressState = 0;
int progressValue = (int)(value * 100.0);
if(!IsWindows7OrGreater()) if(!IsWindows7OrGreater())
{ {
@ -1610,7 +1611,7 @@ void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, const int progressS
if(!window->win32.TaskbarList) if(!window->win32.TaskbarList)
return; return;
res = window->win32.TaskbarList->lpVtbl->SetProgressValue(window->win32.TaskbarList, window->win32.handle, value, 100); res = window->win32.TaskbarList->lpVtbl->SetProgressValue(window->win32.TaskbarList, window->win32.handle, progressValue, 100);
if(res != S_OK) if(res != S_OK)
{ {
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to set taskbar progress value"); _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to set taskbar progress value");

View File

@ -558,7 +558,7 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle,
_glfw.platform.setWindowIcon(window, count, images); _glfw.platform.setWindowIcon(window, count, images);
} }
GLFWAPI void glfwSetWindowTaskbarProgress(GLFWwindow* handle, const int progressState, int value) GLFWAPI void glfwSetWindowTaskbarProgress(GLFWwindow* handle, const int progressState, double value)
{ {
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
@ -566,7 +566,7 @@ GLFWAPI void glfwSetWindowTaskbarProgress(GLFWwindow* handle, const int progress
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
if (value < 0 || value > 100) if (value < 0.0 || value > 1.0)
{ {
_glfwInputError(GLFW_INVALID_VALUE, "Invalid progress amount for window taskbar progress"); _glfwInputError(GLFW_INVALID_VALUE, "Invalid progress amount for window taskbar progress");
return; return;

View File

@ -446,7 +446,7 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, const _GLFWwndconfig* wnd
void _glfwDestroyWindowWayland(_GLFWwindow* window); void _glfwDestroyWindowWayland(_GLFWwindow* window);
void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title); void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title);
void _glfwSetWindowIconWayland(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowIconWayland(_GLFWwindow* window, int count, const GLFWimage* images);
void _glfwSetWindowTaskbarProgressWayland(_GLFWwindow* window, const int taskbarState, int value); void _glfwSetWindowTaskbarProgressWayland(_GLFWwindow* window, const int taskbarState, double value);
void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos); void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos);
void _glfwSetWindowPosWayland(_GLFWwindow* window, int xpos, int ypos); void _glfwSetWindowPosWayland(_GLFWwindow* window, int xpos, int ypos);
void _glfwGetWindowSizeWayland(_GLFWwindow* window, int* width, int* height); void _glfwGetWindowSizeWayland(_GLFWwindow* window, int* width, int* height);

View File

@ -1902,14 +1902,13 @@ void _glfwSetWindowIconWayland(_GLFWwindow* window,
"Wayland: The platform does not support setting the window icon"); "Wayland: The platform does not support setting the window icon");
} }
void _glfwSetWindowTaskbarProgressWayland(_GLFWwindow* window, const int taskbarState, int value) void _glfwSetWindowTaskbarProgressWayland(_GLFWwindow* window, const int taskbarState, double value)
{ {
(void)window; (void)window;
const dbus_bool_t progressVisible = (taskbarState != GLFW_TASKBAR_PROGRESS_DISABLED); const dbus_bool_t progressVisible = (taskbarState != GLFW_TASKBAR_PROGRESS_DISABLED);
const double progressValue = (double)value / 100.0;
_glfwUpdateTaskbarProgressDBusPOSIX(progressVisible, progressValue); _glfwUpdateTaskbarProgressDBusPOSIX(progressVisible, value);
} }
void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos) void _glfwGetWindowPosWayland(_GLFWwindow* window, int* xpos, int* ypos)

View File

@ -905,7 +905,7 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, const _GLFWwndconfig* wndconf
void _glfwDestroyWindowX11(_GLFWwindow* window); void _glfwDestroyWindowX11(_GLFWwindow* window);
void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title); void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title);
void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images); void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images);
void _glfwSetWindowTaskbarProgressX11(_GLFWwindow* window, const int taskbarState, int value); void _glfwSetWindowTaskbarProgressX11(_GLFWwindow* window, const int taskbarState, double value);
void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos); void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos);
void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos); void _glfwSetWindowPosX11(_GLFWwindow* window, int xpos, int ypos);
void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height); void _glfwGetWindowSizeX11(_GLFWwindow* window, int* width, int* height);

View File

@ -2152,14 +2152,13 @@ void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* imag
XFlush(_glfw.x11.display); XFlush(_glfw.x11.display);
} }
void _glfwSetWindowTaskbarProgressX11(_GLFWwindow* window, const int taskbarState, int value) void _glfwSetWindowTaskbarProgressX11(_GLFWwindow* window, const int taskbarState, double value)
{ {
(void)window; (void)window;
const dbus_bool_t progressVisible = (taskbarState != GLFW_TASKBAR_PROGRESS_DISABLED); const dbus_bool_t progressVisible = (taskbarState != GLFW_TASKBAR_PROGRESS_DISABLED);
const double progressValue = (double)value / 100.0;
_glfwUpdateTaskbarProgressDBusPOSIX(progressVisible, progressValue); _glfwUpdateTaskbarProgressDBusPOSIX(progressVisible, value);
} }
void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos) void _glfwGetWindowPosX11(_GLFWwindow* window, int* xpos, int* ypos)

View File

@ -418,20 +418,20 @@ int main(int argc, char** argv)
nk_layout_row_dynamic(nk, 30, 5); nk_layout_row_dynamic(nk, 30, 5);
static int progress = 0; static float progress = 0;
if(nk_button_label(nk, "No progress")) if(nk_button_label(nk, "No progress"))
glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_DISABLED, progress); glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_DISABLED, (double)progress);
if (nk_button_label(nk, "Indeterminate")) if (nk_button_label(nk, "Indeterminate"))
glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_INDETERMINATE, progress); glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_INDETERMINATE, (double)progress);
if (nk_button_label(nk, "Normal")) if (nk_button_label(nk, "Normal"))
glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_NORMAL, progress); glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_NORMAL, (double)progress);
if (nk_button_label(nk, "Error")) if (nk_button_label(nk, "Error"))
glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_ERROR, progress); glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_ERROR, (double)progress);
if (nk_button_label(nk, "Paused")) if (nk_button_label(nk, "Paused"))
glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_PAUSED, progress); glfwSetWindowTaskbarProgress(window, GLFW_TASKBAR_PROGRESS_PAUSED, (double)progress);
nk_label(nk, "Progress: ", NK_TEXT_ALIGN_LEFT); nk_label(nk, "Progress: ", NK_TEXT_ALIGN_LEFT);
nk_slider_int(nk, 0, &progress, 100, 1); nk_slider_float(nk, 0.0f, &progress, 1.0f, 0.05f);
} }
nk_end(nk); nk_end(nk);