[PATCH 2/3] winex11.drv: Implement adding and deleting taskbar buttons.
Zebediah Figura
zfigura at codeweavers.com
Thu Jul 13 13:14:33 CDT 2017
This isn't a complete implementation. AddTab() should allow adding
tabs for child windows, as well as special windows like the desktop;
however, this requires these windows to be managed.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
dlls/winex11.drv/systray.c | 44 +++++++++++++++++++++++++++++++++++++++
dlls/winex11.drv/window.c | 4 ++++
dlls/winex11.drv/winex11.drv.spec | 1 +
dlls/winex11.drv/x11drv.h | 2 ++
4 files changed, 51 insertions(+)
diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c
index 815e5548bf3..433b2aff2f5 100644
--- a/dlls/winex11.drv/systray.c
+++ b/dlls/winex11.drv/systray.c
@@ -102,6 +102,12 @@ static HWND standalone_tray;
static int icon_cx, icon_cy;
static unsigned int nb_displayed;
+/* taskbar button state, defined in explorerframe/taskbarlist.c */
+typedef enum {
+ TASKBAR_ADDED = 1,
+ TASKBAR_DELETED = 2,
+} taskbar_state;
+
/* retrieves icon record by owner window and ID */
static struct tray_icon *get_icon(HWND owner, UINT id)
{
@@ -876,3 +882,41 @@ int CDECL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data )
}
return ret;
}
+
+/***********************************************************************
+ * SetTaskbarState (X11DRV.@)
+ *
+ * Driver-side implementation of ITaskbarList operations.
+ */
+HRESULT CDECL X11DRV_SetTaskbarState( HWND hwnd, taskbar_state state )
+{
+ struct x11drv_win_data *data;
+ HRESULT res = E_NOTIMPL;
+
+ if (!(data = get_win_data( hwnd ))) return E_FAIL;
+
+ switch (state)
+ {
+ case TASKBAR_ADDED:
+ if (data->managed)
+ {
+ data->taskbar_added = TRUE;
+ data->taskbar_deleted = FALSE;
+ res = S_OK;
+ }
+ else
+ FIXME("can't add taskbar button for unmanaged window %p\n", data->hwnd);
+ break;
+ case TASKBAR_DELETED:
+ data->taskbar_added = FALSE;
+ data->taskbar_deleted = TRUE;
+ res = S_OK;
+ break;
+ }
+
+ update_net_wm_states( data );
+ XFlush( data->display );
+
+ release_win_data( data );
+ return res;
+}
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index eaf6dcfa3ed..f54a3d59e5d 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1000,6 +1000,10 @@ void update_net_wm_states( struct x11drv_win_data *data )
new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR) | (1 << NET_WM_STATE_SKIP_PAGER);
if (!(ex_style & WS_EX_APPWINDOW) && GetWindow( data->hwnd, GW_OWNER ))
new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR);
+ if (data->taskbar_added)
+ new_state &= ~(1 << NET_WM_STATE_SKIP_TASKBAR);
+ else if (data->taskbar_deleted)
+ new_state |= (1 << NET_WM_STATE_SKIP_TASKBAR);
if (!data->mapped) /* set the _NET_WM_STATE atom directly */
{
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec
index 614f0b90f43..10f275164f0 100644
--- a/dlls/winex11.drv/winex11.drv.spec
+++ b/dlls/winex11.drv/winex11.drv.spec
@@ -60,6 +60,7 @@
# System tray
@ cdecl wine_notify_icon(long ptr)
+@ cdecl SetTaskbarState(ptr long) X11DRV_SetTaskbarState
#IME Interface
@ stdcall ImeInquire(ptr ptr wstr)
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index f125289333d..fffa5df0a32 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -558,6 +558,8 @@ struct x11drv_win_data
BOOL embedded : 1; /* is window an XEMBED client? */
BOOL shaped : 1; /* is window using a custom region shape? */
BOOL layered : 1; /* is window layered and with valid attributes? */
+ BOOL taskbar_added : 1; /* does window have a manually added taskbar button? */
+ BOOL taskbar_deleted : 1; /* does window have a manually deleted taskbar button? */
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 */
--
2.13.2
More information about the wine-patches
mailing list