Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/explorerframe/taskbarlist.c | 6 +++-- dlls/explorerframe/tests/taskbarlist.c | 8 ------ dlls/winex11.drv/window.c | 36 +++++++++++++++++++++++--- dlls/winex11.drv/x11drv.h | 4 ++- 4 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/dlls/explorerframe/taskbarlist.c b/dlls/explorerframe/taskbarlist.c index 839ae210daa..7e1f5b92c5b 100644 --- a/dlls/explorerframe/taskbarlist.c +++ b/dlls/explorerframe/taskbarlist.c @@ -26,6 +26,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(explorerframe);
#define WM_WINE_DELETE_TAB (WM_USER + 1) +#define WM_WINE_ADD_TAB (WM_USER + 2)
struct taskbar_list { @@ -98,9 +99,10 @@ 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; + SendMessageW(GetDesktopWindow(), WM_WINE_ADD_TAB, (WPARAM)hwnd, 0); + 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 dacb1293a9e..8096d756ccf 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->skip_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->add_taskbar) + { + if (data->skip_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 */ { @@ -1859,6 +1862,7 @@ static WNDPROC desktop_orig_wndproc;
#define WM_WINE_NOTIFY_ACTIVITY WM_USER #define WM_WINE_DELETE_TAB (WM_USER + 1) +#define WM_WINE_ADD_TAB (WM_USER + 2)
static LRESULT CALLBACK desktop_wndproc_wrapper( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) { @@ -1881,6 +1885,9 @@ static LRESULT CALLBACK desktop_wndproc_wrapper( HWND hwnd, UINT msg, WPARAM wp, case WM_WINE_DELETE_TAB: SendMessageA( (HWND)wp, WM_X11DRV_DELETE_TAB, 0, 0 ); break; + case WM_WINE_ADD_TAB: + SendMessageA( (HWND)wp, WM_X11DRV_ADD_TAB, 0, 0 ); + break; } return desktop_orig_wndproc( hwnd, msg, wp, lp ); } @@ -2781,6 +2788,23 @@ done: return ret; }
+/* Add a window to taskbar */ +static void taskbar_add_tab( HWND hwnd ) +{ + struct x11drv_win_data *data; + + TRACE("hwnd %p\n", hwnd); + + data = get_win_data( hwnd ); + if (!data) + return; + + data->add_taskbar = TRUE; + data->skip_taskbar = FALSE; + update_net_wm_states( data ); + release_win_data( data ); +} + /* Delete a window from taskbar */ static void taskbar_delete_tab( HWND hwnd ) { @@ -2793,6 +2817,7 @@ static void taskbar_delete_tab( HWND hwnd ) return;
data->skip_taskbar = TRUE; + data->add_taskbar = FALSE; update_net_wm_states( data ); release_win_data( data ); } @@ -2835,6 +2860,9 @@ LRESULT CDECL X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) case WM_X11DRV_DELETE_TAB: taskbar_delete_tab( hwnd ); return 0; + case WM_X11DRV_ADD_TAB: + taskbar_add_tab( hwnd ); + return 0; default: FIXME( "got window msg %x hwnd %p wp %lx lp %lx\n", msg, hwnd, wp, lp ); return 0; diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 6a38fc5a20e..d678d93905d 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -585,7 +585,8 @@ enum x11drv_window_messages WM_X11DRV_SET_CURSOR, WM_X11DRV_CLIP_CURSOR_NOTIFY, WM_X11DRV_CLIP_CURSOR_REQUEST, - WM_X11DRV_DELETE_TAB + WM_X11DRV_DELETE_TAB, + WM_X11DRV_ADD_TAB };
/* _NET_WM_STATE properties that we keep track of */ @@ -621,6 +622,7 @@ struct x11drv_win_data BOOL layered : 1; /* is window layered and with valid attributes? */ BOOL use_alpha : 1; /* does window use an alpha channel? */ BOOL skip_taskbar : 1; /* does window should be deleted from taskbar */ + BOOL add_taskbar : 1; /* does window should be added to taskbar regardless of style */ int wm_state; /* current value of the WM_STATE property */ DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */ Window embedder; /* window id of embedder */