Merge lp:~3v1n0/compiz/client-frame-api into lp:compiz/0.9.12

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: 3927
Merged at revision: 3967
Proposed branch: lp:~3v1n0/compiz/client-frame-api
Merge into: lp:compiz/0.9.12
Diff against target: 179 lines (+58/-4)
7 files modified
include/core/abiversion.h (+1/-1)
include/core/atoms.h (+1/-0)
include/core/window.h (+3/-1)
src/atoms.cpp (+4/-2)
src/event.cpp (+6/-0)
src/privatewindow.h (+3/-0)
src/window.cpp (+40/-0)
To merge this branch: bzr merge lp:~3v1n0/compiz/client-frame-api
Reviewer Review Type Date Requested Status
MC Return Approve
Christopher Townsend Approve
Review via email: mp+250015@code.launchpad.net

Commit message

Window: add clientFrame(), to get the client-side decoration extents

This only supports GTK at the moment, but it might be adapted to other toolkits.

To post a comment you must log in.
Revision history for this message
Christopher Townsend (townsend) wrote :

Ok, looks good and build fine.

review: Approve
Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

_GTK_FRAME_EXTENTS should be added to _NET_SUPPORTED. Needed by GTK+ 3.16.

src/screen.cpp:
atoms.push_back (Atoms::frameGtkExtents) in CompScreenImpl::_addSupportedAtoms ().

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

> _GTK_FRAME_EXTENTS should be added to _NET_SUPPORTED. Needed by GTK+ 3.16.
>
> src/screen.cpp:
> atoms.push_back (Atoms::frameGtkExtents) in CompScreenImpl::_addSupportedAtoms
> ().

Well, that's needed only by old versions of Gtk (newer one don't really care about that), and yes, will add it but not yet since we still don't handle this value

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

> > _GTK_FRAME_EXTENTS should be added to _NET_SUPPORTED. Needed by GTK+ 3.16.
> >
> > src/screen.cpp:
> > atoms.push_back (Atoms::frameGtkExtents) in
> CompScreenImpl::_addSupportedAtoms
> > ().
>
> Well, that's needed only by old versions of Gtk (newer one don't really care
> about that), and yes, will add it but not yet since we still don't handle this
> value

I think you are wrong. It is needed by GTK+ 3.16. They reverted / added back check for _GTK_FRAME_EXTENTS:
https://git.gnome.org/browse/gtk+/commit/?id=5ced234144ce63decbf5afc8a3517290b9027018

I was testing compiz / gtk-window-decorator with GTK+ 3.16 and windows are not client-side-decorated - they look like compositing manager is not running.

Revision history for this message
MC Return (mc-return) wrote :

This part LGTM, but additional code will be needed also...
(please see my comments here: https://code.launchpad.net/~albertsmuktupavels/compiz/add-gtk-frame-extents-to-net-supported/+merge/257303 )

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/core/abiversion.h'
2--- include/core/abiversion.h 2014-01-23 16:44:12 +0000
3+++ include/core/abiversion.h 2015-02-17 15:00:18 +0000
4@@ -5,6 +5,6 @@
5 # error Conflicting definitions of CORE_ABIVERSION
6 #endif
7
8-#define CORE_ABIVERSION 20140123
9+#define CORE_ABIVERSION 20150217
10
11 #endif // COMPIZ_ABIVERSION_H
12
13=== modified file 'include/core/atoms.h'
14--- include/core/atoms.h 2012-01-19 17:44:32 +0000
15+++ include/core/atoms.h 2015-02-17 15:00:18 +0000
16@@ -110,6 +110,7 @@
17 extern Atom clientListStacking;
18
19 extern Atom frameExtents;
20+ extern Atom frameGtkExtents;
21 extern Atom frameWindow;
22
23 extern Atom wmState;
24
25=== modified file 'include/core/window.h'
26--- include/core/window.h 2014-03-27 15:09:02 +0000
27+++ include/core/window.h 2015-02-17 15:00:18 +0000
28@@ -217,7 +217,8 @@
29 CompWindowNotifyUnshade,
30 CompWindowNotifyEnterShowDesktopMode,
31 CompWindowNotifyLeaveShowDesktopMode,
32- CompWindowNotifyBeforeMap
33+ CompWindowNotifyBeforeMap,
34+ CompWindowNotifyActions,
35 };
36
37 /**
38@@ -502,6 +503,7 @@
39 const CompWindowExtents & border () const;
40 const CompWindowExtents & input () const;
41 const CompWindowExtents & output () const;
42+ const CompWindowExtents & clientFrame () const;
43
44 // FIXME: This should return a const reference but grid needs fixing...
45 XSizeHints & sizeHints () const;
46
47=== modified file 'src/atoms.cpp'
48--- src/atoms.cpp 2012-01-19 17:44:32 +0000
49+++ src/atoms.cpp 2015-02-17 15:00:18 +0000
50@@ -107,6 +107,7 @@
51 Atom clientListStacking;
52
53 Atom frameExtents;
54+ Atom frameGtkExtents;
55 Atom frameWindow;
56
57 Atom wmState;
58@@ -270,8 +271,9 @@
59 clientListStacking =
60 XInternAtom (dpy, "_NET_CLIENT_LIST_STACKING", 0);
61
62- frameExtents = XInternAtom (dpy, "_NET_FRAME_EXTENTS", 0);
63- frameWindow = XInternAtom (dpy, "_NET_FRAME_WINDOW", 0);
64+ frameExtents = XInternAtom (dpy, "_NET_FRAME_EXTENTS", 0);
65+ frameGtkExtents = XInternAtom (dpy, "_GTK_FRAME_EXTENTS", 0);
66+ frameWindow = XInternAtom (dpy, "_NET_FRAME_WINDOW", 0);
67
68 wmState = XInternAtom (dpy, "WM_STATE", 0);
69 wmChangeState = XInternAtom (dpy, "WM_CHANGE_STATE", 0);
70
71=== modified file 'src/event.cpp'
72--- src/event.cpp 2014-06-06 09:42:16 +0000
73+++ src/event.cpp 2015-02-17 15:00:18 +0000
74@@ -1755,6 +1755,12 @@
75 if (w)
76 w->priv->updateIconGeometry ();
77 }
78+ else if (event->xproperty.atom == Atoms::frameGtkExtents)
79+ {
80+ w = findWindow (event->xproperty.window);
81+ if (w)
82+ w->priv->updateClientFrame ();
83+ }
84 else if (event->xproperty.atom == Atoms::wmStrut ||
85 event->xproperty.atom == Atoms::wmStrutPartial)
86 {
87
88=== modified file 'src/privatewindow.h'
89--- src/privatewindow.h 2014-03-27 15:09:02 +0000
90+++ src/privatewindow.h 2015-02-17 15:00:18 +0000
91@@ -276,6 +276,8 @@
92
93 void updateIconGeometry ();
94
95+ void updateClientFrame ();
96+
97 Window getClientLeader ();
98
99 char * getStartupId ();
100@@ -429,6 +431,7 @@
101 CompWindowExtents lastServerInput;
102 CompWindowExtents border;
103 CompWindowExtents output;
104+ CompWindowExtents clientFrame;
105
106 CompStruts *struts;
107
108
109=== modified file 'src/window.cpp'
110--- src/window.cpp 2014-09-16 19:37:23 +0000
111+++ src/window.cpp 2015-02-17 15:00:18 +0000
112@@ -373,6 +373,38 @@
113 }
114 }
115
116+void
117+PrivateWindow::updateClientFrame ()
118+{
119+ Atom actual;
120+ int format;
121+ unsigned long n, left;
122+ unsigned char *data;
123+
124+ int result = XGetWindowProperty (screen->dpy (), priv->id,
125+ Atoms::frameGtkExtents,
126+ 0L, 65536, False, XA_CARDINAL,
127+ &actual, &format, &n, &left, &data);
128+
129+ if (result == Success && actual == XA_CARDINAL && data)
130+ {
131+ if (n == 4)
132+ {
133+ unsigned long *extents = reinterpret_cast<unsigned long *>(data);
134+ priv->clientFrame.left = extents[0];
135+ priv->clientFrame.right = extents[1];
136+ priv->clientFrame.top = extents[2];
137+ priv->clientFrame.bottom = extents[3];
138+ }
139+
140+ XFree (data);
141+ }
142+ else
143+ {
144+ priv->clientFrame = CompWindowExtents ();
145+ }
146+}
147+
148 Window
149 PrivateWindow::getClientLeaderOfAncestor ()
150 {
151@@ -708,6 +740,7 @@
152 if (actions != priv->actions)
153 {
154 priv->actions = actions;
155+ windowNotify (CompWindowNotifyActions);
156 setWindowActions (screen, actions, priv->id);
157 }
158 }
159@@ -5947,6 +5980,12 @@
160 return priv->output;
161 }
162
163+const CompWindowExtents &
164+CompWindow::clientFrame () const
165+{
166+ return priv->clientFrame;
167+}
168+
169 XSizeHints &
170 CompWindow::sizeHints () const
171 {
172@@ -6205,6 +6244,7 @@
173
174 recalcActions ();
175 priv->updateIconGeometry ();
176+ priv->updateClientFrame ();
177
178 if (priv->shaded)
179 priv->updateFrameWindow ();

Subscribers

People subscribed via source and target branches