summaryrefslogtreecommitdiff
diff options
authorDidier Roche <didier.roche@canonical.com>2011-04-07 16:11:14 +0200
committerDidier Roche <didier.roche@canonical.com>2011-04-07 16:11:14 +0200
commit646043659bb4cc18fb8820f2b62fce2b83f248de (patch)
treea9aefdcef8a2daa95e0f01936ac29726e5a76f3c
parent7c0271baa196b595bc83a536429e7d7a4073cdb0 (diff)
parentad6cd62d3f0ac20e92f683e14ed5417c11d0260b (diff)
- 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. (bzr r1083)
-rw-r--r--src/Launcher.cpp29
-rw-r--r--src/Launcher.h4
-rw-r--r--src/PluginAdapter.cpp7
-rw-r--r--src/unityshell.cpp8
-rw-r--r--unityshell.xml.in2
5 files changed, 39 insertions, 11 deletions
diff --git a/src/Launcher.cpp b/src/Launcher.cpp
index abaaaf48d..5a7a9eb54 100644
--- a/src/Launcher.cpp
+++ b/src/Launcher.cpp
@@ -381,6 +381,9 @@ Launcher::Launcher (nux::BaseWindow* parent,
_drag_out_id = 0;
_drag_out_delta_x = 0.0f;
+ // FIXME: remove
+ _initial_drag_animation = false;
+
_check_window_over_launcher = true;
_postreveal_mousemove_delta_x = 0;
_postreveal_mousemove_delta_y = 0;
@@ -1322,7 +1325,9 @@ void Launcher::FillRenderArg (LauncherIcon *icon,
icon->SetCenter (nux::Point3 (roundf (center.x), roundf (center.y), roundf (center.z)));
- if (icon == _drag_icon && _drag_window && _drag_window->Animating ())
+ // FIXME: this is a hack, we should have a look why SetAnimationTarget is necessary in SetAnimationTarget
+ // we should ideally just need it at start to set the target
+ if (!_initial_drag_animation && icon == _drag_icon && _drag_window && _drag_window->Animating ())
_drag_window->SetAnimationTarget ((int) center.x, (int) center.y + _parent->GetGeometry ().y);
center.y += (half_size * size_modifier) + spacing; // move to end
@@ -2748,7 +2753,8 @@ gboolean Launcher::StartIconDragTimeout (gpointer data)
self->_icon_under_mouse->MouseLeave.emit ();
self->_icon_under_mouse->_mouse_inside = false;
self->_icon_under_mouse = 0;
- }
+ }
+ self->_initial_drag_animation = true;
self->StartIconDragRequest (self->GetMouseX (), self->GetMouseY ());
}
self->_start_dragicon_handle = 0;
@@ -2765,7 +2771,11 @@ void Launcher::StartIconDragRequest (int x, int y)
{
StartIconDrag (drag_icon);
SetActionState (ACTION_DRAG_ICON);
- UpdateDragWindowPosition (x, y);
+ UpdateDragWindowPosition (drag_icon->GetCenter ().x, drag_icon->GetCenter ().y);
+ if(_initial_drag_animation) {
+ _drag_window->SetAnimationTarget (x, y + _drag_window->GetGeometry ().height/2);
+ _drag_window->StartAnimation ();
+ }
EnsureAnimation ();
}
}
@@ -2882,6 +2892,9 @@ void Launcher::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned lo
void Launcher::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags)
{
SetMousePosition (x, y);
+
+ // FIXME: hack (see SetupRenderArg)
+ _initial_drag_animation = false;
_dnd_delta_y += dy;
_dnd_delta_x += dx;
@@ -3001,9 +3014,10 @@ Launcher::ResetRepeatShorcutTimeout (gpointer data)
}
gboolean
-Launcher::CheckSuperShortcutPressed (unsigned int key_sym,
+Launcher::CheckSuperShortcutPressed (unsigned int key_sym,
unsigned long key_code,
- unsigned long key_state)
+ unsigned long key_state,
+ char* key_string)
{
if (!_super_pressed)
return false;
@@ -3013,8 +3027,9 @@ Launcher::CheckSuperShortcutPressed (unsigned int key_sym,
// Shortcut to start launcher icons. Only relies on Keycode, ignore modifier
for (it = _model->begin (); it != _model->end (); it++)
{
- if (XKeysymToKeycode (screen->dpy (), (*it)->GetShortcut ()) == key_code)
- {
+ if ((XKeysymToKeycode (screen->dpy (), (*it)->GetShortcut ()) == key_code) ||
+ ((gchar)((*it)->GetShortcut ()) == key_string[0]))
+ {
/*
* start a timeout while repressing the same shortcut will be ignored.
* This is because the keypress repeat is handled by Xorg and we have no
diff --git a/src/Launcher.h b/src/Launcher.h
index c17a60c4b..68509c6be 100644
--- a/src/Launcher.h
+++ b/src/Launcher.h
@@ -138,7 +138,7 @@ public:
void SetAutoHideAnimation (AutoHideAnimation animation);
AutoHideAnimation GetAutoHideAnimation ();
- gboolean CheckSuperShortcutPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state);
+ gboolean CheckSuperShortcutPressed (unsigned int key_sym, unsigned long key_code, unsigned long key_state, char* key_string);
nux::BaseWindow* GetParent () { return _parent; };
@@ -519,6 +519,8 @@ private:
gpointer user_data);
struct timespec _times[TIME_LAST];
+
+ bool _initial_drag_animation;
sigc::connection _set_hidden_connection;
sigc::connection _set_hover_connection;
diff --git a/src/PluginAdapter.cpp b/src/PluginAdapter.cpp
index 40e5a784b..38c2d2718 100644
--- a/src/PluginAdapter.cpp
+++ b/src/PluginAdapter.cpp
@@ -284,6 +284,13 @@ PluginAdapter::InitiateScale (std::string *match, int state)
{
if (std::find (m_SpreadedWindows.begin (), m_SpreadedWindows.end (), w->id ()) == m_SpreadedWindows.end ())
m_SpreadedWindows.push_back (w->id ());
+ /* FIXME:
+ just unminimize minimized window for now, don't minimize them after the scale if not picked as TerminateScale is only
+ called if you click on the launcher, not on any icon. More generally, we should hook up InitiateScale and TerminateScale
+ to a Scale plugin signal as the shortcut will have a different behaviour then.
+ */
+ if (w->minimized ())
+ w->unminimize ();
xids.push_back (w->id ());
}
}
diff --git a/src/unityshell.cpp b/src/unityshell.cpp
index 0f39c6d60..25b9628ff 100644
--- a/src/unityshell.cpp
+++ b/src/unityshell.cpp
@@ -256,8 +256,12 @@ UnityScreen::handleEvent (XEvent *event)
break;
case KeyPress:
KeySym key_sym;
- if (XLookupString (&(event->xkey), NULL, 0, &key_sym, 0) > 0)
- skip_other_plugins = launcher->CheckSuperShortcutPressed (key_sym, event->xkey.keycode, event->xkey.state);
+ char key_string[2];
+ int result;
+ if ((result = XLookupString (&(event->xkey), key_string, 2, &key_sym, 0)) > 0) {
+ key_string[result] = 0;
+ skip_other_plugins = launcher->CheckSuperShortcutPressed (key_sym, event->xkey.keycode, event->xkey.state, key_string);
+ }
break;
}
diff --git a/unityshell.xml.in b/unityshell.xml.in
index e46466f97..86838fe09 100644
--- a/unityshell.xml.in
+++ b/unityshell.xml.in
@@ -33,7 +33,7 @@
</relation>
<requirement>
<plugin>opengl</plugin>
- <plugin>wall</plugin>
+ <feature>largedesktop</feature>
</requirement>
</deps>
<options>