Module: wine Branch: master Commit: 7d9739e2b54919f6053565a5c42a655760946103 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7d9739e2b54919f6053565a5c4...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Aug 20 14:04:36 2007 +0200
winex11: Move setting of the initial wm hints to a separate function.
---
dlls/winex11.drv/window.c | 83 ++++++++++++++++++++++++++------------------ 1 files changed, 49 insertions(+), 34 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 459b8f9..1976c9b 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -461,6 +461,54 @@ static char *get_process_name(void)
/*********************************************************************** + * set_initial_wm_hints + * + * Set the window manager hints that don't change over the lifetime of a window. + */ +static void set_initial_wm_hints( Display *display, struct x11drv_win_data *data ) +{ + int i; + Atom protocols[3]; + Atom dndVersion = 4; + XClassHint *class_hints; + char *process_name = get_process_name(); + + wine_tsx11_lock(); + + /* wm protocols */ + i = 0; + protocols[i++] = x11drv_atom(WM_DELETE_WINDOW); + protocols[i++] = x11drv_atom(_NET_WM_PING); + if (use_take_focus) protocols[i++] = x11drv_atom(WM_TAKE_FOCUS); + XChangeProperty( display, data->whole_window, x11drv_atom(WM_PROTOCOLS), + XA_ATOM, 32, PropModeReplace, (unsigned char *)protocols, i ); + + /* class hints */ + if ((class_hints = XAllocClassHint())) + { + static char wine[] = "Wine"; + + class_hints->res_name = process_name; + class_hints->res_class = wine; + XSetClassHint( display, data->whole_window, class_hints ); + XFree( class_hints ); + } + + /* set the WM_CLIENT_MACHINE and WM_LOCALE_NAME properties */ + XSetWMProperties(display, data->whole_window, NULL, NULL, NULL, 0, NULL, NULL, NULL); + /* set the pid. together, these properties are needed so the window manager can kill us if we freeze */ + i = getpid(); + XChangeProperty(display, data->whole_window, x11drv_atom(_NET_WM_PID), + XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&i, 1); + + XChangeProperty( display, data->whole_window, x11drv_atom(XdndAware), + XA_ATOM, 32, PropModeReplace, (unsigned char*)&dndVersion, 1 ); + + wine_tsx11_unlock(); +} + + +/*********************************************************************** * X11DRV_set_wm_hints * * Set the window manager hints for a newly-created window @@ -468,16 +516,11 @@ static char *get_process_name(void) void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data ) { Window group_leader; - XClassHint *class_hints; - Atom protocols[3]; Atom window_type; MwmHints mwm_hints; - Atom dndVersion = 4; - int i; DWORD style = GetWindowLongW( data->hwnd, GWL_STYLE ); DWORD ex_style = GetWindowLongW( data->hwnd, GWL_EXSTYLE ); HWND owner = GetWindow( data->hwnd, GW_OWNER ); - char *process_name = get_process_name();
if (data->hwnd == GetDesktopWindow()) { @@ -500,35 +543,9 @@ void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data )
wine_tsx11_lock();
- /* wm protocols */ - i = 0; - protocols[i++] = x11drv_atom(WM_DELETE_WINDOW); - protocols[i++] = x11drv_atom(_NET_WM_PING); - if (use_take_focus) protocols[i++] = x11drv_atom(WM_TAKE_FOCUS); - XChangeProperty( display, data->whole_window, x11drv_atom(WM_PROTOCOLS), - XA_ATOM, 32, PropModeReplace, (unsigned char *)protocols, i ); - - /* class hints */ - if ((class_hints = XAllocClassHint())) - { - static char wine[] = "Wine"; - - class_hints->res_name = process_name; - class_hints->res_class = wine; - XSetClassHint( display, data->whole_window, class_hints ); - XFree( class_hints ); - } - /* size hints */ set_size_hints( display, data, style );
- /* set the WM_CLIENT_MACHINE and WM_LOCALE_NAME properties */ - XSetWMProperties(display, data->whole_window, NULL, NULL, NULL, 0, NULL, NULL, NULL); - /* set the pid. together, these properties are needed so the window manager can kill us if we freeze */ - i = getpid(); - XChangeProperty(display, data->whole_window, x11drv_atom(_NET_WM_PID), - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&i, 1); - /* set the WM_WINDOW_TYPE */ window_type = x11drv_atom(_NET_WM_WINDOW_TYPE_NORMAL); if (ex_style & WS_EX_TOOLWINDOW) window_type = x11drv_atom(_NET_WM_WINDOW_TYPE_UTILITY); @@ -563,9 +580,6 @@ void X11DRV_set_wm_hints( Display *display, struct x11drv_win_data *data ) x11drv_atom(_MOTIF_WM_HINTS), 32, PropModeReplace, (unsigned char*)&mwm_hints, sizeof(mwm_hints)/sizeof(long) );
- XChangeProperty( display, data->whole_window, x11drv_atom(XdndAware), - XA_ATOM, 32, PropModeReplace, (unsigned char*)&dndVersion, 1 ); - wine_tsx11_unlock();
/* wm hints */ @@ -797,6 +811,7 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat xim = x11drv_thread_data()->xim; if (xim) data->xic = X11DRV_CreateIC( xim, display, data->whole_window );
+ set_initial_wm_hints( display, data ); X11DRV_set_wm_hints( display, data );
SetPropA( data->hwnd, whole_window_prop, (HANDLE)data->whole_window );