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
=== modified file 'plugins/unityshell/src/PanelMenuView.cpp'
--- plugins/unityshell/src/PanelMenuView.cpp 2011-09-29 00:14:59 +0000
+++ plugins/unityshell/src/PanelMenuView.cpp 2011-09-30 10:42:24 +0000
@@ -660,8 +660,7 @@
660 // Make the special 660 // Make the special
661 label = g_strdup(g_dgettext("nautilus", "Desktop"));661 label = g_strdup(g_dgettext("nautilus", "Desktop"));
662 }662 }
663663 else if (!WindowManager::Default()->IsWindowOnCurrentDesktop(window_xid) ||
664 if (!WindowManager::Default()->IsWindowOnCurrentDesktop(window_xid) ||
665 WindowManager::Default()->IsWindowObscured(window_xid))664 WindowManager::Default()->IsWindowObscured(window_xid))
666 {665 {
667 return g_strdup("");666 return g_strdup("");
668667
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2011-09-30 04:18:01 +0000
+++ plugins/unityshell/src/unityshell.cpp 2011-09-30 10:42:24 +0000
@@ -1640,6 +1640,23 @@
1640 return mMinimizeHandler.get () != NULL;1640 return mMinimizeHandler.get () != NULL;
1641}1641}
16421642
1643gboolean
1644UnityWindow::FocusDesktopTimeout(gpointer data)
1645{
1646 UnityWindow *self = reinterpret_cast<UnityWindow*>(data);
1647
1648 self->mFocusdesktophandle = 0;
1649
1650 for (CompWindow *w : screen->clientList ())
1651 {
1652 if (!(w->type() & NO_FOCUS_MASK) && w->focus ())
1653 return FALSE;
1654 }
1655 self->window->moveInputFocusTo();
1656
1657 return FALSE;
1658}
1659
1643/* Called whenever a window is mapped, unmapped, minimized etc */1660/* Called whenever a window is mapped, unmapped, minimized etc */
1644void UnityWindow::windowNotify(CompWindowNotify n)1661void UnityWindow::windowNotify(CompWindowNotify n)
1645{1662{
@@ -1648,6 +1665,11 @@
1648 switch (n)1665 switch (n)
1649 {1666 {
1650 case CompWindowNotifyMap:1667 case CompWindowNotifyMap:
1668 if (window->type() == CompWindowTypeDesktopMask) {
1669 if (!mFocusdesktophandle)
1670 mFocusdesktophandle = g_timeout_add (1000, &UnityWindow::FocusDesktopTimeout, this);
1671 }
1672 break;
1651 case CompWindowNotifyUnmap:1673 case CompWindowNotifyUnmap:
1652 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&1674 if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&
1653 window->mapNum ())1675 window->mapNum ())
@@ -2358,6 +2380,7 @@
2358 , window(window)2380 , window(window)
2359 , gWindow(GLWindow::get(window))2381 , gWindow(GLWindow::get(window))
2360 , mShowdesktopHandler(nullptr)2382 , mShowdesktopHandler(nullptr)
2383 , mFocusdesktophandle(0)
2361{2384{
2362 WindowInterface::setHandler(window);2385 WindowInterface::setHandler(window);
2363 GLWindowInterface::setHandler(gWindow);2386 GLWindowInterface::setHandler(gWindow);
@@ -2413,6 +2436,9 @@
2413 }2436 }
2414 if (mShowdesktopHandler)2437 if (mShowdesktopHandler)
2415 delete mShowdesktopHandler;2438 delete mShowdesktopHandler;
2439
2440 if (mFocusdesktophandle)
2441 g_source_remove(mFocusdesktophandle);
24162442
2417 if (window->state () & CompWindowStateFullscreenMask)2443 if (window->state () & CompWindowStateFullscreenMask)
2418 UnityScreen::get (screen)->fullscreen_windows_.remove(window);2444 UnityScreen::get (screen)->fullscreen_windows_.remove(window);
24192445
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2011-09-28 20:22:43 +0000
+++ plugins/unityshell/src/unityshell.h 2011-09-30 10:42:24 +0000
@@ -392,6 +392,11 @@
392392
393 compiz::MinimizedWindowHandler::Ptr mMinimizeHandler;393 compiz::MinimizedWindowHandler::Ptr mMinimizeHandler;
394 UnityShowdesktopHandler *mShowdesktopHandler;394 UnityShowdesktopHandler *mShowdesktopHandler;
395
396private:
397
398 guint mFocusdesktophandle;
399 static gboolean FocusDesktopTimeout(gpointer data);
395};400};
396401
397402