mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 21:38:00 +01:00
Add support for _NET_WM_FULLSCREEN_MONITORS
This patch adds the _NET_WM_FULLSCREEN_MONITORS hint as defined in EWMH which is based on Xinerama. It's allowing a window to be displayed fullscreen on multiple monitors. Issue mentioned at https://github.com/window-maker/wmaker/issues/8 Specs at https://specifications.freedesktop.org/wm-spec/1.5/ar01s06.html#idm45763309187776 GTK test program used https://bugzilla.gnome.org/show_bug.cgi?id=414476
This commit is contained in:
committed by
Carlos R. Mafra
parent
ac75047aef
commit
4d658341d2
54
src/wmspec.c
54
src/wmspec.c
@@ -77,6 +77,9 @@ static Atom net_wm_visible_name; /* TODO (unnecessary?) */
|
||||
static Atom net_wm_icon_name;
|
||||
static Atom net_wm_visible_icon_name; /* TODO (unnecessary?) */
|
||||
static Atom net_wm_desktop;
|
||||
#ifdef USE_XINERAMA
|
||||
static Atom net_wm_fullscreen_monitors;
|
||||
#endif
|
||||
static Atom net_wm_window_type;
|
||||
static Atom net_wm_window_type_desktop;
|
||||
static Atom net_wm_window_type_dock;
|
||||
@@ -161,6 +164,9 @@ static atomitem_t atomNames[] = {
|
||||
{"_NET_WM_ICON_NAME", &net_wm_icon_name},
|
||||
{"_NET_WM_VISIBLE_ICON_NAME", &net_wm_visible_icon_name},
|
||||
{"_NET_WM_DESKTOP", &net_wm_desktop},
|
||||
#ifdef USE_XINERAMA
|
||||
{"_NET_WM_FULLSCREEN_MONITORS", &net_wm_fullscreen_monitors},
|
||||
#endif
|
||||
{"_NET_WM_WINDOW_TYPE", &net_wm_window_type},
|
||||
{"_NET_WM_WINDOW_TYPE_DESKTOP", &net_wm_window_type_desktop},
|
||||
{"_NET_WM_WINDOW_TYPE_DOCK", &net_wm_window_type_dock},
|
||||
@@ -287,6 +293,9 @@ static void setSupportedHints(WScreen *scr)
|
||||
atom[i++] = net_wm_moveresize;
|
||||
#endif
|
||||
atom[i++] = net_wm_desktop;
|
||||
#ifdef USE_XINERAMA
|
||||
atom[i++] = net_wm_fullscreen_monitors;
|
||||
#endif
|
||||
atom[i++] = net_wm_window_type;
|
||||
atom[i++] = net_wm_window_type_desktop;
|
||||
atom[i++] = net_wm_window_type_dock;
|
||||
@@ -1027,6 +1036,9 @@ static void updateStateHint(WWindow *wwin, Bool changedWorkspace, Bool del)
|
||||
{ /* changeable */
|
||||
if (del) {
|
||||
XDeleteProperty(dpy, wwin->client_win, net_wm_state);
|
||||
#ifdef USE_XINERAMA
|
||||
XDeleteProperty(dpy, wwin->client_win, net_wm_fullscreen_monitors);
|
||||
#endif
|
||||
} else {
|
||||
Atom state[15]; /* nr of defined state atoms */
|
||||
int i = 0;
|
||||
@@ -1067,6 +1079,20 @@ static void updateStateHint(WWindow *wwin, Bool changedWorkspace, Bool del)
|
||||
|
||||
XChangeProperty(dpy, wwin->client_win, net_wm_state, XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *)state, i);
|
||||
|
||||
#ifdef USE_XINERAMA
|
||||
if (wwin->flags.fullscreen && (wwin->flags.fullscreen_monitors[0] != -1)) {
|
||||
unsigned long data[4];
|
||||
|
||||
data[0] = wwin->flags.fullscreen_monitors[0];
|
||||
data[1] = wwin->flags.fullscreen_monitors[1];
|
||||
data[2] = wwin->flags.fullscreen_monitors[2];
|
||||
data[3] = wwin->flags.fullscreen_monitors[3];
|
||||
|
||||
XChangeProperty(dpy, wwin->client_win, net_wm_fullscreen_monitors, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)data, 4);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1260,8 +1286,10 @@ static void doStateAtom(WWindow *wwin, Atom state, int set, Bool init)
|
||||
} else {
|
||||
if (set)
|
||||
wFullscreenWindow(wwin);
|
||||
else
|
||||
else {
|
||||
wUnfullscreenWindow(wwin);
|
||||
wwin->flags.fullscreen_monitors[0] = -1;
|
||||
}
|
||||
}
|
||||
} else if (state == net_wm_state_above) {
|
||||
if (set == _NET_WM_STATE_TOGGLE)
|
||||
@@ -1759,8 +1787,30 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
|
||||
wWindowChangeWorkspace(wwin, desktop);
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
#ifdef USE_XINERAMA
|
||||
} else if (event->message_type == net_wm_fullscreen_monitors) {
|
||||
unsigned long top, bottom, left, right, src_indication;
|
||||
|
||||
top = event->data.l[0];
|
||||
bottom = event->data.l[1];
|
||||
left = event->data.l[2];
|
||||
right = event->data.l[3];
|
||||
src_indication = event->data.l[4];
|
||||
|
||||
if (src_indication > 1)
|
||||
wwarning("_NET_WM_FULLSCREEN_MONITORS source indication %ld not supported", src_indication);
|
||||
|
||||
wFullscreenMonitorsWindow(wwin, top, bottom, left, right);
|
||||
return True;
|
||||
}
|
||||
#else
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_WMSPEC
|
||||
wmessage("processClientMessage unsupported type %s", XGetAtomName(dpy, event->message_type));
|
||||
#endif
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user