glfwSetWindowTaskbarProgress Polishing

This commit is contained in:
GamesTrap 2023-03-03 16:18:16 +01:00
parent d173bf1fed
commit 9f17a69a67
No known key found for this signature in database
GPG Key ID: 31DFD452434ECDA3
4 changed files with 24 additions and 22 deletions

View File

@ -1305,7 +1305,7 @@ extern "C" {
* *
* Display the progress bar in an error state. * Display the progress bar in an error state.
* *
* @remark @win32 This displays a red progress bar with 100% progress. * @remark @win32 This displays a red progress bar.
* *
* @remark @x11 @wayland @macos This behaves like @ref GLFW_TASKBAR_PROGRESS_NORMAL. * @remark @x11 @wayland @macos This behaves like @ref GLFW_TASKBAR_PROGRESS_NORMAL.
* *
@ -1316,7 +1316,7 @@ extern "C" {
* *
* Display the progress bar in a paused state. * Display the progress bar in a paused state.
* *
* @remark @win32 This displays a yellow filled progress bar. * @remark @win32 This displays a yellow progress bar.
* *
* @remark @x11 @wayland @macos This behaves like @ref GLFW_TASKBAR_PROGRESS_NORMAL. * @remark @x11 @wayland @macos This behaves like @ref GLFW_TASKBAR_PROGRESS_NORMAL.
* *
@ -1368,7 +1368,6 @@ extern "C" {
* *
* Hint value for @ref GLFW_PLATFORM that enables automatic platform selection. * Hint value for @ref GLFW_PLATFORM that enables automatic platform selection.
*/ */
#define GLFW_ANY_PLATFORM 0x00060000 #define GLFW_ANY_PLATFORM 0x00060000
#define GLFW_PLATFORM_WIN32 0x00060001 #define GLFW_PLATFORM_WIN32 0x00060001
#define GLFW_PLATFORM_COCOA 0x00060002 #define GLFW_PLATFORM_COCOA 0x00060002

View File

@ -132,7 +132,10 @@ void _glfwTerminateDBusPOSIX(void)
void _glfwUpdateTaskbarProgressDBusPOSIX(dbus_bool_t progressVisible, double progressValue) void _glfwUpdateTaskbarProgressDBusPOSIX(dbus_bool_t progressVisible, double progressValue)
{ {
if(!_glfw.dbus.handle || !_glfw.dbus.connection) if(!_glfw.dbus.handle || !_glfw.dbus.connection)
{
_glfwInputError(GLFW_FEATURE_UNAVAILABLE, "POSIX: No DBus connection open to set taskbar progress");
return; return;
}
//Signal signature: //Signal signature:
//signal com.canonical.Unity.LauncherEntry.Update (in s app_uri, in a{sv} properties) //signal com.canonical.Unity.LauncherEntry.Update (in s app_uri, in a{sv} properties)

View File

@ -506,8 +506,8 @@ typedef struct _GLFWwindowWin32
// The last received high surrogate when decoding pairs of UTF-16 messages // The last received high surrogate when decoding pairs of UTF-16 messages
WCHAR highSurrogate; WCHAR highSurrogate;
ITaskbarList3* TaskbarList; ITaskbarList3* taskbarList;
UINT TaskbarListMsgID; UINT taskbarListMsgID;
} _GLFWwindowWin32; } _GLFWwindowWin32;
// Win32-specific global data // Win32-specific global data

View File

@ -1244,15 +1244,15 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
} }
} }
if(uMsg == window->win32.TaskbarListMsgID) if(uMsg == window->win32.taskbarListMsgID)
{ {
HRESULT res = CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, (LPVOID*)&window->win32.TaskbarList); HRESULT res = CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, (LPVOID*)&window->win32.taskbarList);
if (res != S_OK && window->win32.TaskbarList) if (res != S_OK && window->win32.taskbarList)
window->win32.TaskbarList->lpVtbl->Release(window->win32.TaskbarList); window->win32.taskbarList->lpVtbl->Release(window->win32.taskbarList);
else else
{ {
window->win32.TaskbarList->lpVtbl->AddRef(window->win32.TaskbarList); window->win32.taskbarList->lpVtbl->AddRef(window->win32.taskbarList);
window->win32.TaskbarList->lpVtbl->HrInit(window->win32.TaskbarList); window->win32.taskbarList->lpVtbl->HrInit(window->win32.taskbarList);
} }
} }
@ -1376,9 +1376,9 @@ static int createNativeWindow(_GLFWwindow* window,
ChangeWindowMessageFilterEx(window->win32.handle, ChangeWindowMessageFilterEx(window->win32.handle,
WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL);
window->win32.TaskbarListMsgID = RegisterWindowMessageW(L"TaskbarButtonCreated"); window->win32.taskbarListMsgID = RegisterWindowMessageW(L"TaskbarButtonCreated");
if (window->win32.TaskbarListMsgID) if (window->win32.taskbarListMsgID)
ChangeWindowMessageFilterEx(window->win32.handle, window->win32.TaskbarListMsgID, MSGFLT_ALLOW, NULL); ChangeWindowMessageFilterEx(window->win32.handle, window->win32.taskbarListMsgID, MSGFLT_ALLOW, NULL);
} }
window->win32.scaleToMonitor = wndconfig->scaleToMonitor; window->win32.scaleToMonitor = wndconfig->scaleToMonitor;
@ -1531,8 +1531,8 @@ void _glfwDestroyWindowWin32(_GLFWwindow* window)
if (_glfw.win32.capturedCursorWindow == window) if (_glfw.win32.capturedCursorWindow == window)
releaseCursor(); releaseCursor();
if (window->win32.TaskbarList) if (window->win32.taskbarList)
window->win32.TaskbarList->lpVtbl->Release(window->win32.TaskbarList); window->win32.taskbarList->lpVtbl->Release(window->win32.taskbarList);
if (window->win32.handle) if (window->win32.handle)
{ {
@ -1608,10 +1608,10 @@ void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, int progressState,
return; return;
} }
if(!window->win32.TaskbarList) if(!window->win32.taskbarList)
return; return;
res = window->win32.TaskbarList->lpVtbl->SetProgressValue(window->win32.TaskbarList, window->win32.handle, progressValue, 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");
@ -1638,7 +1638,7 @@ void _glfwSetWindowTaskbarProgressWin32(_GLFWwindow* window, int progressState,
break; break;
} }
res = window->win32.TaskbarList->lpVtbl->SetProgressState(window->win32.TaskbarList, window->win32.handle, winProgressState); res = window->win32.taskbarList->lpVtbl->SetProgressState(window->win32.taskbarList, window->win32.handle, winProgressState);
if (res != S_OK) if (res != S_OK)
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to set taskbar progress state"); _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "Win32: Failed to set taskbar progress state");
} }