Set the WM protocols supported by a window according to its style

mask. This fixes an issue where an application could be deactivated
under Window Maker when a submenu is closed.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@27623 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2009-01-17 17:48:19 +00:00
parent af8b2e7883
commit 993a5d976b
2 changed files with 34 additions and 27 deletions

View file

@ -1,3 +1,9 @@
2009-01-17 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/x11/XGServerWindow.m (_setSupportedWMProtocols:,
_checkStyle:, window::::, orderwindow:::): Set the WM protocols
supported by a window according to its style mask.
2009-01-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/art/ftfont.m: Give more information on failed font face access.

View file

@ -370,6 +370,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
- (gswindow_device_t *) _rootWindowForScreen: (int)screen;
- (void) styleoffsets: (float *) l : (float *) r : (float *) t : (float *) b
: (unsigned int) style : (Window) win;
- (void) _setSupportedWMProtocols: (gswindow_device_t *) window;
@end
@implementation XGServer (WindowOps)
@ -819,18 +820,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
* Prepare the protocols supported by the window.
* These protocols should be set on the window when it is ordered in.
*/
window->numProtocols = 0;
window->protocols[window->numProtocols++] = generic.take_focus_atom;
window->protocols[window->numProtocols++] = generic.delete_win_atom;
if ((generic.wm & XGWM_EWMH) != 0)
{
window->protocols[window->numProtocols++] = generic.net_wm_ping_atom;
}
if ((generic.wm & XGWM_WINDOWMAKER) != 0)
{
window->protocols[window->numProtocols++] = generic.miniaturize_atom;
}
XSetWMProtocols(dpy, window->ident, window->protocols, window->numProtocols);
[self _setSupportedWMProtocols: window];
window->exposedRects = [NSMutableArray new];
window->region = XCreateRegion();
@ -1373,6 +1363,30 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
}
}
- (void) _setSupportedWMProtocols: (gswindow_device_t *) window
{
NSWindow *nswin = GSWindowWithNumber(window->number);
window->numProtocols = 0;
if (!nswin || [nswin canBecomeKeyWindow])
{
window->protocols[window->numProtocols++] = generic.take_focus_atom;
}
if ((window->win_attrs.window_style & NSClosableWindowMask) != 0)
window->protocols[window->numProtocols++] = generic.delete_win_atom;
// Add ping protocol for EWMH
if ((generic.wm & XGWM_EWMH) != 0)
{
window->protocols[window->numProtocols++] = generic.net_wm_ping_atom;
}
if ((generic.wm & XGWM_WINDOWMAKER) != 0
&& (window->win_attrs.window_style & NSMiniaturizableWindowMask) != 0)
{
window->protocols[window->numProtocols++] = generic.miniaturize_atom;
}
XSetWMProtocols(dpy, window->ident, window->protocols, window->numProtocols);
}
- (void) _setupRootWindow
{
NSProcessInfo *pInfo = [NSProcessInfo processInfo];
@ -1998,19 +2012,7 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
* Prepare the protocols supported by the window.
* These protocols should be set on the window when it is ordered in.
*/
window->numProtocols = 0;
window->protocols[window->numProtocols++] = generic.take_focus_atom;
window->protocols[window->numProtocols++] = generic.delete_win_atom;
// Add ping protocol for EWMH
if ((generic.wm & XGWM_EWMH) != 0)
{
window->protocols[window->numProtocols++] = generic.net_wm_ping_atom;
}
if ((generic.wm & XGWM_WINDOWMAKER) != 0)
{
window->protocols[window->numProtocols++] = generic.miniaturize_atom;
}
XSetWMProtocols(dpy, window->ident, window->protocols, window->numProtocols);
[self _setSupportedWMProtocols: window];
window->exposedRects = [NSMutableArray new];
window->region = XCreateRegion();
@ -2745,8 +2747,7 @@ static BOOL didCreatePixmaps;
/*
* Tell the window manager what protocols this window conforms to.
*/
XSetWMProtocols(dpy, window->ident, window->protocols,
window->numProtocols);
[self _setSupportedWMProtocols: window];
}
if (generic.flags.useWindowMakerIcons == 1)