Merge lp:~alexlauni/unity/window-placement into lp:unity

Proposed by Alex Launi
Status: Merged
Merged at revision: 1048
Proposed branch: lp:~alexlauni/unity/window-placement
Merge into: lp:unity
Diff against target: 56 lines (+27/-1)
2 files modified
src/unityshell.cpp (+24/-0)
src/unityshell.h (+3/-1)
To merge this branch: bzr merge lp:~alexlauni/unity/window-placement
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+55591@code.launchpad.net

Description of the change

Tries to ensure that new windows don't obscure the launcher. Behaves correctly for floating, and maximized windows.

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

This could push a window slightly offscreen. You should ensure the new proposed position + the width of the window does not fall off the right edge of the screen.

review: Needs Fixing
Revision history for this message
Jason Smith (jassmith) wrote :

+1 looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unityshell.cpp'
2--- src/unityshell.cpp 2011-03-30 10:24:53 +0000
3+++ src/unityshell.cpp 2011-03-30 17:04:31 +0000
4@@ -567,6 +567,30 @@
5 window->resizeNotify (x, y, w, h);
6 }
7
8+bool
9+UnityWindow::place (CompPoint &pos)
10+{
11+ UnityScreen *us = UnityScreen::get (screen);
12+ nux::Geometry geo = us->launcher->GetAbsoluteGeometry ();
13+ Launcher::LauncherHideMode hideMode = us->launcher->GetHideMode ();
14+
15+ switch (hideMode)
16+ {
17+ case Launcher::LAUNCHER_HIDE_DODGE_WINDOWS:
18+ case Launcher::LAUNCHER_HIDE_DODGE_ACTIVE_WINDOW:
19+ if (pos.x () <= geo.width && window->width () + geo.width < screen->workArea ().width ())
20+ {
21+ pos.setX (geo.width);
22+ return true;
23+ }
24+ break;
25+ default:
26+ break;
27+ }
28+
29+ return false;
30+}
31+
32 /* Configure callback for the launcher window */
33 void
34 UnityScreen::launcherWindowConfigureCallback(int WindowWidth, int WindowHeight, nux::Geometry& geo, void *user_data)
35
36=== modified file 'src/unityshell.h'
37--- src/unityshell.h 2011-03-30 10:39:59 +0000
38+++ src/unityshell.h 2011-03-30 17:04:31 +0000
39@@ -142,7 +142,7 @@
40
41 void ScheduleRelayout (guint timeout);
42
43- protected:
44+protected:
45
46 const gchar* GetName ();
47
48@@ -255,6 +255,8 @@
49 void resizeNotify (int x, int y, int w, int h);
50
51 void stateChangeNotify (unsigned int lastState);
52+
53+ bool place (CompPoint &pos);
54 };
55
56 #define EX_SCREEN (screen) \