winex11: Added tracking of the WM_STATE window property.
This commit is contained in:
parent
9939b7b430
commit
5a5344b4ad
|
@ -582,34 +582,65 @@ 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");
|
||||
struct x11drv_win_data *data;
|
||||
|
||||
if (!hwnd) return;
|
||||
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
||||
|
||||
switch(event->state)
|
||||
{
|
||||
case PropertyDelete:
|
||||
if (event->atom == x11drv_atom(WM_STATE))
|
||||
{
|
||||
TRACE("\tPropertyDelete for atom %ld on window %ld\n",
|
||||
event->atom, (long)event->window);
|
||||
break;
|
||||
data->wm_state = WithdrawnState;
|
||||
TRACE( "%p/%lx: WM_STATE deleted\n", data->hwnd, data->whole_window );
|
||||
}
|
||||
break;
|
||||
|
||||
case PropertyNewValue:
|
||||
if (event->atom == x11drv_atom(WM_STATE))
|
||||
{
|
||||
TRACE("\tPropertyNewValue for atom %ld on window %ld\n\n",
|
||||
event->atom, (long)event->window);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue