Merge lp:~didrocks/unity/desktop_label_fixes into lp:unity

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: 1678
Proposed branch: lp:~didrocks/unity/desktop_label_fixes
Merge into: lp:unity
Diff against target: 85 lines (+32/-2)
3 files modified
plugins/unityshell/src/PanelMenuView.cpp (+1/-2)
plugins/unityshell/src/unityshell.cpp (+26/-0)
plugins/unityshell/src/unityshell.h (+5/-0)
To merge this branch: bzr merge lp:~didrocks/unity/desktop_label_fixes
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+77683@code.launchpad.net

Description of the change

Fixes:
- Focus the desktop when the desktop is mapped and that there is no other window around (focus on startup in particular) (LP: #863037)

- Show the 'Desktop' label when desktop has been focused (LP: #863129)

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

we dont do m prefixing anymore please_use_this_style_ :) (note the trailing backslash)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/PanelMenuView.cpp'
2--- plugins/unityshell/src/PanelMenuView.cpp 2011-09-29 00:14:59 +0000
3+++ plugins/unityshell/src/PanelMenuView.cpp 2011-09-30 10:42:24 +0000
4@@ -660,8 +660,7 @@
5 // Make the special
6 label = g_strdup(g_dgettext("nautilus", "Desktop"));
7 }
8-
9- if (!WindowManager::Default()->IsWindowOnCurrentDesktop(window_xid) ||
10+ else if (!WindowManager::Default()->IsWindowOnCurrentDesktop(window_xid) ||
11 WindowManager::Default()->IsWindowObscured(window_xid))
12 {
13 return g_strdup("");
14
15=== modified file 'plugins/unityshell/src/unityshell.cpp'
16--- plugins/unityshell/src/unityshell.cpp 2011-09-30 04:18:01 +0000
17+++ plugins/unityshell/src/unityshell.cpp 2011-09-30 10:42:24 +0000
18@@ -1640,6 +1640,23 @@
19 return mMinimizeHandler.get () != NULL;
20 }
21
22+gboolean
23+UnityWindow::FocusDesktopTimeout(gpointer data)
24+{
25+ UnityWindow *self = reinterpret_cast<UnityWindow*>(data);
26+
27+ self->mFocusdesktophandle = 0;
28+
29+ for (CompWindow *w : screen->clientList ())
30+ {
31+ if (!(w->type() & NO_FOCUS_MASK) && w->focus ())
32+ return FALSE;
33+ }
34+ self->window->moveInputFocusTo();
35+
36+ return FALSE;
37+}
38+
39 /* Called whenever a window is mapped, unmapped, minimized etc */
40 void UnityWindow::windowNotify(CompWindowNotify n)
41 {
42@@ -1648,6 +1665,11 @@
43 switch (n)
44 {
45 case CompWindowNotifyMap:
46+ if (window->type() == CompWindowTypeDesktopMask) {
47+ if (!mFocusdesktophandle)
48+ mFocusdesktophandle = g_timeout_add (1000, &UnityWindow::FocusDesktopTimeout, this);
49+ }
50+ break;
51 case CompWindowNotifyUnmap:
52 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&
53 window->mapNum ())
54@@ -2358,6 +2380,7 @@
55 , window(window)
56 , gWindow(GLWindow::get(window))
57 , mShowdesktopHandler(nullptr)
58+ , mFocusdesktophandle(0)
59 {
60 WindowInterface::setHandler(window);
61 GLWindowInterface::setHandler(gWindow);
62@@ -2413,6 +2436,9 @@
63 }
64 if (mShowdesktopHandler)
65 delete mShowdesktopHandler;
66+
67+ if (mFocusdesktophandle)
68+ g_source_remove(mFocusdesktophandle);
69
70 if (window->state () & CompWindowStateFullscreenMask)
71 UnityScreen::get (screen)->fullscreen_windows_.remove(window);
72
73=== modified file 'plugins/unityshell/src/unityshell.h'
74--- plugins/unityshell/src/unityshell.h 2011-09-28 20:22:43 +0000
75+++ plugins/unityshell/src/unityshell.h 2011-09-30 10:42:24 +0000
76@@ -392,6 +392,11 @@
77
78 compiz::MinimizedWindowHandler::Ptr mMinimizeHandler;
79 UnityShowdesktopHandler *mShowdesktopHandler;
80+
81+private:
82+
83+ guint mFocusdesktophandle;
84+ static gboolean FocusDesktopTimeout(gpointer data);
85 };
86
87