winex11: Check if _NET_WM_MOVERESIZE is supported before using it.

This commit is contained in:
Alexandre Julliard 2008-03-12 17:29:28 +01:00
parent dc26f27835
commit cf76c7d65c
3 changed files with 39 additions and 0 deletions

View File

@ -638,6 +638,37 @@ void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
}
/***********************************************************************
* is_netwm_supported
*/
static BOOL is_netwm_supported( Display *display, Atom atom )
{
static Atom *net_supported;
static int net_supported_count = -1;
int i;
wine_tsx11_lock();
if (net_supported_count == -1)
{
Atom type;
int format;
unsigned long count, remaining;
if (!XGetWindowProperty( display, DefaultRootWindow(display), x11drv_atom(_NET_SUPPORTED), 0,
~0UL, False, XA_ATOM, &type, &format, &count,
&remaining, (unsigned char **)&net_supported ))
net_supported_count = count * (format / 8) / sizeof(Atom);
else
net_supported_count = 0;
}
wine_tsx11_unlock();
for (i = 0; i < net_supported_count; i++)
if (net_supported[i] == atom) return TRUE;
return FALSE;
}
/***********************************************************************
* SysCommandSizeMove (X11DRV.@)
*
@ -656,6 +687,12 @@ BOOL X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wparam )
if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
if (!data->whole_window || !data->managed) return FALSE;
if (!is_netwm_supported( display, x11drv_atom(_NET_WM_MOVERESIZE) ))
{
TRACE( "_NET_WM_MOVERESIZE not supported\n" );
return FALSE;
}
if (syscommand == SC_MOVE)
{
if (!hittest) dir = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;

View File

@ -567,6 +567,7 @@ enum x11drv_atoms
XATOM__ICC_PROFILE,
XATOM__MOTIF_WM_HINTS,
XATOM__KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR,
XATOM__NET_SUPPORTED,
XATOM__NET_SYSTEM_TRAY_OPCODE,
XATOM__NET_SYSTEM_TRAY_S0,
XATOM__NET_WM_MOVERESIZE,

View File

@ -131,6 +131,7 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
"_ICC_PROFILE",
"_MOTIF_WM_HINTS",
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR",
"_NET_SUPPORTED",
"_NET_SYSTEM_TRAY_OPCODE",
"_NET_SYSTEM_TRAY_S0",
"_NET_WM_MOVERESIZE",