[Xfce4-commits] r27356 - xfwm4/trunk/src
Olivier Fourdan
olivier at xfce.org
Sun Jul 20 23:22:15 CEST 2008
Author: olivier
Date: 2008-07-20 21:22:15 +0000 (Sun, 20 Jul 2008)
New Revision: 27356
Modified:
xfwm4/trunk/src/client.c
xfwm4/trunk/src/client.h
xfwm4/trunk/src/display.c
xfwm4/trunk/src/display.h
xfwm4/trunk/src/events.c
xfwm4/trunk/src/hints.c
xfwm4/trunk/src/hints.h
xfwm4/trunk/src/netwm.c
xfwm4/trunk/src/stacking.c
Log:
Add support for EWMH 1.4 NET_WM_USER_TIME_WINDOW property,
use a separate layer for fullscreen windows (Bug #3526).
Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/client.c 2008-07-20 21:22:15 UTC (rev 27356)
@@ -1262,6 +1262,42 @@
}
}
+void
+clientAddUserTimeWin (Client * c)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (c->window != None);
+
+ screen_info = c->screen_info;
+ display_info = screen_info->display_info;
+
+ if ((c->user_time_win != None) && (c->user_time_win != c->window))
+ {
+ XSelectInput (display_info->dpy, c->user_time_win, PropertyChangeMask);
+ }
+}
+
+void
+clientRemoveUserTimeWin (Client * c)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (c->window != None);
+
+ screen_info = c->screen_info;
+ display_info = screen_info->display_info;
+
+ if ((c->user_time_win != None) && (c->user_time_win != c->window))
+ {
+ XSelectInput (display_info->dpy, c->user_time_win, NoEventMask);
+ }
+}
+
static void
clientUpdateIconPix (Client * c)
{
@@ -1569,6 +1605,8 @@
c->fullscreen_old_layer = c->win_layer;
/* net_wm_user_time standard */
+ c->user_time_win = getNetWMUserTimeWindow(display_info, c->window);
+ clientAddUserTimeWin (c);
clientGetUserTime (c);
/* Apply startup notification properties if available */
@@ -1815,6 +1853,7 @@
myDisplayGrabServer (display_info);
gdk_error_trap_push ();
+ clientRemoveUserTimeWin (c);
clientUngrabButtons (c);
XUnmapWindow (display_info->dpy, c->frame);
clientCoordGravitate (c, REMOVE, &c->x, &c->y);
@@ -1992,6 +2031,15 @@
}
}
+ if (mode & SEARCH_WIN_USER_TIME)
+ {
+ if (c->user_time_win == w)
+ {
+ TRACE ("found \"%s\" (mode WIN_USER_TIME)", c->name);
+ return (c);
+ }
+ }
+
if (mode & SEARCH_BUTTON)
{
for (b = 0; b < BUTTON_COUNT; b++)
Modified: xfwm4/trunk/src/client.h
===================================================================
--- xfwm4/trunk/src/client.h 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/client.h 2008-07-20 21:22:15 UTC (rev 27356)
@@ -237,6 +237,7 @@
Window window;
Window frame;
Window transient_for;
+ Window user_time_win;
Window *cmap_windows;
xfwmWindow title;
xfwmWindow sides[SIDE_COUNT];
@@ -320,6 +321,8 @@
void clientClearLastOpTime (Client *);
void clientUpdateWinState (Client *,
XClientMessageEvent *);
+void clientAddUserTimeWin (Client *);
+void clientRemoveUserTimeWin (Client *);
void clientUpdateUrgency (Client *);
void clientCoordGravitate (Client *,
int,
Modified: xfwm4/trunk/src/display.c
===================================================================
--- xfwm4/trunk/src/display.c 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/display.c 2008-07-20 21:22:15 UTC (rev 27356)
@@ -137,6 +137,7 @@
"_NET_WM_SYNC_REQUEST",
"_NET_WM_SYNC_REQUEST_COUNTER",
"_NET_WM_USER_TIME",
+ "_NET_WM_USER_TIME_WINDOW",
"_NET_WM_WINDOW_TYPE",
"_NET_WM_WINDOW_TYPE_DESKTOP",
"_NET_WM_WINDOW_TYPE_DIALOG",
Modified: xfwm4/trunk/src/display.h
===================================================================
--- xfwm4/trunk/src/display.h 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/display.h 2008-07-20 21:22:15 UTC (rev 27356)
@@ -80,11 +80,11 @@
enum
{
- SEARCH_WINDOW = (1 << 0),
- SEARCH_FRAME = (1 << 1),
- SEARCH_BUTTON = (1 << 2)
+ SEARCH_WINDOW = (1 << 0),
+ SEARCH_FRAME = (1 << 1),
+ SEARCH_BUTTON = (1 << 2),
+ SEARCH_WIN_USER_TIME = (1 << 3)
};
-#define SEARCH_ANY (SEARCH_WINDOW | SEARCH_FRAME | SEARCH_BUTTON)
enum
{
@@ -231,6 +231,7 @@
NET_WM_SYNC_REQUEST,
NET_WM_SYNC_REQUEST_COUNTER,
NET_WM_USER_TIME,
+ NET_WM_USER_TIME_WINDOW,
NET_WM_WINDOW_TYPE,
NET_WM_WINDOW_TYPE_DESKTOP,
NET_WM_WINDOW_TYPE_DIALOG,
Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/events.c 2008-07-20 21:22:15 UTC (rev 27356)
@@ -1819,7 +1819,7 @@
TRACE ("entering handlePropertyNotify");
status = EVENT_FILTER_PASS;
- c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW);
+ c = myDisplayGetClientFromWindow (display_info, ev->window, SEARCH_WINDOW | SEARCH_WIN_USER_TIME);
if (c)
{
status = EVENT_FILTER_REMOVE;
@@ -1880,25 +1880,6 @@
if (clientCheckTransientWindow (c, w))
{
c->transient_for = w;
-#if 0
- /*
- Java 1.6 updates the WM_TRANSIENT_FOR properties "on-the-fly"
- of its windows to maintain the z-order.
-
- If we raise the transient then, we clearly have a race
- condition between the WM and Java... And that breaks
- the z-order. Bug #2483.
-
- I still think that raising here makes sense, to ensure
- that the newly promoted transient window is placed above
- its parent.
-
- Chances are that Java 1.6 won't change any time soon (heh,
- it's not even released yet), so let's adjust the WM to
- work with Java 1.6...
- */
- clientRaise (c, w);
-#endif
}
}
else if (ev->atom == display_info->atoms[WIN_HINTS])
@@ -1939,6 +1920,13 @@
FLAG_SET (c->flags, CLIENT_FLAG_HAS_USER_TIME);
}
}
+ else if (ev->atom == display_info->atoms[NET_WM_USER_TIME_WINDOW])
+ {
+ TRACE ("client \"%s\" (0x%lx) has received a NET_WM_USER_TIME_WINDOW notify", c->name, c->window);
+ clientRemoveUserTimeWin (c);
+ c->user_time_win = getNetWMUserTimeWindow(display_info, c->window);
+ clientAddUserTimeWin (c);
+ }
else if (ev->atom == display_info->atoms[NET_WM_WINDOW_OPACITY])
{
TRACE ("client \"%s\" (0x%lx) has received a NET_WM_OPACITY notify", c->name, c->window);
Modified: xfwm4/trunk/src/hints.c
===================================================================
--- xfwm4/trunk/src/hints.c 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/hints.c 2008-07-20 21:22:15 UTC (rev 27356)
@@ -452,6 +452,7 @@
atoms[i++] = display_info->atoms[NET_WM_SYNC_REQUEST];
atoms[i++] = display_info->atoms[NET_WM_SYNC_REQUEST_COUNTER];
atoms[i++] = display_info->atoms[NET_WM_USER_TIME];
+ atoms[i++] = display_info->atoms[NET_WM_USER_TIME_WINDOW];
atoms[i++] = display_info->atoms[NET_WM_WINDOW_TYPE];
atoms[i++] = display_info->atoms[NET_WM_WINDOW_TYPE_DESKTOP];
atoms[i++] = display_info->atoms[NET_WM_WINDOW_TYPE_DIALOG];
@@ -828,6 +829,39 @@
}
gboolean
+getWindowProp (DisplayInfo *display_info, Window window, int atom_id, Window *w)
+{
+ Atom type;
+ int format;
+ unsigned long nitems;
+ unsigned long bytes_after;
+ unsigned char *prop;
+
+ TRACE ("entering getWindowProp");
+
+ g_return_val_if_fail (window != None, None);
+
+ *w = None;
+ if (XGetWindowProperty (display_info->dpy, window, display_info->atoms[atom_id],
+ 0L, 1L, FALSE, XA_WINDOW, &type, &format, &nitems,
+ &bytes_after, (unsigned char **) &prop) == Success)
+ {
+ *w = *((Window *) prop);
+ if (prop)
+ {
+ XFree (prop);
+ }
+ if (!check_type_and_format (32, XA_WINDOW, -1, format, type))
+ {
+ *w = None;
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+gboolean
getClientMachine (DisplayInfo *display_info, Window w, gchar **machine)
{
char *str;
@@ -921,31 +955,12 @@
getClientLeader (DisplayInfo *display_info, Window window)
{
Window client_leader;
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- unsigned char *prop;
-
TRACE ("entering getClientLeader");
g_return_val_if_fail (window != None, None);
client_leader = None;
- if (XGetWindowProperty (display_info->dpy, window, display_info->atoms[WM_CLIENT_LEADER],
- 0L, 1L, FALSE, AnyPropertyType, &actual_type, &actual_format, &nitems,
- &bytes_after, (unsigned char **) &prop) == Success)
- {
- if ((prop) && (actual_type == XA_WINDOW) && (actual_format == 32)
- && (nitems == 1) && (bytes_after == 0))
- {
- client_leader = *((Window *) prop);
- }
- if (prop)
- {
- XFree (prop);
- }
- }
+ getWindowProp (display_info, window, WM_CLIENT_LEADER, &client_leader);
return client_leader;
}
@@ -979,6 +994,22 @@
return FALSE;
}
+Window
+getNetWMUserTimeWindow (DisplayInfo *display_info, Window window)
+{
+ Window user_time_win;
+ TRACE ("entering getNetWMUserTimeWindow");
+
+ g_return_val_if_fail (window != None, None);
+
+ user_time_win = None;
+ if (getWindowProp (display_info, window, NET_WM_USER_TIME_WINDOW, &user_time_win) && (user_time_win != None))
+ {
+ return user_time_win;
+ }
+ return window;
+}
+
gboolean
getClientID (DisplayInfo *display_info, Window window, gchar **client_id)
{
@@ -991,7 +1022,7 @@
*client_id = NULL;
g_return_val_if_fail (window != None, FALSE);
- if ((id = getClientLeader (display_info, window)))
+ if (getWindowProp (display_info, window, WM_CLIENT_LEADER, &id) && (id != None))
{
if (XGetTextProperty (display_info->dpy, id, &tp, display_info->atoms[SM_CLIENT_ID]))
{
@@ -1019,7 +1050,7 @@
{
return TRUE;
}
- if ((id = getClientLeader (display_info, window)))
+ if (getWindowProp (display_info, window, WM_CLIENT_LEADER, &id) && (id != None))
{
if (XGetCommand (display_info->dpy, id, argv, argc) && (*argc > 0))
{
Modified: xfwm4/trunk/src/hints.h
===================================================================
--- xfwm4/trunk/src/hints.h 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/hints.h 2008-07-20 21:22:15 UTC (rev 27356)
@@ -90,6 +90,7 @@
#define WIN_LAYER_ONTOP 6
#define WIN_LAYER_DOCK 8
#define WIN_LAYER_ABOVE_DOCK 10
+#define WIN_LAYER_FULLSCREEN 12
#define NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
#define NET_WM_MOVERESIZE_SIZE_TOP 1
@@ -229,9 +230,10 @@
int,
gchar ***,
int *);
-gboolean getClientMachine (DisplayInfo *,
+gboolean getWindowProp (DisplayInfo *,
Window,
- gchar **);
+ int,
+ Window *);
gboolean getClientMachine (DisplayInfo *,
Window,
gchar **);
@@ -243,6 +245,8 @@
gboolean getNetWMUserTime (DisplayInfo *,
Window,
Time *);
+Window getNetWMUserTimeWindow (DisplayInfo *,
+ Window);
gboolean getClientID (DisplayInfo *,
Window,
gchar **);
Modified: xfwm4/trunk/src/netwm.c
===================================================================
--- xfwm4/trunk/src/netwm.c 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/netwm.c 2008-07-20 21:22:15 UTC (rev 27356)
@@ -723,7 +723,7 @@
wc.y = rect.y;
wc.width = rect.width;
wc.height = rect.height;
- layer = WIN_LAYER_ABOVE_DOCK;
+ layer = WIN_LAYER_FULLSCREEN;
}
else
{
Modified: xfwm4/trunk/src/stacking.c
===================================================================
--- xfwm4/trunk/src/stacking.c 2008-07-20 19:54:06 UTC (rev 27355)
+++ xfwm4/trunk/src/stacking.c 2008-07-20 21:22:15 UTC (rev 27356)
@@ -549,11 +549,11 @@
if (FLAG_TEST(c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN)
|| FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN))
{
- clientSetLayer (c, WIN_LAYER_ABOVE_DOCK);
+ clientSetLayer (c, WIN_LAYER_FULLSCREEN);
return TRUE;
}
}
- else if (c->win_layer == WIN_LAYER_ABOVE_DOCK)
+ else if (c->win_layer == WIN_LAYER_FULLSCREEN)
{
if (FLAG_TEST(c->xfwm_flags, XFWM_FLAG_LEGACY_FULLSCREEN)
|| FLAG_TEST(c->flags, CLIENT_FLAG_FULLSCREEN))
More information about the Xfce4-commits
mailing list