Alexandre Julliard : winex11: Added tracking of the WM_STATE window property.
Alexandre Julliard
julliard at winehq.org
Thu Feb 28 06:21:15 CST 2008
Module: wine
Branch: master
Commit: 5a5344b4ad2b9be527940c8d259961e4b4e9cfb8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5a5344b4ad2b9be527940c8d259961e4b4e9cfb8
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Feb 27 19:11:43 2008 +0100
winex11: Added tracking of the WM_STATE window property.
---
dlls/winex11.drv/event.c | 71 ++++++++++++++++++++++++++++-----------
dlls/winex11.drv/window.c | 2 +-
dlls/winex11.drv/x11drv.h | 2 +
dlls/winex11.drv/x11drv_main.c | 1 +
4 files changed, 55 insertions(+), 21 deletions(-)
diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index ad42ef2..ee96d02 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -583,35 +583,66 @@ static void EVENT_FocusOut( HWND hwnd, XEvent *xev )
/***********************************************************************
+ * get_window_wm_state
+ */
+int get_window_wm_state( Display *display, struct x11drv_win_data *data )
+{
+ struct
+ {
+ CARD32 state;
+ XID icon;
+ } *state;
+ Atom type;
+ int format, ret = -1;
+ unsigned long count, remaining;
+
+ wine_tsx11_lock();
+ if (!XGetWindowProperty( display, data->whole_window, x11drv_atom(WM_STATE), 0,
+ sizeof(*state)/sizeof(CARD32), False, x11drv_atom(WM_STATE),
+ &type, &format, &count, &remaining, (unsigned char **)&state ))
+ {
+ if (type == x11drv_atom(WM_STATE) && format && count >= sizeof(*state)/(format/8))
+ ret = state->state;
+ XFree( state );
+ }
+ wine_tsx11_unlock();
+ return ret;
+}
+
+
+/***********************************************************************
* EVENT_PropertyNotify
- * We use this to release resources like Pixmaps when a selection
- * client no longer needs them.
*/
static void EVENT_PropertyNotify( HWND hwnd, XEvent *xev )
{
- XPropertyEvent *event = &xev->xproperty;
- /* Check if we have any resources to free */
- TRACE("Received PropertyNotify event:\n");
+ XPropertyEvent *event = &xev->xproperty;
+ struct x11drv_win_data *data;
- switch(event->state)
- {
- case PropertyDelete:
+ if (!hwnd) return;
+ if (!(data = X11DRV_get_win_data( hwnd ))) return;
+
+ switch(event->state)
{
- TRACE("\tPropertyDelete for atom %ld on window %ld\n",
- event->atom, (long)event->window);
- break;
- }
+ case PropertyDelete:
+ if (event->atom == x11drv_atom(WM_STATE))
+ {
+ data->wm_state = WithdrawnState;
+ TRACE( "%p/%lx: WM_STATE deleted\n", data->hwnd, data->whole_window );
+ }
+ break;
case PropertyNewValue:
- {
- TRACE("\tPropertyNewValue for atom %ld on window %ld\n\n",
- event->atom, (long)event->window);
- break;
+ if (event->atom == x11drv_atom(WM_STATE))
+ {
+ int new_state = get_window_wm_state( event->display, data );
+ if (new_state != -1 && new_state != data->wm_state)
+ {
+ TRACE( "%p/%lx: new WM_STATE %d\n", data->hwnd, data->whole_window, new_state );
+ data->wm_state = new_state;
+ }
+ }
+ break;
}
-
- default:
- break;
- }
}
static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt )
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index cf84389..71edc60 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -200,7 +200,7 @@ static int get_window_attributes( Display *display, struct x11drv_win_data *data
attr->event_mask = (ExposureMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
KeyPressMask | KeyReleaseMask | FocusChangeMask | KeymapStateMask);
- if (data->managed) attr->event_mask |= StructureNotifyMask;
+ if (data->managed) attr->event_mask |= StructureNotifyMask | PropertyChangeMask;
return (CWOverrideRedirect | CWSaveUnder | CWColormap | CWCursor |
CWEventMask | CWBitGravity | CWBackingStore);
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 79631c4..375b04b 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -559,6 +559,7 @@ enum x11drv_atoms
XATOM_RAW_CAP_HEIGHT,
XATOM_WM_PROTOCOLS,
XATOM_WM_DELETE_WINDOW,
+ XATOM_WM_STATE,
XATOM_WM_TAKE_FOCUS,
XATOM_KWM_DOCKWINDOW,
XATOM_DndProtocol,
@@ -669,6 +670,7 @@ struct x11drv_win_data
XWMHints *wm_hints; /* window manager hints */
BOOL managed : 1; /* is window managed? */
BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */
+ int wm_state; /* current value of the WM_STATE property */
DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */
unsigned int lock_changes; /* lock count for X11 change requests */
HBITMAP hWMIconBitmap;
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 32f6437..8982716 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -123,6 +123,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"RAW_CAP_HEIGHT",
"WM_PROTOCOLS",
"WM_DELETE_WINDOW",
+ "WM_STATE",
"WM_TAKE_FOCUS",
"KWM_DOCKWINDOW",
"DndProtocol",
More information about the wine-cvs
mailing list