Commit a0ac99c5 authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Add some generic support for XEMBED client windows.

parent ea59ea59
...@@ -69,8 +69,6 @@ static BOOL delete_icon( struct tray_icon *icon ); ...@@ -69,8 +69,6 @@ static BOOL delete_icon( struct tray_icon *icon );
#define SYSTEM_TRAY_BEGIN_MESSAGE 1 #define SYSTEM_TRAY_BEGIN_MESSAGE 1
#define SYSTEM_TRAY_CANCEL_MESSAGE 2 #define SYSTEM_TRAY_CANCEL_MESSAGE 2
#define XEMBED_MAPPED (1 << 0)
#define ICON_BORDER 2 #define ICON_BORDER 2
/* retrieves icon record by owner window and ID */ /* retrieves icon record by owner window and ID */
...@@ -228,23 +226,13 @@ static void dock_systray_window( HWND hwnd, Window systray_window ) ...@@ -228,23 +226,13 @@ static void dock_systray_window( HWND hwnd, Window systray_window )
struct x11drv_win_data *data; struct x11drv_win_data *data;
XEvent ev; XEvent ev;
XSetWindowAttributes attr; XSetWindowAttributes attr;
unsigned long info[2];
if (!(data = X11DRV_get_win_data( hwnd )) && if (!(data = X11DRV_get_win_data( hwnd )) &&
!(data = X11DRV_create_win_data( hwnd ))) return; !(data = X11DRV_create_win_data( hwnd ))) return;
TRACE( "icon window %p/%lx managed %u\n", data->hwnd, data->whole_window, data->managed ); TRACE( "icon window %p/%lx managed %u\n", data->hwnd, data->whole_window, data->managed );
/* the window _cannot_ be mapped if we intend to dock with an XEMBED tray */ make_window_embedded( display, data );
assert( !data->mapped );
/* set XEMBED protocol data on the window */
info[0] = 0; /* protocol version */
info[1] = XEMBED_MAPPED; /* flags */
wine_tsx11_lock();
XChangeProperty( display, data->whole_window, x11drv_atom(_XEMBED_INFO),
x11drv_atom(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*)info, 2 );
/* send the docking request message */ /* send the docking request message */
ev.xclient.type = ClientMessage; ev.xclient.type = ClientMessage;
...@@ -256,15 +244,13 @@ static void dock_systray_window( HWND hwnd, Window systray_window ) ...@@ -256,15 +244,13 @@ static void dock_systray_window( HWND hwnd, Window systray_window )
ev.xclient.data.l[2] = data->whole_window; ev.xclient.data.l[2] = data->whole_window;
ev.xclient.data.l[3] = 0; ev.xclient.data.l[3] = 0;
ev.xclient.data.l[4] = 0; ev.xclient.data.l[4] = 0;
wine_tsx11_lock();
XSendEvent( display, systray_window, False, NoEventMask, &ev ); XSendEvent( display, systray_window, False, NoEventMask, &ev );
attr.background_pixmap = ParentRelative; attr.background_pixmap = ParentRelative;
attr.bit_gravity = ForgetGravity; attr.bit_gravity = ForgetGravity;
XChangeWindowAttributes( display, data->whole_window, CWBackPixmap | CWBitGravity, &attr ); XChangeWindowAttributes( display, data->whole_window, CWBackPixmap | CWBitGravity, &attr );
XChangeWindowAttributes( display, data->client_window, CWBackPixmap | CWBitGravity, &attr ); XChangeWindowAttributes( display, data->client_window, CWBackPixmap | CWBitGravity, &attr );
wine_tsx11_unlock(); wine_tsx11_unlock();
data->mapped = TRUE;
data->wm_state = NormalState;
} }
......
...@@ -205,18 +205,41 @@ static void update_net_wm_states( Display *display, struct x11drv_win_data *data ...@@ -205,18 +205,41 @@ static void update_net_wm_states( Display *display, struct x11drv_win_data *data
/*********************************************************************** /***********************************************************************
* set_xembed_flags
*/
static void set_xembed_flags( Display *display, struct x11drv_win_data *data, unsigned long flags )
{
unsigned long info[2];
info[0] = 0; /* protocol version */
info[1] = flags;
wine_tsx11_lock();
XChangeProperty( display, data->whole_window, x11drv_atom(_XEMBED_INFO),
x11drv_atom(_XEMBED_INFO), 32, PropModeReplace, (unsigned char*)info, 2 );
wine_tsx11_unlock();
}
/***********************************************************************
* map_window * map_window
*/ */
static void map_window( Display *display, struct x11drv_win_data *data, DWORD new_style ) static void map_window( Display *display, struct x11drv_win_data *data, DWORD new_style )
{ {
TRACE( "win %p/%lx\n", data->hwnd, data->whole_window ); TRACE( "win %p/%lx\n", data->hwnd, data->whole_window );
wait_for_withdrawn_state( display, data, TRUE ); wait_for_withdrawn_state( display, data, TRUE );
if (!data->embedded)
{
update_net_wm_states( display, data ); update_net_wm_states( display, data );
X11DRV_sync_window_style( display, data ); X11DRV_sync_window_style( display, data );
wine_tsx11_lock(); wine_tsx11_lock();
XMapWindow( display, data->whole_window ); XMapWindow( display, data->whole_window );
XFlush( display ); XFlush( display );
wine_tsx11_unlock(); wine_tsx11_unlock();
}
else set_xembed_flags( display, data, XEMBED_MAPPED );
data->mapped = TRUE; data->mapped = TRUE;
data->iconic = (new_style & WS_MINIMIZE) != 0; data->iconic = (new_style & WS_MINIMIZE) != 0;
} }
...@@ -228,17 +251,43 @@ static void map_window( Display *display, struct x11drv_win_data *data, DWORD ne ...@@ -228,17 +251,43 @@ static void map_window( Display *display, struct x11drv_win_data *data, DWORD ne
static void unmap_window( Display *display, struct x11drv_win_data *data ) static void unmap_window( Display *display, struct x11drv_win_data *data )
{ {
TRACE( "win %p/%lx\n", data->hwnd, data->whole_window ); TRACE( "win %p/%lx\n", data->hwnd, data->whole_window );
if (!data->embedded)
{
wait_for_withdrawn_state( display, data, FALSE ); wait_for_withdrawn_state( display, data, FALSE );
wine_tsx11_lock(); wine_tsx11_lock();
if (data->managed) XWithdrawWindow( display, data->whole_window, DefaultScreen(display) ); if (data->managed) XWithdrawWindow( display, data->whole_window, DefaultScreen(display) );
else XUnmapWindow( display, data->whole_window ); else XUnmapWindow( display, data->whole_window );
wine_tsx11_unlock(); wine_tsx11_unlock();
}
else set_xembed_flags( display, data, 0 );
data->mapped = FALSE; data->mapped = FALSE;
data->net_wm_state = 0; data->net_wm_state = 0;
} }
/*********************************************************************** /***********************************************************************
* make_window_embedded
*/
void make_window_embedded( Display *display, struct x11drv_win_data *data )
{
if (data->mapped)
{
/* the window cannot be mapped before being embedded */
unmap_window( display, data );
data->embedded = TRUE;
map_window( display, data, 0 );
}
else
{
data->embedded = TRUE;
set_xembed_flags( display, data, 0 );
}
}
/***********************************************************************
* SetWindowStyle (X11DRV.@) * SetWindowStyle (X11DRV.@)
* *
* Update the X state of a window to reflect a style change * Update the X state of a window to reflect a style change
......
...@@ -695,6 +695,7 @@ struct x11drv_win_data ...@@ -695,6 +695,7 @@ struct x11drv_win_data
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) */
BOOL iconic : 1; /* is window in iconic state? */ BOOL iconic : 1; /* is window in iconic state? */
BOOL embedded : 1; /* is window an XEMBED client? */
int wm_state; /* current value of the WM_STATE property */ 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 */
HBITMAP hWMIconBitmap; HBITMAP hWMIconBitmap;
...@@ -717,6 +718,7 @@ extern void flush_gl_drawable( X11DRV_PDEVICE *physDev ); ...@@ -717,6 +718,7 @@ extern void flush_gl_drawable( X11DRV_PDEVICE *physDev );
extern int get_window_wm_state( Display *display, struct x11drv_win_data *data ); extern int get_window_wm_state( Display *display, struct x11drv_win_data *data );
extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set ); extern void wait_for_withdrawn_state( Display *display, struct x11drv_win_data *data, BOOL set );
extern void make_window_embedded( Display *display, struct x11drv_win_data *data );
/* X context to associate a hwnd to an X window */ /* X context to associate a hwnd to an X window */
extern XContext winContext; extern XContext winContext;
...@@ -773,4 +775,6 @@ extern void X11DRV_DDHAL_SwitchMode(DWORD dwModeIndex, LPVOID fb_addr, LPVIDMEM ...@@ -773,4 +775,6 @@ extern void X11DRV_DDHAL_SwitchMode(DWORD dwModeIndex, LPVOID fb_addr, LPVIDMEM
extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ); extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode );
extern void WIN_invalidate_dce( HWND hwnd, const RECT *rect ); extern void WIN_invalidate_dce( HWND hwnd, const RECT *rect );
#define XEMBED_MAPPED (1 << 0)
#endif /* __WINE_X11DRV_H */ #endif /* __WINE_X11DRV_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment