Merge lp:~3v1n0/unity/simpler-request-frame-extents into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4098
Proposed branch: lp:~3v1n0/unity/simpler-request-frame-extents
Merge into: lp:unity
Diff against target: 78 lines (+27/-8)
2 files modified
decorations/DecoratedWindow.cpp (+26/-8)
decorations/DecorationsPriv.h (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/simpler-request-frame-extents
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+290670@code.launchpad.net

Commit message

DecoratedWindow: Just send estimated extents on _NET_REQUEST_FRAME_EXTENTS

As per EWMH protocol when _NET_REQUEST_FRAME_EXTENTS we just have to send the
client the estimation of the border. We don't have to set it on window yet.
Let's just implement this by avoiding setting the compiz borders, as this will prevent the window
to be moved to be fully visible once mapped.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'decorations/DecoratedWindow.cpp'
2--- decorations/DecoratedWindow.cpp 2016-03-08 00:09:32 +0000
3+++ decorations/DecoratedWindow.cpp 2016-04-01 00:53:26 +0000
4@@ -17,6 +17,9 @@
5 * Authored by: Marco Trevisan <marco.trevisan@canonical.com>
6 */
7
8+#include <core/atoms.h>
9+#include <X11/Xatom.h>
10+
11 #include "DecorationsPriv.h"
12 #include "DecorationsForceQuitDialog.h"
13 #include "DecorationsEdgeBorders.h"
14@@ -155,13 +158,8 @@
15 win_->setWindowFrameExtents(&empty, &empty);
16 }
17
18-void Window::Impl::SetupExtents()
19+void Window::Impl::ComputeBorderExtent(CompWindowExtents& border)
20 {
21- if (win_->hasUnmapReference())
22- return;
23-
24- CompWindowExtents border;
25-
26 if (deco_elements_ & cu::DecorationElement::BORDER)
27 {
28 auto const& sb = Style::Get()->Border();
29@@ -170,6 +168,15 @@
30 border.top = cv_->CP(sb.top);
31 border.bottom = cv_->CP(sb.bottom);
32 }
33+}
34+
35+void Window::Impl::SetupExtents()
36+{
37+ if (win_->hasUnmapReference())
38+ return;
39+
40+ CompWindowExtents border;
41+ ComputeBorderExtent(border);
42
43 CompWindowExtents input(border);
44
45@@ -189,8 +196,19 @@
46 void Window::Impl::SendFrameExtents()
47 {
48 UpdateElements(cu::WindowFilter::UNMAPPED);
49- SetupExtents();
50- win_->setWindowFrameExtents(&win_->border(), &win_->input());
51+
52+ CompWindowExtents border;
53+ ComputeBorderExtent(border);
54+
55+ std::vector<unsigned long> extents(4);
56+ extents.push_back(border.left);
57+ extents.push_back(border.right);
58+ extents.push_back(border.top);
59+ extents.push_back(border.bottom);
60+
61+ XChangeProperty(screen->dpy(), win_->id(), Atoms::frameExtents, XA_CARDINAL, 32,
62+ PropModeReplace, reinterpret_cast<unsigned char *>(extents.data()),
63+ extents.size());
64 }
65
66 void Window::Impl::UnsetFrame()
67
68=== modified file 'decorations/DecorationsPriv.h'
69--- decorations/DecorationsPriv.h 2016-03-09 17:28:36 +0000
70+++ decorations/DecorationsPriv.h 2016-04-01 00:53:26 +0000
71@@ -98,6 +98,7 @@
72 private:
73 void UnsetExtents();
74 void SetupExtents();
75+ void ComputeBorderExtent(CompWindowExtents &border);
76 void UpdateElements(cu::WindowFilter wf = cu::WindowFilter::NONE);
77 void UpdateClientDecorationsState();
78 void UpdateMonitor();