Patch for _NET_WM_FULLSCREEN_MONITORS
zstegi <[email protected]> Sat, 25 Aug 2012 09:48:01 +0200
| Newsgroups | gmane.comp.window-managers.icewm.devel |
|---|---|
| Message-ID | <1345880881.18399.16.camel@mythos-laptop> |
--=-cMDKFkjzHyeHEezPybqV
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Hello there,
here is an implementation for _NET_WM_FULLSCREEN_MONITORS. The xfwm4
implementation was my sample (git show
f128147411a235b1651520b7620f03b35c86c5a5). If you want to test it,
simply use fakeXinerama (http://home.kde.org/~seli/fakexinerama/) and
this testprogram: https://bugzilla.gnome.org/attachment.cgi?id=122703
Best regards
--=-cMDKFkjzHyeHEezPybqV
Content-Disposition: attachment; filename="NetWMFullscreenMonitors.patch"
Content-Type: text/x-patch; name="NetWMFullscreenMonitors.patch";
charset="UTF-8"
Content-Transfer-Encoding: 7bit
diff --git a/icewm-1.2/src/wmapp.cc b/icewm-1.2/src/wmapp.cc
index eedc40b..7e4f43b 100644
--- a/icewm-1.2/src/wmapp.cc
+++ b/icewm-1.2/src/wmapp.cc
@@ -183,6 +183,7 @@ static void registerProtocols2(Window xid) {
_XA_NET_CLIENT_LIST_STACKING,
_XA_NET_NUMBER_OF_DESKTOPS,
_XA_NET_DESKTOP_GEOMETRY,
+ _XA_NET_WM_FULLSCREEN_MONITORS,
_XA_NET_CURRENT_DESKTOP,
_XA_NET_WM_DESKTOP,
_XA_NET_ACTIVE_WINDOW,
diff --git a/icewm-1.2/src/wmclient.cc b/icewm-1.2/src/wmclient.cc
index ab424b1..612f5fa 100644
--- a/icewm-1.2/src/wmclient.cc
+++ b/icewm-1.2/src/wmclient.cc
@@ -488,6 +488,9 @@ void YFrameClient::handleProperty(const XPropertyEvent &property) {
if (getFrame())
getFrame()->updateNetWMStrut();
prop.net_wm_strut = new_prop;
+ } else if (property.atom == _XA_NET_WM_FULLSCREEN_MONITORS) {
+ // ignore - we triggered this event
+ // (do i need to set a property here?)
#endif
#ifdef WMSPEC_HINTS
} else if (property.atom == _XA_NET_WM_ICON) {
@@ -680,6 +683,19 @@ long getMask(Atom a) {
mask |= WinStateSkipTaskBar;
return mask;
}
+
+void YFrameClient::setNetWMFullscreenMonitors(int top, int bottom, int left, int right) {
+ // why do i have to do this?
+ unsigned long data[4] = { 0, 0, 0, 0 };
+ data[0] = (unsigned long) top;;
+ data[1] = (unsigned long) bottom;
+ data[2] = (unsigned long) left;
+ data[3] = (unsigned long) right;
+ XChangeProperty (xapp->display(), handle(),
+ _XA_NET_WM_FULLSCREEN_MONITORS, XA_CARDINAL,
+ 32, PropModeReplace,
+ (unsigned char *) data, 4);
+}
#endif
void YFrameClient::handleClientMessage(const XClientMessageEvent &message) {
@@ -708,6 +724,12 @@ void YFrameClient::handleClientMessage(const XClientMessageEvent &message) {
getFrame()->setCurrentGeometryOuter(YRect(message.data.l[1], message.data.l[2],
message.data.l[3], message.data.l[4]));
}
+ } else if (message.message_type == _XA_NET_WM_FULLSCREEN_MONITORS)
+ {
+ if (getFrame()) {
+ getFrame()->updateNetWMFullscreenMonitors(message.data.l[0], message.data.l[1],
+ message.data.l[2], message.data.l[3]);
+ }
}
if (message.message_type == _XA_NET_WM_STATE) {
long mask =
diff --git a/icewm-1.2/src/wmclient.h b/icewm-1.2/src/wmclient.h
index 4c3d4c1..b9aab3b 100644
--- a/icewm-1.2/src/wmclient.h
+++ b/icewm-1.2/src/wmclient.h
@@ -146,6 +146,7 @@ public:
bool getNetWMDesktopHint(long *workspace);
bool getNetWMStrut(int *left, int *right, int *top, int *bottom);
bool getNetWMWindowType(Atom *window_type);
+ void setNetWMFullscreenMonitors(int top, int bottom, int left, int right);
#endif
#ifndef NO_MWM_HINTS
diff --git a/icewm-1.2/src/wmframe.cc b/icewm-1.2/src/wmframe.cc
index 6825c2e..d5b199d 100644
--- a/icewm-1.2/src/wmframe.cc
+++ b/icewm-1.2/src/wmframe.cc
@@ -122,6 +122,11 @@ YFrameWindow::YFrameWindow(
fStrutTop = 0;
fStrutBottom = 0;
+ fFullscreenMonitorsTop = -1;
+ fFullscreenMonitorsBottom = -1;
+ fFullscreenMonitorsLeft = -1;
+ fFullscreenMonitorsRight = -1;
+
setStyle(wsOverrideRedirect);
setPointer(YXApplication::leftPointer);
@@ -3110,16 +3115,29 @@ void YFrameWindow::updateLayout() {
setWindowGeometry(YRect(iconX, iconY, fMiniIcon->width(), fMiniIcon->height()));
} else {
- int xiscreen = manager->getScreenForRect(posX,
- posY,
- posW,
- posH);
-
- int dx, dy, dw, dh;
- manager->getScreenGeometry(&dx, &dy, &dw, &dh, xiscreen);
-
if (isFullscreen()) {
- setWindowGeometry(YRect(dx, dy, dw, dh));
+ // for _NET_WM_FULLSCREEN_MONITORS
+ if (fFullscreenMonitorsTop >= 0 && fFullscreenMonitorsBottom >= 0 &&
+ fFullscreenMonitorsLeft >= 0 && fFullscreenMonitorsRight >= 0) {
+ int x, y, w, h;
+ int monitor[4] = { fFullscreenMonitorsTop, fFullscreenMonitorsBottom,
+ fFullscreenMonitorsLeft, fFullscreenMonitorsRight };
+ manager->getScreenGeometry(&x, &y, &w, &h, monitor[0]);
+ YRect* r = new YRect(x, y, w, h);
+ for (int i = 1; i < 4; i++) {
+ manager->getScreenGeometry(&x, &y, &w, &h, monitor[i]);
+ r->unionRect(x, y, w, h);
+ }
+ setWindowGeometry(*r);
+ } else {
+ int xiscreen = manager->getScreenForRect(posX,
+ posY,
+ posW,
+ posH);
+ int dx, dy, dw, dh;
+ manager->getScreenGeometry(&dx, &dy, &dw, &dh, xiscreen);
+ setWindowGeometry(YRect(dx, dy, dw, dh));
+ }
} else {
if (isRollup()) {
@@ -3435,6 +3453,22 @@ void YFrameWindow::updateNetWMStrut() {
manager->updateWorkArea();
}
}
+
+void YFrameWindow::updateNetWMFullscreenMonitors(int t, int b, int l, int r) {
+ if (t != fFullscreenMonitorsTop ||
+ b != fFullscreenMonitorsBottom ||
+ l != fFullscreenMonitorsLeft ||
+ r != fFullscreenMonitorsRight)
+ {
+ fFullscreenMonitorsTop = t;
+ fFullscreenMonitorsBottom = b;
+ fFullscreenMonitorsLeft = l;
+ fFullscreenMonitorsRight = r;
+ MSG(("fullscreen monitors: %d %d %d %d", t, b, l, r));
+ client()->setNetWMFullscreenMonitors(t, b, l, r);
+ updateLayout();
+ }
+}
#endif
/* Work around for X11R5 and earlier */
diff --git a/icewm-1.2/src/wmframe.h b/icewm-1.2/src/wmframe.h
index 04b6866..a5ad53c 100644
--- a/icewm-1.2/src/wmframe.h
+++ b/icewm-1.2/src/wmframe.h
@@ -413,6 +413,7 @@ public:
#ifdef WMSPEC_HINTS
void updateNetWMStrut();
+ void updateNetWMFullscreenMonitors(int, int, int, int);
#endif
int strutLeft() { return fStrutLeft; }
int strutRight() { return fStrutRight; }
@@ -526,6 +527,11 @@ private:
bool fManaged;
long fWinOptionMask;
long fOldLayer;
+
+ int fFullscreenMonitorsTop;
+ int fFullscreenMonitorsBottom;
+ int fFullscreenMonitorsLeft;
+ int fFullscreenMonitorsRight;
YMsgBox *fKillMsgBox;
diff --git a/icewm-1.2/src/wmmgr.h b/icewm-1.2/src/wmmgr.h
index 700817c..817cc32 100644
--- a/icewm-1.2/src/wmmgr.h
+++ b/icewm-1.2/src/wmmgr.h
@@ -357,6 +357,7 @@ extern Atom _XA_NET_WM_ICON; // TODO
extern Atom _XA_NET_WM_PID; // TODO
extern Atom _XA_NET_WM_HANDLED_ICONS; // TODO -> toggle minimizeToDesktop
extern Atom _XA_NET_WM_PING; // TODO
+extern Atom _XA_NET_WM_FULLSCREEN_MONITORS; // OK
extern Atom _XA_NET_WM_USER_TIME; // TODO
extern Atom _XA_NET_WM_STATE_DEMANDS_ATTENTION; // TODO
diff --git a/icewm-1.2/src/yrect.h b/icewm-1.2/src/yrect.h
index 2b4ad7f..746d6f7 100644
--- a/icewm-1.2/src/yrect.h
+++ b/icewm-1.2/src/yrect.h
@@ -2,6 +2,7 @@
#define __YRECT_H
#include "ypoint.h"
+#include <math.h>
// change this to use x,y,w,h internal representation?
class YRect {
@@ -49,6 +50,19 @@ public:
ww = r.width();
hh = r.height();
}
+
+ // does the same as gdk_rectangle_union
+ void unionRect(int x, int y, int width, int height) {
+ int dest_x, dest_y;
+
+ dest_x = fmin(xx, x);
+ dest_y = fmin(yy, y);
+ ww = fmax(xx + ww, x + width) - dest_x;
+ hh = fmax(yy + hh, y + height) - dest_y;
+ xx = dest_x;
+ yy = dest_y;
+ }
+
//YPoint center() { return YPoint((x1 + x2) / 2,
// (y1 + y2) / 2); }
diff --git a/icewm-1.2/src/yxapp.cc b/icewm-1.2/src/yxapp.cc
index 51c6e5b..f2e22f9 100644
--- a/icewm-1.2/src/yxapp.cc
+++ b/icewm-1.2/src/yxapp.cc
@@ -71,6 +71,7 @@ Atom _XA_NET_CURRENT_DESKTOP;
Atom _XA_NET_WORKAREA;
Atom _XA_NET_WM_MOVERESIZE;
Atom _XA_NET_MOVERESIZE_WINDOW;
+Atom _XA_NET_WM_FULLSCREEN_MONITORS;
Atom _XA_NET_WM_STRUT;
Atom _XA_NET_WM_DESKTOP;
@@ -288,6 +289,7 @@ static void initAtoms() {
{ &_XA_NET_CLIENT_LIST_STACKING, "_NET_CLIENT_LIST_STACKING" },
{ &_XA_NET_NUMBER_OF_DESKTOPS, "_NET_NUMBER_OF_DESKTOPS" },
{ &_XA_NET_DESKTOP_GEOMETRY, "_NET_DESKTOP_GEOMETRY" },
+ { &_XA_NET_WM_FULLSCREEN_MONITORS, "_NET_WM_FULLSCREEN_MONITORS" },
{ &_XA_NET_CURRENT_DESKTOP, "_NET_CURRENT_DESKTOP" },
{ &_XA_NET_WORKAREA, "_NET_WORKAREA" },
{ &_XA_NET_WM_MOVERESIZE, "_NET_WM_MOVERESIZE" },
--=-cMDKFkjzHyeHEezPybqV
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--=-cMDKFkjzHyeHEezPybqV
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Icewm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/icewm-devel
--=-cMDKFkjzHyeHEezPybqV--