Commit f1281474 authored by Olivier Fourdan's avatar Olivier Fourdan

* src/display.c, src/display.h, src/events.c, src/client.c

	  src/client.h, src/hints.c, src/hints.h, src/netwm.c, README:
	  Add support for NET_WM_FULLSCREEN_MONITORS

(Old svn revision: 29311)
parent a97cd94c
2009-01-24 olivier
* src/display.c, src/display.h, src/events.c, src/client.c
src/client.h, src/hints.c, src/hints.h, src/netwm.c, README:
Add support for NET_WM_FULLSCREEN_MONITORS
2009-01-23 olivier
* src/parserc.c, src/settings.c, src/settings.c: Fix settings not
......
......@@ -6,6 +6,7 @@
the session manager (Bug #4839).
- Fix settings not being set at startup (Bug #4845)
- Flatten default theme
- Add support for NET_WM_FULLSCREEN_MONITORS
4.5.93 (Xfce 4.6beta3)
======================
......
......@@ -20,14 +20,17 @@ Xfwm is compliant with the following specifications from the freedesktop.org
NET_NUMBER_OF_DESKTOPS
NET_REQUEST_FRAME_EXTENTS
NET_SHOWING_DESKTOP
NET_STARTUP_ID
NET_SUPPORTED
NET_SUPPORTING_WM_CHECK
NET_SYSTEM_TRAY_OPCODE
NET_WM_ACTION_ABOVE
NET_WM_ACTION_BELOW
NET_WM_ACTION_CHANGE_DESKTOP
NET_WM_ACTION_CLOSE
NET_WM_ACTION_FULLSCREEN
NET_WM_ACTION_MAXIMIZE_HORZ
NET_WM_ACTION_MAXIMIZE_VERT
NET_WM_ACTION_MINIMIZE
NET_WM_ACTION_MOVE
NET_WM_ACTION_RESIZE
NET_WM_ACTION_SHADE
......@@ -35,13 +38,14 @@ Xfwm is compliant with the following specifications from the freedesktop.org
NET_WM_ALLOWED_ACTIONS
NET_WM_CONTEXT_HELP
NET_WM_DESKTOP
NET_WM_FULLSCREEN_MONITORS
NET_WM_ICON
NET_WM_ICON_GEOMETRY
NET_WM_ICON_NAME
NET_WM_MOVERESIZE
NET_WM_NAME
NET_WM_WINDOW_OPACITY
NET_WM_WINDOW_OPACITY_LOCKED
NET_WM_PID
NET_WM_PING
NET_WM_STATE
NET_WM_STATE_ABOVE
NET_WM_STATE_BELOW
......@@ -60,6 +64,9 @@ Xfwm is compliant with the following specifications from the freedesktop.org
NET_WM_SYNC_REQUEST
NET_WM_SYNC_REQUEST_COUNTER
NET_WM_USER_TIME
NET_WM_USER_TIME_WINDOW
NET_WM_WINDOW_OPACITY
NET_WM_WINDOW_OPACITY_LOCKED
NET_WM_WINDOW_TYPE
NET_WM_WINDOW_TYPE_DESKTOP
NET_WM_WINDOW_TYPE_DIALOG
......
......@@ -1760,6 +1760,11 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
c->ncmap = 0;
}
c->fullscreen_monitors[0] = 0;
c->fullscreen_monitors[1] = 0;
c->fullscreen_monitors[2] = 0;
c->fullscreen_monitors[3] = 0;
/* Opacity for compositing manager */
c->opacity = NET_WM_OPAQUE;
getOpacity (display_info, c->window, &c->opacity);
......@@ -2973,6 +2978,70 @@ clientToggleSticky (Client * c, gboolean include_transients)
}
}
void
clientUpdateFullscreenSize (Client * c)
{
ScreenInfo *screen_info;
DisplayInfo *display_info;
XWindowChanges wc;
GdkRectangle monitor, rect;
int i;
g_return_if_fail (c != NULL);
TRACE ("entering clientUpdateFullscreenSize");
TRACE ("Update fullscreen size for client \"%s\" (0x%lx)", c->name, c->window);
screen_info = c->screen_info;
display_info = screen_info->display_info;
if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
{
if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS))
{
gdk_screen_get_monitor_geometry (screen_info->gscr, c->fullscreen_monitors[0], &rect);
for (i = 1; i < 4; i++)
{
gdk_screen_get_monitor_geometry (screen_info->gscr, c->fullscreen_monitors[i], &monitor);
gdk_rectangle_union (&rect, &monitor, &rect);
}
}
else
{
int cx, cy;
cx = frameX (c) + (frameWidth (c) / 2);
cy = frameY (c) + (frameHeight (c) / 2);
myScreenFindMonitorAtPoint (screen_info, cx, cy, &rect);
}
wc.x = rect.x;
wc.y = rect.y;
wc.width = rect.width;
wc.height = rect.height;
}
else
{
wc.x = c->fullscreen_old_x;
wc.y = c->fullscreen_old_y;
wc.width = c->fullscreen_old_width;
wc.height = c->fullscreen_old_height;
}
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED))
{
clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_FORCE_REDRAW);
}
else
{
c->x = wc.x;
c->y = wc.y;
c->height = wc.height;
c->width = wc.width;
}
}
void clientToggleFullscreen (Client * c)
{
g_return_if_fail (c != NULL);
......@@ -3003,6 +3072,48 @@ void clientToggleFullscreen (Client * c)
}
}
void clientSetFullscreenMonitor (Client * c, gint top, gint bottom, gint left, gint right)
{
ScreenInfo *screen_info;
DisplayInfo *display_info;
gint num_monitors;
g_return_if_fail (c != NULL);
TRACE ("entering clientSetFullscreenMonitor");
screen_info = c->screen_info;
display_info = screen_info->display_info;
num_monitors = gdk_screen_get_n_monitors (screen_info->gscr);
if ((top >= 0) && (top < num_monitors) &&
(bottom >= 0) && (bottom < num_monitors) &&
(left >= 0) && (left < num_monitors) &&
(right >= 0) && (right < num_monitors))
{
c->fullscreen_monitors[0] = top;
c->fullscreen_monitors[1] = bottom;
c->fullscreen_monitors[2] = left;
c->fullscreen_monitors[3] = right;
FLAG_SET (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS);
}
else
{
c->fullscreen_monitors[0] = 0;
c->fullscreen_monitors[1] = 0;
c->fullscreen_monitors[2] = 0;
c->fullscreen_monitors[3] = 0;
FLAG_UNSET (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS);
}
if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
{
clientUpdateFullscreenSize (c);
}
if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS))
{
setNetFullscreenMonitors (display_info, c->window, top, bottom, left, right);
}
}
void clientToggleLayerAbove (Client * c)
{
g_return_if_fail (c != NULL);
......
......@@ -157,6 +157,7 @@
#define CLIENT_FLAG_NAME_CHANGED (1L<<16)
#define CLIENT_FLAG_DEMANDS_ATTENTION (1L<<17)
#define CLIENT_FLAG_HAS_SHAPE (1L<<18)
#define CLIENT_FLAG_FULLSCREN_MONITORS (1L<<19)
#define WM_FLAG_DELETE (1L<<0)
#define WM_FLAG_INPUT (1L<<1)
......@@ -298,6 +299,7 @@ struct _Client
unsigned long flags;
unsigned long wm_flags;
unsigned long xfwm_flags;
gint fullscreen_monitors[4];
/* Termination dialog */
int dialog_pid;
......@@ -408,7 +410,13 @@ void clientUnstick (Client *,
gboolean);
void clientToggleSticky (Client *,
gboolean);
void clientUpdateFullscreenSize (Client *);
void clientToggleFullscreen (Client *);
void clientSetFullscreenMonitor (Client *,
gint,
gint,
gint,
gint);
void clientToggleLayerAbove (Client *);
void clientToggleLayerBelow (Client *);
void clientSetLayerNormal (Client *);
......
......@@ -113,6 +113,7 @@ myDisplayInitAtoms (DisplayInfo *display_info)
"_NET_WM_ALLOWED_ACTIONS",
"_NET_WM_CONTEXT_HELP",
"_NET_WM_DESKTOP",
"_NET_WM_FULLSCREEN_MONITORS",
"_NET_WM_ICON",
"_NET_WM_ICON_GEOMETRY",
"_NET_WM_ICON_NAME",
......
......@@ -207,6 +207,7 @@ enum
NET_WM_ALLOWED_ACTIONS,
NET_WM_CONTEXT_HELP,
NET_WM_DESKTOP,
NET_WM_FULLSCREEN_MONITORS,
NET_WM_ICON,
NET_WM_ICON_GEOMETRY,
NET_WM_ICON_NAME,
......
......@@ -2026,6 +2026,12 @@ handleClientMessage (DisplayInfo *display_info, XClientMessageEvent * ev)
setNetFrameExtents (display_info, c->window, frameTop (c), frameLeft (c),
frameRight (c), frameBottom (c));
}
else if (ev->message_type == display_info->atoms[NET_WM_FULLSCREEN_MONITORS])
{
TRACE ("client \"%s\" (0x%lx) has received a NET_WM_FULLSCREEN_MONITORS event", c->name, c->window);
clientSetFullscreenMonitor (c, (gint) ev->data.l[0], (gint) ev->data.l[1],
(gint) ev->data.l[2], (gint) ev->data.l[3]);
}
}
else
{
......
......@@ -423,6 +423,7 @@ setNetSupportedHint (DisplayInfo *display_info, Window root, Window check_win)
atoms[i++] = display_info->atoms[NET_WM_ALLOWED_ACTIONS];
atoms[i++] = display_info->atoms[NET_WM_CONTEXT_HELP];
atoms[i++] = display_info->atoms[NET_WM_DESKTOP];
atoms[i++] = display_info->atoms[NET_WM_FULLSCREEN_MONITORS];
atoms[i++] = display_info->atoms[NET_WM_ICON];
atoms[i++] = display_info->atoms[NET_WM_ICON_GEOMETRY];
atoms[i++] = display_info->atoms[NET_WM_ICON_NAME];
......@@ -589,6 +590,20 @@ setNetFrameExtents (DisplayInfo *display_info, Window w, int top, int left, int
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) data, 4);
}
void
setNetFullscreenMonitors (DisplayInfo *display_info, Window w, gint top, gint bottom, gint left, gint right)
{
unsigned long data[4] = { 0, 0, 0, 0 };
TRACE ("entering setNetFullscreenMonitors");
data[0] = (unsigned long) top;;
data[1] = (unsigned long) bottom;
data[2] = (unsigned long) left;
data[3] = (unsigned long) right;
XChangeProperty (display_info->dpy, w, display_info->atoms[NET_WM_FULLSCREEN_MONITORS],
XA_CARDINAL, 32, PropModeReplace, (unsigned char *) data, 4);
}
void
initNetDesktopInfo (DisplayInfo *display_info, Window root, int workspace, int width, int height)
{
......
......@@ -205,6 +205,12 @@ void setNetFrameExtents (DisplayInfo *,
int,
int,
int);
void setNetFullscreenMonitors (DisplayInfo *,
Window,
gint,
gint,
gint,
gint);
void initNetDesktopInfo (DisplayInfo *,
Window,
int,
......
......@@ -728,7 +728,6 @@ clientUpdateFullscreenState (Client * c)
{
ScreenInfo *screen_info;
DisplayInfo *display_info;
XWindowChanges wc;
int layer;
g_return_if_fail (c != NULL);
......@@ -740,46 +739,19 @@ clientUpdateFullscreenState (Client * c)
if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
{
GdkRectangle rect;
int cx, cy;
cx = frameX (c) + (frameWidth (c) / 2);
cy = frameY (c) + (frameHeight (c) / 2);
myScreenFindMonitorAtPoint (screen_info, cx, cy, &rect);
c->fullscreen_old_x = c->x;
c->fullscreen_old_y = c->y;
c->fullscreen_old_width = c->width;
c->fullscreen_old_height = c->height;
c->fullscreen_old_layer = c->win_layer;
wc.x = rect.x;
wc.y = rect.y;
wc.width = rect.width;
wc.height = rect.height;
layer = WIN_LAYER_FULLSCREEN;
}
else
{
wc.x = c->fullscreen_old_x;
wc.y = c->fullscreen_old_y;
wc.width = c->fullscreen_old_width;
wc.height = c->fullscreen_old_height;
layer = c->fullscreen_old_layer;
}
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED))
{
clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_FORCE_REDRAW);
}
else
{
c->x = wc.x;
c->y = wc.y;
c->height = wc.height;
c->width = wc.width;
}
clientSetLayer (c, layer);
clientUpdateFullscreenSize (c);
/* Fullscreen has no decoration at all, update NET_FRAME_EXTENTS accordingly */
setNetFrameExtents (display_info,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment