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
1=== modified file 'places/app/dashdeclarativeview.cpp'
2--- places/app/dashdeclarativeview.cpp 2011-04-07 11:34:25 +0000
3+++ places/app/dashdeclarativeview.cpp 2011-04-12 17:31:00 +0000
4@@ -52,7 +52,7 @@
5 , m_mode(HiddenMode)
6 , m_expanded(false)
7 {
8- setAttribute(Qt::WA_X11NetWmWindowTypeDock);
9+ setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
10
11 if (QX11Info::isCompositingManagerRunning()) {
12 setAttribute(Qt::WA_TranslucentBackground);
13@@ -84,7 +84,9 @@
14 void
15 DashDeclarativeView::fitToAvailableSpace()
16 {
17- setGeometry(availableGeometry());
18+ QRect rect = availableGeometry();
19+ move(rect.topLeft());
20+ setFixedSize(rect.size());
21 }
22
23 void
24@@ -92,9 +94,12 @@
25 {
26 QRect rect = availableGeometry();
27
28- rect.setWidth(DASH_DESKTOP_WIDTH);
29- rect.setHeight(m_expanded ? DASH_DESKTOP_EXPANDED_HEIGHT : DASH_DESKTOP_COLLAPSED_HEIGHT);
30- setGeometry(rect);
31+ rect.setWidth(qMin(DASH_DESKTOP_WIDTH, rect.width()));
32+ rect.setHeight(qMin(m_expanded ? DASH_DESKTOP_EXPANDED_HEIGHT : DASH_DESKTOP_COLLAPSED_HEIGHT,
33+ rect.height()));
34+
35+ move(rect.topLeft());
36+ setFixedSize(rect.size());
37 }
38
39 void
40@@ -113,6 +118,31 @@
41 }
42
43 void
44+DashDeclarativeView::setWMFlags()
45+{
46+ Display *display = QX11Info::display();
47+ Atom stateAtom = XInternAtom(display, "_NET_WM_STATE", False);
48+ Atom propAtom;
49+
50+ propAtom = XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", False);
51+ XChangeProperty(display, effectiveWinId(), stateAtom,
52+ XA_ATOM, 32, PropModeAppend, (unsigned char *) &propAtom, 1);
53+
54+ propAtom = XInternAtom(display, "_NET_WM_STATE_SKIP_PAGER", False);
55+ XChangeProperty(display, effectiveWinId(), stateAtom,
56+ XA_ATOM, 32, PropModeAppend, (unsigned char *) &propAtom, 1);
57+}
58+
59+void
60+DashDeclarativeView::showEvent(QShowEvent *event)
61+{
62+ QDeclarativeView::showEvent(event);
63+ /* Note that this has to be called everytime the window is shown, as the WM
64+ will remove the flags when the window is hidden */
65+ setWMFlags();
66+}
67+
68+void
69 DashDeclarativeView::setActive(bool value)
70 {
71 if (value != active()) {
72@@ -147,18 +177,10 @@
73 DashDeclarativeView::DashMode oldMode = m_mode;
74 m_mode = mode;
75 if (m_mode == HiddenMode) {
76- /* Before hiding and showing the window it is important to remove and put back
77- the dock flag. This is because we need the window to be a dock to have the
78- WM maintain it on top of all others properly. However metacity has a bug
79- that causes corruption when hiding dock windows in certain conditions.
80- Therefore we remove the flag before hiding, which is enough to fix the
81- metacity issue. */
82- setAttribute(Qt::WA_X11NetWmWindowTypeDock, false);
83 hide();
84 m_launcherClient->endForceVisible();
85 activeChanged(false);
86 } else {
87- setAttribute(Qt::WA_X11NetWmWindowTypeDock, true);
88 show();
89 raise();
90 // We need a delay, otherwise the window may not be visible when we try to activate it
91
92=== modified file 'places/app/dashdeclarativeview.h'
93--- places/app/dashdeclarativeview.h 2011-03-23 11:30:21 +0000
94+++ places/app/dashdeclarativeview.h 2011-04-12 17:31:00 +0000
95@@ -74,6 +74,7 @@
96
97 protected:
98 void resizeEvent(QResizeEvent*);
99+ virtual void showEvent(QShowEvent *event);
100
101 private Q_SLOTS:
102 void onWorkAreaResized(int screen);
103@@ -85,6 +86,7 @@
104 void focusOutEvent(QFocusEvent* event);
105 void keyPressEvent(QKeyEvent* event);
106 void updateMask();
107+ void setWMFlags();
108
109 LauncherClient* m_launcherClient;
110 DashMode m_mode;

Subscribers

People subscribed via source and target branches

to all changes: