This is an unfinished patch for _NET_WM_DESKTOP as a demonstration.
The idea is that when one of the window of an application is moved to
another virtual desktop,
the menu, app icon, floating panel, etc. should also be moved to the
same desktop.
WindowMaker current do that, I think, but it should be done by GNUstep
so that users of all desktop environment can benefit.
This patch only shows how to receive event for _NET_WM_DESKTOP
and retrieve the new desktop.
But I don't know how to get all windows belonging to the same application.
To change desktop of window, just send a client message:
http://standards.freedesktop.org/wm-spec/wm-spec-1.4.html#id2511177
Yen-Ju
Index: Source/x11/XGServerWindow.m
===================================================================
--- Source/x11/XGServerWindow.m (revision 25397)
+++ Source/x11/XGServerWindow.m (working copy)
@@ -1897,7 +1897,7 @@
| EnterWindowMask
| LeaveWindowMask
| FocusChangeMask
-// | PropertyChangeMask
+ | PropertyChangeMask
// | ColormapChangeMask
| KeymapStateMask
| VisibilityChangeMask
Index: Source/x11/XGServerEvent.m
===================================================================
--- Source/x11/XGServerEvent.m (revision 25397)
+++ Source/x11/XGServerEvent.m (working copy)
@@ -1311,6 +1311,36 @@
NSDebugLLog(@"NSEvent", @"%d PropertyNotify - '%s'\n",
xEvent.xproperty.window,
XGetAtomName(dpy, xEvent.xproperty.atom));
+ {
+ Atom XG_NET_WM_DESKTOP = XInternAtom(dpy, "_NET_WM_DESKTOP", False);
+ if (xEvent.xproperty.atom == XG_NET_WM_DESKTOP)
+ {
+// NSLog(@"Change desktop");
+ unsigned long *data = NULL;
+ Atom prop = XInternAtom(dpy, "_NET_WM_DESKTOP", False);
+ Atom type_ret;
+ int format_ret;
+ unsigned long after_ret, count;
+ int result = XGetWindowProperty(dpy, xEvent.xproperty.window, prop,
+ 0, 0x7FFFFFFF, False, XA_CARDINAL,
+ &type_ret, &format_ret, &count,
+ &after_ret, (unsigned char **)&data);
+ if ((result != Success))
+ {
+ NSLog(@"Error: cannot get _NET_WM_DESKTOP of client");
+ if (data)
+ {
+ XFree(data);
+ data = NULL;
+ }
+ break;
+ }
+ int desktop = (int)*data;
+ XFree(data);
+ data = NULL;
+ NSLog(@"New desktop %d", desktop);
+ }
+ }
break;
// a client successfully reparents a window
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev