Merge lp:~didrocks/unity/misc-launcher-fixes-070411 into lp:unity

Proposed by Didier Roche
Status: Merged
Approved by: Neil J. Patel
Approved revision: 1081
Merged at revision: 1083
Proposed branch: lp:~didrocks/unity/misc-launcher-fixes-070411
Merge into: lp:unity
Diff against target: 154 lines (+39/-11)
5 files modified
src/Launcher.cpp (+22/-7)
src/Launcher.h (+3/-1)
src/PluginAdapter.cpp (+7/-0)
src/unityshell.cpp (+6/-2)
unityshell.xml.in (+1/-1)
To merge this branch: bzr merge lp:~didrocks/unity/misc-launcher-fixes-070411
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+56772@code.launchpad.net

Description of the change

Some additional fixes since yesterday:
- make shortcuts work with fn key and keynum pad (LP: #747153)
- unmimize all for selected apps window on scale. Don't minimize them if not selected after, see FIXME (LP: #750349)
- depends on largedestkop feature (LP: #711561)
- finish the "start drag but press 1s" animation.

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Looks good, approved!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Launcher.cpp'
2--- src/Launcher.cpp 2011-04-06 17:53:41 +0000
3+++ src/Launcher.cpp 2011-04-07 13:52:26 +0000
4@@ -381,6 +381,9 @@
5 _drag_out_id = 0;
6 _drag_out_delta_x = 0.0f;
7
8+ // FIXME: remove
9+ _initial_drag_animation = false;
10+
11 _check_window_over_launcher = true;
12 _postreveal_mousemove_delta_x = 0;
13 _postreveal_mousemove_delta_y = 0;
14@@ -1322,7 +1325,9 @@
15
16 icon->SetCenter (nux::Point3 (roundf (center.x), roundf (center.y), roundf (center.z)));
17
18- if (icon == _drag_icon && _drag_window && _drag_window->Animating ())
19+ // FIXME: this is a hack, we should have a look why SetAnimationTarget is necessary in SetAnimationTarget
20+ // we should ideally just need it at start to set the target
21+ if (!_initial_drag_animation && icon == _drag_icon && _drag_window && _drag_window->Animating ())
22 _drag_window->SetAnimationTarget ((int) center.x, (int) center.y + _parent->GetGeometry ().y);
23
24 center.y += (half_size * size_modifier) + spacing; // move to end
25@@ -2748,7 +2753,8 @@
26 self->_icon_under_mouse->MouseLeave.emit ();
27 self->_icon_under_mouse->_mouse_inside = false;
28 self->_icon_under_mouse = 0;
29- }
30+ }
31+ self->_initial_drag_animation = true;
32 self->StartIconDragRequest (self->GetMouseX (), self->GetMouseY ());
33 }
34 self->_start_dragicon_handle = 0;
35@@ -2765,7 +2771,11 @@
36 {
37 StartIconDrag (drag_icon);
38 SetActionState (ACTION_DRAG_ICON);
39- UpdateDragWindowPosition (x, y);
40+ UpdateDragWindowPosition (drag_icon->GetCenter ().x, drag_icon->GetCenter ().y);
41+ if(_initial_drag_animation) {
42+ _drag_window->SetAnimationTarget (x, y + _drag_window->GetGeometry ().height/2);
43+ _drag_window->StartAnimation ();
44+ }
45 EnsureAnimation ();
46 }
47 }
48@@ -2882,6 +2892,9 @@
49 void Launcher::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
50 {
51 SetMousePosition (x, y);
52+
53+ // FIXME: hack (see SetupRenderArg)
54+ _initial_drag_animation = false;
55
56 _dnd_delta_y += dy;
57 _dnd_delta_x += dx;
58@@ -3001,9 +3014,10 @@
59 }
60
61 gboolean
62-Launcher::CheckSuperShortcutPressed (unsigned int key_sym,
63+Launcher::CheckSuperShortcutPressed (unsigned int key_sym,
64 unsigned long key_code,
65- unsigned long key_state)
66+ unsigned long key_state,
67+ char* key_string)
68 {
69 if (!_super_pressed)
70 return false;
71@@ -3013,8 +3027,9 @@
72 // Shortcut to start launcher icons. Only relies on Keycode, ignore modifier
73 for (it = _model->begin (); it != _model->end (); it++)
74 {
75- if (XKeysymToKeycode (screen->dpy (), (*it)->GetShortcut ()) == key_code)
76- {
77+ if ((XKeysymToKeycode (screen->dpy (), (*it)->GetShortcut ()) == key_code) ||
78+ ((gchar)((*it)->GetShortcut ()) == key_string[0]))
79+ {
80 /*
81 * start a timeout while repressing the same shortcut will be ignored.
82 * This is because the keypress repeat is handled by Xorg and we have no
83
84=== modified file 'src/Launcher.h'
85--- src/Launcher.h 2011-04-05 15:43:59 +0000
86+++ src/Launcher.h 2011-04-07 13:52:26 +0000
87@@ -138,7 +138,7 @@
88 void SetAutoHideAnimation (AutoHideAnimation animation);
89 AutoHideAnimation GetAutoHideAnimation ();
90
91- gboolean CheckSuperShortcutPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
92+ gboolean CheckSuperShortcutPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state, char* key_string);
93
94 nux::BaseWindow* GetParent () { return _parent; };
95
96@@ -519,6 +519,8 @@
97 gpointer user_data);
98
99 struct timespec _times[TIME_LAST];
100+
101+ bool _initial_drag_animation;
102
103 sigc::connection _set_hidden_connection;
104 sigc::connection _set_hover_connection;
105
106=== modified file 'src/PluginAdapter.cpp'
107--- src/PluginAdapter.cpp 2011-04-05 09:28:19 +0000
108+++ src/PluginAdapter.cpp 2011-04-07 13:52:26 +0000
109@@ -284,6 +284,13 @@
110 {
111 if (std::find (m_SpreadedWindows.begin (), m_SpreadedWindows.end (), w->id ()) == m_SpreadedWindows.end ())
112 m_SpreadedWindows.push_back (w->id ());
113+ /* FIXME:
114+ just unminimize minimized window for now, don't minimize them after the scale if not picked as TerminateScale is only
115+ called if you click on the launcher, not on any icon. More generally, we should hook up InitiateScale and TerminateScale
116+ to a Scale plugin signal as the shortcut will have a different behaviour then.
117+ */
118+ if (w->minimized ())
119+ w->unminimize ();
120 xids.push_back (w->id ());
121 }
122 }
123
124=== modified file 'src/unityshell.cpp'
125--- src/unityshell.cpp 2011-04-05 08:55:52 +0000
126+++ src/unityshell.cpp 2011-04-07 13:52:26 +0000
127@@ -256,8 +256,12 @@
128 break;
129 case KeyPress:
130 KeySym key_sym;
131- if (XLookupString (&(event->xkey), NULL, 0, &key_sym, 0) > 0)
132- skip_other_plugins = launcher->CheckSuperShortcutPressed (key_sym, event->xkey.keycode, event->xkey.state);
133+ char key_string[2];
134+ int result;
135+ if ((result = XLookupString (&(event->xkey), key_string, 2, &key_sym, 0)) > 0) {
136+ key_string[result] = 0;
137+ skip_other_plugins = launcher->CheckSuperShortcutPressed (key_sym, event->xkey.keycode, event->xkey.state, key_string);
138+ }
139 break;
140 }
141
142
143=== modified file 'unityshell.xml.in'
144--- unityshell.xml.in 2011-03-30 14:04:40 +0000
145+++ unityshell.xml.in 2011-04-07 13:52:26 +0000
146@@ -33,7 +33,7 @@
147 </relation>
148 <requirement>
149 <plugin>opengl</plugin>
150- <plugin>wall</plugin>
151+ <feature>largedesktop</feature>
152 </requirement>
153 </deps>
154 <options>