Merge lp:~unity-2d-team/unity-2d/dash-not-dock into lp:unity-2d/3.0

Proposed by Ugo Riboni
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 531
Merged at revision: 530
Proposed branch: lp:~unity-2d-team/unity-2d/dash-not-dock
Merge into: lp:unity-2d/3.0
Diff against target: 110 lines (+37/-13)
2 files modified
places/app/dashdeclarativeview.cpp (+35/-13)
places/app/dashdeclarativeview.h (+2/-0)
To merge this branch: bzr merge lp:~unity-2d-team/unity-2d/dash-not-dock
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
Review via email: mp+57361@code.launchpad.net

Description of the change

[dash] Make the dash a regular window without borders and request the WM not to show it in pagers.
This should hopefully make the situation a bit less confusing for metacity, and the dash-related corruption problems both with and without the metacity compositor active.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

/* Note that this has to be called everytime the window is shown, as the WM
   will to clean the flags when the window is hidden (whitdrawn) */

Grammar and spelling parser choked…

s/will to/will/
s/whitdrawn/withdrawn/

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

- setGeometry(availableGeometry());
+ move(availableGeometry().topLeft());
+ setFixedSize(availableGeometry().size());

You’re calling availableGeometry() twice here, you should call it only once and assign the result to a local variable to re-use in the calls to move(…) and setFixedSize(…).

review: Needs Fixing
531. By Ugo Riboni

Fix some code style, comments and other minor remarks from code review

Revision history for this message
Olivier Tilloy (osomon) wrote :

That works well, both with and without compositing enabled. Good job!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'places/app/dashdeclarativeview.cpp'
--- places/app/dashdeclarativeview.cpp 2011-04-07 11:34:25 +0000
+++ places/app/dashdeclarativeview.cpp 2011-04-12 17:31:00 +0000
@@ -52,7 +52,7 @@
52, m_mode(HiddenMode)52, m_mode(HiddenMode)
53, m_expanded(false)53, m_expanded(false)
54{54{
55 setAttribute(Qt::WA_X11NetWmWindowTypeDock);55 setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
5656
57 if (QX11Info::isCompositingManagerRunning()) {57 if (QX11Info::isCompositingManagerRunning()) {
58 setAttribute(Qt::WA_TranslucentBackground);58 setAttribute(Qt::WA_TranslucentBackground);
@@ -84,7 +84,9 @@
84void84void
85DashDeclarativeView::fitToAvailableSpace()85DashDeclarativeView::fitToAvailableSpace()
86{86{
87 setGeometry(availableGeometry());87 QRect rect = availableGeometry();
88 move(rect.topLeft());
89 setFixedSize(rect.size());
88}90}
8991
90void92void
@@ -92,9 +94,12 @@
92{94{
93 QRect rect = availableGeometry();95 QRect rect = availableGeometry();
9496
95 rect.setWidth(DASH_DESKTOP_WIDTH);97 rect.setWidth(qMin(DASH_DESKTOP_WIDTH, rect.width()));
96 rect.setHeight(m_expanded ? DASH_DESKTOP_EXPANDED_HEIGHT : DASH_DESKTOP_COLLAPSED_HEIGHT);98 rect.setHeight(qMin(m_expanded ? DASH_DESKTOP_EXPANDED_HEIGHT : DASH_DESKTOP_COLLAPSED_HEIGHT,
97 setGeometry(rect);99 rect.height()));
100
101 move(rect.topLeft());
102 setFixedSize(rect.size());
98}103}
99104
100void105void
@@ -113,6 +118,31 @@
113}118}
114119
115void120void
121DashDeclarativeView::setWMFlags()
122{
123 Display *display = QX11Info::display();
124 Atom stateAtom = XInternAtom(display, "_NET_WM_STATE", False);
125 Atom propAtom;
126
127 propAtom = XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", False);
128 XChangeProperty(display, effectiveWinId(), stateAtom,
129 XA_ATOM, 32, PropModeAppend, (unsigned char *) &propAtom, 1);
130
131 propAtom = XInternAtom(display, "_NET_WM_STATE_SKIP_PAGER", False);
132 XChangeProperty(display, effectiveWinId(), stateAtom,
133 XA_ATOM, 32, PropModeAppend, (unsigned char *) &propAtom, 1);
134}
135
136void
137DashDeclarativeView::showEvent(QShowEvent *event)
138{
139 QDeclarativeView::showEvent(event);
140 /* Note that this has to be called everytime the window is shown, as the WM
141 will remove the flags when the window is hidden */
142 setWMFlags();
143}
144
145void
116DashDeclarativeView::setActive(bool value)146DashDeclarativeView::setActive(bool value)
117{147{
118 if (value != active()) {148 if (value != active()) {
@@ -147,18 +177,10 @@
147 DashDeclarativeView::DashMode oldMode = m_mode;177 DashDeclarativeView::DashMode oldMode = m_mode;
148 m_mode = mode;178 m_mode = mode;
149 if (m_mode == HiddenMode) {179 if (m_mode == HiddenMode) {
150 /* Before hiding and showing the window it is important to remove and put back
151 the dock flag. This is because we need the window to be a dock to have the
152 WM maintain it on top of all others properly. However metacity has a bug
153 that causes corruption when hiding dock windows in certain conditions.
154 Therefore we remove the flag before hiding, which is enough to fix the
155 metacity issue. */
156 setAttribute(Qt::WA_X11NetWmWindowTypeDock, false);
157 hide();180 hide();
158 m_launcherClient->endForceVisible();181 m_launcherClient->endForceVisible();
159 activeChanged(false);182 activeChanged(false);
160 } else {183 } else {
161 setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);
162 show();184 show();
163 raise();185 raise();
164 // We need a delay, otherwise the window may not be visible when we try to activate it186 // We need a delay, otherwise the window may not be visible when we try to activate it
165187
=== modified file 'places/app/dashdeclarativeview.h'
--- places/app/dashdeclarativeview.h 2011-03-23 11:30:21 +0000
+++ places/app/dashdeclarativeview.h 2011-04-12 17:31:00 +0000
@@ -74,6 +74,7 @@
7474
75protected:75protected:
76 void resizeEvent(QResizeEvent*);76 void resizeEvent(QResizeEvent*);
77 virtual void showEvent(QShowEvent *event);
7778
78private Q_SLOTS:79private Q_SLOTS:
79 void onWorkAreaResized(int screen);80 void onWorkAreaResized(int screen);
@@ -85,6 +86,7 @@
85 void focusOutEvent(QFocusEvent* event);86 void focusOutEvent(QFocusEvent* event);
86 void keyPressEvent(QKeyEvent* event);87 void keyPressEvent(QKeyEvent* event);
87 void updateMask();88 void updateMask();
89 void setWMFlags();
8890
89 LauncherClient* m_launcherClient;91 LauncherClient* m_launcherClient;
90 DashMode m_mode;92 DashMode m_mode;

Subscribers

People subscribed via source and target branches

to all changes: