Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/explorerframe/taskbarlist.c | 14 +++++++++++-- dlls/explorerframe/tests/taskbarlist.c | 8 ------- dlls/winex11.drv/window.c | 29 ++++++++++++++++++++++---- dlls/winex11.drv/winex11.drv.spec | 1 + dlls/winex11.drv/x11drv.h | 1 + 5 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/dlls/explorerframe/taskbarlist.c b/dlls/explorerframe/taskbarlist.c index 04dbb182cc2..9aba6484b24 100644 --- a/dlls/explorerframe/taskbarlist.c +++ b/dlls/explorerframe/taskbarlist.c @@ -25,6 +25,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(explorerframe);
+static void (CDECL *pwine_taskbar_add_tab)(HWND); static void (CDECL *pwine_taskbar_delete_tab)(HWND);
struct taskbar_list @@ -119,6 +120,7 @@ static BOOL WINAPI init_taskbar_driver_once(INIT_ONCE *once, void *param, void * HMODULE module;
module = load_graphics_driver(); + pwine_taskbar_add_tab = (void *)GetProcAddress(module, "wine_taskbar_add_tab"); pwine_taskbar_delete_tab = (void *)GetProcAddress(module, "wine_taskbar_delete_tab"); return TRUE; } @@ -139,9 +141,17 @@ static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList4 *iface)
static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList4 *iface, HWND hwnd) { - FIXME("iface %p, hwnd %p stub!\n", iface, hwnd); + TRACE("iface %p, hwnd %p\n", iface, hwnd);
- return E_NOTIMPL; + if (!IsWindow(hwnd)) + return S_OK; + + if (pwine_taskbar_add_tab) + pwine_taskbar_add_tab(hwnd); + else + FIXME("wine_taskbar_add_tab() is unimplemented for the current graphics driver.\n"); + + return S_OK; }
static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList4 *iface, HWND hwnd) diff --git a/dlls/explorerframe/tests/taskbarlist.c b/dlls/explorerframe/tests/taskbarlist.c index 9b2de996000..5f5cc98c5b4 100644 --- a/dlls/explorerframe/tests/taskbarlist.c +++ b/dlls/explorerframe/tests/taskbarlist.c @@ -43,7 +43,6 @@ static void test_ITaskbarList(void)
/* Test calling methods before calling ITaskbarList::HrInit() */ hr = ITaskbarList_AddTab(taskbarlist, hwnd); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = ITaskbarList_SetActiveAlt(taskbarlist, hwnd); @@ -69,21 +68,17 @@ static void test_ITaskbarList(void) /* Test ITaskbarList::AddTab() */ /* Check invalid parameters */ hr = ITaskbarList_AddTab(taskbarlist, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = ITaskbarList_AddTab(taskbarlist, (HWND)0xdeadbeef); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
/* Normal ITaskbarList::AddTab() */ hr = ITaskbarList_AddTab(taskbarlist, hwnd); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
/* Repeat ITaskbarList::AddTab() with the same hwnd */ hr = ITaskbarList_AddTab(taskbarlist, hwnd); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = ITaskbarList_DeleteTab(taskbarlist, hwnd); @@ -101,7 +96,6 @@ static void test_ITaskbarList(void)
/* Normal ITaskbarList::SetActiveAlt() */ hr = ITaskbarList_AddTab(taskbarlist, hwnd); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = ITaskbarList_SetActiveAlt(taskbarlist, hwnd); @@ -128,7 +122,6 @@ static void test_ITaskbarList(void)
/* Normal ITaskbarList::ActivateTab() */ hr = ITaskbarList_AddTab(taskbarlist, hwnd); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = ITaskbarList_ActivateTab(taskbarlist, hwnd); @@ -156,7 +149,6 @@ static void test_ITaskbarList(void)
/* Normal ITaskbarList::DeleteTab() */ hr = ITaskbarList_AddTab(taskbarlist, hwnd); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = ITaskbarList_DeleteTab(taskbarlist, hwnd); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index a9015f8f5b7..0db79e0b911 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -994,10 +994,13 @@ void update_net_wm_states( struct x11drv_win_data *data ) ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE ); if (ex_style & WS_EX_TOPMOST) new_state |= (1 << NET_WM_STATE_ABOVE); - if (data->deleted_from_taskbar || (ex_style & (WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE))) - new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR) | (1 << NET_WM_STATE_SKIP_PAGER); - else if (!(ex_style & WS_EX_APPWINDOW) && GetWindow( data->hwnd, GW_OWNER )) - new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR); + if (!data->added_to_taskbar) + { + if (data->deleted_from_taskbar || (ex_style & (WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE))) + new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR) | (1 << NET_WM_STATE_SKIP_PAGER); + else if (!(ex_style & WS_EX_APPWINDOW) && GetWindow( data->hwnd, GW_OWNER )) + new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR); + }
if (!data->mapped) /* set the _NET_WM_STATE atom directly */ { @@ -2973,6 +2976,23 @@ void CDECL X11DRV_FlashWindowEx( PFLASHWINFO pfinfo )
/* Taskbar functions */
+/* Add a window to taskbar */ +void CDECL X11DRV_add_tab( HWND hwnd ) +{ + struct x11drv_win_data *data; + + TRACE("hwnd %p\n", hwnd); + + data = get_win_data( hwnd ); + if (!data) + return; + + data->added_to_taskbar = TRUE; + data->deleted_from_taskbar = FALSE; + update_net_wm_states( data ); + release_win_data( data ); +} + /* Delete a window from taskbar */ void CDECL X11DRV_delete_tab( HWND hwnd ) { @@ -2985,6 +3005,7 @@ void CDECL X11DRV_delete_tab( HWND hwnd ) return;
data->deleted_from_taskbar = TRUE; + data->added_to_taskbar = FALSE; update_net_wm_states( data ); release_win_data( data ); } diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 898c3334062..1778b4b8ad9 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -8,6 +8,7 @@ @ cdecl wine_create_desktop(long long) X11DRV_create_desktop
# Taskbar +@ cdecl wine_taskbar_add_tab(ptr) X11DRV_add_tab @ cdecl wine_taskbar_delete_tab(ptr) X11DRV_delete_tab
# System tray diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 23f4144b7a4..ce56f0fc99a 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -619,6 +619,7 @@ struct x11drv_win_data BOOL shaped : 1; /* is window using a custom region shape? */ BOOL layered : 1; /* is window layered and with valid attributes? */ BOOL use_alpha : 1; /* does window use an alpha channel? */ + BOOL added_to_taskbar : 1; /* does window should be added to taskbar */ BOOL deleted_from_taskbar : 1; /* does window should be deleted from taskbar */ int wm_state; /* current value of the WM_STATE property */ DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */