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
=== modified file 'decorations/DecoratedWindow.cpp'
--- decorations/DecoratedWindow.cpp 2016-03-08 00:09:32 +0000
+++ decorations/DecoratedWindow.cpp 2016-04-01 00:53:26 +0000
@@ -17,6 +17,9 @@
17 * Authored by: Marco Trevisan <marco.trevisan@canonical.com>17 * Authored by: Marco Trevisan <marco.trevisan@canonical.com>
18 */18 */
1919
20#include <core/atoms.h>
21#include <X11/Xatom.h>
22
20#include "DecorationsPriv.h"23#include "DecorationsPriv.h"
21#include "DecorationsForceQuitDialog.h"24#include "DecorationsForceQuitDialog.h"
22#include "DecorationsEdgeBorders.h"25#include "DecorationsEdgeBorders.h"
@@ -155,13 +158,8 @@
155 win_->setWindowFrameExtents(&empty, &empty);158 win_->setWindowFrameExtents(&empty, &empty);
156}159}
157160
158void Window::Impl::SetupExtents()161void Window::Impl::ComputeBorderExtent(CompWindowExtents& border)
159{162{
160 if (win_->hasUnmapReference())
161 return;
162
163 CompWindowExtents border;
164
165 if (deco_elements_ & cu::DecorationElement::BORDER)163 if (deco_elements_ & cu::DecorationElement::BORDER)
166 {164 {
167 auto const& sb = Style::Get()->Border();165 auto const& sb = Style::Get()->Border();
@@ -170,6 +168,15 @@
170 border.top = cv_->CP(sb.top);168 border.top = cv_->CP(sb.top);
171 border.bottom = cv_->CP(sb.bottom);169 border.bottom = cv_->CP(sb.bottom);
172 }170 }
171}
172
173void Window::Impl::SetupExtents()
174{
175 if (win_->hasUnmapReference())
176 return;
177
178 CompWindowExtents border;
179 ComputeBorderExtent(border);
173180
174 CompWindowExtents input(border);181 CompWindowExtents input(border);
175182
@@ -189,8 +196,19 @@
189void Window::Impl::SendFrameExtents()196void Window::Impl::SendFrameExtents()
190{197{
191 UpdateElements(cu::WindowFilter::UNMAPPED);198 UpdateElements(cu::WindowFilter::UNMAPPED);
192 SetupExtents();199
193 win_->setWindowFrameExtents(&win_->border(), &win_->input());200 CompWindowExtents border;
201 ComputeBorderExtent(border);
202
203 std::vector<unsigned long> extents(4);
204 extents.push_back(border.left);
205 extents.push_back(border.right);
206 extents.push_back(border.top);
207 extents.push_back(border.bottom);
208
209 XChangeProperty(screen->dpy(), win_->id(), Atoms::frameExtents, XA_CARDINAL, 32,
210 PropModeReplace, reinterpret_cast<unsigned char *>(extents.data()),
211 extents.size());
194}212}
195213
196void Window::Impl::UnsetFrame()214void Window::Impl::UnsetFrame()
197215
=== modified file 'decorations/DecorationsPriv.h'
--- decorations/DecorationsPriv.h 2016-03-09 17:28:36 +0000
+++ decorations/DecorationsPriv.h 2016-04-01 00:53:26 +0000
@@ -98,6 +98,7 @@
98private:98private:
99 void UnsetExtents();99 void UnsetExtents();
100 void SetupExtents();100 void SetupExtents();
101 void ComputeBorderExtent(CompWindowExtents &border);
101 void UpdateElements(cu::WindowFilter wf = cu::WindowFilter::NONE);102 void UpdateElements(cu::WindowFilter wf = cu::WindowFilter::NONE);
102 void UpdateClientDecorationsState();103 void UpdateClientDecorationsState();
103 void UpdateMonitor();104 void UpdateMonitor();