winex11: Added tracking of the WM_STATE window property.
This commit is contained in:
parent
9939b7b430
commit
5a5344b4ad
|
@ -582,36 +582,67 @@ 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
|
* 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 )
|
static void EVENT_PropertyNotify( HWND hwnd, XEvent *xev )
|
||||||
{
|
{
|
||||||
XPropertyEvent *event = &xev->xproperty;
|
XPropertyEvent *event = &xev->xproperty;
|
||||||
/* Check if we have any resources to free */
|
struct x11drv_win_data *data;
|
||||||
TRACE("Received PropertyNotify event:\n");
|
|
||||||
|
|
||||||
switch(event->state)
|
if (!hwnd) return;
|
||||||
{
|
if (!(data = X11DRV_get_win_data( hwnd ))) return;
|
||||||
case PropertyDelete:
|
|
||||||
|
switch(event->state)
|
||||||
{
|
{
|
||||||
TRACE("\tPropertyDelete for atom %ld on window %ld\n",
|
case PropertyDelete:
|
||||||
event->atom, (long)event->window);
|
if (event->atom == x11drv_atom(WM_STATE))
|
||||||
break;
|
{
|
||||||
}
|
data->wm_state = WithdrawnState;
|
||||||
|
TRACE( "%p/%lx: WM_STATE deleted\n", data->hwnd, data->whole_window );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case PropertyNewValue:
|
case PropertyNewValue:
|
||||||
{
|
if (event->atom == x11drv_atom(WM_STATE))
|
||||||
TRACE("\tPropertyNewValue for atom %ld on window %ld\n\n",
|
{
|
||||||
event->atom, (long)event->window);
|
int new_state = get_window_wm_state( event->display, data );
|
||||||
break;
|
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 )
|
static HWND find_drop_window( HWND hQueryWnd, LPPOINT lpPt )
|
||||||
|
|
|
@ -200,7 +200,7 @@ static int get_window_attributes( Display *display, struct x11drv_win_data *data
|
||||||
attr->event_mask = (ExposureMask | PointerMotionMask |
|
attr->event_mask = (ExposureMask | PointerMotionMask |
|
||||||
ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
|
ButtonPressMask | ButtonReleaseMask | EnterWindowMask |
|
||||||
KeyPressMask | KeyReleaseMask | FocusChangeMask | KeymapStateMask);
|
KeyPressMask | KeyReleaseMask | FocusChangeMask | KeymapStateMask);
|
||||||
if (data->managed) attr->event_mask |= StructureNotifyMask;
|
if (data->managed) attr->event_mask |= StructureNotifyMask | PropertyChangeMask;
|
||||||
|
|
||||||
return (CWOverrideRedirect | CWSaveUnder | CWColormap | CWCursor |
|
return (CWOverrideRedirect | CWSaveUnder | CWColormap | CWCursor |
|
||||||
CWEventMask | CWBitGravity | CWBackingStore);
|
CWEventMask | CWBitGravity | CWBackingStore);
|
||||||
|
|
|
@ -559,6 +559,7 @@ enum x11drv_atoms
|
||||||
XATOM_RAW_CAP_HEIGHT,
|
XATOM_RAW_CAP_HEIGHT,
|
||||||
XATOM_WM_PROTOCOLS,
|
XATOM_WM_PROTOCOLS,
|
||||||
XATOM_WM_DELETE_WINDOW,
|
XATOM_WM_DELETE_WINDOW,
|
||||||
|
XATOM_WM_STATE,
|
||||||
XATOM_WM_TAKE_FOCUS,
|
XATOM_WM_TAKE_FOCUS,
|
||||||
XATOM_KWM_DOCKWINDOW,
|
XATOM_KWM_DOCKWINDOW,
|
||||||
XATOM_DndProtocol,
|
XATOM_DndProtocol,
|
||||||
|
@ -669,6 +670,7 @@ struct x11drv_win_data
|
||||||
XWMHints *wm_hints; /* window manager hints */
|
XWMHints *wm_hints; /* window manager hints */
|
||||||
BOOL managed : 1; /* is window managed? */
|
BOOL managed : 1; /* is window managed? */
|
||||||
BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */
|
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 */
|
DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */
|
||||||
unsigned int lock_changes; /* lock count for X11 change requests */
|
unsigned int lock_changes; /* lock count for X11 change requests */
|
||||||
HBITMAP hWMIconBitmap;
|
HBITMAP hWMIconBitmap;
|
||||||
|
|
|
@ -123,6 +123,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
|
||||||
"RAW_CAP_HEIGHT",
|
"RAW_CAP_HEIGHT",
|
||||||
"WM_PROTOCOLS",
|
"WM_PROTOCOLS",
|
||||||
"WM_DELETE_WINDOW",
|
"WM_DELETE_WINDOW",
|
||||||
|
"WM_STATE",
|
||||||
"WM_TAKE_FOCUS",
|
"WM_TAKE_FOCUS",
|
||||||
"KWM_DOCKWINDOW",
|
"KWM_DOCKWINDOW",
|
||||||
"DndProtocol",
|
"DndProtocol",
|
||||||
|
|
Loading…
Reference in New Issue