mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
Patch by Hubert Chathi <hubert@uhoreg.ca> to handle window minimization
on EWMH systems better. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@26795 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2c01043f5d
commit
ff0796c5d4
5 changed files with 81 additions and 6 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2008-07-19 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/x11/XGServerWindow.m (-window::::): For EWMH window
|
||||
enable property change notifications.
|
||||
* Source/x11/XGServerWindow.m (-_ewmh_isMinimized:): Check whether
|
||||
the window is minimized.
|
||||
* Headers/x11/XGServerWindow.h (-_ewmh_isMinimized:): Declare new
|
||||
method.
|
||||
* Source/x11/XGServerEvent.m: Handle case when window gets minimized.
|
||||
* Headers/x11/XGGeneric.h: Add atom for hidden state.
|
||||
Patch by Hubert Chathi <hubert@uhoreg.ca>.
|
||||
|
||||
2008-07-12 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/xlib/GSXftFontInfo.m (-setupAttributes:),
|
||||
|
|
|
@ -63,6 +63,7 @@ typedef struct {
|
|||
Atom net_wm_state_skip_taskbar_atom;
|
||||
Atom net_wm_state_skip_pager_atom;
|
||||
Atom net_wm_state_sticky_atom;
|
||||
Atom net_wm_state_hidden_atom;
|
||||
} XGWMNetStates;
|
||||
|
||||
/*
|
||||
|
|
|
@ -129,6 +129,8 @@ typedef struct _gswindow_device_t {
|
|||
|
||||
/* This needs to go in GSDisplayServer */
|
||||
- (void) _DPSsetcursor: (Cursor)c : (BOOL)set;
|
||||
|
||||
- (BOOL) _ewmh_isMinimized: (Window) win;
|
||||
@end
|
||||
|
||||
extern Pixmap
|
||||
|
|
|
@ -1298,12 +1298,37 @@ static int check_modifier (XEvent *xEvent, KeySym key_sym)
|
|||
break;
|
||||
}
|
||||
|
||||
// a window property has changed or been deleted
|
||||
// a window property has changed or been deleted
|
||||
case PropertyNotify:
|
||||
NSDebugLLog(@"NSEvent", @"%d PropertyNotify - '%s'\n",
|
||||
xEvent.xproperty.window,
|
||||
XGetAtomName(dpy, xEvent.xproperty.atom));
|
||||
break;
|
||||
NSDebugLLog(@"NSEvent", @"%d PropertyNotify - '%s'\n",
|
||||
xEvent.xproperty.window,
|
||||
XGetAtomName(dpy, xEvent.xproperty.atom));
|
||||
{
|
||||
if (xEvent.xproperty.atom == generic.netstates.net_wm_state_atom &&
|
||||
xEvent.xproperty.state == PropertyNewValue)
|
||||
{
|
||||
/*
|
||||
* FIXME: we really should detect when the state changes from
|
||||
* unminimized to minimized, or vice versa
|
||||
*/
|
||||
if ([self _ewmh_isMinimized: xEvent.xproperty.window])
|
||||
{
|
||||
// Same event as when we get ClientMessage with the atom
|
||||
// equal to generic.miniaturize_atom
|
||||
eventLocation = NSMakePoint(0,0);
|
||||
e = [NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: eventLocation
|
||||
modifierFlags: 0
|
||||
timestamp: xEvent.xproperty.time / 1000
|
||||
windowNumber: cWin->number
|
||||
context: gcontext
|
||||
subtype: GSAppKitWindowMiniaturize
|
||||
data1: 0
|
||||
data2: 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// a client successfully reparents a window
|
||||
case ReparentNotify:
|
||||
|
|
|
@ -1235,6 +1235,8 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
XInternAtom(dpy, "_NET_WM_STATE_SKIP_PAGER", False);
|
||||
generic.netstates.net_wm_state_sticky_atom =
|
||||
XInternAtom(dpy, "_NET_WM_STATE_STICKY", False);
|
||||
generic.netstates.net_wm_state_hidden_atom =
|
||||
XInternAtom(dpy, "_NET_WM_STATE_HIDDEN", False);
|
||||
}
|
||||
if (win1)
|
||||
{
|
||||
|
@ -1940,7 +1942,8 @@ _get_next_prop_new_event(Display *display, XEvent *event, char *arg)
|
|||
| EnterWindowMask
|
||||
| LeaveWindowMask
|
||||
| FocusChangeMask
|
||||
// | PropertyChangeMask
|
||||
// enable property notifications under ewmh to detect window minimizing
|
||||
| (generic.wm & XGWM_EWMH ? PropertyChangeMask : 0)
|
||||
// | ColormapChangeMask
|
||||
| KeymapStateMask
|
||||
| VisibilityChangeMask
|
||||
|
@ -4573,4 +4576,36 @@ _computeDepth(int class, int bpp)
|
|||
return hasShadow;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether the window is miniaturized according to the EWMH window state
|
||||
* property. We map the EWMH _NET_WM_STATE_HIDDEN state to GNUstep's
|
||||
* miniaturized state.
|
||||
*/
|
||||
- (BOOL) _ewmh_isMinimized: (Window) win
|
||||
{
|
||||
Atom *data;
|
||||
int count;
|
||||
int i;
|
||||
|
||||
data = (Atom *)PropGetCheckProperty(dpy, win,
|
||||
generic.netstates.net_wm_state_atom,
|
||||
XA_ATOM, 32, -1, &count);
|
||||
|
||||
if (!data)
|
||||
// if we don't have any information, default to "No"
|
||||
return NO;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (data[i] == generic.netstates.net_wm_state_hidden_atom)
|
||||
{
|
||||
XFree(data);
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(data);
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue