summaryrefslogtreecommitdiff
diff options
-rw-r--r--AUTHORS9
-rw-r--r--CMakeLists.txt4
-rw-r--r--ChangeLog2182
-rw-r--r--manual-tests/Dash.txt16
-rw-r--r--manual-tests/Launcher.txt15
-rw-r--r--manual-tests/Menus.txt10
-rw-r--r--plugins/unity-mt-grab-handles/CMakeLists.txt2
-rw-r--r--plugins/unityshell/src/AbstractIconRenderer.h3
-rw-r--r--plugins/unityshell/src/AbstractLauncherIcon.h51
-rw-r--r--plugins/unityshell/src/BFBLauncherIcon.cpp6
-rw-r--r--plugins/unityshell/src/BFBLauncherIcon.h2
-rw-r--r--plugins/unityshell/src/BamfLauncherIcon.cpp1126
-rw-r--r--plugins/unityshell/src/BamfLauncherIcon.h134
-rw-r--r--plugins/unityshell/src/DashController.cpp11
-rw-r--r--plugins/unityshell/src/DashSearchBar.cpp2
-rw-r--r--plugins/unityshell/src/DashSettings.cpp2
-rw-r--r--plugins/unityshell/src/DashView.cpp6
-rw-r--r--plugins/unityshell/src/DashView.h1
-rw-r--r--plugins/unityshell/src/Decaymulator.cpp58
-rw-r--r--plugins/unityshell/src/Decaymulator.h51
-rw-r--r--plugins/unityshell/src/DesktopLauncherIcon.cpp6
-rw-r--r--plugins/unityshell/src/DesktopLauncherIcon.h9
-rw-r--r--plugins/unityshell/src/DeviceLauncherIcon.cpp4
-rw-r--r--plugins/unityshell/src/DeviceLauncherIcon.h2
-rw-r--r--plugins/unityshell/src/DeviceLauncherSection.cpp9
-rw-r--r--plugins/unityshell/src/DeviceLauncherSection.h3
-rw-r--r--plugins/unityshell/src/FilterBasicButton.cpp16
-rw-r--r--plugins/unityshell/src/FilterBasicButton.h1
-rw-r--r--plugins/unityshell/src/FilterExpanderLabel.cpp4
-rw-r--r--plugins/unityshell/src/FilterMultiRangeButton.cpp2
-rw-r--r--plugins/unityshell/src/FilterRatingsButton.cpp1
-rw-r--r--plugins/unityshell/src/FilterWidget.cpp1
-rw-r--r--plugins/unityshell/src/IconRenderer.cpp58
-rw-r--r--plugins/unityshell/src/IconRenderer.h2
-rw-r--r--plugins/unityshell/src/Introspectable.cpp2
-rw-r--r--plugins/unityshell/src/Introspectable.h6
-rw-r--r--plugins/unityshell/src/Launcher.cpp1321
-rw-r--r--plugins/unityshell/src/Launcher.h259
-rw-r--r--plugins/unityshell/src/LauncherController.cpp675
-rw-r--r--plugins/unityshell/src/LauncherController.h37
-rw-r--r--plugins/unityshell/src/LauncherHideMachine.cpp60
-rw-r--r--plugins/unityshell/src/LauncherHideMachine.h25
-rw-r--r--plugins/unityshell/src/LauncherIcon.cpp201
-rw-r--r--plugins/unityshell/src/LauncherIcon.h105
-rw-r--r--plugins/unityshell/src/LauncherModel.cpp135
-rw-r--r--plugins/unityshell/src/LauncherModel.h45
-rw-r--r--plugins/unityshell/src/LauncherOptions.cpp62
-rw-r--r--plugins/unityshell/src/LauncherOptions.h102
-rw-r--r--plugins/unityshell/src/LensBarIcon.cpp2
-rw-r--r--plugins/unityshell/src/MockLauncherIcon.h71
-rw-r--r--plugins/unityshell/src/OverlayRenderer.cpp8
-rw-r--r--plugins/unityshell/src/OverlayRenderer.h3
-rw-r--r--plugins/unityshell/src/PanelController.cpp32
-rw-r--r--plugins/unityshell/src/PanelController.h6
-rw-r--r--plugins/unityshell/src/PanelIndicatorsView.cpp5
-rw-r--r--plugins/unityshell/src/PanelIndicatorsView.h1
-rw-r--r--plugins/unityshell/src/PanelMenuView.cpp4
-rw-r--r--plugins/unityshell/src/PanelView.cpp17
-rw-r--r--plugins/unityshell/src/PanelView.h1
-rw-r--r--plugins/unityshell/src/PlacesSimpleTile.cpp6
-rw-r--r--plugins/unityshell/src/PlacesSimpleTile.h1
-rw-r--r--plugins/unityshell/src/PluginAdapter.cpp19
-rw-r--r--plugins/unityshell/src/PluginAdapter.h2
-rw-r--r--plugins/unityshell/src/PointerBarrier.cpp165
-rw-r--r--plugins/unityshell/src/PointerBarrier.h91
-rw-r--r--plugins/unityshell/src/ShortcutController.cpp14
-rw-r--r--plugins/unityshell/src/ShortcutView.cpp200
-rw-r--r--plugins/unityshell/src/ShortcutView.h25
-rw-r--r--plugins/unityshell/src/SimpleLauncherIcon.cpp20
-rw-r--r--plugins/unityshell/src/SimpleLauncherIcon.h12
-rw-r--r--plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp96
-rw-r--r--plugins/unityshell/src/SoftwareCenterLauncherIcon.h32
-rw-r--r--plugins/unityshell/src/SpacerLauncherIcon.cpp4
-rw-r--r--plugins/unityshell/src/SpacerLauncherIcon.h2
-rw-r--r--plugins/unityshell/src/SwitcherController.cpp26
-rw-r--r--plugins/unityshell/src/SwitcherController.h3
-rw-r--r--plugins/unityshell/src/SwitcherModel.cpp2
-rw-r--r--plugins/unityshell/src/SwitcherView.cpp208
-rw-r--r--plugins/unityshell/src/SwitcherView.h26
-rw-r--r--plugins/unityshell/src/TimeUtil.h43
-rw-r--r--plugins/unityshell/src/TrashLauncherIcon.cpp4
-rw-r--r--plugins/unityshell/src/TrashLauncherIcon.h2
-rw-r--r--plugins/unityshell/src/UBusMessages.h8
-rw-r--r--plugins/unityshell/src/UScreen.cpp18
-rw-r--r--plugins/unityshell/src/UScreen.h1
-rw-r--r--plugins/unityshell/src/UnityWindowStyle.cpp64
-rw-r--r--plugins/unityshell/src/UnityWindowStyle.h54
-rw-r--r--plugins/unityshell/src/UnityWindowView.cpp222
-rw-r--r--plugins/unityshell/src/UnityWindowView.h65
-rw-r--r--plugins/unityshell/src/WindowButtons.cpp36
-rw-r--r--plugins/unityshell/src/WindowManager.cpp2
-rw-r--r--plugins/unityshell/src/WindowManager.h2
-rw-r--r--plugins/unityshell/src/unity-launcher-accessible.cpp22
-rw-r--r--plugins/unityshell/src/unity-switcher-accessible.cpp4
-rw-r--r--plugins/unityshell/src/unitya11ytests.cpp2
-rw-r--r--plugins/unityshell/src/unityshell.cpp390
-rw-r--r--plugins/unityshell/src/unityshell.h11
-rw-r--r--plugins/unityshell/unityshell.xml.in54
-rw-r--r--services/CMakeLists.txt2
-rw-r--r--services/panel-service.c40
-rw-r--r--tests/CMakeLists.txt3
-rw-r--r--tests/autopilot/autopilot/emulators/X11.py86
-rw-r--r--tests/autopilot/autopilot/emulators/unity.py120
-rw-r--r--tests/autopilot/autopilot/tests/test_launcher.py110
-rw-r--r--tests/test_launcher_model.cpp216
105 files changed, 6326 insertions, 3203 deletions
diff --git a/AUTHORS b/AUTHORS
index dd8a03d6f..2438e539b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,7 @@
+ 3v1n0 <mail@3v1n0.net>, Marco Trevisan (Treviño) <mail@3v1n0.net>
+ agateau <aurelien.gateau@canonical.com>
Alejandro Piñeiro <apinheiro@igalia.com>
+ Alexandros Frantzis <alexandros.frantzis@linaro.org>, Marc Ordinas i Llopis <marc.ordinasillopis@linaro.org>, Jay Taoko <jay.taoko@canonical.com>
Alex Launi <alex.launi@canonical.com>
Alex Launi <alex.launi@canonical.com>, Allan LeSage <allanlesage@gmail.com>
Andrea Azzarone
@@ -15,6 +18,7 @@
Daniel van Vugt <vanvugt@gmail.com>
David Barth <david.barth@canonical.com>
David Gomes <davidrafagomes@gmail.com>
+ David Planella <david.planella@ubuntu.com>
Didier Roche <didier.roche@canonical.com>
Gordon Allott <gord.allott@canonical.com>
Henri De Veene <henri.deveene@gmail.com>
@@ -22,6 +26,8 @@
Jani Monoses <jani@ubuntu.com>
Jason Conti <jason.conti@gmail.com>
Jason Smith <jason.smith@canonical.com>
+ Jason Smith <jason.smith@canonical.com>, Marco Trevisan (Treviño) <mail@3v1n0.net>, Thomi Richards <thomi.richards@canonical.com>
+ Jason Smith <jason.smith@canonical.com>, smspillaz <sam.spilsbury@canonical.com>
jassmith@gmail.com
Jay Ó Broin <ismise@lavabit.com>
Jay Taoko <jay.taoko@canonical.com>
@@ -31,6 +37,7 @@
Marco Trevisan
Marco Trevisan <mail@3v1n0.net>
Marco Trevisan (Treviño) <mail@3v1n0.net>
+ Marco Trevisan (Treviño) <mail@3v1n0.net>, 3v1n0 <mail@3v1n0.net>
Marius Gedminas <marius@gedmin.as>
Michael Terry <michael.terry@canonical.com>
Michael Terry <mike@mterry.name>
@@ -50,11 +57,13 @@
Sam Spilsbury <sam.spilsbury@canonical.com>
Sam Spilsbury <sam.spilsbury@canonical.com>, Daniel van Vugt <vanvugt@gmail.com>
Sebastien Bacher <seb128@ubuntu.com>
+ smspillaz <sam.spilsbury@canonical.com>, Sam Spilsbury <sam.spilsbury@canonical.com>
Tarmac
Ted Gould <ted@gould.cx>
Thomas Voß <thomas.voss@rub.de>
Thomi Richards <thomir@gmail.com>
Thomi Richards <thomir@gmail.com>, Alex Launi <alex.launi@canonical.com>
+ Thomi Richards <thomir@gmail.com>, Thomi Richards <thomi.richards@canonical.com>
Tim Penhey <tim.penhey@canonical.com>
Ubuntu <ubuntu@netbook>
Unity Merger <unity.merger@gmail.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 66c47f12e..14206c816 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ include (cmake/Documentation.cmake)
#
set (PROJECT_NAME "unity")
set (UNITY_MAJOR 5)
-set (UNITY_MINOR 0)
+set (UNITY_MINOR 2)
set (UNITY_MICRO 0)
set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}")
set (UNITY_API_VERSION "5.0")
@@ -122,7 +122,7 @@ endif (DISABLE_MAINTAINER_CFLAGS)
#
# Compiz Plugins
#
-set (UNITY_PLUGIN_DEPS "compiz;nux-2.0 >= 2.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4;atk;unity-misc >= 0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0 >= 3.1;sigc++-2.0;json-glib-1.0;libnotify;gnome-desktop-3.0;gdu")
+set (UNITY_PLUGIN_DEPS "compiz;nux-2.0>=2.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4;atk;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;gnome-desktop-3.0;gdu")
add_subdirectory(plugins/unityshell)
add_subdirectory(plugins/gtkloader)
diff --git a/ChangeLog b/ChangeLog
index e4503e1cc..284e94f4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,2185 @@
+2012-02-03 Didier Roche <didier.roche@canonical.com>
+
+ welcome unity 5.2
+
+2012-02-02 Andrea Azzarone <azzaronea@gmail.com>
+
+ Constructs the shortcut view until its first needed. UNBLOCK.. Fixes: . Approved by Jason Smith.
+
+2012-02-02 Andrea Azzarone <azzaronea@gmail.com>
+
+ Constructs the shortcut view until its first needed.
+
+2012-02-01 Jason Smith <jason.smith@canonical.com>
+
+ Adds filtering when icon backgrounds are being scaled.
+
+ UNBLOCK - this is a display regression.. Fixes: . Approved by Gord Allott.
+
+2012-02-01 Jason Smith <jason.smith@canonical.com>
+
+ fix square icons at non-default sizes
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ UNBLOCK
+
+ Fixes launcher reveal for some people. Fixes: . Approved by Robert Carr, Gord Allott.
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ adjust algo some more
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ tweak algo
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ implement responsiveness as a conglomerate option for changing reveal behavior
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ initialize variable
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ ooops
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ don't ever release barriers on left edge of X screen
+
+2012-01-31 Jason Smith <jason.smith@canonical.com>
+
+ dont emit on event_id change as there are some bugs in the protocol still
+
+2012-01-31 Andrea Azzarone <azzaronea@gmail.com>
+
+ Make sure that the dash searchbar doesn't lose the focus when clicking on an empty dash area (or an area that should not get the focus on mouse down).
+
+ SetAccepetKeyNavFocus is already tested in trunk.
+
+ UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/919567, https://bugs.launchpad.net/bugs/923988. Approved by Mikkel Kamstrup Erlandsen.
+
+2012-01-31 Andrea Azzarone <azzaronea@gmail.com>
+
+ Updates the manual test.
+
+2012-01-30 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes bug #923988.
+
+2012-01-27 Andrea Azzarone <azzaronea@gmail.com>
+
+ Adds a manutal test.
+
+2012-01-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Clicking on an empty areas makes the dash search bar lose focus.
+
+2012-01-31 Gord Allott <gord.allott@canonical.com>
+
+ adds definition to the launcher manual test
+ UNBLOCK. Fixes: . Approved by Didier Roche.
+
+2012-01-31 Gord Allott <gord.allott@canonical.com>
+
+ added definition to the launcher manual-test
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ UNBLOCK
+
+ (as didrocks requested)
+
+ This branch implements different defaults for the edge reveal as well as capping velocities at 600 to help slower devices.. Fixes: . Approved by Thomi Richards.
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ make sure test passes every time
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ fix autopilot tests
+ add test to ensure launcher doesn't hide after mouse reveal
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ fix defaults
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ update defaults
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ increase smoothing a bit
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ cap max velocity
+
+2012-01-30 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Making the panel service to attach its menus to a MenuBar to make the new lp:light-themes to correctly draw them.
+
+ Now we use a menubar child of an offscreen window to attach the menus to. So Cimi can recognize them and make them pink! :D
+
+ UNBLOCK. Fixes: . Approved by Andrea Cimitan.
+
+2012-01-30 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Added manual test.
+
+2012-01-30 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelService: go back to use gtk_window_set_attached_to
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelService: we don't need anymore gtk+-3.0 3.3...
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelService: Moving to gtk_menu_attach_to_widget
+
+ It doesn't need to get the indicator toplevel window, and is here since long time
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelService: add created menus to a menubar, to fix styling
+
+ Idea by Cimi.
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ UNBLOCK
+
+ Creates test for situation where mouse is under launcher, and the user presses and releases super. The launcher should hide again after all is done.. Fixes: . Approved by Neil J. Patel.
+
+2012-01-30 Jason Smith <jason.smith@canonical.com>
+
+ add autopilot test for launcher hide after super keypress
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ Colorifies icons as per design spec. Fixes: . Approved by .
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ implement colorify filtering on desaturated icons to match design goals
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ . Fixes: . Approved by Thomi Richards.
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ whitespace fixes
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ get monitor properly
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ add monitor to Launcher introspection
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ fix some whitespace issues and fix spurious ranging
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ add comment to test
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ improve quicklist testing
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ make reveal test check every launcher
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ restore reveal test
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ This branch implements the following behaviors into Unity:
+
+ - Multiple launchers per monitor
+ - Dash follows mouse
+ - Keybindings follow mouse
+ - Focus and raising windows is monitor aware
+ - Launchers are monitor and workspace aware. Fixes: . Approved by Thomi Richards, Marco Trevisan (Treviño).
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ merge multi-screen work for autopilot
+
+2012-01-30 Thomi Richards <thomi.richards@canonical.com>
+
+ Screen Geometry class added to X11.py
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ fix sort test
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ fix test formatting
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ make SwitcherView and ShortcutView use the same code to render their backgrounds
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ hide shortcuts when entering key nav mode
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ add test for quicklist open/close in launcher switcher
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ make window placement algorithm aware of all launchers
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ add autopilot tests for launcher keybinding interactions
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ restore functionality so key-nav continues after closing a quicklist in alt+f1
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ fix potential crash whel Alt+F1 is used and last_monitor is not set
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ use nullptr
+
+2012-01-29 Jason Smith <jason.smith@canonical.com>
+
+ more consting
+
+2012-01-28 Jason Smith <jason.smith@canonical.com>
+
+ more const's
+
+2012-01-28 Jason Smith <jason.smith@canonical.com>
+
+ begin const-ification of launcher and its fellow classes
+
+2012-01-28 Jason Smith <jason.smith@canonical.com>
+
+ remove unused code
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ prepare for doing some sort of progress indication
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityScreen: reimplementing some lost features to disable the switcher on key / button press.
+
+ And also to avoid to send the cancel event if not requested.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Opps. damned bzr: removing duplicated values.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merging with upstream.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merging with jason changes
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ merge trunk
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherController: don't show the shortcuts if the key_nav is active.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Go back to use TYPE_BEGIN for the DesktopLauncherIcon or it will mess around with the switcher.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ AbstractLauncherIcon: reducing the priority of the desktop icon on switcher.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityScreen: Don't show the switcher if the desktop icon is the only available.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ DesktopLauncherIcon: don't set as running.
+
+ This fix the issue that was causing an arrow indicator to show next to it.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ SwitcherView: add monitor property and use it to get the number of windows indicators to draw
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ BamfLauncherIcon: don't return window invisible windows on WindowsForMonitor
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ BamfLauncherIcon: WindowsForMonitor should take care of the viewport too.
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ Also render sheen properly for rows
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ properly calculate current monitor
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ make overlay sheen render properly in multi-monitor
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ make sure right panel goes transparent
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ ensure proper monitor gets used
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ fix issue where tooltip would pop up even when mouse wasn't over launcher
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ apply smoothing to raw pointer barrier events
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ monitor aware focus behavior
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ enable Super+Esc
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ enable looping around of super+tab and make sure that icons are always visible
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ remove dead code
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ make sure icons redraw when selection changes
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ merge trunk
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ make dash move around with mouse
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ restore feature parity with trunk, but now with MM support
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ restore alt-f1 functionality
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ restore activation with keyboard
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ restore shortcut drawing
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ remove cruft
+
+2012-01-26 Jason Smith <jason.smith@canonical.com>
+
+ start responding to Super keybindings again
+
+2012-01-25 Jason Smith <jason.smith@canonical.com>
+
+ Add decaymulator
+
+2012-01-25 Jason Smith <jason.smith@canonical.com>
+
+ merge trunk and make options configurable
+
+2012-01-25 Jason Smith <jason.smith@canonical.com>
+
+ start work to match upstream changes to pointer barrier work
+
+2012-01-24 Jason Smith <jason.smith@canonical.com>
+
+ start work of porting keynav to multi-monitor world
+
+2012-01-24 Jason Smith <jason.smith@canonical.com>
+
+ make sure we destroy launchers when we no longer need them
+
+2012-01-24 Jason Smith <jason.smith@canonical.com>
+
+ add launcher model tests
+
+2012-01-24 Jason Smith <jason.smith@canonical.com>
+
+ make alt-tab properly select based on viewport
+
+2012-01-24 Jason Smith <jason.smith@canonical.com>
+
+ fix issue where show desktop didn't show up when the switcehr is biased
+
+2012-01-24 Jason Smith <jason.smith@canonical.com>
+
+ add missing files
+
+2012-01-24 Jason Smith <jason.smith@canonical.com>
+
+ merge trunk
+
+2012-01-23 Jason Smith <jason.smith@canonical.com>
+
+ start tweaking in velocity (waiting for upstream changes to finalize)
+
+2012-01-20 Jason Smith <jason.smith@canonical.com>
+
+ add autohide support to multi-monitor setups
+
+2012-01-18 Jason Smith <jason.smith@canonical.com>
+
+ merge trunk
+
+2012-01-17 Jason Smith <jason.smith@canonical.com>
+
+ port Launcher to AbstractLauncherIcon
+
+2012-01-17 Jason Smith <jason.smith@canonical.com>
+
+ make sure we resize launchers appropriately when screen layout changes
+
+2012-01-17 Jason Smith <jason.smith@canonical.com>
+
+ merge trunk
+
+2012-01-16 Jason Smith <jason.smith@canonical.com>
+
+ make arrow indicators accurately reflect monitor counts in multi-monitor setups
+
+2012-01-16 Jason Smith <jason.smith@canonical.com>
+
+ first attempt at multi-monitor launcher support
+
+2012-01-29 Thomi Richards <thomir@gmail.com>
+
+ Added the PanelController to the Introspectable tree. This allows us to write AP tests for panel indicators etc.
+
+ Fixed a bug in Introspectable which sometimes caused a crash when Unity shut down, due to the fact that Introspectable was holding stale pointers to parents.. Fixes: . Approved by Jason Smith.
+
+2012-01-30 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed a few things from MP review.
+
+2012-01-20 Thomi Richards <thomir@gmail.com>
+
+ Added a warning to stop people overriding Introspectable::GetChildsName() without cause.
+
+2012-01-20 Thomi Richards <thomir@gmail.com>
+
+ Removed instances where people were overriding the childs name in the introspection tree for no good reason.
+
+2012-01-20 Thomi Richards <thomir@gmail.com>
+
+ Shell now adds panel controller to introspection tree.
+
+2012-01-20 Thomi Richards <thomir@gmail.com>
+
+ PanelController is now an introspectable object.
+
+2012-01-20 Thomi Richards <thomir@gmail.com>
+
+ Fixed a bug that would cause unity to crash sometimes on exit due to Introspectable keeping stale pointers to parents.
+
+2012-01-27 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Improved the Super+Tab switcher making possible to escape from it using the Esc key and making the selection circular.
+
+ This branch mostly fixes bug #919018 and bug #919019 as requested by design on recent updates of the main bug #891620. Fixes: https://bugs.launchpad.net/bugs/891620, https://bugs.launchpad.net/bugs/919018, https://bugs.launchpad.net/bugs/919019. Approved by Sam Spilsbury.
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ manual-tests, SuperTab: added more manual tests for circular switcher and escaping.
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityScreen: ignore the Escape key when looking for shortcuts.
+
+ This also avoids the shortcut-hint to be hidden when pressing Escape
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityScreen: don't consider the Escape key as releasing the Super key
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityScreen: add the EnableCancelAction utility function
+
+ It allows to enable or disable the Escape action.
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityScreen: Cancel the Launcher KeySwitcher on Escape and on ButtonPress
+
+ Also now we actually use the terminate callback fuction.
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Launcher: add KeySwitcherCancel function to terminate the switcher without effects
+
+2012-01-19 3v1n0 <mail@3v1n0.net>
+
+ Launcher: make the Super+Tab circular.
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ Adds a testcase for 922447. Fixes: . Approved by Jason Smith.
+
+2012-01-28 smspillaz <sam.spilsbury@canonical.com>
+
+ Added a case for different monitor layouts
+
+2012-01-27 smspillaz <sam.spilsbury@canonical.com>
+
+ Merge lp:~unity-team/unity/unity.fix-fbo-viewport
+
+2012-01-27 Jason Smith <jason.smith@canonical.com>
+
+ fix viewport calculation
+
+2012-01-27 Michal Hruby <michal.mhr@gmail.com>
+
+ Coalesce results coming from the background icon loader threads, so we don't update the UI after each icon loaded.. Fixes: . Approved by Mirco Müller.
+
+2012-01-26 Michal Hruby <michal.mhr@gmail.com>
+
+ Coalesce results from the IconLoader, so we don't repaint the UI after each result
+
+2012-01-26 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Remaining issues for LP: #863246 (and also LP: #863240) fixed.
+
+ See example screenshots of the after-state here:
+ http://people.canonical.com/~mmueller/fix-863246-863240-1.png
+ http://people.canonical.com/~mmueller/fix-863246-863240-2.png
+ http://people.canonical.com/~mmueller/fix-863246-863240-3.png
+ http://people.canonical.com/~mmueller/fix-863246-863240-4.png
+
+ Alignments, margins, colors, opacities, artwork fixed for buttons, separators, outlines, text and expander-arrows.
+
+ One glitch remaining is the separator-rendering being too thick/missing occasionally (on some systems). A solution for fixing this, is available. It's reverted in this branch, as some blending issues with this remain. But that can be added afterwards, to avoid all the other fixes being blocked on just that.. Fixes: https://bugs.launchpad.net/bugs/863246. Appoved by Andrea Azzarone, Andrea Cimitan.
+
+2012-01-26 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Use unnamed namespace instead of static variable declaration
+
+2012-01-26 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Tweak the outline-opacity as per request, make sure the top/bottom-padding for the ratings-widget is 12px also
+
+2012-01-26 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Remove the layout debug-rects
+
+2012-01-26 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Revert the separator-drawing to the Draw2DLine approach for now, make sure the filter-results text is the same size as the filter-genre caption-text
+
+2012-01-25 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Don't forget about the removal of the separator when getting rid of a filter
+
+2012-01-25 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Use a TextureArea as part of the filter-layout for drawing the separators between filter-categories
+
+2012-01-23 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Replace text-based expander-arrow with correct image-file based artwork from Design, tweak outline highlight-opacity for selected buttons
+
+2012-01-23 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Fix right edge alignment for all-, toggle- and multirange-buttons.
+
+2012-01-23 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Padding gap between adjacent filter-categories is always 12px now thus complying with the Design
+
+2012-01-23 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Fix vertical padding to be 12px between All-button and previous separator line
+
+2012-01-23 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Fix vertical padding to be 12px between All-button and first button of filters
+
+2012-01-23 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Fix position of filter-expander heading, solve issue with trailing separators in filters
+
+2012-01-20 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ fixed all-button size, disabled debug-rects for the moment
+
+2012-01-19 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Add colored debug-rectangles, remove drawing of trailing separator lines
+
+2012-01-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add FavoriteStore external change support.. Fixes: https://bugs.launchpad.net/bugs/681503. Appoved by Mirco Müller.
+
+2012-01-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Don't pessimize prematurely.
+
+2012-01-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-01-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix.
+
+2012-01-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-01-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-01-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix corner case.
+
+2012-01-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Ops.
+
+2012-01-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add signals tests.
+
+2012-01-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Clean up.
+
+2012-01-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add FavoriteStore external change support.
+
+2012-01-06 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-01-06 Andrea Azzarone <azzaronea@gmail.com>
+
+ First step to fix bug #681503.
+
+2012-01-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Add support to middle-click pasting on the dash search bar.
+
+ When the XA_PRIMARY clipboard has some content, that is pasted by middle click over the dash search bar.
+ This is for consistency with the rest of the system.
+
+ I've also added the proper glib::Object support to the class.. Fixes: https://bugs.launchpad.net/bugs/842462. Appoved by Mirco Müller, Andrea Azzarone.
+
+2012-01-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ IMTextEntry: always use glib:: namespace for casting
+
+ To improve read-ability.
+
+2012-01-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ IMTextEntry: some more code cleanup.
+
+2012-01-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ No need to initialize empty glib::Object.
+
+2012-01-05 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ IMTextEntry IM shouldn't be enabled to allow paste-by-middle-click.
+
+2012-01-03 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Dash: added middle-click manual test.
+
+2012-01-03 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ IMTextEntry: don't crash when there's no text to paste.
+
+2012-01-03 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ IMTextEntry: moving to glib::Object
+
+2012-01-03 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ IMTextEntry: add support for middle-click over the dash search bar to paste content.
+
+ When middle-clicking over the dash search bar, the XA_PRIMARY keyboard content is pasted
+ in the search box and the cursor position get updated.
+
+2012-01-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Window auto-maximise functionality should be disabled on monitors with a resolution above 1024 x 600.. Fixes: https://bugs.launchpad.net/bugs/797808. Appoved by Mirco Müller, Marco Biscaro.
+
+2012-01-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add a manual test.
+
+2012-01-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2012-01-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Disables window auto-maximise functionality if the monitor resolution is greater then 1024x600.
+
+2012-01-26 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Replace the Unity home screen tiles with a "merged lens view" where lenses can contribute any categories they see fit.
+
+ settings: introduced a new gsettings key in the com.canonical.Unity.Dash namespace that controls the order of the results on the home screen. We should consider in a later branch having the sorting logic in FilesystemLenses also use this key (still falling back to alphabetical sorting when nothing is set). It empowers users and OEMs to override the default view on the homescreen by putting custom stuff first.
+
+ libunity-core: Added a HomeLens class that implements Lens and Lenses interfaces. The typical use case is to add a FilesystemLenses to the HomeLens which will make it automatically merge all lenses found on the fs. In testing we implement custom Lenses instances and add those to the HomeLens in stead.
+
+ unityshell: Removed the tiled homescreen and use a bog standard LensView to render the HomeLens in stead. Fixed a bunch of places where we assumed that Lenses' categories were always only appended to. This is no longer true with the HomeLens. Also important: Fix the SetViewType() calling semantics to the lenses when showing/hiding the dash and when switching between the lenses.
+
+ Testing it out:
+ For this branch to work you need also: lp:~kamstrup/unity-lens-applications/home-lenses, lp:~kamstrup/unity-lens-files/home-lenses, and lp:~mhr3/unity-lens-music/home-lenses. Add to that latest bamf. Without these you will not see the correct results.
+
+ To validate the results: Make sure that bringing up the dash resets the search and shows you a default view with exactly 3 categories in this order: Recent Apps, Recent Files, and Downloads. Then do a search and validate that you have exactly 3 categories in this order Applications, Files & Folders, and Music.
+
+ Finally; launch an app that is not a favorite, then bring up the bring up the dash home screen and assert that the running app is *not* in the recent apps category (but showing in the launcher). Then close the app and bring up the dash again. The app should now show under Recent Apps.
+
+ Design review:
+ Home screen without search: https://bugs.launchpad.net/unity/+bug/885738/+attachment/2690636/+files/unity-home-lens-design-review-1.png
+ Home screen with search: https://bugs.launchpad.net/unity/+bug/885738/+attachment/2690639/+files/unity-home-lens-design-review-2.png. Fixes: https://bugs.launchpad.net/bugs/885738, https://bugs.launchpad.net/bugs/914759. Appoved by Michal Hruby.
+
+2012-01-26 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Sync with trunk
+
+2012-01-26 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Use glib::String to simplify mem management in HomeLens
+
+2012-01-26 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add automatic std::string conversion to glib::String
+
+2012-01-25 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Clear search entry when Esc is pressed - and close it if we have no search string.
+
+2012-01-24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Implement search state retention policy for the home lens as specified in https://bugs.launchpad.net/unity/+bug/914759
+
+2012-01-24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Re-add unity.pot. It seems to have been removed by some freak accident in r1832 of this branch
+
+2012-01-24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Sync with trunk
+
+2012-01-24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Remove PlacesHomeView.cpp from POTFILES.in
+
+2012-01-24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Remove HomeView.{cpp,h} and PlacesHomeView.{cpp,h} now that they have been obsoleted by the HomeLens class. Check them diffstats, ma'!
+
+2012-01-24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ From the review: Make the destructor for the Lens class virtual
+
+2012-01-24 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ From the review: Make the Model<RowAdaptor> constructors call into a shared Init() method to make sure we don't forget to initialize some of the properties (in particular one variant of the constructor wasn't setting a getter on the 'model' property)
+
+2012-01-23 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Revert changes to .po files
+
+2012-01-23 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add some tests for the category merging in HomeLens and fix a bug that it turned up (when different lenses registered cats with the same display name we screwed up the offsets)
+
+2012-01-23 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Some refactoring in the HomeLens tests
+
+2012-01-23 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Sync with trunk
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add some tests to the HomeLens that actually executes a search. More in depth validation of the results to come. This required that I added some more convenience helpers to test_utils.h
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Make the Lens.search_in_global properly actually writable as per declaration. We need that for tests.
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Fix small memleak in HomeLens. Initialize source category models up fron if they are preloaded with data.
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ More tests for HomeLens
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ More tests for HomeLens
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Start writing unit tests for the HomeLens class
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Whitespace fixes in tests/CMakeLists.txt
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Implement on-the-fly recalibration of merged category offsets if the categories are resorted in HomeLens (typically imposed by the external sorting of lenses vie the gsettings key). This fixes the crashers I was talking about earlier. They were caused by Result instaces pointing to incorrect categories
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Sync with trunk
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add todo item - // FIXME: Coordinated sorting between the lens bar and home screen categories. Make void FilesystemLenses::Impl::DecrementAndCheckChildrenWaiting() use the gsettings key
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ WIP: Sort categories on the home screen according to their sorting order defined in the gsettings key "com.canonical.Unity.Dash/home-lens-ordering".
+
+ NOTE: This required some bug fixing in LensView.cpp and there are still bugs (crashers) a plenty. Although, the initial view renders correctly, as soon as you change the search we get a crash. The problem seems to be that everything in the rendering has been written with the assumption that lenses will only ever *append* to the categories model. The HomeLens breaks this assumption (and can not even in theory be made to work that way)
+
+2012-01-20 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add gsettings schema com.canonical.Unity.Dash which holds a key to specify lens sorting (FIXME: how do we sort the entries in the lens bar, perhaps we should really respect those in stead?)
+
+2012-01-19 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Whitespace fixes in gsettings schema
+
+2012-01-19 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Make HomeLens constructor take i18n strings so we don't have to add i18n to libunity-core. Remove some unsused variables and confusing code. Simplify setting of search_hints in the search entry now that we have a proper i18n hint.
+
+2012-01-19 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ W00t! Sort out the whole SetViewType mess in the dash. Sometimes we were spamming change messages other times we remained silent about important ones.
+
+ This was one tricky one. Should be correct now.
+
+2012-01-19 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Implement glib::DBusProxy::IsConnected() and add some guards checking this in the unity::dash::Lens class
+
+2012-01-19 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Emit search_changed from HomeLens when all running global searches in normal lenses have completed
+
+2012-01-19 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Make sure we actually set ViewType::HIDDEN when we're hiding lenses
+
+2012-01-18 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Sync with trunk
+
+2012-01-18 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add another FIXME so I don't forget
+
+2012-01-18 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Update FIXMEs
+
+2012-01-18 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Don't show filters in the HomeLens
+
+2012-01-17 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Some simplifications and debugging
+
+2012-01-17 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Fix arguments of HomeLens::Impl::EnsureCategoryAnnotation() being inverted which resulted in a cascade of errors.
+
+ Stricter error checking and more useful debug logging.
+
+2012-01-17 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Merged gord's lp:~gordallott/unity/dashview-renderer-refactoring
+
+2012-01-17 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Implement Activate() and Preview() for the HomeLens
+
+2012-01-17 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Sync with trunk
+
+2012-01-16 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Sync with trunk
+
+2012-01-16 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add some TODOs for the HomeLens
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Remove a noisy debugging statement
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Fix a double free of a gvariant - the one we replace in the merged results model to fix the offsets into the merged category model
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Fix a divide-by-zero in ResultViewGrid that were spraying SIGFPEs in my general direction.
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Make sure we use the results models to generate category ids in all cases. We were mixing it up. This required some closure magic in order not to get out of hand logic-wise; because they enable us to capture the locals that we need in the async context.
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ More elaborate debugging and erro output in HomeLens. Also fix an unsigned int "under flow" where we passed in -1.
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Make Lens subclassable by making GlobalSearch(), Search(), Activate(), and Preview() virtual; and override these methods in HomeLens.
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Add a remark to HACKING explaining how to enable debug logging
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ The big switch! Change the HomeView to a normal LensView backed by the new HomeLens class. Segfaults a plenty.
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Improve debugging statements in Lens.cpp
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Fix linker errors caused by missing implementations of constructors for ResultsMerger and CategoryMerger
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Wire up the (hairy) logic to merge categories and results correctly in the HomeLens
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Implement row-removed and row-changed signal handling for HomeLens::ModelMerger.
+
+2012-01-13 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Wire up categories- and filters models in HomeLens. Document the logic in EnsureRowBuf().
+
+2012-01-12 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ WIP Start writing a ModelMerger class that will be responsible for backing the models of the HomeLens with the data from all the loaded lenses
+
+2012-01-12 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ WIP Start implementing a HomeLens class in UnityCore that extends the Lens class. The plan is to use it to make home screen rendering use stock lens rendering mechanisms
+
+2012-01-11 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Show default global search results instead of tiles in the home view. In order to get lenses up we initialize them when we're about to show.
+
+2012-01-11 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Fix compilation of the stand alone Dash example
+
+2012-01-26 3v1n0 <mail@3v1n0.net>
+
+ Fixed the logical interaction between lp:~3v1n0/unity/super-tab-switcher and lp:~andyrock/unity/shortcut-hint as defined by design.
+
+ Plus, some code improvements and fixed an issue that caused the shortcut hint to show when pressing Super and clicking over the BFB to show the dash.
+
+ I'm wondering if we should avoid the same also when pressing over the workspace switcher.. Fixes: https://bugs.launchpad.net/bugs/918453. Appoved by Andrea Azzarone, Tim Penhey.
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityScreen: use ubus_manager_ also to send messages.
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ ShortcutController: always use UBusWrapper (also for sending messages)
+
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ No commit message
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ UnityScreen: fixing indentation
+
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ ShortcutController: always hide the shortcut-overlay when the dash is opened.
+
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ manual-tests: SuperTab, added test for the interaction with the overlay
+
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ ShortcutController: animators doesn't need to be dinamically allocated.
+
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ ShortcutController: use UBusWrapper to manage interests
+
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ UnityScreen: always use UBusManager
+
+2012-01-14 3v1n0 <mail@3v1n0.net>
+
+ UnityScreen: disable the shortcut only if a "standard" key is pressed
+
+ This is done not to make the overlay to show when Super+Tab is used.
+ We need an idle, since the overlay activation is done after handleEvent
+ is called.
+
+2012-01-14 3v1n0 <mail@3v1n0.net>
+
+ ShortcutController: allow to be enabled and disabled, and disable it on Super-Tab
+
+ When the launcher key-navigation is activated and the shortcut hint has
+ still not been shown, the shortcut hint should be disabled.
+
+2012-01-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Should use GTK_IS_MENU instead GTK_MENU. Fixes: . Appoved by Michal Hruby.
+
+2012-01-26 Andrea Cimitan <andrea.cimitan@canonical.com>
+
+ Fixes potential crashes
+
+2012-01-23 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2012-01-23 Andrea Azzarone <azzaronea@gmail.com>
+
+ Updates test_lens.cpp
+
+2012-01-22 Andrea Azzarone <azzaronea@gmail.com>
+
+ Auto selects the All button if all the CheckOptionButtons are selected.
+
+2012-01-25 David Planella <david.planella@ubuntu.com>
+
+ - Change 'Rubbish Bin' to 'Trash' in the Unity shortcuts hints overlay
+
+ From bug 920529:
+
+ In all the software we ship in Ubuntu we use American English (en-US) messages as the source for translations. These can then be translated to any language or variant, such as British English (en-GB).
+
+ In the Unity shortcuts hints overlay, the current message (for the want of a better name) for the place where discarded files go is "Rubbish Bin", which is the en-GB version.
+
+ In order to be consistent with the rest of the desktop and with the translations, the original message should refer to "Trash", which can then be translated to "Rubbish Bin" in en-GB and will allow the right translation to be shown in the user's desktop for their chosen locales.
+
+ It might seem a trivial issue, but those involved in bug 406626, its duplicates and follow-ups will remember that it's a sensitive topic.... Fixes: https://bugs.launchpad.net/bugs/920529. Appoved by John Lea, Tim Penhey.
+
+2012-01-23 David Planella <david.planella@ubuntu.com>
+
+ Changed 'Rubbish Bin' to 'Trash' - the translatable messages' source locale should be en-US
+
+2012-01-25 Thomi Richards <thomir@gmail.com>
+
+ Added 'Debug Unity Introspection Tree' script (duit.py). Use this to quickly discover what information is available in the introspection tree.. Fixes: . Appoved by Tim Penhey, Sam Spilsbury, Alex Launi.
+
+2012-01-24 Thomi Richards <thomi.richards@canonical.com>
+
+ Now prints a more friendly message if it can't find the autopilot module.
+
+2012-01-24 Thomi Richards <thomi.richards@canonical.com>
+
+ Moved duit script into tools/ folder, and made the name more explicit.
+
+2012-01-24 Thomi Richards <thomi.richards@canonical.com>
+
+ PEP8 fixes.
+
+2012-01-23 Thomi Richards <thomi.richards@canonical.com>
+
+ Whitespace fix.
+
+2012-01-23 Thomi Richards <thomi.richards@canonical.com>
+
+ Now uses a proper font-face ;)
+
+2012-01-19 Thomi Richards <thomir@gmail.com>
+
+ Finished writing the 'Debug Unity Introspection Tree' script.
+
+2012-01-19 Thomi Richards <thomir@gmail.com>
+
+ Clean ups, and make node shape rounded record.
+
+2012-01-19 Thomi Richards <thomir@gmail.com>
+
+ Output works.
+
+2012-01-19 Thomi Richards <thomir@gmail.com>
+
+ duit now uses pydot only.
+
+2012-01-19 Thomi Richards <thomir@gmail.com>
+
+ First version of duit
+
+2012-01-25 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Just refactoring, and removing unused variable to clean up valgrind results.
+
+ Covered by existing tests.. Fixes: . Appoved by Tim Penhey.
+
+2012-01-24 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Changed variable name from it to icon_it because it isn't an itertor but a refrence to an icon
+
+2012-01-24 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Missed removing unsued iterator
+
+2012-01-24 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Changed 2 more for loops to use range based instead
+
+2012-01-23 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Removed un used vars and changed for loops to use range based
+
+2012-01-23 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Fixed uninitialized variables.
+
+2012-01-25 Alexandros Frantzis <alexandros.frantzis@linaro.org>
+
+ Desktop safe OpenGL ES 2.0 branch from Linaro's Graphics WG
+ - This branch protects OpenGL ES 2.0 specific code with a build time option (BUILD_GLES)
+ - The branch does not affect the runtime execution of Unity on the desktop if BUILD_GLES is not activated
+
+ Authors:
+ alexandros.frantzis@linaro.org
+ marc.ordinasillopis@linaro.org
+ . Fixes: . Appoved by Jay Taoko, Jason Smith.
+
+2012-01-25 Jay Taoko <jay.taoko@canonical.com>
+
+ * Merged into Unity trunk
+
+2012-01-24 Alexandros Frantzis <alexandros.frantzis@linaro.org>
+
+ Desktop safe OpenGL ES 2.0 branch from Linaro's Graphics WG
+ - This branch protects OpenGL ES 2.0 specific code with a build time option (BUILD_GLES)
+ - The branch does not affect the runtime execution of Unity on the desktop if BUILD_GLES is not activated
+
+ Authors:
+ alexandros.frantzis@linaro.org
+ marc.ordinasillopis@linaro.org
+
+2012-01-24 Alexandros Frantzis <alexandros.frantzis@linaro.org>
+
+ GLES2: Fix gles2 compilation in unity-mt-grab-handles.
+
+2012-01-23 Alexandros Frantzis <alexandros.frantzis@linaro.org>
+
+ GLES2: Fix GLES conditional in CMakeLists.txt.
+
+2012-01-20 Marc Ordinas i Llopis <marc.ordinasillopis@linaro.org>
+
+ GLES2: Make GLES2 build compile.
+
+2012-01-20 Alexandros Frantzis <alexandros.frantzis@linaro.org>
+
+ GLES2: Fixed shader header definitions in the IconRenderer port.
+
+2012-01-20 Marc Ordinas i Llopis <marc.ordinasillopis@linaro.org>
+
+ GLES2: Ported changes to plugins/unityshell/src/IconRenderer.cpp.
+
+2012-01-20 Alexandros Frantzis <alexandros.frantzis@linaro.org>
+
+ GLES2: Ported changes to plugins/unityshell.
+
+2012-01-19 Marc Ordinas i Llopis <marc.ordinasillopis@linaro.org>
+
+ GLES2: Ported changes to files outside plugins/unityshell.
+
+2012-01-25 Tim Penhey <tim.penhey@canonical.com>
+
+ Don't assign null to a std::string. Fixes: https://bugs.launchpad.net/bugs/865840. Appoved by Marco Trevisan (Treviño), Sam Spilsbury.
+
+2012-01-24 Tim Penhey <tim.penhey@canonical.com>
+
+ Use the wrapper to avoid assigning null to a std::string.
+
+2012-01-25 Michal Hruby <michal.mhr@gmail.com>
+
+ Move all icon loading into background gio threads. (there was mainly issue with gtk_icon_info_load_icon which is doing synchronous IO and noticeably blocks the UI when using some themes). Fixes: https://bugs.launchpad.net/bugs/828582. Appoved by Gord Allott, Sam Spilsbury.
+
+2012-01-23 Michal Hruby <michal.mhr@gmail.com>
+
+ Add tests
+
+2012-01-19 Michal Hruby <michal.mhr@gmail.com>
+
+ Make sure all the icon loading is done in non-main thread
+
+2012-01-25 Jason Smith <jason.smith@canonical.com>
+
+ . Fixes: . Appoved by Neil J. Patel.
+
+2012-01-25 Jason Smith <jason.smith@canonical.com>
+
+ fix build
+
+2012-01-23 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ This branch contains the first phase of the implementation of software-center integration with Unity. The complete spec on how it should be implemented, is located at:
+ https://wiki.ubuntu.com/SoftwareCenter#Learning_how_to_launch_an_application
+
+ This branch brings the following changes:
+ 1) An app being installed is shown in the launcher with a tooltip "Waiting to install"
+ 2) A progress bar on the launcher item displays the download/install progress.
+ 3) When the app gets installed, the launcher items becomes usable, and the tooltip gets changed to the app name.
+
+ Things which are still to be implemented, in the next phases:
+ 1) Animate the movement of the icon from the USC window to the Unity launcher.
+ 2) Make the launcher icon wiggle when installation is complete
+ 3) Stop the launcher icon from blinking when clicked in "waiting to install" state.
+
+ In the meantime, you can merge this branch into Unity while I implement the remaining aspects
+
+ Branch Testing instructions:
+ 1) Make sure Unity built from my branch is running.
+ 2) Get software-center from bzr branch lp:~gary-lasker/software-center/launcher-integration-lp761851
+ 3) In the software center branch dir, run PYTHONPATH=. python ./software-center
+ 4) Make sure that in the software center View menu, "New Applications In Launcher" is CHECKED.
+ 5) Install a package using software-center that contains a desktop file (like gnome-color-chooser, gnome-mplayer or could be any package with a .desktop file)
+ 6) Watch the Unity launcher :-). Fixes: https://bugs.launchpad.net/bugs/761851. Appoved by Mikkel Kamstrup Erlandsen.
+
+2012-01-17 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix yet another g_strcmp0
+
+2012-01-16 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Make minor changes as pointed out by Mikkel, thanks!
+
+2012-01-15 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix crash, icon of newly-created icon
+
+2012-01-15 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix persistance of launcher icons
+
+2012-01-15 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Major code cleanup, get progress bar to work
+
+2012-01-15 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Integrate SoftwareCenterLauncherIcon.* code back into the main Unity 5.0 source and fix build failures.
+
+2012-01-15 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix build failure
+
+2012-01-15 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Merge from trunk
+
+2011-09-05 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Massive code cleanup, still not able to solve a memory issue :(
+
+2011-09-05 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Use GLIbDBusProxy
+
+2011-09-05 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Trunkify yet again
+
+2011-09-04 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix some issues, thanks Neil! Still need to work out on GDBusProxy
+
+2011-08-19 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Merge from trunk
+
+2011-08-17 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ MEH. Fix conflicts
+
+2011-08-17 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Phase-1 integration complete
+
+2011-08-17 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ NEARLY THERE\!
+
+2011-08-17 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Get the value of Progress in the g-signal
+
+2011-08-16 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix segfault
+
+2011-08-16 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Make code less crappy, fix signals
+
+2011-08-14 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Listen to signals, fix properties proxy
+
+2011-08-10 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Can someone help me?
+
+2011-08-09 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix "undefined symbol" runtime error FOR GOOD
+
+2011-08-08 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix DBus property Get call.
+
+2011-08-08 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ DBussing all the way to the moon\!
+
+2011-08-07 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Tons of underlying changes for better SC integration with Unity
+
+2012-01-20 Jay Taoko <jay.taoko@canonical.com>
+
+ * Triggers a Unity build following Nux API change. Fixes: . Appoved by Jason Smith.
+
+2012-01-20 Jay Taoko <jay.taoko@canonical.com>
+
+ * Trigger Unity build
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Make the launcher be aware of the window's workspace
+
+ Fixed another part of bug #689733 that we were missing, making the launcher to count only the windows in the current workspace when drawing the left "pips".
+
+ Also fixed the unity side of the bug #690143 to make the launcher to spread only the windows in the current workspace.
+
+ Manual tests included.. Fixes: https://bugs.launchpad.net/bugs/689733, https://bugs.launchpad.net/bugs/690143. Appoved by .
+
+2012-01-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ manual-tests: Launcher, removing old test.
+
+2012-01-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merging again with trunk
+
+2012-01-15 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merging with upstream
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ manual-tests: added a test for spread windows in current workspace
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ manual-tests: added test for launcher icon.
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PluginAdapter: some code cleanup
+
+ Avoid extra computation of the VP, we already checked for that.
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ BamfLauncherIcon: spread only windows available on the current workspace.
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merging with upstream
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ BamfLauncherIcon: show only windows on current workspace on the launcher pips
+
+ The launcher icons should show only a number of "pips" equal to
+ the windows on the current workspace.
+
+2012-01-20 Didier Roche <didier.roche@canonical.com>
+
+ kill any previous compiz process as it can hangs before --replace
+ (LP: #919132). Fixes: https://bugs.launchpad.net/bugs/919132. Appoved by Gord Allott.
+
+2012-01-20 Didier Roche <didier.roche@canonical.com>
+
+ be without any mercy
+
+2012-01-20 Didier Roche <didier.roche@canonical.com>
+
+ kill any previous compiz process as it can hangs before --replace (LP: #919132)
+
+2012-01-20 Daniel van Vugt <vanvugt@gmail.com>
+
+ Fix SIGSEGV when a window is minimized. (LP: #918329)
+
+ The crash was caused by 'minimizedWindows' leaking pointers to windows that had been deleted, and then later trying to dereference those pointers. The reason for the leak appears to be a reference leak in the boost::shared_ptr's to CompizMinimizedWindowHandler. Reverting to regular pointers avoids the reference leak, avoids the crash, and makes the code easier to understand (and debug).
+
+ Detailed valgrind log showing the error:
+ https://bugs.launchpad.net/ubuntu/+source/unity/+bug/918329/comments/6. Fixes: https://bugs.launchpad.net/bugs/918329. Appoved by Sam Spilsbury.
+
+2012-01-20 Daniel van Vugt <vanvugt@gmail.com>
+
+ Fix SIGSEGV when a window is minimized. (LP: #918329)
+
+ The crash was caused by 'minimizedWindows' leaking pointers to windows that
+ had been deleted, and then later trying to dereference those pointers. The
+ reason for the leak appears to be a reference leak in the boost::shared_ptr's
+ to CompizMinimizedWindowHandler. Reverting to regular pointers avoids the
+ reference leak, avoids the crash, and makes the code easier to understand (and
+ debug).
+
+2012-01-19 Thomi Richards <thomir@gmail.com>
+
+ Very small change that fixes valgrind warnings about uninitialised variables.. Fixes: . Appoved by Alex Launi.
+
+2012-01-19 Thomi Richards <thomir@gmail.com>
+
+ Fixed a valgrind uninitialised variable warning.
+
+2012-01-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Updates launcher icons shortcuts when removing icons from launcher.. Fixes: https://bugs.launchpad.net/bugs/914018. Appoved by Marco Biscaro.
+
+2012-01-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Ops.
+
+2012-01-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Update launcher shortcuts when removing icons from launcher.
+
+2012-01-19 Didier Roche <didier.roche@canonical.com>
+
+ This branch does two things:
+ - dep on scale and wall after the discussion on bug #897697
+ - alt-tab per workspace is the new default, from the design requirement. Fixes: https://bugs.launchpad.net/bugs/897697. Appoved by Sam Spilsbury.
+
+2012-01-19 Didier Roche <didier.roche@canonical.com>
+
+ s/wall/expo as it's the one we wanted
+
+2012-01-19 Didier Roche <didier.roche@canonical.com>
+
+ alt-tab per workspace is the new default, from the design requirement
+
+2012-01-19 Didier Roche <didier.roche@canonical.com>
+
+ dep on scale and wall after the discussion on bug #897697
+
+2012-01-19 Omer Akram <om26er@ubuntu.com>
+
+ comment #27 bug 778256
+
+ "This bugfix got lost during the merge in revision 1361: http://bazaar.launchpad.net/~unity-team/unity/trunk/revision/1361
+ It was fixed in revision 1228: http://bazaar.launchpad.net/~unity-team/unity/trunk/revision/1228
+ The fix landed in June but this way it did not make it into Oneiric and is not part of the latest 5.0 release in Precise either.
+ Could any Ubuntu developer please check this out? It's a one liner change only.". Fixes: https://bugs.launchpad.net/bugs/778256. Appoved by Michal Hruby, Fitoschido.
+
+2012-01-19 Omer Akram <om26er@ubuntu.com>
+
+ fix
+
+2012-01-15 Omer Akram <om26er@ubuntu.com>
+
+ Re-apply the fix for bug 778256 which got lost in a major unity change.
+
+2012-01-19 Gord Allott <gord.allott@canonical.com>
+
+ Adds alignment options in to DashStyle, only enabled for DashStyle::Button right now. Fixes: . Appoved by Mirco Müller.
+
+2012-01-19 Gord Allott <gord.allott@canonical.com>
+
+ remove debugs
+
+2012-01-19 Gord Allott <gord.allott@canonical.com>
+
+ enables alignment selection in DashStyle::Button
+
+2012-01-19 Daniel van Vugt <vanvugt@gmail.com>
+
+ Log messages from unity should say "unity", not "glib" which is totally misleading (LP: #908004)
+ . Fixes: https://bugs.launchpad.net/bugs/908004. Appoved by Marco Trevisan (Treviño).
+
+2011-12-23 Daniel van Vugt <vanvugt@gmail.com>
+
+ Log messages from unity should say "unity", not "glib" which is totally
+ misleading (LP: #908004)
+
+2012-01-19 Thomas Voß <thomas.voss@rub.de>
+
+ Fixes a dependency issue for unity-mt-grab-handles. Fixes: . Appoved by .
+
+2012-01-19 Thomas Voß <thomas.voss@rub.de>
+
+ Fixed dependency issue on nux-1 instead of nux-2.
+
+2012-01-19 Alex Launi <alex.launi@canonical.com>
+
+ This test has been automated via an autopilot test.. Fixes: . Appoved by .
+
+2012-01-10 Alex Launi <alex.launi@canonical.com>
+
+ Launcher test has been automated into an autopilot test
+
+2012-01-18 smspillaz <sam.spilsbury@canonical.com>
+
+ Fixes LP bug 912682
+
+ glTexEnvMode was never reset to GL_REPLACE so GL_MODULE caused any texture with an alpha channel to draw without proper blending. Fixes: . Appoved by Jay Taoko.
+
+2012-01-19 smspillaz <sam.spilsbury@canonical.com>
+
+ Reset the tex env mode to GL_REPLACE once we're done. Fixes LP#912682
+
+2012-01-12 Sam Spilsbury <sam.spilsbury@canonical.com>
+
+ Do gtk_init_check in unity
+
+2012-01-10 Sam Spilsbury <sam.spilsbury@canonical.com>
+
+ Port to the new compiz API
+
+2012-01-18 Gord Allott <gord.allott@canonical.com>
+
+ Converts the Launcher.cpp ubus handles into a ubus manager class, safer
+ Adds the LOCK_HIDE qurik into the hide machine, enables it when ubus calls it. Fixes: . Appoved by Jason Smith.
+
+2012-01-18 Gord Allott <gord.allott@canonical.com>
+
+ fully working with LAUNCHER_HIDE_NEVER mode now
+
+2012-01-17 Gord Allott <gord.allott@canonical.com>
+
+ Convert the launcher ubus work over to ubus manager and add the LOCK_HIDE quirk
+
+2012-01-18 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Fourth of fifth time I fix my stuff after the stuff in trunk changed below my feet after it was approved... having a fun wasting time :/
+
+ "The actual unity-part of the fix for LP: #841902. It needs lp:~macslow/libunity/libunity.fix-841902 and lp:~macslow/unity-lens-music/unity-lens-music.fix-841902 to be merged first.". Fixes: . Appoved by Michal Hruby.
+
+2012-01-18 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Oops
+
+2012-01-18 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Fixing the the unity-part of my patch for LP: #841902 for the fourth of fifth time... after it got approved everytime before... seriously WTF
+
+2012-01-18 Michal Hruby <michal.mhr@gmail.com>
+
+ Added new unity::glib::Variant class wrapping GVariant. This also fixes GVariant ref-counting issues when using std::map (or Lens::Hints, HintsMap, Filter::Properties etc.). Fixes: . Appoved by Gord Allott.
+
+2012-01-17 Michal Hruby <michal.mhr@gmail.com>
+
+ Get rid of the Utils class, move the functionality to Variant
+
+2012-01-17 Michal Hruby <michal.mhr@gmail.com>
+
+ Make sure Variant::GetString doesn't blow up
+
+2012-01-17 Michal Hruby <michal.mhr@gmail.com>
+
+ Added unity::glib::Variant wrapper
+
+2012-01-17 Mirco Müller <mirco.mueller@canonical.com>
+
+ Fixes the position, alignment, spacing and arrow-artwork for the "Filter results". See...
+
+ http://people.canonical.com/~mmueller/fix-863240.png. Fixes: https://bugs.launchpad.net/bugs/863240. Appoved by Gord Allott.
+
+2012-01-17 Mirco Müller <mirco.mueller@ubuntu.com>
+
+ Correct right gap between expander-arrow and inner Dash edge to be 14 px
+
+2012-01-11 Mirco Müller <mirco.mueller@canonical.com>
+
+ Fix vertical expander-arrow position with an insane nux-layout setup
+
+2012-01-11 Mirco Müller <mirco.mueller@canonical.com>
+
+ Make Filter-text follow right edge when dash is expanded to fullscreen
+
+2012-01-11 Mirco Müller <mirco.mueller@canonical.com>
+
+ Add callback to expander-arrow, fix initial display of just the expander-arrow
+
+2012-01-11 Mirco Müller <mirco.mueller@canonical.com>
+
+ Disabled colored debug-rectangles, make it flush to the right
+
+2012-01-11 Mirco Müller <mirco.mueller@canonical.com>
+
+ First set of fixes for patching LP: #863240
+
+2012-01-17 Gord Allott <gord.allott@canonical.com>
+
+ Re-factors the dash rendering into its own OverlayRenderer class, doesn't add new code above that so should be fairly sane. . Fixes: . Appoved by Mikkel Kamstrup Erlandsen, Michal Hruby.
+
+2012-01-17 Gord Allott <gord.allott@canonical.com>
+
+ merged with latest trunk, fixed kamstrupflicts
+
+2012-01-16 Gord Allott <gord.allott@canonical.com>
+
+ make kamstrup happy by adding a comment on the unique pointer reasoning
+
+2012-01-16 Gord Allott <gord.allott@canonical.com>
+
+ hook up the abouttoshow/hide mechanic
+
+2012-01-16 Gord Allott <gord.allott@canonical.com>
+
+ integrated the OverlayRenderer class in to DashView
+
+2012-01-16 Gord Allott <gord.allott@canonical.com>
+
+ merged in standalone-clients fix from trunk
+
+2012-01-16 Gord Allott <gord.allott@canonical.com>
+
+ First stab at overlay renderer class
+
+2012-01-17 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Make standalone-clients/dash actually compile. Fixes: . Appoved by Gord Allott.
+
+2012-01-17 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@gmail.com>
+
+ Make standalone-clients/dash actually compile
+
+2012-01-17 Michal Hruby <michal.mhr@gmail.com>
+
+ Dispatch search to lenses faster and add a timeout for animating the spinner (otherwise it would just flicker now).. Fixes: . Appoved by Mikkel Kamstrup Erlandsen, Mirco Müller.
+
+2012-01-16 Michal Hruby <michal.mhr@gmail.com>
+
+ Be more verbose when something is wrong with a DBus call
+
+2012-01-16 Michal Hruby <michal.mhr@gmail.com>
+
+ Decrease the timeout used for dispatching searches to lenses and introduce timeout which starts the spinner animation
+
+2012-01-16 Omer Akram <om26er@ubuntu.com>
+
+ revert the bad looking panel branch. the real fix is still being worked on and may take a while.. its for bug 839480. Fixes: . Appoved by Andrea Azzarone.
+
+2012-01-16 Omer Akram <om26er@ubuntu.com>
+
+ revert bug 839480
+
+2012-01-16 Omer Akram <om26er@ubuntu.com>
+
+ merge
+
+2012-01-16 Didier Roche <didier.roche@canonical.com>
+
+ Removing unexisting file in potfiles.in. Seems enough to make it build
+ there. Fixes: . Appoved by Michal Hruby, Gord Allott.
+
+2012-01-16 Didier Roche <didier.roche@canonical.com>
+
+ removing unexisting file from POTFILES.in
+
+2012-01-16 Jay Taoko <jay.taoko@canonical.com>
+
+ * Fix Nux calls in standalone-clients test.. Fixes: . Appoved by Gord Allott.
+
+2012-01-15 Jay Taoko <jay.taoko@canonical.com>
+
+ * Fix Nux calls in standalone-clients test.
+
+2012-01-15 3v1n0 <mail@3v1n0.net>
+
+ Fixed bug #891620 to support the Super+Tab switcher.
+
+ Added a new launcher key switcher that matches design bug #891620, the key bindings are set to default to Super+Tab and Super+Shift+Tab by default, but they can be changed from compiz settings.
+
+ I've added some new functions to Launcher to manage the KeySwitcher and others to share the code between the switcher and the key navigation.. Fixes: https://bugs.launchpad.net/bugs/891620. Appoved by .
+
+2012-01-14 3v1n0 <mail@3v1n0.net>
+
+ Merging with upstream.
+
+2012-01-13 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Super+Tab manual-test: fixed a typo.
+
+2012-01-13 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Updated the manual test
+
+2012-01-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ manual-tests: Added test for Super-Tab switcher
+
+2012-01-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UnityAccesibile: register interest for launcher on key-switcher.
+
+2012-01-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Launcher: added UBUS support for KeySwitcher.
+
+2012-01-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Launcher: add SelectPreviousIcon() and SelectNextIcon() to factorize code
+
+ This code can be shared both by the key navigation and by the Super+Tab
+
+2012-01-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ unityshell: launcher swticher code cleanup.
+
+2012-01-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ SuperTab, rename it to Launcher Key Switcher, as the keybinding can change
+
+2012-01-07 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ unityshell, Launcher: add first support for Super+Tab launcher switcher
+
+ This is a first draft, but working super+tab swtiching, it allows
+ to select windows from the launcher and to activate them when releasing
+ the defined keybinding.
+
+2012-01-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Display a shortcut hints overlay during the super key pressing.
+
+ It includes two unit tests and a standalone test.
+
+ Mockup: https://launchpadlibrarian.net/85352653/Super_key_shutcuts_overlay.png
+ Branch: http://ubuntuone.com/7cqBbWAbvXTRCT4ySFj7z4
+
+ Visual diff: http://ubuntuone.com/014zDKCoxaQYmtm8mS5pp8
+
+ Keep in mind that something is different because the shortcuts values are not hardcoded.. Fixes: https://bugs.launchpad.net/bugs/855532. Appoved by Marco Trevisan (Treviño), John Lea, Tim Penhey.
+
+2012-01-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2011-12-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2011-12-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Center it in the screen.
+
+2011-12-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Close the dash on super press.
+
+2011-12-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2011-12-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2011-12-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add COMPIZ_MOUSE_OPTION
+
+2011-12-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Uses proper case for shortcut hints. Tests it too.
+
+2011-12-16 Andrea Azzarone <azzaronea@gmail.com>
+
+ Try to make it as pixel perfect as possible.
+
+2011-12-14 Andrea Azzarone <azzaronea@gmail.com>
+
+ Ops.
+
+2011-12-14 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2011-12-14 Andrea Azzarone <azzaronea@gmail.com>
+
+ Updates shortcut hints list.
+
+2011-12-14 Andrea Azzarone <azzaronea@gmail.com>
+
+ Show the shortcut in the primary monitor with the right alignment. Don't show the overlay if it doesn't fit in the monitor.
+
+2011-12-14 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes padding.
+
+2011-12-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2011-12-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Hide the shortcuts overlay when a key is pressed.
+
+2011-12-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2011-12-11 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix typo.
+
+2011-12-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Updates the shortcuts window if a shortcut option changes.
+
+2011-12-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix standalone test.
+
+2011-12-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add a quick fade in/out animation.
+
+2011-12-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Layout processing is slown, so it doesn't create the shortcut overlay every single time.
+
+2011-12-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add bold to the titles.
+
+2011-12-08 Andrea Azzarone <azzaronea@gmail.com>
+
+ Unregister dbus interest after controller destruction.
+
+2011-12-08 Andrea Azzarone <azzaronea@gmail.com>
+
+ Jay's work merged.
+
+2011-12-08 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2011-12-08 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes FixShortcutFormat and fixes it.
+
+2011-12-08 Andrea Azzarone <azzaronea@gmail.com>
+
+ Const const const.
+
+2011-12-08 Andrea Azzarone <azzaronea@gmail.com>
+
+ First draft of a function to fix shortcut format.
+
+2011-12-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Moves ctor and copy ctor in the abstract class.
+
+2011-12-07 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2011-12-05 Andrea Azzarone <azzaronea@gmail.com>
+
+ First draft of a shortcuts hint overlay...
+
+2012-01-13 Mirco Müller <mirco.mueller@canonical.com>
+
+ Since the bug LP: #863246 states so many issues, I'm splitting up the work into a series of branches/fixes. This first part corrects pixel-grid alignment of selected/unselected button-outlines, opacity-values (outline, filling) and vertical and horizontal spacing between buttons.
+
+ Here are a few screenshots/screencast showing this first set of improvements:
+
+ http://people.canonical.com/~mmueller/fix-863246-part-1.png
+ http://people.canonical.com/~mmueller/fix-863246-part-4.png
+ http://people.canonical.com/~mmueller/fix-863246-part-5.ogv. Fixes: https://bugs.launchpad.net/bugs/863246. Appoved by Andrea Azzarone.
+
+2012-01-13 Mirco Müller <mirco.mueller@canonical.com>
+
+ Jenkins reported conflicts... merged with branch again and solved conflicts... *sigh³*
+
+2012-01-13 Mirco Müller <mirco.mueller@canonical.com>
+
+ Fixed the vertical and horizontal spacing between buttons to comply with the design
+
+2012-01-13 Mirco Müller <mirco.mueller@canonical.com>
+
+ Fix pixel-grid alignment of curved parts of the multi-range widgets outline
+
+2012-01-13 Mirco Müller <mirco.mueller@canonical.com>
+
+ more value tweaking of opacities to fit the design
+
+2012-01-13 Mirco Müller <mirco.mueller@canonical.com>
+
+ Fix pixel-grid alignment of selected/unselected button-outline, corrected outline color-opacity according to design
+
+2012-01-12 Mirco Müller <mirco.mueller@canonical.com>
+
+ Align outline of selected multirange-widget elements to pixel-grid
+
+2012-01-12 Mirco Müller <mirco.mueller@canonical.com>
+
+ Fixed the pixel-grid alignment of the outline of the unselected multirange-widget/buttons
+
+2012-01-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Dash filters fixes.. Fixes: https://bugs.launchpad.net/bugs/838901, https://bugs.launchpad.net/bugs/841864, https://bugs.launchpad.net/bugs/841870. Appoved by Tim Penhey, Michal Hruby.
+
+2012-01-11 Andrea Azzarone <azzaronea@gmail.com>
+
+ Keep in consideration collapsed property.
+
+2012-01-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Strips trailing spaces.
+
+2012-01-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Makes the FilterWidget inherit from nux::View.
+
+2012-01-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2012-01-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Uses dash style json file to disable prelight state.
+
+2011-12-20 Andrea Azzarone <azzaronea@gmail.com>
+
+ Uses nux::ObjectPtr in FilterExpanderLabel
+
+2011-12-20 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Adds manual tests.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Style fixes.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+ Fix rating stars padding.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes #841870. Don't use SetVisibile on a Layout, nux doesn't like it.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add FilterAllButton class too.
+
+2011-12-15 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fixes "All" button behaviour.
+
+2011-12-14 Andrea Azzarone <azzaronea@gmail.com>
+
+ Updates dash filters coding style.
+
+2011-12-14 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge lp:~yeganeh/unity/fix-for-838901
+
+2011-10-06 Zaid Yeganeh <zaid.yeganeh@gmail.com>
+
+ [unityshell] Removed the 'prelight' state that is used on mouse overs
+
+ modified:
+ plugins/unityshell/src/FilterBasicButton.cpp
+ plugins/unityshell/src/FilterBasicButton.h
+
+2012-01-13 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Making unity be aware of user-invisible windows, and manage them correctly.
+
+ Fixed bug #784804, but after a discussion with Jason I followed his guidelines to get the things fixed.
+ Basically now user-invisible windows (i.e. the ones with the skip-taskbar flag) are ignored by unity unless they don't belong to a sticky application. In that case the application is shown as running, but clicking on it makes the application to run a new instance (while the alt+tab allows to select the user-invisible windows).
+ When an application as both user visible and invisible windows, clicking on the launcher icon or the alt+tab gives priority to the visible windows when bringing them to focus, while when closing all the visible windows, the application is hidden from launcher and alt+tab unless it's sticky (and in this case it behaves as explained above).
+ Also the user-invisible windows, never increment the count of the running windows (i.e. the launcher "pips").
+
+ Read more cases in the provided manual-tests.
+
+ This branch also fixes the management of the urgent windows, that with some latest commits were not managed anymore as they should (now they get again priority when the parent application is focused).. Fixes: https://bugs.launchpad.net/bugs/784804. Appoved by Mirco Müller.
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ manual-tests: added test for UserInvisibleWindows
+
+2012-01-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ BamfLauncherIcon: manage user-invisible windows
+
+ Windows that have the skip-taskbar flag shouldn't be managed by
+ unity unless there's another user-visible window of the given application
+ mapped or the application is pinned.
+
+ Also, when performing a click over a launcher icon, if it has currently
+ opened only non-visible windows, the application is launched, otherwise
+ we give priority to the user visible windows bringing to focus just them
+ (this doesn't happen in the case of the Alt+Tab).
+
+ When an application with user-invisible windows is closed, we show it
+ on the launcher only if that is pinned.
+
+2012-01-13 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Update the top panel title with the current alt+tab focused application title.
+
+ Fixed bug #855516, using ubus messages to make the switcher notify of events.. Fixes: https://bugs.launchpad.net/bugs/855516, https://bugs.launchpad.net/bugs/913889. Appoved by Mirco Müller.
+
+2012-01-12 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: added the "paranoia"-checks ;)
+
+2012-01-10 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ manual-test: added Panel manual test for Alt+Tab interaction
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: set the show-now delay to the previous value.
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: set show_now as disactive when showing the switcher.
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: reduce the risk of not hiding the menus.
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: update the mouse position when the switcher has been hidden
+
+ Since the switcher grabs the pointer, we need to update the mouse position
+ to check if the the pointer is over the panel or not.
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: Never shows menus or window buttons when the switcher is showing
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: use a vector instead of signal guint values to save ubus interests
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PanelMenuView: be aware of the switcher status and update the title on switcher changes
+
+ This fixes bug #855516, making the Alt+Tab switcher to update the unity
+ panel title.
+
+2012-01-08 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ SwitcherController: send new UBusMessages when switcher changes visibility or selection
+
+ So clients can easily get what's happening on the switcher without
+ using class signals.
+
+2012-01-13 Mirco Müller <mirco.mueller@canonical.com>
+
+ Changed rendering of filling of Dash's search-bar according to design-suggestion... http://people.canonical.com/~mmueller/fix-913717.png. Fixes: https://bugs.launchpad.net/bugs/913717. Appoved by John Lea, Andrea Cimitan, Andrea Azzarone.
+
+2012-01-12 Mirco Müller <mirco.mueller@canonical.com>
+
+ Fix color/opacity of Dash's search-bar filling. Fix LP: #913717
+
+2012-01-12 agateau <aurelien.gateau@canonical.com>
+
+ Release\ 5.0.0
+
2012-01-11 Marco Trevisan (Treviño) <mail@3v1n0.net>
Fixed bug #914251, local variables should be passed by value.
diff --git a/manual-tests/Dash.txt b/manual-tests/Dash.txt
index 116defd76..32c94344c 100644
--- a/manual-tests/Dash.txt
+++ b/manual-tests/Dash.txt
@@ -10,6 +10,22 @@ using the dash. (see lp:856205)
Outcome
The dash disappears, and gedit is run. If nothing happens or the first
command is run (in this case gcc), this test failed.
+
+
+Mouse down and search bar focus
+-------------------------------
+This test makes sure that the search bar doesn't lose the focus clicking into
+am emtpy area (or into a filter button).
+
+#. Open the app lens
+#. Expand the filter bar
+#. Make sure the dash has the focus
+#. The cursor should blink
+#. Click between a filter expander and the All Button (for example between Type > and All)
+ or into a filter button.
+
+Outcome
+The cursor is still blinking.
Category headers focus
diff --git a/manual-tests/Launcher.txt b/manual-tests/Launcher.txt
index bfafa408b..969948723 100644
--- a/manual-tests/Launcher.txt
+++ b/manual-tests/Launcher.txt
@@ -1,3 +1,6 @@
+Note, for simplification, one pip is defined as a single filled in arrow to the
+ left of a launcher.
+
Test Launcher Icon with Windows in multiple workspaces
------------------------------------------------------
This test shows how the launcher should draw when there are application windows
@@ -5,17 +8,17 @@ in multiple workspaces.
#. Start on a fresh login
#. Run an application
-#. Run another instance of this application and keep it on the initial workspace
-#. Run another instance of this application and move it no another workspaces
+#. Run another instance (window) of this application and keep it on the initial workspace
+#. Run another instance (window) of this application and move it to another workspace
#. Go back to the initial workspace
Outcome
- The Launcher icon "pips" should reflect the number of windows in the current
- workspace, so when showing the "initial" workspace the launcher icon should
+ The Launcher icon "pips" (indicators) should reflect the number of windows in the
+ current workspace, so when showing the "initial" workspace the launcher icon should
have 2 "pips", when moving to the second workspace (where there's only 1 window)
- the launcher application icon should show 1 pip.
+ the launcher application icon should have a left filled arrow.
When moving to a workspace where there are no windows, the launcher icon should
- use an empty arrow as left indicator.
+ use an empty (non filled) arrow as left indicator (despite the number of opened windows).
Test Launcher Spread with Windows in multiple workspaces
diff --git a/manual-tests/Menus.txt b/manual-tests/Menus.txt
new file mode 100644
index 000000000..f039c5f40
--- /dev/null
+++ b/manual-tests/Menus.txt
@@ -0,0 +1,10 @@
+Menu Color
+----------
+This test shows the color of the menus using the Ambiance theme:
+
+#. Start with a clean screen
+#. Open an application window with menus
+#. Go on the top panel and open a menu
+
+Outcome:
+ The menu should have a black background (i.e. #403f3a)
diff --git a/plugins/unity-mt-grab-handles/CMakeLists.txt b/plugins/unity-mt-grab-handles/CMakeLists.txt
index 71dabcb73..9e5a65f4a 100644
--- a/plugins/unity-mt-grab-handles/CMakeLists.txt
+++ b/plugins/unity-mt-grab-handles/CMakeLists.txt
@@ -2,4 +2,4 @@ find_package (Compiz REQUIRED)
include (CompizPlugin)
-compiz_plugin (unitymtgrabhandles PKGDEPS nux-2.0 >= 2.0.0 PLUGINDEPS composite opengl CFLAGSADD -std=c++0x)
+compiz_plugin (unitymtgrabhandles PKGDEPS nux-2.0>=2.0.0 PLUGINDEPS composite opengl CFLAGSADD -std=c++0x)
diff --git a/plugins/unityshell/src/AbstractIconRenderer.h b/plugins/unityshell/src/AbstractIconRenderer.h
index 5c98dbf99..8571ecec6 100644
--- a/plugins/unityshell/src/AbstractIconRenderer.h
+++ b/plugins/unityshell/src/AbstractIconRenderer.h
@@ -41,6 +41,7 @@ class RenderArg
public:
RenderArg()
: icon(0)
+ , colorify(nux::color::White)
, x_rotation(0)
, y_rotation(0)
, z_rotation(0)
@@ -70,6 +71,7 @@ public:
launcher::AbstractLauncherIcon* icon;
nux::Point3 render_center;
nux::Point3 logical_center;
+ nux::Color colorify;
float x_rotation;
float y_rotation;
float z_rotation;
@@ -103,6 +105,7 @@ public:
virtual ~AbstractIconRenderer() {}
nux::Property<PipRenderStyle> pip_style;
+ nux::Property<int> monitor;
// RenderArgs not const in case processor needs to modify positions to do a perspective correct.
virtual void PreprocessIcons(std::list<RenderArg>& args, nux::Geometry const& target_window) = 0;
diff --git a/plugins/unityshell/src/AbstractLauncherIcon.h b/plugins/unityshell/src/AbstractLauncherIcon.h
index 14afb45f3..c9add523e 100644
--- a/plugins/unityshell/src/AbstractLauncherIcon.h
+++ b/plugins/unityshell/src/AbstractLauncherIcon.h
@@ -33,6 +33,7 @@
#include "DndData.h"
#include "Introspectable.h"
+#include "LauncherEntryRemote.h"
namespace unity
{
@@ -53,19 +54,22 @@ public:
: source(OTHER)
, button(0)
, target(0)
+ , monitor(-1)
{
}
- ActionArg(Source source, int button, Window target = 0)
+ ActionArg(Source source, int button, Window target = 0, int monitor = -1)
: source(source)
, button(button)
, target(target)
+ , monitor(monitor)
{
}
Source source;
int button;
Window target;
+ int monitor;
};
class AbstractLauncherIcon : public nux::InitiallyUnownedObject, public debug::Introspectable
@@ -104,6 +108,7 @@ public:
QUIRK_DROP_DIM,
QUIRK_DESAT,
QUIRK_PULSE_ONCE,
+ QUIRK_LAST_ACTION,
QUIRK_LAST,
} Quirk;
@@ -129,13 +134,17 @@ public:
virtual void SetSortPriority(int priority) = 0;
- virtual bool OpenQuicklist(bool default_to_first_item = false) = 0;
+ virtual bool OpenQuicklist(bool default_to_first_item = false, int monitor = -1) = 0;
- virtual void SetCenter(nux::Point3 center) = 0;
+ virtual void SetCenter(nux::Point3 center, int monitor, nux::Geometry parent_geo) = 0;
- virtual nux::Point3 GetCenter() = 0;
+ virtual nux::Point3 GetCenter(int monitor) = 0;
- virtual std::vector<nux::Vector4> & GetTransform(TransformIndex index) = 0;
+ virtual nux::Point3 GetSavedCenter(int monitor) = 0;
+
+ virtual void SaveCenter() = 0;
+
+ virtual std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor) = 0;
virtual void Activate(ActionArg arg) = 0;
@@ -143,13 +152,13 @@ public:
virtual int SortPriority() = 0;
- virtual int RelatedWindows() = 0;
+ virtual std::vector<Window> Windows() = 0;
- virtual std::vector<Window> RelatedXids () = 0;
+ virtual std::vector<Window> WindowsForMonitor(int monitor) = 0;
virtual std::string NameForWindow (Window window) = 0;
- virtual const bool HasWindowOnViewport() = 0;
+ virtual const bool WindowVisibleOnMonitor(int monitor) = 0;
virtual bool IsSpacer() = 0;
@@ -157,16 +166,18 @@ public:
virtual float GetProgress() = 0;
- virtual bool ShowInSwitcher() = 0;
+ virtual bool ShowInSwitcher(bool current) = 0;
virtual unsigned long long SwitcherPriority() = 0;
- virtual bool GetQuirk(Quirk quirk) = 0;
+ virtual bool GetQuirk(Quirk quirk) const = 0;
virtual void SetQuirk(Quirk quirk, bool value) = 0;
virtual struct timespec GetQuirkTime(Quirk quirk) = 0;
+ virtual void ResetQuirkTime(Quirk quirk) = 0;
+
virtual IconType Type() = 0;
virtual nux::Color BackgroundColor() = 0;
@@ -189,16 +200,26 @@ public:
virtual void SendDndLeave() = 0;
- sigc::signal<void, int> mouse_down;
- sigc::signal<void, int> mouse_up;
- sigc::signal<void, int> mouse_click;
- sigc::signal<void> mouse_enter;
- sigc::signal<void> mouse_leave;
+ virtual void InsertEntryRemote(LauncherEntryRemote* remote) = 0;
+
+ virtual void RemoveEntryRemote(LauncherEntryRemote* remote) = 0;
+
+ sigc::signal<void, int, int> mouse_down;
+ sigc::signal<void, int, int> mouse_up;
+ sigc::signal<void, int, int> mouse_click;
+ sigc::signal<void, int> mouse_enter;
+ sigc::signal<void, int> mouse_leave;
sigc::signal<void, AbstractLauncherIcon*> show;
sigc::signal<void, AbstractLauncherIcon*> hide;
sigc::signal<void, AbstractLauncherIcon*> needs_redraw;
+ sigc::signal<void, AbstractLauncherIcon*> remove;
+ sigc::connection needs_redraw_connection;
+ sigc::connection on_icon_added_connection;
+ sigc::connection on_icon_removed_connection;
+ sigc::connection on_order_changed_connection;
+ sigc::connection on_expo_terminated_connection;
};
}
diff --git a/plugins/unityshell/src/BFBLauncherIcon.cpp b/plugins/unityshell/src/BFBLauncherIcon.cpp
index 11e05de4a..c7d6f46ac 100644
--- a/plugins/unityshell/src/BFBLauncherIcon.cpp
+++ b/plugins/unityshell/src/BFBLauncherIcon.cpp
@@ -32,8 +32,8 @@ namespace launcher
UBusManager BFBLauncherIcon::ubus_manager_;
-BFBLauncherIcon::BFBLauncherIcon(Launcher* IconManager)
- : SimpleLauncherIcon(IconManager)
+BFBLauncherIcon::BFBLauncherIcon()
+ : SimpleLauncherIcon()
{
tooltip_text = _("Dash home");
icon_name = PKGDATADIR"/launcher_bfb.png";
@@ -43,7 +43,7 @@ BFBLauncherIcon::BFBLauncherIcon(Launcher* IconManager)
background_color_ = nux::color::White;
- mouse_enter.connect([&]() { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });
+ mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });
}
nux::Color BFBLauncherIcon::BackgroundColor()
diff --git a/plugins/unityshell/src/BFBLauncherIcon.h b/plugins/unityshell/src/BFBLauncherIcon.h
index 115c416bc..441448e73 100644
--- a/plugins/unityshell/src/BFBLauncherIcon.h
+++ b/plugins/unityshell/src/BFBLauncherIcon.h
@@ -35,7 +35,7 @@ class BFBLauncherIcon : public SimpleLauncherIcon
{
public:
- BFBLauncherIcon(Launcher* launcher);
+ BFBLauncherIcon();
virtual nux::Color BackgroundColor();
virtual nux::Color GlowColor();
diff --git a/plugins/unityshell/src/BamfLauncherIcon.cpp b/plugins/unityshell/src/BamfLauncherIcon.cpp
index fa4f007fb..2d66fc766 100644
--- a/plugins/unityshell/src/BamfLauncherIcon.cpp
+++ b/plugins/unityshell/src/BamfLauncherIcon.cpp
@@ -1,6 +1,6 @@
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
- * Copyright (C) 2010 Canonical Ltd
+ * Copyright (C) 2010-2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Jason Smith <jason.smith@canonical.com>
+ * Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
*/
#include <Nux/Nux.h>
@@ -29,7 +30,6 @@
#include <glib/gi18n-lib.h>
#include <gio/gdesktopappinfo.h>
-#include <libindicator/indicator-desktop-shortcuts.h>
#include <UnityCore/GLibWrapper.h>
@@ -38,24 +38,140 @@ namespace unity
namespace launcher
{
-struct _ShortcutData
+BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)
+ : SimpleLauncherIcon()
+ , _bamf_app(app, glib::AddRef())
+ , _dnd_hovered(false)
+ , _dnd_hover_timer(0)
+ , _supported_types_filled(false)
+ , _fill_supported_types_id(0)
+ , _window_moved_id(0)
{
- BamfLauncherIcon* self;
- IndicatorDesktopShortcuts* shortcuts;
- char* nick;
-};
-typedef struct _ShortcutData ShortcutData;
-static void shortcut_data_destroy(ShortcutData* data)
+ auto bamf_view = glib::object_cast<BamfView>(_bamf_app);
+
+ glib::String icon(bamf_view_get_icon(bamf_view));
+
+ tooltip_text = BamfName();
+ icon_name = icon.Str();
+ SetIconType(TYPE_APPLICATION);
+
+ if (IsSticky())
+ SetQuirk(QUIRK_VISIBLE, true);
+ else
+ SetQuirk(QUIRK_VISIBLE, bamf_view_user_visible(bamf_view));
+
+ SetQuirk(QUIRK_ACTIVE, bamf_view_is_active(bamf_view));
+ SetQuirk(QUIRK_RUNNING, bamf_view_is_running(bamf_view));
+
+ glib::SignalBase* sig;
+
+ sig = new glib::Signal<void, BamfView*, BamfView*>(bamf_view, "child-added",
+ [&] (BamfView*, BamfView*) {
+ EnsureWindowState();
+ UpdateMenus();
+ UpdateIconGeometries(GetCenters());
+ });
+ _gsignals.Add(sig);
+
+ sig = new glib::Signal<void, BamfView*, BamfView*>(bamf_view, "child-removed",
+ [&] (BamfView*, BamfView*) { EnsureWindowState(); });
+ _gsignals.Add(sig);
+
+ sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "urgent-changed",
+ [&] (BamfView*, gboolean urgent) {
+ SetQuirk(QUIRK_URGENT, urgent);
+ });
+ _gsignals.Add(sig);
+
+ sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "active-changed",
+ [&] (BamfView*, gboolean active) {
+ SetQuirk(QUIRK_ACTIVE, active);
+ });
+ _gsignals.Add(sig);
+
+ sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "running-changed",
+ [&] (BamfView*, gboolean running) {
+ SetQuirk(QUIRK_RUNNING, running);
+ if (running)
+ {
+ EnsureWindowState();
+ UpdateIconGeometries(GetCenters());
+ }
+ });
+ _gsignals.Add(sig);
+
+ sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "user-visible-changed",
+ [&] (BamfView*, gboolean visible) {
+ if (!IsSticky())
+ SetQuirk(QUIRK_VISIBLE, visible);
+ });
+ _gsignals.Add(sig);
+
+ sig = new glib::Signal<void, BamfView*>(bamf_view, "closed",
+ [&] (BamfView*) {
+ if (!IsSticky())
+ Remove();
+ });
+ _gsignals.Add(sig);
+
+ WindowManager::Default()->window_minimized.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnWindowMinimized));
+ WindowManager::Default()->window_moved.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnWindowMoved));
+ WindowManager::Default()->compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));
+ WindowManager::Default()->terminate_expo.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));
+
+ EnsureWindowState();
+ UpdateMenus();
+ UpdateDesktopFile();
+
+ // hack
+ SetProgress(0.0f);
+
+ // Calls when there are no higher priority events pending to the default main loop.
+ _fill_supported_types_id = g_idle_add([] (gpointer data) -> gboolean {
+ static_cast<BamfLauncherIcon*>(data)->FillSupportedTypes();
+ return false;
+ }, this);
+}
+
+BamfLauncherIcon::~BamfLauncherIcon()
+{
+ g_object_set_qdata(G_OBJECT(_bamf_app.RawPtr()),
+ g_quark_from_static_string("unity-seen"),
+ GINT_TO_POINTER(0));
+
+ if (_fill_supported_types_id != 0)
+ g_source_remove(_fill_supported_types_id);
+
+ if (_window_moved_id != 0)
+ g_source_remove(_window_moved_id);
+
+ if (_dnd_hover_timer != 0)
+ g_source_remove(_dnd_hover_timer);
+}
+
+bool BamfLauncherIcon::IsSticky() const
{
- g_object_unref(data->shortcuts);
- g_free(data->nick);
- g_slice_free(ShortcutData, data);
+ return bamf_view_is_sticky(BAMF_VIEW(_bamf_app.RawPtr()));
}
-static void shortcut_activated(DbusmenuMenuitem* _sender, guint timestamp, gpointer userdata)
+bool BamfLauncherIcon::IsVisible() const
{
- ShortcutData* data = (ShortcutData*)userdata;
- indicator_desktop_shortcuts_nick_exec(data->shortcuts, data->nick);
+ return GetQuirk(QUIRK_VISIBLE);
+}
+
+bool BamfLauncherIcon::IsActive() const
+{
+ return GetQuirk(QUIRK_ACTIVE);
+}
+
+bool BamfLauncherIcon::IsRunning() const
+{
+ return GetQuirk(QUIRK_RUNNING);
+}
+
+bool BamfLauncherIcon::IsUrgent() const
+{
+ return GetQuirk(QUIRK_URGENT);
}
void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
@@ -63,14 +179,11 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
SimpleLauncherIcon::ActivateLauncherIcon(arg);
bool scaleWasActive = WindowManager::Default()->IsScaleActive();
GList *l;
- BamfView *view;
- bool active, running, user_visible;
- active = bamf_view_is_active(BAMF_VIEW(m_App));
- running = bamf_view_is_running(BAMF_VIEW(m_App));
- user_visible = running;
+ bool active = IsActive();
+ bool user_visible = IsRunning();
- if (arg.target && OwnsWindow (arg.target))
+ if (arg.target && OwnsWindow(arg.target))
{
WindowManager::Default()->Activate(arg.target);
return;
@@ -82,28 +195,32 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
if (arg.source != ActionArg::SWITCHER)
{
- user_visible = bamf_view_user_visible(BAMF_VIEW(m_App));
+ auto bamf_view = glib::object_cast<BamfView>(_bamf_app);
+ user_visible = bamf_view_user_visible(bamf_view);
bool any_visible = false;
- for (l = bamf_view_get_children(BAMF_VIEW(m_App)); l; l = l->next)
+ GList *children = bamf_view_get_children(bamf_view);
+
+ for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
+
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
- if (BAMF_IS_WINDOW(view))
+ if (!any_visible && WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
{
- Window xid = bamf_window_get_xid(BAMF_WINDOW(view));
+ any_visible = true;
+ }
- if (!any_visible && WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
- {
- any_visible = true;
- }
- if (active && !WindowManager::Default()->IsWindowMapped(xid))
- {
- active = false;
- }
+ if (active && !WindowManager::Default()->IsWindowMapped(xid))
+ {
+ active = false;
}
}
+ g_list_free(children);
+
if (!any_visible)
active = false;
}
@@ -116,7 +233,7 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
* 5) Spread is active -> Spread de-activated, and fall through
*/
- if (!running || (running && !user_visible)) // #1 above
+ if (!IsRunning() || (IsRunning() && !user_visible)) // #1 above
{
if (GetQuirk(QUIRK_STARTING))
return;
@@ -163,147 +280,53 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
}
if (arg.source != ActionArg::SWITCHER)
- ubus_server_send_message(ubus_server_get_default(), UBUS_LAUNCHER_ACTION_DONE, NULL);
+ ubus_server_send_message(ubus_server_get_default(), UBUS_LAUNCHER_ACTION_DONE, nullptr);
}
-BamfLauncherIcon::BamfLauncherIcon(Launcher* IconManager, BamfApplication* app)
- : SimpleLauncherIcon(IconManager)
- , _supported_types_filled(false)
- , _fill_supported_types_id(0)
+std::vector<Window> BamfLauncherIcon::Windows()
{
- _cached_desktop_file = NULL;
- _cached_name = NULL;
- m_App = app;
- _remote_uri = 0;
- _dnd_hover_timer = 0;
- _dnd_hovered = false;
- _launcher = IconManager;
- _desktop_file_monitor = NULL;
- _menu_desktop_shortcuts = NULL;
- _on_desktop_file_changed_handler_id = 0;
- _window_moved_id = 0;
- glib::String icon(bamf_view_get_icon(BAMF_VIEW(m_App)));
-
- tooltip_text = BamfName();
- icon_name = icon.Str();
- SetIconType(TYPE_APPLICATION);
-
- if (bamf_view_is_sticky(BAMF_VIEW(m_App)))
- SetQuirk(QUIRK_VISIBLE, true);
- else
- SetQuirk(QUIRK_VISIBLE, bamf_view_user_visible(BAMF_VIEW(m_App)));
-
- SetQuirk(QUIRK_ACTIVE, bamf_view_is_active(BAMF_VIEW(m_App)));
- SetQuirk(QUIRK_RUNNING, bamf_view_is_running(BAMF_VIEW(m_App)));
-
- g_signal_connect(app, "child-removed", (GCallback) &BamfLauncherIcon::OnChildRemoved, this);
- g_signal_connect(app, "child-added", (GCallback) &BamfLauncherIcon::OnChildAdded, this);
- g_signal_connect(app, "urgent-changed", (GCallback) &BamfLauncherIcon::OnUrgentChanged, this);
- g_signal_connect(app, "running-changed", (GCallback) &BamfLauncherIcon::OnRunningChanged, this);
- g_signal_connect(app, "active-changed", (GCallback) &BamfLauncherIcon::OnActiveChanged, this);
- g_signal_connect(app, "user-visible-changed", (GCallback) &BamfLauncherIcon::OnUserVisibleChanged, this);
- g_signal_connect(app, "closed", (GCallback) &BamfLauncherIcon::OnClosed, this);
-
- g_object_ref(m_App);
-
- EnsureWindowState();
- UpdateMenus();
-
- UpdateDesktopFile();
-
- WindowManager::Default()->window_minimized.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnWindowMinimized));
- WindowManager::Default()->window_moved.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnWindowMoved));
- WindowManager::Default()->compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));
- WindowManager::Default()->terminate_expo.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState));
- IconManager->hidden_changed.connect(sigc::mem_fun(this, &BamfLauncherIcon::OnLauncherHiddenChanged));
-
- // hack
- SetProgress(0.0f);
-
- // Calls when there are no higher priority events pending to the default main loop.
- _fill_supported_types_id = g_idle_add((GSourceFunc)FillSupportedTypes, this);
-
-}
-
-BamfLauncherIcon::~BamfLauncherIcon()
-{
- g_object_set_qdata(G_OBJECT(m_App), g_quark_from_static_string("unity-seen"), GINT_TO_POINTER(0));
-
- // We might not have created the menu items yet
- for (auto it = _menu_clients.begin(); it != _menu_clients.end(); it++)
- {
- g_object_unref(G_OBJECT(it->second));
- }
-
- if (_menu_items.find("Pin") != _menu_items.end())
- {
- g_signal_handler_disconnect(G_OBJECT(_menu_items["Pin"]),
- _menu_callbacks["Pin"]);
- }
+ std::vector<Window> results;
+ GList* children, *l;
+ WindowManager *wm = WindowManager::Default();
- if (_menu_items.find("Quit") != _menu_items.end())
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
+ for (l = children; l; l = l->next)
{
- g_signal_handler_disconnect(G_OBJECT(_menu_items["Quit"]),
- _menu_callbacks["Quit"]);
- }
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- for (auto it = _menu_items.begin(); it != _menu_items.end(); it++)
- {
- g_object_unref(G_OBJECT(it->second));
- }
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
- for (auto it = _menu_items_extra.begin(); it != _menu_items_extra.end(); it++)
- {
- g_object_unref(G_OBJECT(it->second));
+ if (wm->IsWindowMapped(xid))
+ {
+ results.push_back(xid);
+ }
}
- if (G_IS_OBJECT(_menu_desktop_shortcuts))
- g_object_unref(G_OBJECT(_menu_desktop_shortcuts));
-
- if (_on_desktop_file_changed_handler_id != 0)
- g_signal_handler_disconnect(G_OBJECT(_desktop_file_monitor),
- _on_desktop_file_changed_handler_id);
-
- if (_fill_supported_types_id != 0)
- g_source_remove(_fill_supported_types_id);
-
- if (_window_moved_id != 0)
- g_source_remove(_window_moved_id);
-
- g_signal_handlers_disconnect_by_func(m_App, (void*) &BamfLauncherIcon::OnChildRemoved, this);
- g_signal_handlers_disconnect_by_func(m_App, (void*) &BamfLauncherIcon::OnChildAdded, this);
- g_signal_handlers_disconnect_by_func(m_App, (void*) &BamfLauncherIcon::OnUrgentChanged, this);
- g_signal_handlers_disconnect_by_func(m_App, (void*) &BamfLauncherIcon::OnRunningChanged, this);
- g_signal_handlers_disconnect_by_func(m_App, (void*) &BamfLauncherIcon::OnActiveChanged, this);
- g_signal_handlers_disconnect_by_func(m_App, (void*) &BamfLauncherIcon::OnUserVisibleChanged, this);
- g_signal_handlers_disconnect_by_func(m_App, (void*) &BamfLauncherIcon::OnClosed, this);
-
- g_object_unref(m_App);
- g_object_unref(_desktop_file_monitor);
-
- g_free(_cached_desktop_file);
- g_free(_cached_name);
+ g_list_free(children);
+ return results;
}
-std::vector<Window> BamfLauncherIcon::RelatedXids ()
+std::vector<Window> BamfLauncherIcon::WindowsForMonitor(int monitor)
{
std::vector<Window> results;
GList* children, *l;
- BamfView* view;
WindowManager *wm = WindowManager::Default();
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
- if (BAMF_IS_WINDOW(view))
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
+
+ auto window = static_cast<BamfWindow*>(l->data);
+ if (bamf_window_get_monitor(window) == monitor)
{
- guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
+ guint32 xid = bamf_window_get_xid(window);
+ bool user_visible = bamf_view_user_visible(reinterpret_cast<BamfView*>(window));
- if (wm->IsWindowMapped(xid))
- {
- results.push_back (xid);
- }
+ if (user_visible && wm->IsWindowMapped(xid) && wm->IsWindowOnCurrentDesktop(xid))
+ results.push_back(xid);
}
}
@@ -311,18 +334,20 @@ std::vector<Window> BamfLauncherIcon::RelatedXids ()
return results;
}
-std::string BamfLauncherIcon::NameForWindow (Window window)
+std::string BamfLauncherIcon::NameForWindow(Window window)
{
std::string result;
GList* children, *l;
- BamfView* view;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
- if (BAMF_IS_WINDOW(view) && (Window) bamf_window_get_xid(BAMF_WINDOW(view)) == window)
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
+
+ if (bamf_window_get_xid(static_cast<BamfWindow*>(l->data)) == window)
{
+ auto view = static_cast<BamfView*>(l->data);
result = glib::String(bamf_view_get_name(view)).Str();
break;
}
@@ -332,11 +357,6 @@ std::string BamfLauncherIcon::NameForWindow (Window window)
return result;
}
-void BamfLauncherIcon::OnLauncherHiddenChanged()
-{
- UpdateIconGeometries(GetCenter());
-}
-
void BamfLauncherIcon::OnWindowMinimized(guint32 xid)
{
if (!OwnsWindow(xid))
@@ -348,11 +368,12 @@ void BamfLauncherIcon::OnWindowMinimized(guint32 xid)
void BamfLauncherIcon::OnWindowMoved(guint32 moved_win)
{
+ if (!OwnsWindow(moved_win))
+ return;
+
if (_window_moved_id != 0)
g_source_remove(_window_moved_id);
- _window_moved_xid = moved_win;
-
_window_moved_id = g_timeout_add(250, [] (gpointer data) -> gboolean
{
BamfLauncherIcon* self = static_cast<BamfLauncherIcon*>(data);
@@ -362,115 +383,98 @@ void BamfLauncherIcon::OnWindowMoved(guint32 moved_win)
}, this);
}
-bool BamfLauncherIcon::IsSticky()
-{
- return bamf_view_is_sticky(BAMF_VIEW(m_App));
-}
-
void BamfLauncherIcon::UpdateDesktopFile()
{
- char* filename = NULL;
- filename = (char*) bamf_application_get_desktop_file(m_App);
+ const char* filename = bamf_application_get_desktop_file(_bamf_app);
- if (filename != NULL && g_strcmp0(_cached_desktop_file, filename) != 0)
+ if (filename != nullptr && filename[0] != '\0' && _desktop_file != filename)
{
- if (_cached_desktop_file != NULL)
- g_free(_cached_desktop_file);
-
- _cached_desktop_file = g_strdup(filename);
+ _desktop_file = filename;
// add a file watch to the desktop file so that if/when the app is removed
// we can remove ourself from the launcher and when it's changed
// we can update the quicklist.
if (_desktop_file_monitor)
- {
- if (_on_desktop_file_changed_handler_id != 0)
- g_signal_handler_disconnect(G_OBJECT(_desktop_file_monitor),
- _on_desktop_file_changed_handler_id);
- g_object_unref(_desktop_file_monitor);
- }
+ _gsignals.Disconnect(_desktop_file_monitor, "changed");
- GFile* desktop_file = g_file_new_for_path(DesktopFile());
+ glib::Object<GFile> desktop_file(g_file_new_for_path(_desktop_file.c_str()));
_desktop_file_monitor = g_file_monitor_file(desktop_file, G_FILE_MONITOR_NONE,
- NULL, NULL);
- g_file_monitor_set_rate_limit (_desktop_file_monitor, 1000);
- _on_desktop_file_changed_handler_id = g_signal_connect(_desktop_file_monitor,
- "changed",
- G_CALLBACK(&BamfLauncherIcon::OnDesktopFileChanged),
- this);
+ nullptr, nullptr);
+ g_file_monitor_set_rate_limit(_desktop_file_monitor, 1000);
+
+ auto sig = new glib::Signal<void, GFileMonitor*, GFile*, GFile*, GFileMonitorEvent>(_desktop_file_monitor, "changed",
+ [&] (GFileMonitor*, GFile*, GFile*, GFileMonitorEvent event_type) {
+ switch (event_type)
+ {
+ case G_FILE_MONITOR_EVENT_DELETED:
+ UnStick();
+ break;
+ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
+ UpdateDesktopQuickList();
+ break;
+ default:
+ break;
+ }
+ });
+ _gsignals.Add(sig);
}
}
-const char* BamfLauncherIcon::DesktopFile()
+std::string BamfLauncherIcon::DesktopFile()
{
UpdateDesktopFile();
- return _cached_desktop_file;
+ return _desktop_file;
}
-const char* BamfLauncherIcon::BamfName()
+std::string BamfLauncherIcon::BamfName() const
{
- gchar* name = bamf_view_get_name(BAMF_VIEW(m_App));
-
- if (name == NULL)
- name = g_strdup("");
-
- if (_cached_name != NULL)
- g_free(_cached_name);
-
- _cached_name = name;
-
- return _cached_name;
+ glib::String name(bamf_view_get_name(BAMF_VIEW(_bamf_app.RawPtr())));
+ return name.Str();
}
void BamfLauncherIcon::AddProperties(GVariantBuilder* builder)
{
LauncherIcon::AddProperties(builder);
- g_variant_builder_add(builder, "{sv}", "desktop-file", g_variant_new_string(DesktopFile()));
+ g_variant_builder_add(builder, "{sv}", "desktop-file", g_variant_new_string(DesktopFile().c_str()));
GList* children, *l;
- BamfView* view;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
GVariant* xids[(int) g_list_length(children)];
int i = 0;
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- if (BAMF_IS_WINDOW(view))
- {
- xids[i++] = g_variant_new_uint32(bamf_window_get_xid(BAMF_WINDOW(view)));
- }
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
+ xids[i++] = g_variant_new_uint32(xid);
}
g_list_free(children);
g_variant_builder_add(builder, "{sv}", "xids", g_variant_new_array(G_VARIANT_TYPE_UINT32, xids, i));
}
-bool BamfLauncherIcon::OwnsWindow(Window w)
+bool BamfLauncherIcon::OwnsWindow(Window xid) const
{
GList* children, *l;
- BamfView* view;
bool owns = false;
- if (!w) return owns;
+ if (!xid)
+ return owns;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- if (BAMF_IS_WINDOW(view))
+ if (bamf_window_get_xid(static_cast<BamfWindow*>(l->data)) == xid)
{
- guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
-
- if (xid == w)
- {
- owns = true;
- break;
- }
+ owns = true;
+ break;
}
}
@@ -480,49 +484,40 @@ bool BamfLauncherIcon::OwnsWindow(Window w)
void BamfLauncherIcon::OpenInstanceWithUris(std::set<std::string> uris)
{
- GDesktopAppInfo* appInfo;
- GError* error = NULL;
-
- appInfo = g_desktop_app_info_new_from_filename(DesktopFile());
+ glib::Error error;
+ glib::Object<GDesktopAppInfo> desktopInfo(g_desktop_app_info_new_from_filename(DesktopFile().c_str()));
+ auto appInfo = glib::object_cast<GAppInfo>(desktopInfo);
- if (g_app_info_supports_uris(G_APP_INFO(appInfo)))
+ if (g_app_info_supports_uris(appInfo))
{
- GList* list = NULL;
+ GList* list = nullptr;
for (auto it : uris)
list = g_list_prepend(list, g_strdup(it.c_str()));
- g_app_info_launch_uris(G_APP_INFO(appInfo), list, NULL, &error);
+ g_app_info_launch_uris(appInfo, list, nullptr, &error);
g_list_free_full(list, g_free);
}
- else if (g_app_info_supports_files(G_APP_INFO(appInfo)))
+ else if (g_app_info_supports_files(appInfo))
{
- GList* list = NULL, *l;
-
+ GList* list = nullptr;
+
for (auto it : uris)
{
GFile* file = g_file_new_for_uri(it.c_str());
list = g_list_prepend(list, file);
}
- g_app_info_launch(G_APP_INFO(appInfo), list, NULL, &error);
- for (l = list; l; l = l->next)
- g_object_unref(G_FILE(list->data));
-
- g_list_free(list);
+ g_app_info_launch(appInfo, list, nullptr, &error);
+ g_list_free_full(list, g_object_unref);
}
else
{
- g_app_info_launch(G_APP_INFO(appInfo), NULL, NULL, &error);
+ g_app_info_launch(appInfo, nullptr, nullptr, &error);
}
- g_object_unref(appInfo);
-
if (error)
- {
- g_warning("%s\n", error->message);
- g_error_free(error);
- }
+ g_warning("%s\n", error.Message().c_str());
UpdateQuirkTime(QUIRK_STARTING);
}
@@ -531,60 +526,59 @@ void BamfLauncherIcon::OpenInstanceLauncherIcon(ActionArg arg)
{
std::set<std::string> empty;
OpenInstanceWithUris(empty);
- ubus_server_send_message(ubus_server_get_default(), UBUS_LAUNCHER_ACTION_DONE, NULL);
+ ubus_server_send_message(ubus_server_get_default(), UBUS_LAUNCHER_ACTION_DONE, nullptr);
}
void BamfLauncherIcon::Focus(ActionArg arg)
{
GList* children, *l;
- BamfView* view;
bool any_urgent = false;
bool any_visible = false;
bool any_user_visible = false;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
std::vector<Window> windows;
/* get the list of windows */
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- if (BAMF_IS_WINDOW(view))
- {
- Window xid = bamf_window_get_xid(BAMF_WINDOW(view));
- bool urgent = bamf_view_is_urgent(view);
- bool user_visible = bamf_view_user_visible(view);
+ auto view = static_cast<BamfView*>(l->data);
- if (any_urgent)
- {
- if (urgent)
- windows.push_back(xid);
- }
- else if (any_user_visible && !urgent)
- {
- if (user_visible)
- windows.push_back(xid);
- }
- else
- {
- if (urgent || user_visible)
- {
- windows.clear();
- any_visible = false;
- any_urgent = (any_urgent || urgent);
- any_user_visible = (any_user_visible || user_visible);
- }
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
+ bool urgent = bamf_view_is_urgent(view);
+ bool user_visible = bamf_view_user_visible(view);
+ if (any_urgent)
+ {
+ if (urgent)
windows.push_back(xid);
- }
-
- if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid) &&
- WindowManager::Default()->IsWindowVisible(xid))
+ }
+ else if (any_user_visible && !urgent)
+ {
+ if (user_visible)
+ windows.push_back(xid);
+ }
+ else
+ {
+ if (urgent || user_visible)
{
- any_visible = true;
+ windows.clear();
+ any_visible = false;
+ any_urgent = (any_urgent || urgent);
+ any_user_visible = (any_user_visible || user_visible);
}
+
+ windows.push_back(xid);
+ }
+
+ if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid) &&
+ WindowManager::Default()->IsWindowVisible(xid))
+ {
+ any_visible = true;
}
}
g_list_free(children);
@@ -594,41 +588,38 @@ void BamfLauncherIcon::Focus(ActionArg arg)
if (any_visible)
{
WindowManager::Default()->FocusWindowGroup(windows,
- WindowManager::FocusVisibility::ForceUnminimizeInvisible);
+ WindowManager::FocusVisibility::ForceUnminimizeInvisible, arg.monitor);
}
else
{
WindowManager::Default()->FocusWindowGroup(windows,
- WindowManager::FocusVisibility::ForceUnminimizeOnCurrentDesktop);
+ WindowManager::FocusVisibility::ForceUnminimizeOnCurrentDesktop, arg.monitor);
}
}
else
{
WindowManager::Default()->FocusWindowGroup(windows,
- WindowManager::FocusVisibility::OnlyVisible);
+ WindowManager::FocusVisibility::OnlyVisible, arg.monitor);
}
}
bool BamfLauncherIcon::Spread(bool current_desktop, int state, bool force)
{
- BamfView* view;
GList* children, *l;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
WindowManager* wm = WindowManager::Default();
std::vector<Window> windowList;
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- if (BAMF_IS_WINDOW(view))
- {
- guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
- if (!current_desktop || (current_desktop && wm->IsWindowOnCurrentDesktop(xid)))
- {
- windowList.push_back((Window) xid);
- }
+ if (!current_desktop || (current_desktop && wm->IsWindowOnCurrentDesktop(xid)))
+ {
+ windowList.push_back(xid);
}
}
@@ -636,113 +627,41 @@ bool BamfLauncherIcon::Spread(bool current_desktop, int state, bool force)
return WindowManager::Default()->ScaleWindowGroup(windowList, state, force);
}
-void BamfLauncherIcon::OnClosed(BamfView* view, gpointer data)
-{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
-
- if (!bamf_view_is_sticky(BAMF_VIEW(self->m_App)))
- self->Remove();
-}
-
-void BamfLauncherIcon::OnUserVisibleChanged(BamfView* view, gboolean visible,
- gpointer data)
-{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
-
- if (!bamf_view_is_sticky(BAMF_VIEW(self->m_App)))
- self->SetQuirk(QUIRK_VISIBLE, visible);
-}
-
-void BamfLauncherIcon::OnRunningChanged(BamfView* view, gboolean running,
- gpointer data)
-{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
- self->SetQuirk(QUIRK_RUNNING, running);
-
- if (running)
- {
- self->EnsureWindowState();
- self->UpdateIconGeometries(self->GetCenter());
- }
-}
-
-void BamfLauncherIcon::OnActiveChanged(BamfView* view, gboolean active, gpointer data)
-{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
- self->SetQuirk(QUIRK_ACTIVE, active);
-}
-
-void BamfLauncherIcon::OnUrgentChanged(BamfView* view, gboolean urgent, gpointer data)
-{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
- self->SetQuirk(QUIRK_URGENT, urgent);
-}
-
void BamfLauncherIcon::EnsureWindowState()
{
GList* children, *l;
- bool has_win_on_current_vp = false;
- unsigned int user_visible_count = 0;
- unsigned int children_count = 0;
+ std::vector<bool> monitors;
+ monitors.resize(max_num_monitors);
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
for (l = children; l; l = l->next)
{
if (!BAMF_IS_WINDOW(l->data))
continue;
- Window xid = bamf_window_get_xid(BAMF_WINDOW(l->data));
- if (WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
- {
- has_win_on_current_vp = true;
-
- if (bamf_view_user_visible (BAMF_VIEW (l->data)))
- {
- user_visible_count++;
- }
- }
+ auto window = static_cast<BamfWindow*>(l->data);
+ Window xid = bamf_window_get_xid(window);
+ int monitor = bamf_window_get_monitor(window);
- children_count++;
+ if (monitor >= 0 && WindowManager::Default()->IsWindowOnCurrentDesktop(xid))
+ monitors[monitor] = true;
}
- if (user_visible_count > 0)
- {
- SetRelatedWindows(user_visible_count);
- }
- else if (children_count > 0)
- {
- SetRelatedWindows(1);
- }
+ for (int i = 0; i < max_num_monitors; i++)
+ SetWindowVisibleOnMonitor(monitors[i], i);
- SetHasWindowOnViewport(has_win_on_current_vp);
+ needs_redraw.emit(this);
g_list_free(children);
}
-void BamfLauncherIcon::OnChildAdded(BamfView* view, BamfView* child, gpointer data)
-{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
- self->EnsureWindowState();
- self->UpdateMenus();
- self->UpdateIconGeometries(self->GetCenter());
-}
-
-void BamfLauncherIcon::OnChildRemoved(BamfView* view, BamfView* child, gpointer data)
-{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
- self->EnsureWindowState();
-}
-
void BamfLauncherIcon::UpdateDesktopQuickList()
{
- IndicatorDesktopShortcuts* desktop_shortcuts;
GKeyFile* keyfile;
- GError* error = NULL;
- const char *desktop_file;
-
- desktop_file = DesktopFile();
+ glib::Error error;
+ std::string const& desktop_file = DesktopFile();
- if (!desktop_file || g_strcmp0(desktop_file, "") == 0)
+ if (desktop_file.empty())
return;
// check that we have the X-Ayatana-Desktop-Shortcuts flag
@@ -750,58 +669,49 @@ void BamfLauncherIcon::UpdateDesktopQuickList()
// and not report errors when it can't find the key.
// so FIXME when ted is around
keyfile = g_key_file_new();
- g_key_file_load_from_file(keyfile, desktop_file, G_KEY_FILE_NONE, &error);
+ g_key_file_load_from_file(keyfile, desktop_file.c_str(), G_KEY_FILE_NONE, &error);
- if (error != NULL)
+ if (error)
{
- g_warning("Could not load desktop file for: %s", desktop_file);
+ g_warning("Could not load desktop file for: %s", desktop_file.c_str());
g_key_file_free(keyfile);
- g_error_free(error);
return;
}
if (g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP,
- "X-Ayatana-Desktop-Shortcuts", NULL))
+ "X-Ayatana-Desktop-Shortcuts", nullptr))
{
- DbusmenuMenuitem* root = dbusmenu_menuitem_new();
- dbusmenu_menuitem_set_root(root, TRUE);
- desktop_shortcuts = indicator_desktop_shortcuts_new(desktop_file, "Unity");
- const gchar** nicks = indicator_desktop_shortcuts_get_nicks(desktop_shortcuts);
+ for (GList *l = dbusmenu_menuitem_get_children(_menu_desktop_shortcuts); l; l = l->next)
+ _gsignals.Disconnect(l->data, "item-activated");
+
+ _menu_desktop_shortcuts = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_set_root(_menu_desktop_shortcuts, TRUE);
+
+ _desktop_shortcuts = indicator_desktop_shortcuts_new(desktop_file.c_str(), "Unity");
+ const gchar** nicks = indicator_desktop_shortcuts_get_nicks(_desktop_shortcuts);
int index = 0;
- if (nicks)
+ while (nicks[index])
{
- while (((gpointer*) nicks)[index])
- {
- gchar* name;
- DbusmenuMenuitem* item;
- name = indicator_desktop_shortcuts_nick_get_name(desktop_shortcuts,
- nicks[index]);
- ShortcutData* data = g_slice_new0(ShortcutData);
- data->self = this;
- data->shortcuts = INDICATOR_DESKTOP_SHORTCUTS(g_object_ref(desktop_shortcuts));
- data->nick = g_strdup(nicks[index]);
-
- item = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, name);
- dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
- dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- g_signal_connect_data(item, "item-activated",
- (GCallback) shortcut_activated, (gpointer) data,
- (GClosureNotify) shortcut_data_destroy, (GConnectFlags)0);
-
- dbusmenu_menuitem_child_append(root, item);
-
- index++;
-
- g_free(name);
- }
+ glib::String name(indicator_desktop_shortcuts_nick_get_name(_desktop_shortcuts,
+ nicks[index]));
+ glib::Object<DbusmenuMenuitem> item(dbusmenu_menuitem_new());
+ dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, name);
+ dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ dbusmenu_menuitem_property_set(item, "shortcut-nick", nicks[index]);
+
+ auto sig = new glib::Signal<void, DbusmenuMenuitem*, gint>(item, "item-activated",
+ [&] (DbusmenuMenuitem* item, gint) {
+ const gchar *nick;
+ nick = dbusmenu_menuitem_property_get(item, "shortcut-nick");
+ indicator_desktop_shortcuts_nick_exec(_desktop_shortcuts, nick);
+ });
+ _gsignals.Add(sig);
+
+ dbusmenu_menuitem_child_append(_menu_desktop_shortcuts, item);
+ index++;
}
-
- if (G_IS_OBJECT(_menu_desktop_shortcuts))
- g_object_unref(G_OBJECT(_menu_desktop_shortcuts));
-
- _menu_desktop_shortcuts = root;
}
g_key_file_free(keyfile);
@@ -811,61 +721,60 @@ void BamfLauncherIcon::UpdateMenus()
{
GList* children, *l;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
for (l = children; l; l = l->next)
{
if (!BAMF_IS_INDICATOR(l->data))
continue;
- BamfIndicator* indicator = BAMF_INDICATOR(l->data);
+ auto indicator = static_cast<BamfIndicator*>(l->data);
std::string path = bamf_indicator_get_dbus_menu_path(indicator);
// we already have this
if (_menu_clients.find(path) != _menu_clients.end())
continue;
- DbusmenuClient* client = dbusmenu_client_new(bamf_indicator_get_remote_address(indicator), path.c_str());
- _menu_clients[path] = client;
+ std::string address = bamf_indicator_get_remote_address(indicator);
+ DbusmenuClient* client = dbusmenu_client_new(address.c_str(), path.c_str());
+ _menu_clients[path] = glib::Object<DbusmenuClient>(client);
}
g_list_free(children);
// add dynamic quicklist
- if (_menuclient_dynamic_quicklist != NULL)
+ if (DBUSMENU_IS_CLIENT(_menuclient_dynamic_quicklist))
{
- auto menu_client = DBUSMENU_CLIENT(g_object_ref(_menuclient_dynamic_quicklist));
- _menu_clients["dynamicquicklist"] = menu_client;
+ if (_menu_clients["dynamicquicklist"] != _menuclient_dynamic_quicklist)
+ {
+ _menu_clients["dynamicquicklist"] = glib::Object<DbusmenuClient>(_menuclient_dynamic_quicklist);
+ }
+ }
+ else if (_menu_clients["dynamicquicklist"])
+ {
+ _menu_clients.erase("dynamicquicklist");
+ _menuclient_dynamic_quicklist = nullptr;
}
// make a client for desktop file actions
- if (!DBUSMENU_IS_MENUITEM(_menu_desktop_shortcuts))
+ if (!DBUSMENU_IS_MENUITEM(_menu_desktop_shortcuts.RawPtr()))
{
UpdateDesktopQuickList();
}
-
-}
-
-void BamfLauncherIcon::OnQuit(DbusmenuMenuitem* item, int time, BamfLauncherIcon* self)
-{
- self->Quit();
}
void BamfLauncherIcon::Quit()
{
GList* children, *l;
- BamfView* view;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- if (BAMF_IS_WINDOW(view))
- {
- guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
- WindowManager::Default()->Close(xid);
- }
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
+ WindowManager::Default()->Close(xid);
}
g_list_free(children);
@@ -873,51 +782,41 @@ void BamfLauncherIcon::Quit()
void BamfLauncherIcon::Stick(bool save)
{
- BamfView* view = BAMF_VIEW(m_App);
-
- if (bamf_view_is_sticky(view))
+ if (IsSticky())
return;
-
- const gchar* desktop_file = DesktopFile();
- bamf_view_set_sticky(view, true);
-
- if (save && desktop_file && strlen(desktop_file) > 0)
- FavoriteStore::GetDefault().AddFavorite(desktop_file, -1);
+
+ std::string const& desktop_file = DesktopFile();
+ bamf_view_set_sticky(BAMF_VIEW(_bamf_app.RawPtr()), true);
+
+ if (save && !desktop_file.empty())
+ FavoriteStore::GetDefault().AddFavorite(desktop_file.c_str(), -1);
}
-void BamfLauncherIcon::UnStick(void)
+void BamfLauncherIcon::UnStick()
{
- BamfView* view = BAMF_VIEW(this->m_App);
-
- if (!bamf_view_is_sticky(view))
+ if (!IsSticky())
return;
- const gchar* desktop_file = DesktopFile();
+ std::string const& desktop_file = DesktopFile();
+ BamfView* view = BAMF_VIEW(_bamf_app.RawPtr());
bamf_view_set_sticky(view, false);
if (bamf_view_is_closed(view) || !bamf_view_user_visible(view))
- this->Remove();
+ Remove();
- if (desktop_file && desktop_file[0] != '\0')
- FavoriteStore::GetDefault().RemoveFavorite(desktop_file);
+ if (!desktop_file.empty())
+ FavoriteStore::GetDefault().RemoveFavorite(desktop_file.c_str());
}
-void BamfLauncherIcon::OnTogglePin(DbusmenuMenuitem* item, int time, BamfLauncherIcon* self)
+void BamfLauncherIcon::ToggleSticky()
{
- BamfView* view = BAMF_VIEW(self->m_App);
- bool sticky = bamf_view_is_sticky(view);
- const gchar* desktop_file = self->DesktopFile();
-
- if (sticky)
+ if (IsSticky())
{
- self->UnStick();
+ UnStick();
}
else
{
- bamf_view_set_sticky(view, true);
-
- if (desktop_file && strlen(desktop_file) > 0)
- FavoriteStore::GetDefault().AddFavorite(desktop_file, -1);
+ Stick();
}
}
@@ -929,17 +828,18 @@ void BamfLauncherIcon::EnsureMenuItemsReady()
if (_menu_items.find("Pin") == _menu_items.end())
{
menu_item = dbusmenu_menuitem_new();
-
dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, true);
dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true);
- _menu_callbacks["Pin"] = g_signal_connect(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, (GCallback) &BamfLauncherIcon::OnTogglePin, this);
+ _gsignals.Add(new glib::Signal<void, DbusmenuMenuitem*, int>(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ [&] (DbusmenuMenuitem*, int) {
+ ToggleSticky();
+ }));
- _menu_items["Pin"] = menu_item;
+ _menu_items["Pin"] = glib::Object<DbusmenuMenuitem>(menu_item);
}
-
- const char* label = !bamf_view_is_sticky(BAMF_VIEW(m_App)) ?
- _("Lock to launcher") : _("Unlock from launcher");
+
+ const char* label = !IsSticky() ? _("Lock to launcher") : _("Unlock from launcher");
dbusmenu_menuitem_property_set(_menu_items["Pin"], DBUSMENU_MENUITEM_PROP_LABEL, label);
@@ -948,50 +848,38 @@ void BamfLauncherIcon::EnsureMenuItemsReady()
if (_menu_items.find("Quit") == _menu_items.end())
{
menu_item = dbusmenu_menuitem_new();
-
dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Quit"));
dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, true);
dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true);
- _menu_callbacks["Quit"] = g_signal_connect(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, (GCallback) &BamfLauncherIcon::OnQuit, this);
+ _gsignals.Add(new glib::Signal<void, DbusmenuMenuitem*, int>(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ [&] (DbusmenuMenuitem*, int) {
+ Quit();
+ }));
- _menu_items["Quit"] = menu_item;
+ _menu_items["Quit"] = glib::Object<DbusmenuMenuitem>(menu_item);
}
}
-static void OnAppLabelActivated(DbusmenuMenuitem* sender,
- guint timestamp,
- gpointer data)
-{
- BamfLauncherIcon* self = NULL;
-
- if (!data)
- return;
-
- self = static_cast <BamfLauncherIcon*> (data);
- self->ActivateLauncherIcon(ActionArg(ActionArg::OTHER, 0));
-}
-
std::list<DbusmenuMenuitem*> BamfLauncherIcon::GetMenus()
{
- std::map<std::string, DbusmenuClient*>::iterator it;
std::list<DbusmenuMenuitem*> result;
bool first_separator_needed = false;
- DbusmenuMenuitem* item = NULL;
+ DbusmenuMenuitem* item = nullptr;
// FIXME for O: hack around the wrong abstraction
UpdateMenus();
- for (it = _menu_clients.begin(); it != _menu_clients.end(); it++)
+ for (auto it = _menu_clients.begin(); it != _menu_clients.end(); ++it)
{
- GList* child = NULL;
- DbusmenuClient* client = (*it).second;
+ GList* child = nullptr;
+ DbusmenuClient* client = it->second;
DbusmenuMenuitem* root = dbusmenu_client_get_root(client);
if (!root || !dbusmenu_menuitem_property_get_bool(root, DBUSMENU_MENUITEM_PROP_VISIBLE))
continue;
- for (child = dbusmenu_menuitem_get_children(root); child != NULL; child = g_list_next(child))
+ for (child = dbusmenu_menuitem_get_children(root); child; child = child->next)
{
DbusmenuMenuitem* item = (DbusmenuMenuitem*) child->data;
@@ -1009,12 +897,11 @@ std::list<DbusmenuMenuitem*> BamfLauncherIcon::GetMenus()
}
// FIXME: this should totally be added as a _menu_client
- if (DBUSMENU_IS_MENUITEM(_menu_desktop_shortcuts))
+ if (DBUSMENU_IS_MENUITEM(_menu_desktop_shortcuts.RawPtr()))
{
- GList* child = NULL;
- DbusmenuMenuitem* root = _menu_desktop_shortcuts;
+ GList* child = nullptr;
- for (child = dbusmenu_menuitem_get_children(root); child != NULL; child = g_list_next(child))
+ for (child = dbusmenu_menuitem_get_children(_menu_desktop_shortcuts); child; child = child->next)
{
DbusmenuMenuitem* item = (DbusmenuMenuitem*) child->data;
@@ -1040,7 +927,7 @@ std::list<DbusmenuMenuitem*> BamfLauncherIcon::GetMenus()
dbusmenu_menuitem_property_set(item,
DBUSMENU_MENUITEM_PROP_TYPE,
DBUSMENU_CLIENT_TYPES_SEPARATOR);
- _menu_items_extra["FirstSeparator"] = item;
+ _menu_items_extra["FirstSeparator"] = glib::Object<DbusmenuMenuitem>(item);
}
result.push_back(item);
}
@@ -1052,7 +939,7 @@ std::list<DbusmenuMenuitem*> BamfLauncherIcon::GetMenus()
}
else
{
- glib::String app_name(g_markup_escape_text(BamfName(), -1));
+ glib::String app_name(g_markup_escape_text(BamfName().c_str(), -1));
std::ostringstream bold_app_name;
bold_app_name << "<b>" << app_name << "</b>";
@@ -1066,9 +953,13 @@ std::list<DbusmenuMenuitem*> BamfLauncherIcon::GetMenus()
dbusmenu_menuitem_property_set_bool(item,
"unity-use-markup",
true);
- g_signal_connect(item, "item-activated", (GCallback) OnAppLabelActivated, this);
- _menu_items_extra["AppName"] = item;
+ _gsignals.Add(new glib::Signal<void, DbusmenuMenuitem*, int>(item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ [&] (DbusmenuMenuitem*, int) {
+ ActivateLauncherIcon(ActionArg(ActionArg::OTHER, 0));
+ }));
+
+ _menu_items_extra["AppName"] = glib::Object<DbusmenuMenuitem>(item);
}
result.push_back(item);
@@ -1083,30 +974,27 @@ std::list<DbusmenuMenuitem*> BamfLauncherIcon::GetMenus()
dbusmenu_menuitem_property_set(item,
DBUSMENU_MENUITEM_PROP_TYPE,
DBUSMENU_CLIENT_TYPES_SEPARATOR);
- _menu_items_extra["SecondSeparator"] = item;
+ _menu_items_extra["SecondSeparator"] = glib::Object<DbusmenuMenuitem>(item);
}
result.push_back(item);
EnsureMenuItemsReady();
- std::map<std::string, DbusmenuMenuitem*>::iterator it_m;
- std::list<DbusmenuMenuitem*>::iterator it_l;
- bool exists;
- for (it_m = _menu_items.begin(); it_m != _menu_items.end(); it_m++)
+ for (auto it_m = _menu_items.begin(); it_m != _menu_items.end(); ++it_m)
{
- const char* key = ((*it_m).first).c_str();
- if (g_strcmp0(key , "Quit") == 0 && !bamf_view_is_running(BAMF_VIEW(m_App)))
+ if (!IsRunning() && it_m->first == "Quit")
continue;
- exists = false;
- std::string label_default = dbusmenu_menuitem_property_get((*it_m).second, DBUSMENU_MENUITEM_PROP_LABEL);
- for (it_l = result.begin(); it_l != result.end(); it_l++)
+ bool exists = false;
+ std::string label_default(dbusmenu_menuitem_property_get(it_m->second, DBUSMENU_MENUITEM_PROP_LABEL));
+
+ for (auto menu_item : result)
{
- const gchar* type = dbusmenu_menuitem_property_get(*it_l, DBUSMENU_MENUITEM_PROP_TYPE);
- if (type == NULL)//(g_strcmp0 (type, DBUSMENU_MENUITEM_PROP_LABEL) == 0)
+ const gchar* type = dbusmenu_menuitem_property_get(menu_item, DBUSMENU_MENUITEM_PROP_TYPE);
+ if (type == nullptr)//(g_strcmp0 (type, DBUSMENU_MENUITEM_PROP_LABEL) == 0)
{
- std::string label_menu = dbusmenu_menuitem_property_get(*it_l, DBUSMENU_MENUITEM_PROP_LABEL);
- if (label_menu.compare(label_default) == 0)
+ std::string label_menu(dbusmenu_menuitem_property_get(menu_item, DBUSMENU_MENUITEM_PROP_LABEL));
+ if (label_menu == label_default)
{
exists = true;
break;
@@ -1115,72 +1003,61 @@ std::list<DbusmenuMenuitem*> BamfLauncherIcon::GetMenus()
}
if (!exists)
- result.push_back((*it_m).second);
+ result.push_back(it_m->second);
}
return result;
}
-
-void BamfLauncherIcon::UpdateIconGeometries(nux::Point3 center)
+void BamfLauncherIcon::UpdateIconGeometries(std::vector<nux::Point3> center)
{
GList* children, *l;
- BamfView* view;
nux::Geometry geo;
- if (_launcher->Hidden() && !_launcher->ShowOnEdge())
- {
- geo.x = 0;
- geo.y = 0;
- }
- else
- {
- geo.x = center.x - 24;
- geo.y = center.y - 24;
- }
+ geo.x = center[0].x - 24;
+ geo.y = center[0].y - 24;
geo.width = 48;
geo.height = 48;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- if (BAMF_IS_WINDOW(view))
- {
- guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
- WindowManager::Default()->SetWindowIconGeometry((Window)xid, geo);
- }
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
+ WindowManager::Default()->SetWindowIconGeometry(xid, geo);
}
g_list_free(children);
}
-void BamfLauncherIcon::OnCenterStabilized(nux::Point3 center)
+void BamfLauncherIcon::OnCenterStabilized(std::vector<nux::Point3> center)
{
UpdateIconGeometries(center);
}
const gchar* BamfLauncherIcon::GetRemoteUri()
{
- if (!_remote_uri)
+ if (_remote_uri.empty())
{
- const gchar* desktop_file = DesktopFile();
- gchar* basename = g_path_get_basename(desktop_file);
+ const std::string prefix = "application://";
+ glib::String basename(g_path_get_basename(DesktopFile().c_str()));
- _remote_uri = g_strdup_printf("application://%s", basename);
-
- g_free(basename);
+ if (!basename.Str().empty())
+ {
+ _remote_uri = prefix + basename.Str();
+ }
}
- return _remote_uri;
+ return _remote_uri.c_str();
}
std::set<std::string> BamfLauncherIcon::ValidateUrisForLaunch(unity::DndData& uris)
{
std::set<std::string> result;
- gboolean is_home_launcher = g_str_has_suffix(DesktopFile(), "nautilus-home.desktop");
+ gboolean is_home_launcher = g_str_has_suffix(DesktopFile().c_str(), "nautilus-home.desktop");
if (is_home_launcher)
{
@@ -1190,34 +1067,38 @@ std::set<std::string> BamfLauncherIcon::ValidateUrisForLaunch(unity::DndData& ur
}
for (auto i : uris.Types())
+ {
for (auto j : GetSupportedTypes())
+ {
if (g_content_type_is_a(i.c_str(), j.c_str()))
{
for (auto k : uris.UrisByType(i))
result.insert(k);
-
+
break;
}
-
+ }
+ }
+
return result;
}
-gboolean BamfLauncherIcon::OnDndHoveredTimeout(gpointer data)
+void BamfLauncherIcon::OnDndHovered()
{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
-
// for now, let's not do this, it turns out to be quite buggy
- //if (self->_dnd_hovered && bamf_view_is_running(BAMF_VIEW(self->m_App)))
- // self->Spread(CompAction::StateInitEdgeDnd, true);
-
- self->_dnd_hover_timer = 0;
- return false;
+ //if (_dnd_hovered && IsRunning())
+ // Spread(CompAction::StateInitEdgeDnd, true);
}
void BamfLauncherIcon::OnDndEnter()
{
_dnd_hovered = true;
- _dnd_hover_timer = g_timeout_add(1000, &BamfLauncherIcon::OnDndHoveredTimeout, this);
+ _dnd_hover_timer = g_timeout_add(1000, [] (gpointer data) -> gboolean {
+ BamfLauncherIcon* self = static_cast<BamfLauncherIcon*>(data);
+ self->OnDndHovered();
+ self->_dnd_hover_timer = 0;
+ return false;
+ }, this);
}
void BamfLauncherIcon::OnDndLeave()
@@ -1234,122 +1115,111 @@ nux::DndAction BamfLauncherIcon::OnQueryAcceptDrop(unity::DndData& dnd_data)
return ValidateUrisForLaunch(dnd_data).empty() ? nux::DNDACTION_NONE : nux::DNDACTION_COPY;
}
-void BamfLauncherIcon::OnAcceptDrop(unity::DndData& dnd_data)
+void BamfLauncherIcon::OnAcceptDrop(unity::DndData& dnd_data)
{
OpenInstanceWithUris(ValidateUrisForLaunch(dnd_data));
}
-void BamfLauncherIcon::OnDesktopFileChanged(GFileMonitor* monitor,
- GFile* file,
- GFile* other_file,
- GFileMonitorEvent event_type,
- gpointer data)
+bool BamfLauncherIcon::ShowInSwitcher(bool current)
{
- BamfLauncherIcon* self = static_cast<BamfLauncherIcon*>(data);
- switch (event_type)
+ bool result = false;
+
+ if (IsRunning() && IsVisible())
{
- case G_FILE_MONITOR_EVENT_DELETED:
- self->UnStick();
- break;
- case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
- self->UpdateDesktopQuickList();
- break;
- default:
- break;
+ if (current)
+ {
+ result = true;
+ }
+ else
+ {
+ for (int i = 0; i < max_num_monitors; i++)
+ {
+ if (WindowVisibleOnMonitor(i))
+ {
+ result = true;
+ break;
+ }
+ }
+ }
}
-}
-bool
-BamfLauncherIcon::ShowInSwitcher()
-{
- return GetQuirk(QUIRK_RUNNING) && GetQuirk(QUIRK_VISIBLE);
+ return result;
}
-unsigned long long
-BamfLauncherIcon::SwitcherPriority()
+unsigned long long BamfLauncherIcon::SwitcherPriority()
{
GList* children, *l;
- BamfView* view;
unsigned long long result = 0;
- children = bamf_view_get_children(BAMF_VIEW(m_App));
+ children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
/* get the list of windows */
for (l = children; l; l = l->next)
{
- view = static_cast <BamfView*> (l->data);
+ if (!BAMF_IS_WINDOW(l->data))
+ continue;
- if (BAMF_IS_WINDOW(view))
- {
- guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
- result = std::max(result, WindowManager::Default()->GetWindowActiveNumber (xid));
- }
+ Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
+ result = std::max(result, WindowManager::Default()->GetWindowActiveNumber(xid));
}
g_list_free(children);
return result;
}
-const std::set<std::string>&
-BamfLauncherIcon::GetSupportedTypes()
+const std::set<std::string>& BamfLauncherIcon::GetSupportedTypes()
{
if (!_supported_types_filled)
- FillSupportedTypes(this);
-
+ FillSupportedTypes();
+
return _supported_types;
}
-gboolean
-BamfLauncherIcon::FillSupportedTypes(gpointer data)
+void BamfLauncherIcon::FillSupportedTypes()
{
- BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
-
- if (self->_fill_supported_types_id)
+ if (_fill_supported_types_id)
{
- g_source_remove(self->_fill_supported_types_id);
- self->_fill_supported_types_id = 0;
+ g_source_remove(_fill_supported_types_id);
+ _fill_supported_types_id = 0;
}
-
- if (!self->_supported_types_filled)
+
+ if (!_supported_types_filled)
{
- self->_supported_types_filled = true;
-
- self->_supported_types.clear();
-
- const char* desktop_file = self->DesktopFile();
-
- if (!desktop_file || strlen(desktop_file) <= 1)
- return false;
-
+ _supported_types_filled = true;
+ _supported_types.clear();
+
+ std::string const& desktop_file = DesktopFile();
+
+ if (desktop_file.empty())
+ return;
+
GKeyFile* key_file = g_key_file_new();
- unity::glib::Error error;
+ glib::Error error;
- g_key_file_load_from_file(key_file, desktop_file, (GKeyFileFlags) 0, &error);
+ g_key_file_load_from_file(key_file, desktop_file.c_str(), (GKeyFileFlags) 0, &error);
if (error)
{
g_key_file_free(key_file);
- return false;
+ return;
}
-
- char** mimes = g_key_file_get_string_list(key_file, "Desktop Entry", "MimeType", NULL, NULL);
+
+ char** mimes = g_key_file_get_string_list(key_file, "Desktop Entry", "MimeType", nullptr, nullptr);
if (!mimes)
{
g_key_file_free(key_file);
- return false;
+ return;
}
-
- for (int i=0; mimes[i]; i++)
+
+ for (int i = 0; mimes[i]; i++)
{
unity::glib::String super_type(g_content_type_from_mime_type(mimes[i]));
- self->_supported_types.insert(super_type.Str());
+ _supported_types.insert(super_type.Str());
}
-
+
g_key_file_free(key_file);
g_strfreev(mimes);
}
-
- return false;
}
} // namespace launcher
diff --git a/plugins/unityshell/src/BamfLauncherIcon.h b/plugins/unityshell/src/BamfLauncherIcon.h
index 24c1e053a..900a80152 100644
--- a/plugins/unityshell/src/BamfLauncherIcon.h
+++ b/plugins/unityshell/src/BamfLauncherIcon.h
@@ -1,6 +1,6 @@
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
- * Copyright (C) 2010 Canonical Ltd
+ * Copyright (C) 2010-2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -15,19 +15,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Jason Smith <jason.smith@canonical.com>
+ * Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
*/
#ifndef BAMFLAUNCHERICON_H
#define BAMFLAUNCHERICON_H
-/* Compiz */
-#include <core/core.h>
+#include <UnityCore/GLibSignal.h>
+#include <UnityCore/GLibWrapper.h>
-#include <Nux/BaseWindow.h>
-#include <NuxCore/Math/MathInc.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libbamf/libbamf.h>
-#include <sigc++/sigc++.h>
+#include <libindicator/indicator-desktop-shortcuts.h>
#include "SimpleLauncherIcon.h"
@@ -41,111 +39,89 @@ class Launcher;
class BamfLauncherIcon : public SimpleLauncherIcon
{
public:
- BamfLauncherIcon(Launcher* IconManager, BamfApplication* app);
+ BamfLauncherIcon(BamfApplication* app);
virtual ~BamfLauncherIcon();
- const char* DesktopFile();
- bool IsSticky();
- void Stick(bool save = true);
- void UnStick();
- void Quit();
-
void ActivateLauncherIcon(ActionArg arg);
- virtual bool ShowInSwitcher();
- virtual unsigned long long SwitcherPriority();
-
- std::vector<Window> RelatedXids ();
+ std::string DesktopFile();
- std::string NameForWindow (Window window);
+ bool IsSticky() const;
+ bool IsVisible() const;
+ bool IsActive() const;
+ bool IsRunning() const;
+ bool IsUrgent() const;
-protected:
- std::list<DbusmenuMenuitem*> GetMenus();
+ void Quit();
+ void Stick(bool save = true);
+ void UnStick();
- void UpdateIconGeometries(nux::Point3 center);
- void OnCenterStabilized(nux::Point3 center);
+ virtual bool ShowInSwitcher(bool current);
+ virtual unsigned long long SwitcherPriority();
- void OnLauncherHiddenChanged();
+ std::vector<Window> Windows();
+ std::vector<Window> WindowsForMonitor(int monitor);
+ std::string NameForWindow(Window window);
+protected:
+ void UpdateIconGeometries(std::vector<nux::Point3> center);
+ void OnCenterStabilized(std::vector<nux::Point3> center);
void AddProperties(GVariantBuilder* builder);
-
- const gchar* GetRemoteUri();
-
- nux::DndAction OnQueryAcceptDrop(unity::DndData& dnd_data);
void OnAcceptDrop(unity::DndData& dnd_data);
void OnDndEnter();
+ void OnDndHovered();
void OnDndLeave();
-
void OpenInstanceLauncherIcon(ActionArg arg);
+ void ToggleSticky();
+ nux::DndAction OnQueryAcceptDrop(unity::DndData& dnd_data);
+
+ std::list<DbusmenuMenuitem*> GetMenus();
std::set<std::string> ValidateUrisForLaunch(unity::DndData& dnd_data);
- const char* BamfName();
+ const gchar* GetRemoteUri();
+ std::string BamfName() const;
- bool HandlesSpread () { return true; }
+ bool HandlesSpread() { return true; }
private:
- BamfApplication* m_App;
- Launcher* _launcher;
- std::map<std::string, DbusmenuClient*> _menu_clients;
- std::map<std::string, DbusmenuMenuitem*> _menu_items;
- std::map<std::string, DbusmenuMenuitem*> _menu_items_extra;
- std::map<std::string, gulong> _menu_callbacks;
- DbusmenuMenuitem* _menu_desktop_shortcuts;
- gchar* _remote_uri;
- bool _dnd_hovered;
- guint _dnd_hover_timer;
-
- gchar* _cached_desktop_file;
- gchar* _cached_name;
-
- GFileMonitor* _desktop_file_monitor;
- gulong _on_desktop_file_changed_handler_id;
-
- std::set<std::string> _supported_types;
- bool _supported_types_filled;
- guint _fill_supported_types_id;
- guint32 _window_moved_id;
- guint32 _window_moved_xid;
-
void EnsureWindowState();
-
+ void EnsureMenuItemsReady();
void UpdateDesktopFile();
void UpdateMenus();
void UpdateDesktopQuickList();
+ void FillSupportedTypes();
void OpenInstanceWithUris(std::set<std::string> uris);
void Focus(ActionArg arg);
bool Spread(bool current_desktop, int state, bool force);
- void EnsureMenuItemsReady();
-
void OnWindowMinimized(guint32 xid);
void OnWindowMoved(guint32 xid);
- bool OwnsWindow(Window w);
-
+
+ bool OwnsWindow(Window w) const;
+
const std::set<std::string>& GetSupportedTypes();
- static void OnClosed(BamfView* view, gpointer data);
- static void OnUserVisibleChanged(BamfView* view, gboolean visible, gpointer data);
- static void OnActiveChanged(BamfView* view, gboolean active, gpointer data);
- static void OnRunningChanged(BamfView* view, gboolean running, gpointer data);
- static void OnUrgentChanged(BamfView* view, gboolean urgent, gpointer data);
- static void OnChildAdded(BamfView* view, BamfView* child, gpointer data);
- static void OnChildRemoved(BamfView* view, BamfView* child, gpointer data);
-
- static void OnQuit(DbusmenuMenuitem* item, int time, BamfLauncherIcon* self);
- static void OnLaunch(DbusmenuMenuitem* item, int time, BamfLauncherIcon* self);
- static void OnTogglePin(DbusmenuMenuitem* item, int time, BamfLauncherIcon* self);
-
- static void OnDesktopFileChanged(GFileMonitor* monitor,
- GFile* file,
- GFile* other_file,
- GFileMonitorEvent event_type,
- gpointer data);
-
- static gboolean OnDndHoveredTimeout(gpointer data);
- static gboolean FillSupportedTypes(gpointer data);
+
+ glib::Object<BamfApplication> _bamf_app;
+ bool _dnd_hovered;
+ guint _dnd_hover_timer;
+
+ bool _supported_types_filled;
+ guint _fill_supported_types_id;
+ guint _window_moved_id;
+
+ std::string _remote_uri;
+ std::string _desktop_file;
+ std::set<std::string> _supported_types;
+ std::map<std::string, glib::Object<DbusmenuClient>> _menu_clients;
+ std::map<std::string, glib::Object<DbusmenuMenuitem>> _menu_items;
+ std::map<std::string, glib::Object<DbusmenuMenuitem>> _menu_items_extra;
+ glib::Object<IndicatorDesktopShortcuts> _desktop_shortcuts;
+ glib::Object<DbusmenuMenuitem> _menu_desktop_shortcuts;
+ glib::Object<GFileMonitor> _desktop_file_monitor;
+ glib::SignalManager _gsignals;
};
}
diff --git a/plugins/unityshell/src/DashController.cpp b/plugins/unityshell/src/DashController.cpp
index d0e2cbac9..afcc2efbe 100644
--- a/plugins/unityshell/src/DashController.cpp
+++ b/plugins/unityshell/src/DashController.cpp
@@ -151,7 +151,7 @@ void Controller::OnWindowConfigure(int window_width, int window_height,
nux::Geometry Controller::GetIdealWindowGeometry()
{
UScreen *uscreen = UScreen::GetDefault();
- int primary_monitor = uscreen->GetPrimaryMonitor();
+ int primary_monitor = uscreen->GetMonitorWithMouse();
auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor);
// We want to cover as much of the screen as possible to grab any mouse events outside
@@ -169,6 +169,7 @@ void Controller::Relayout(GdkScreen*screen)
nux::Geometry geo = GetIdealWindowGeometry();
window_->SetGeometry(geo);
view_->Relayout();
+ view_->SetMonitorOffset(launcher_width, panel_height);
}
void Controller::OnMouseDownOutsideWindow(int x, int y,
@@ -242,7 +243,8 @@ void Controller::ShowDash()
StartShowHideTimeline();
- ubus_manager_.SendMessage(UBUS_PLACE_VIEW_SHOWN);
+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, UScreen::GetDefault()->GetMonitorWithMouse());
+ ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info);
}
void Controller::HideDash(bool restore)
@@ -262,8 +264,9 @@ void Controller::HideDash(bool restore)
PluginAdapter::Default ()->restoreInputFocus ();
StartShowHideTimeline();
-
- ubus_manager_.SendMessage(UBUS_PLACE_VIEW_HIDDEN);
+
+ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, g_variant_new_int32(UScreen::GetDefault()->GetMonitorWithMouse()));
+ ubus_manager_.SendMessage(UBUS_OVERLAY_HIDDEN, info);
}
void Controller::StartShowHideTimeline()
diff --git a/plugins/unityshell/src/DashSearchBar.cpp b/plugins/unityshell/src/DashSearchBar.cpp
index 3088fad5a..090d70ebc 100644
--- a/plugins/unityshell/src/DashSearchBar.cpp
+++ b/plugins/unityshell/src/DashSearchBar.cpp
@@ -474,4 +474,4 @@ void SearchBar::AddProperties(GVariantBuilder* builder)
}
} // namespace dash
-} // namespace unity \ No newline at end of file
+} // namespace unity
diff --git a/plugins/unityshell/src/DashSettings.cpp b/plugins/unityshell/src/DashSettings.cpp
index 7833f79a5..e1a417853 100644
--- a/plugins/unityshell/src/DashSettings.cpp
+++ b/plugins/unityshell/src/DashSettings.cpp
@@ -80,7 +80,7 @@ void Settings::Impl::Refresh()
if (raw_from_factor == 0) //Automatic
{
UScreen *uscreen = UScreen::GetDefault();
- int primary_monitor = uscreen->GetPrimaryMonitor();
+ int primary_monitor = uscreen->GetMonitorWithMouse();
auto geo = uscreen->GetMonitorGeometry(primary_monitor);
form_factor_ = geo.height > 799 ? FormFactor::DESKTOP : FormFactor::NETBOOK;
diff --git a/plugins/unityshell/src/DashView.cpp b/plugins/unityshell/src/DashView.cpp
index cc1b7807e..bde256eee 100644
--- a/plugins/unityshell/src/DashView.cpp
+++ b/plugins/unityshell/src/DashView.cpp
@@ -79,6 +79,12 @@ DashView::~DashView()
g_source_remove (searching_timeout_id_);
}
+void DashView::SetMonitorOffset(int x, int y)
+{
+ renderer_.x_offset = x;
+ renderer_.y_offset = y;
+}
+
void DashView::AboutToShow()
{
ubus_manager_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT);
diff --git a/plugins/unityshell/src/DashView.h b/plugins/unityshell/src/DashView.h
index 9c881289d..938950665 100644
--- a/plugins/unityshell/src/DashView.h
+++ b/plugins/unityshell/src/DashView.h
@@ -56,6 +56,7 @@ public:
void Relayout();
void DisableBlur();
void OnActivateRequest(GVariant* args);
+ void SetMonitorOffset(int x, int y);
std::string const GetIdForShortcutActivation(std::string const& shortcut) const;
std::vector<char> GetAllShortcuts();
diff --git a/plugins/unityshell/src/Decaymulator.cpp b/plugins/unityshell/src/Decaymulator.cpp
new file mode 100644
index 000000000..03fe54a09
--- /dev/null
+++ b/plugins/unityshell/src/Decaymulator.cpp
@@ -0,0 +1,58 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ */
+
+#include "Decaymulator.h"
+
+namespace unity {
+namespace ui {
+
+Decaymulator::Decaymulator()
+{
+ on_decay_handle = 0;
+ value.changed.connect(sigc::mem_fun(this, &Decaymulator::OnValueChanged));
+}
+
+void Decaymulator::OnValueChanged(int value)
+{
+ if (!on_decay_handle && value > 0)
+ {
+ on_decay_handle = g_timeout_add(10, &Decaymulator::OnDecayTimeout, this);
+ }
+}
+
+gboolean Decaymulator::OnDecayTimeout(gpointer data)
+{
+ Decaymulator* self = (Decaymulator*) data;
+
+ int partial_decay = self->rate_of_decay / 100;
+
+ if (self->value <= partial_decay)
+ {
+ self->value = 0;
+ self->on_decay_handle = 0;
+ return FALSE;
+ }
+
+
+ self->value = self->value - partial_decay;
+ return TRUE;
+}
+
+}
+} \ No newline at end of file
diff --git a/plugins/unityshell/src/Decaymulator.h b/plugins/unityshell/src/Decaymulator.h
new file mode 100644
index 000000000..a0f26aa13
--- /dev/null
+++ b/plugins/unityshell/src/Decaymulator.h
@@ -0,0 +1,51 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ */
+
+#ifndef UNITY_DECAYMULATOR_H
+#define UNITY_DECAYMULATOR_H
+
+#include <Nux/Nux.h>
+#include <glib.h>
+
+namespace unity
+{
+namespace ui
+{
+
+class Decaymulator
+{
+public:
+ typedef std::shared_ptr<Decaymulator> Ptr;
+
+ nux::Property<int> rate_of_decay;
+ nux::Property<int> value;
+
+ Decaymulator();
+
+private:
+ void OnValueChanged(int value);
+ static gboolean OnDecayTimeout (gpointer value);
+
+ guint on_decay_handle;
+};
+
+}
+}
+
+#endif \ No newline at end of file
diff --git a/plugins/unityshell/src/DesktopLauncherIcon.cpp b/plugins/unityshell/src/DesktopLauncherIcon.cpp
index 0adc79de7..ae474aade 100644
--- a/plugins/unityshell/src/DesktopLauncherIcon.cpp
+++ b/plugins/unityshell/src/DesktopLauncherIcon.cpp
@@ -27,14 +27,14 @@ namespace unity
namespace launcher
{
-DesktopLauncherIcon::DesktopLauncherIcon(Launcher* IconManager)
- : SimpleLauncherIcon(IconManager)
+DesktopLauncherIcon::DesktopLauncherIcon()
+ : SimpleLauncherIcon()
, show_in_switcher_(true)
{
tooltip_text = _("Show Desktop");
icon_name = "desktop";
SetQuirk(QUIRK_VISIBLE, true);
- SetQuirk(QUIRK_RUNNING, true);
+ SetQuirk(QUIRK_RUNNING, false);
SetIconType(TYPE_BEGIN);
}
diff --git a/plugins/unityshell/src/DesktopLauncherIcon.h b/plugins/unityshell/src/DesktopLauncherIcon.h
index 078228bde..05ad51f31 100644
--- a/plugins/unityshell/src/DesktopLauncherIcon.h
+++ b/plugins/unityshell/src/DesktopLauncherIcon.h
@@ -31,7 +31,7 @@ class DesktopLauncherIcon : public SimpleLauncherIcon
{
public:
- DesktopLauncherIcon(Launcher* launcher);
+ DesktopLauncherIcon();
~DesktopLauncherIcon();
virtual nux::Color BackgroundColor();
@@ -42,12 +42,7 @@ public:
show_in_switcher_ = show_in_switcher;
}
- const bool HasWindowOnViewport()
- {
- return true;
- }
-
- bool ShowInSwitcher()
+ bool ShowInSwitcher(bool current)
{
return show_in_switcher_;
}
diff --git a/plugins/unityshell/src/DeviceLauncherIcon.cpp b/plugins/unityshell/src/DeviceLauncherIcon.cpp
index dac1c9f76..eca15f17a 100644
--- a/plugins/unityshell/src/DeviceLauncherIcon.cpp
+++ b/plugins/unityshell/src/DeviceLauncherIcon.cpp
@@ -43,8 +43,8 @@ GduDevice* get_device_for_device_file (const gchar *device_file);
}
-DeviceLauncherIcon::DeviceLauncherIcon(Launcher* launcher, GVolume* volume)
- : SimpleLauncherIcon(launcher)
+DeviceLauncherIcon::DeviceLauncherIcon(GVolume* volume)
+ : SimpleLauncherIcon()
, volume_(volume)
, device_file_(g_volume_get_identifier(volume_, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE))
, gdu_device_(get_device_for_device_file(device_file_))
diff --git a/plugins/unityshell/src/DeviceLauncherIcon.h b/plugins/unityshell/src/DeviceLauncherIcon.h
index 28b8204a7..4c52b451b 100644
--- a/plugins/unityshell/src/DeviceLauncherIcon.h
+++ b/plugins/unityshell/src/DeviceLauncherIcon.h
@@ -36,7 +36,7 @@ class DeviceLauncherIcon : public SimpleLauncherIcon
{
public:
- DeviceLauncherIcon(Launcher* launcher, GVolume* volume);
+ DeviceLauncherIcon(GVolume* volume);
virtual nux::Color BackgroundColor();
virtual nux::Color GlowColor();
diff --git a/plugins/unityshell/src/DeviceLauncherSection.cpp b/plugins/unityshell/src/DeviceLauncherSection.cpp
index cf9c79f09..6958f0a12 100644
--- a/plugins/unityshell/src/DeviceLauncherSection.cpp
+++ b/plugins/unityshell/src/DeviceLauncherSection.cpp
@@ -23,9 +23,8 @@ namespace unity
namespace launcher
{
-DeviceLauncherSection::DeviceLauncherSection(Launcher* launcher)
- : launcher_(launcher)
- , monitor_(g_volume_monitor_get())
+DeviceLauncherSection::DeviceLauncherSection()
+ : monitor_(g_volume_monitor_get())
{
on_volume_added_handler_id_ = g_signal_connect(monitor_,
"volume-added",
@@ -79,7 +78,7 @@ bool DeviceLauncherSection::PopulateEntries(DeviceLauncherSection* self)
for (GList* v = volumes; v; v = v->next)
{
glib::Object<GVolume> volume((GVolume* )v->data);
- DeviceLauncherIcon* icon = new DeviceLauncherIcon(self->launcher_, volume);
+ DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);
self->map_[volume] = icon;
self->IconAdded.emit(icon);
@@ -100,7 +99,7 @@ void DeviceLauncherSection::OnVolumeAdded(GVolumeMonitor* monitor,
GVolume* volume,
DeviceLauncherSection* self)
{
- DeviceLauncherIcon* icon = new DeviceLauncherIcon(self->launcher_, volume);
+ DeviceLauncherIcon* icon = new DeviceLauncherIcon(volume);
self->map_[volume] = icon;
self->IconAdded.emit(icon);
diff --git a/plugins/unityshell/src/DeviceLauncherSection.h b/plugins/unityshell/src/DeviceLauncherSection.h
index e940eec89..6cc770d9f 100644
--- a/plugins/unityshell/src/DeviceLauncherSection.h
+++ b/plugins/unityshell/src/DeviceLauncherSection.h
@@ -39,7 +39,7 @@ namespace launcher
class DeviceLauncherSection : public sigc::trackable
{
public:
- DeviceLauncherSection(Launcher* launcher);
+ DeviceLauncherSection();
~DeviceLauncherSection();
sigc::signal<void, LauncherIcon*> IconAdded;
@@ -64,7 +64,6 @@ private:
DeviceLauncherSection* self);
private:
- Launcher* launcher_;
glib::Object<GVolumeMonitor> monitor_;
std::map<GVolume*, DeviceLauncherIcon*> map_;
gulong on_volume_added_handler_id_;
diff --git a/plugins/unityshell/src/FilterBasicButton.cpp b/plugins/unityshell/src/FilterBasicButton.cpp
index a4257f212..e75cdff11 100644
--- a/plugins/unityshell/src/FilterBasicButton.cpp
+++ b/plugins/unityshell/src/FilterBasicButton.cpp
@@ -36,33 +36,39 @@ namespace dash
FilterBasicButton::FilterBasicButton(nux::TextureArea* image, NUX_FILE_LINE_DECL)
: nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
{
- InitTheme();
+ Init();
}
FilterBasicButton::FilterBasicButton(std::string const& label, NUX_FILE_LINE_DECL)
: nux::ToggleButton(NUX_FILE_LINE_PARAM)
, label_(label)
{
- InitTheme();
+ Init();
}
FilterBasicButton::FilterBasicButton(std::string const& label, nux::TextureArea* image, NUX_FILE_LINE_DECL)
: nux::ToggleButton(image, NUX_FILE_LINE_PARAM)
, label_(label)
{
- InitTheme();
+ Init();
}
FilterBasicButton::FilterBasicButton(NUX_FILE_LINE_DECL)
: nux::ToggleButton(NUX_FILE_LINE_PARAM)
{
- InitTheme();
+ Init();
}
FilterBasicButton::~FilterBasicButton()
{
}
+void FilterBasicButton::Init()
+{
+ InitTheme();
+ SetAcceptKeyNavFocusOnMouseDown(false);
+}
+
void FilterBasicButton::InitTheme()
{
if (!active_)
@@ -144,4 +150,4 @@ void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
}
} // namespace dash
-} // namespace unity \ No newline at end of file
+} // namespace unity
diff --git a/plugins/unityshell/src/FilterBasicButton.h b/plugins/unityshell/src/FilterBasicButton.h
index 86de6102c..4de0e7292 100644
--- a/plugins/unityshell/src/FilterBasicButton.h
+++ b/plugins/unityshell/src/FilterBasicButton.h
@@ -46,6 +46,7 @@ protected:
virtual long ComputeContentSize();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
+ void Init();
void InitTheme();
void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
diff --git a/plugins/unityshell/src/FilterExpanderLabel.cpp b/plugins/unityshell/src/FilterExpanderLabel.cpp
index e5e4b3691..35543bd7c 100644
--- a/plugins/unityshell/src/FilterExpanderLabel.cpp
+++ b/plugins/unityshell/src/FilterExpanderLabel.cpp
@@ -93,6 +93,8 @@ void FilterExpanderLabel::BuildLayout()
cairo_label_ = new nux::StaticText(label_.c_str(), NUX_TRACKER_LOCATION);
cairo_label_->SetFontName("Ubuntu 10");
cairo_label_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
+ cairo_label_->SetAcceptKeyNavFocusOnMouseDown(false);
+
cairo_label_->mouse_down.connect(
[&](int x, int y, unsigned long button_flags, unsigned long key_flag)
{
@@ -174,4 +176,4 @@ void FilterExpanderLabel::DrawContent(nux::GraphicsEngine& GfxContext, bool forc
}
} // namespace dash
-} // namespace unity \ No newline at end of file
+} // namespace unity
diff --git a/plugins/unityshell/src/FilterMultiRangeButton.cpp b/plugins/unityshell/src/FilterMultiRangeButton.cpp
index 1ae86f9b0..ea613ea18 100644
--- a/plugins/unityshell/src/FilterMultiRangeButton.cpp
+++ b/plugins/unityshell/src/FilterMultiRangeButton.cpp
@@ -45,6 +45,8 @@ FilterMultiRangeButton::FilterMultiRangeButton(NUX_FILE_LINE_DECL)
, side_(MultiRangeSide::CENTER)
{
InitTheme();
+ SetAcceptKeyNavFocusOnMouseDown(false);
+
state_change.connect(sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
}
diff --git a/plugins/unityshell/src/FilterRatingsButton.cpp b/plugins/unityshell/src/FilterRatingsButton.cpp
index 417e25f4a..9b1cb65ca 100644
--- a/plugins/unityshell/src/FilterRatingsButton.cpp
+++ b/plugins/unityshell/src/FilterRatingsButton.cpp
@@ -36,6 +36,7 @@ FilterRatingsButton::FilterRatingsButton(NUX_FILE_LINE_DECL)
: nux::ToggleButton(NUX_FILE_LINE_PARAM)
{
InitTheme();
+ SetAcceptKeyNavFocusOnMouseDown(false);
mouse_up.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseUp));
mouse_drag.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseDrag));
diff --git a/plugins/unityshell/src/FilterWidget.cpp b/plugins/unityshell/src/FilterWidget.cpp
index 650300fab..655037421 100644
--- a/plugins/unityshell/src/FilterWidget.cpp
+++ b/plugins/unityshell/src/FilterWidget.cpp
@@ -32,6 +32,7 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterWidget);
FilterWidget::FilterWidget( NUX_FILE_LINE_DECL)
: nux::View(NUX_FILE_LINE_PARAM)
{
+ SetAcceptKeyNavFocusOnMouseDown(false);
}
} // namespace dash
diff --git a/plugins/unityshell/src/IconRenderer.cpp b/plugins/unityshell/src/IconRenderer.cpp
index 2c6cb41e4..6eeff066c 100644
--- a/plugins/unityshell/src/IconRenderer.cpp
+++ b/plugins/unityshell/src/IconRenderer.cpp
@@ -63,9 +63,9 @@ namespace ui
*/
// halfed lumin values to provide darkening while desaturating in shader
-#define LUMIN_RED "0.15"
-#define LUMIN_GREEN "0.295"
-#define LUMIN_BLUE "0.055"
+#define LUMIN_RED "0.30"
+#define LUMIN_GREEN "0.59"
+#define LUMIN_BLUE "0.11"
nux::NString gPerspectiveCorrectShader = TEXT(
"[Vertex Shader] \n"
@@ -91,6 +91,7 @@ varying vec4 varyTexCoord0; \n\
uniform sampler2D TextureObject0; \n\
uniform vec4 color0; \n\
uniform vec4 desat_factor; \n\
+uniform vec4 colorify_color; \n\
vec4 SampleTexture(sampler2D TexObject, vec4 TexCoord) \n\
{ \n\
return texture2D(TexObject, TexCoord.st); \n\
@@ -105,6 +106,7 @@ void main() \n\
vec4 texel = color0 * SampleTexture(TextureObject0, tex); \n\
vec4 desat = vec4 ("LUMIN_RED"*texel.r + "LUMIN_GREEN"*texel.g + "LUMIN_BLUE"*texel.b); \n\
vec4 final_color = (vec4 (1.0, 1.0, 1.0, 1.0) - desat_factor) * desat + desat_factor * texel; \n\
+ final_color = colorify_color * final_color; \n\
final_color.a = texel.a; \n\
gl_FragColor = final_color; \n\
} \n\
@@ -369,7 +371,7 @@ void IconRenderer::UpdateIconSectionTransform(launcher::AbstractLauncherIcon* ic
v3.y = -geo.height * (v3.y - 1.0f) / 2.0f - geo.height / 2.0f + yy + hh / 2.0f;
- std::vector<nux::Vector4>& vectors = icon->GetTransform(index);
+ std::vector<nux::Vector4>& vectors = icon->GetTransform(index, monitor);
vectors[0] = v0;
vectors[1] = v1;
@@ -392,6 +394,7 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
nux::Color background_color = arg.icon->BackgroundColor();
nux::Color glow_color = arg.icon->GlowColor();
nux::Color edge_color(0x55555555);
+ nux::Color colorify = arg.colorify;
float backlight_intensity = arg.backlight_intensity;
float glow_intensity = arg.glow_intensity;
@@ -399,11 +402,14 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
nux::BaseTexture* glow = local::icon_glow[size];
nux::BaseTexture* shine = local::icon_shine[size];
+ bool force_filter = icon_size != background->GetWidth();
+
if (arg.keyboard_nav_hl)
{
background_color = nux::color::White;
glow_color = nux::color::White;
edge_color = nux::color::White;
+ colorify = nux::color::White;
backlight_intensity = 0.95;
glow_intensity = 1.0f;
@@ -420,7 +426,7 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
shine = local::squircle_shine;
}
- auto tile_transform = arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_TILE);
+ auto tile_transform = arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_TILE, monitor);
// draw tile
if (backlight_intensity > 0 && !arg.draw_edge_only)
@@ -429,7 +435,9 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
background->GetDeviceTexture(),
background_color,
+ arg.colorify,
backlight_intensity * arg.alpha,
+ force_filter,
tile_transform);
}
@@ -441,7 +449,9 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
local::icon_edge[size]->GetDeviceTexture(),
edge_color,
+ arg.colorify,
arg.alpha,
+ force_filter,
tile_transform);
}
// end tile draw
@@ -451,15 +461,19 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
arg.icon->TextureForSize(image_size)->GetDeviceTexture(),
nux::color::White,
+ arg.colorify,
arg.alpha,
- arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_IMAGE));
+ false,
+ arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_IMAGE, monitor));
// draw overlay shine
RenderElement(GfxContext,
arg,
shine->GetDeviceTexture(),
nux::color::White,
+ arg.colorify,
arg.alpha,
+ force_filter,
tile_transform);
// draw glow
@@ -469,8 +483,10 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
glow->GetDeviceTexture(),
glow_color,
+ nux::color::White,
glow_intensity * arg.alpha,
- arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_GLOW));
+ force_filter,
+ arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_GLOW, monitor));
}
// draw shimmer
@@ -489,8 +505,10 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
local::icon_glow[size]->GetDeviceTexture(),
arg.icon->GlowColor(),
+ nux::color::White,
fade_out * arg.alpha,
- arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_GLOW));
+ force_filter,
+ arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_GLOW, monitor));
GfxContext.PopClippingRectangle();
}
@@ -510,7 +528,9 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
local::offscreen_progress_texture,
nux::color::White,
+ nux::color::White,
arg.alpha,
+ force_filter,
tile_transform);
}
@@ -520,8 +540,10 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
arg.icon->Emblem()->GetDeviceTexture(),
nux::color::White,
+ nux::color::White,
arg.alpha,
- arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_EMBLEM));
+ force_filter,
+ arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_EMBLEM, monitor));
}
// draw indicators
@@ -544,7 +566,9 @@ void IconRenderer::RenderIcon(nux::GraphicsEngine& GfxContext, RenderArg const&
arg,
local::label_map[shortcut]->GetDeviceTexture(),
nux::Color(0xFFFFFFFF),
+ nux::color::White,
arg.alpha,
+ false,
tile_transform);
}
}
@@ -611,13 +635,18 @@ void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
RenderArg const& arg,
nux::ObjectPtr<nux::IOpenGLBaseTexture> icon,
nux::Color bkg_color,
+ nux::Color colorify,
float alpha,
+ bool force_filter,
std::vector<nux::Vector4>& xform_coords)
{
if (icon.IsNull())
return;
- if (nux::Abs(arg.x_rotation) < 0.01f && nux::Abs(arg.y_rotation) < 0.01f && nux::Abs(arg.z_rotation) < 0.01f)
+ if (nux::Abs(arg.x_rotation) < 0.01f &&
+ nux::Abs(arg.y_rotation) < 0.01f &&
+ nux::Abs(arg.z_rotation) < 0.01f &&
+ !force_filter)
icon->SetFiltering(GL_NEAREST, GL_NEAREST);
else
icon->SetFiltering(GL_LINEAR, GL_LINEAR);
@@ -673,6 +702,7 @@ void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
int VertexLocation;
int TextureCoord0Location;
int FragmentColor;
+ int ColorifyColor;
int DesatFactor;
if (nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath())
@@ -683,6 +713,7 @@ void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
VertexLocation = local::shader_program_uv_persp_correction->GetAttributeLocation("iVertex");
TextureCoord0Location = local::shader_program_uv_persp_correction->GetAttributeLocation("iTexCoord0");
FragmentColor = local::shader_program_uv_persp_correction->GetUniformLocationARB("color0");
+ ColorifyColor = local::shader_program_uv_persp_correction->GetUniformLocationARB("colorify_color");
DesatFactor = local::shader_program_uv_persp_correction->GetUniformLocationARB("desat_factor");
if (TextureObjectLocation != -1)
@@ -727,7 +758,12 @@ void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
if (nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath())
{
+ colorify.red += (0.5f + 0.5f * arg.saturation) * (nux::color::White.red - colorify.red);
+ colorify.green += (0.5f + 0.5f * arg.saturation) * (nux::color::White.green - colorify.green);
+ colorify.blue += (0.5f + 0.5f * arg.saturation) * (nux::color::White.blue - colorify.blue);
+
CHECKGL(glUniform4fARB(FragmentColor, bg_color.red, bg_color.green, bg_color.blue, bg_color.alpha));
+ CHECKGL(glUniform4fARB(ColorifyColor, colorify.red, colorify.green, colorify.blue, colorify.alpha));
CHECKGL(glUniform4fARB(DesatFactor, arg.saturation, arg.saturation, arg.saturation, arg.saturation));
nux::GetWindowThread()->GetGraphicsEngine().SetTexture(GL_TEXTURE0, icon);
@@ -787,7 +823,7 @@ void IconRenderer::RenderIndicators(nux::GraphicsEngine& GfxContext,
}
else
{
- auto bounds = arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_TILE);
+ auto bounds = arg.icon->GetTransform(launcher::AbstractLauncherIcon::TRANSFORM_TILE, monitor);
markerX = bounds[0].x + 2;
scale = 2;
}
diff --git a/plugins/unityshell/src/IconRenderer.h b/plugins/unityshell/src/IconRenderer.h
index 51e91d360..b54a8b3e0 100644
--- a/plugins/unityshell/src/IconRenderer.h
+++ b/plugins/unityshell/src/IconRenderer.h
@@ -53,7 +53,9 @@ protected:
RenderArg const& arg,
nux::ObjectPtr<nux::IOpenGLBaseTexture> icon,
nux::Color bkg_color,
+ nux::Color colorify,
float alpha,
+ bool force_filter,
std::vector<nux::Vector4>& xform_coords);
void RenderIndicators(nux::GraphicsEngine& GfxContext,
diff --git a/plugins/unityshell/src/Introspectable.cpp b/plugins/unityshell/src/Introspectable.cpp
index c4b154a75..889dcf58e 100644
--- a/plugins/unityshell/src/Introspectable.cpp
+++ b/plugins/unityshell/src/Introspectable.cpp
@@ -32,6 +32,8 @@ Introspectable::~Introspectable()
{
for (auto parent : _parents)
parent->_children.remove(this);
+ for (auto child : _children)
+ child->_parents.remove(this);
}
GVariant*
diff --git a/plugins/unityshell/src/Introspectable.h b/plugins/unityshell/src/Introspectable.h
index d94045835..d7a5022fd 100644
--- a/plugins/unityshell/src/Introspectable.h
+++ b/plugins/unityshell/src/Introspectable.h
@@ -41,10 +41,12 @@ public:
void RemoveChild(Introspectable* child);
IntrospectableList const& GetIntrospectableChildren() { return _children; };
virtual void AddProperties(GVariantBuilder* builder) = 0;
-
+
protected:
+ /// Please don't override this unless you really need to. The only valid reason
+ /// is if you have a property that simply *must* be called 'Children'.
virtual std::string GetChildsName() const;
-
+
/*
* AddProperties should be implemented as such ...
diff --git a/plugins/unityshell/src/Launcher.cpp b/plugins/unityshell/src/Launcher.cpp
index 7fb69d867..bbd511001 100644
--- a/plugins/unityshell/src/Launcher.cpp
+++ b/plugins/unityshell/src/Launcher.cpp
@@ -36,7 +36,7 @@
#include <Nux/WindowCompositor.h>
#include "Launcher.h"
-#include "LauncherIcon.h"
+#include "AbstractLauncherIcon.h"
#include "SpacerLauncherIcon.h"
#include "LauncherModel.h"
#include "QuicklistManager.h"
@@ -44,6 +44,7 @@
#include "IconRenderer.h"
#include "TimeUtil.h"
#include "WindowManager.h"
+#include "UScreen.h"
#include "ubus-server.h"
#include "UBusMessages.h"
@@ -54,6 +55,8 @@
namespace unity
{
using ui::RenderArg;
+using ui::PointerBarrierWrapper;
+using ui::Decaymulator;
namespace launcher
{
@@ -72,6 +75,7 @@ const int STARTING_BLINK_LAMBDA = 3;
const int PULSE_BLINK_LAMBDA = 2;
const float BACKLIGHT_STRENGTH = 0.9f;
+const int panel_height = 24;
}
@@ -94,19 +98,6 @@ const float BACKLIGHT_STRENGTH = 0.9f;
NUX_IMPLEMENT_OBJECT_TYPE(Launcher);
-void SetTimeBack(struct timespec* timeref, int remove)
-{
- timeref->tv_sec -= remove / 1000;
- remove = remove % 1000;
-
- if (remove > timeref->tv_nsec / 1000000)
- {
- timeref->tv_sec--;
- timeref->tv_nsec += 1000000000;
- }
- timeref->tv_nsec -= remove * 1000000;
-}
-
const gchar Launcher::introspection_xml[] =
"<node>"
" <interface name='com.canonical.Unity.Launcher'>"
@@ -134,8 +125,6 @@ GDBusInterfaceVTable Launcher::interface_vtable =
Launcher::Launcher(nux::BaseWindow* parent,
NUX_FILE_LINE_DECL)
: View(NUX_FILE_LINE_PARAM)
- , m_ContentOffsetY(0)
- , m_BackgroundLayer(0)
, _model(0)
, _collection_window(NULL)
, _background_color(nux::color::DimGray)
@@ -143,10 +132,13 @@ Launcher::Launcher(nux::BaseWindow* parent,
{
_parent = parent;
- _active_quicklist = 0;
+ _active_quicklist = nullptr;
+
+ monitor = 0;
_hide_machine = new LauncherHideMachine();
_hide_machine->should_hide_changed.connect(sigc::mem_fun(this, &Launcher::SetHidden));
+
_hover_machine = new LauncherHoverMachine();
_hover_machine->should_hover_changed.connect(sigc::mem_fun(this, &Launcher::SetHover));
@@ -161,11 +153,10 @@ Launcher::Launcher(nux::BaseWindow* parent,
mouse_leave.connect(sigc::mem_fun(this, &Launcher::RecvMouseLeave));
mouse_move.connect(sigc::mem_fun(this, &Launcher::RecvMouseMove));
mouse_wheel.connect(sigc::mem_fun(this, &Launcher::RecvMouseWheel));
- key_down.connect(sigc::mem_fun(this, &Launcher::RecvKeyPressed));
- mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Launcher::RecvMouseDownOutsideArea));
//OnEndFocus.connect (sigc::mem_fun (this, &Launcher::exitKeyNavMode));
CaptureMouseDownAnyWhereElse(true);
+ SetAcceptKeyNavFocusOnMouseDown(false);
QuicklistManager& ql_manager = *(QuicklistManager::Default());
ql_manager.quicklist_opened.connect(sigc::mem_fun(this, &Launcher::RecvQuicklistOpened));
@@ -199,10 +190,6 @@ Launcher::Launcher(nux::BaseWindow* parent,
display.changed.connect(sigc::mem_fun(this, &Launcher::OnDisplayChanged));
- _current_icon = NULL;
- _current_icon_index = -1;
- _last_icon_index = -1;
-
SetCompositionLayout(m_Layout);
_folded_angle = 1.0f;
@@ -212,9 +199,6 @@ Launcher::Launcher(nux::BaseWindow* parent,
_launcher_bottom_y = 0;
_folded_z_distance = 10.0f;
_launcher_action_state = ACTION_NONE;
- _launch_animation = LAUNCH_ANIMATION_NONE;
- _urgent_animation = URGENT_ANIMATION_NONE;
- _autohide_animation = FADE_AND_SLIDE;
_hidemode = LAUNCHER_HIDE_NEVER;
_icon_under_mouse = NULL;
_icon_mouse_down = NULL;
@@ -223,7 +207,6 @@ Launcher::Launcher(nux::BaseWindow* parent,
_icon_glow_size = 62;
_icon_image_size_delta = 6;
_icon_size = _icon_image_size + _icon_image_size_delta;
- _background_alpha = 0.6667; // about 0xAA
_enter_y = 0;
_launcher_drag_delta = 0;
@@ -231,28 +214,19 @@ Launcher::Launcher(nux::BaseWindow* parent,
_dnd_delta_x = 0;
_autoscroll_handle = 0;
- _super_show_launcher_handle = 0;
- _super_hide_launcher_handle = 0;
- _super_show_shortcuts_handle = 0;
_start_dragicon_handle = 0;
- _focus_keynav_handle = 0;
_dnd_check_handle = 0;
- _ignore_repeat_shortcut_handle = 0;
- _latest_shortcut = 0;
_shortcuts_shown = false;
- _floating = false;
_hovered = false;
_hidden = false;
_render_drag_window = false;
_drag_edge_touching = false;
- _keynav_activated = false;
- _key_switcher_activated = false;
- _backlight_mode = BACKLIGHT_NORMAL;
_last_button_press = 0;
_selection_atom = 0;
_drag_out_id = 0;
_drag_out_delta_x = 0.0f;
+ _edge_overcome_pressure = 0.0f;
// FIXME: remove
_initial_drag_animation = false;
@@ -261,10 +235,6 @@ Launcher::Launcher(nux::BaseWindow* parent,
_postreveal_mousemove_delta_x = 0;
_postreveal_mousemove_delta_y = 0;
- // set them to 1 instead of 0 to avoid :0 in case something is racy
- _bfb_width = 1;
- _bfb_height = 1;
-
_data_checked = false;
_collection_window = new unity::DNDCollectionWindow();
_collection_window->SinkReference();
@@ -282,8 +252,8 @@ Launcher::Launcher(nux::BaseWindow* parent,
_drag_window = NULL;
_offscreen_drag_texture = nux::GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, nux::BITFMT_R8G8B8A8);
- ubus.RegisterInterest(UBUS_PLACE_VIEW_SHOWN, sigc::mem_fun(this, &Launcher::OnPlaceViewShown));
- ubus.RegisterInterest(UBUS_PLACE_VIEW_HIDDEN, sigc::mem_fun(this, &Launcher::OnPlaceViewHidden));
+ ubus.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &Launcher::OnOverlayShown));
+ ubus.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &Launcher::OnOverlayHidden));
ubus.RegisterInterest(UBUS_LAUNCHER_ACTION_DONE, sigc::mem_fun(this, &Launcher::OnActionDone));
ubus.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, sigc::mem_fun(this, &Launcher::OnBGColorChanged));
ubus.RegisterInterest(UBUS_LAUNCHER_LOCK_HIDE, sigc::mem_fun(this, &Launcher::OnLockHideChanged));
@@ -326,6 +296,12 @@ Launcher::Launcher(nux::BaseWindow* parent,
launcher_sheen_->UnReference();
}
+ _pointer_barrier = PointerBarrierWrapper::Ptr(new PointerBarrierWrapper());
+ _pointer_barrier->barrier_event.connect(sigc::mem_fun(this, &Launcher::OnPointerBarrierEvent));
+
+ decaymulator_ = Decaymulator::Ptr(new Decaymulator());
+
+ options.changed.connect (sigc::mem_fun (this, &Launcher::OnOptionsChanged));
}
Launcher::~Launcher()
@@ -336,18 +312,8 @@ Launcher::~Launcher()
g_source_remove(_dnd_check_handle);
if (_autoscroll_handle)
g_source_remove(_autoscroll_handle);
- if (_focus_keynav_handle)
- g_source_remove(_focus_keynav_handle);
- if (_super_show_launcher_handle)
- g_source_remove(_super_show_launcher_handle);
- if (_super_show_shortcuts_handle)
- g_source_remove(_super_show_shortcuts_handle);
if (_start_dragicon_handle)
g_source_remove(_start_dragicon_handle);
- if (_ignore_repeat_shortcut_handle)
- g_source_remove(_ignore_repeat_shortcut_handle);
- if (_super_hide_launcher_handle)
- g_source_remove(_super_hide_launcher_handle);
if (_launcher_animation_timeout > 0)
g_source_remove(_launcher_animation_timeout);
@@ -414,102 +380,34 @@ Launcher::OnDragFinish(GeisAdapter::GeisDragData* data)
{
if (_drag_out_delta_x >= DRAG_OUT_PIXELS - 90.0f)
_hide_machine->SetQuirk(LauncherHideMachine::MT_DRAG_OUT, true);
- SetTimeStruct(&_times[TIME_DRAG_OUT], &_times[TIME_DRAG_OUT], ANIM_DURATION_SHORT);
+ TimeUtil::SetTimeStruct(&_times[TIME_DRAG_OUT], &_times[TIME_DRAG_OUT], ANIM_DURATION_SHORT);
_drag_out_id = 0;
EnsureAnimation();
}
}
void
-Launcher::startKeyNavMode()
-{
- SetStateKeyNav(true);
- _hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
-
- GrabKeyboard();
-
- // FIXME: long term solution is to rewrite the keynav handle
- if (_focus_keynav_handle > 0)
- g_source_remove(_focus_keynav_handle);
- _focus_keynav_handle = g_timeout_add(ANIM_DURATION_SHORT, &Launcher::MoveFocusToKeyNavModeTimeout, this);
-
-}
-
-gboolean
-Launcher::MoveFocusToKeyNavModeTimeout(gpointer data)
-{
- Launcher* self = (Launcher*) data;
-
- // move focus to key nav mode when activated
- if (!(self->_keynav_activated))
- return false;
-
- if (self->_last_icon_index == -1)
- {
- self->_current_icon_index = 0;
- }
- else
- self->_current_icon_index = self->_last_icon_index;
- self->EnsureAnimation();
-
- ubus_server_send_message(ubus_server_get_default(),
- UBUS_LAUNCHER_START_KEY_NAV,
- NULL);
-
- self->selection_change.emit();
- self->_focus_keynav_handle = 0;
-
- return false;
-}
-
-void
-Launcher::leaveKeyNavMode(bool preserve_focus)
-{
- _last_icon_index = _current_icon_index;
- _current_icon_index = -1;
- QueueDraw();
-
- ubus_server_send_message(ubus_server_get_default(),
- UBUS_LAUNCHER_END_KEY_NAV,
- g_variant_new_boolean(preserve_focus));
-
- selection_change.emit();
-}
-
-void
-Launcher::exitKeyNavMode()
-{
- if (!_keynav_activated)
- return;
-
- UnGrabKeyboard();
- UnGrabPointer();
- SetStateKeyNav(false);
-
- _current_icon_index = -1;
- _last_icon_index = _current_icon_index;
- QueueDraw();
- ubus_server_send_message(ubus_server_get_default(),
- UBUS_LAUNCHER_END_KEY_NAV,
- g_variant_new_boolean(true));
- selection_change.emit();
-}
-
-void
Launcher::AddProperties(GVariantBuilder* builder)
{
timespec current;
clock_gettime(CLOCK_MONOTONIC, &current);
+ nux::Geometry abs_geo = GetAbsoluteGeometry();
+
unity::variant::BuilderWrapper(builder)
.add("hover-progress", GetHoverProgress(current))
.add("dnd-exit-progress", DnDExitProgress(current))
.add("autohide-progress", AutohideProgress(current))
.add("dnd-delta", _dnd_delta_y)
- .add("floating", _floating)
.add("hovered", _hovered)
.add("hidemode", _hidemode)
.add("hidden", _hidden)
+ .add("x", abs_geo.x)
+ .add("y", abs_geo.y)
+ .add("width", abs_geo.width)
+ .add("height", abs_geo.height)
+ .add("monitor", monitor())
+ .add("quicklist-open", _hide_machine->GetQuirk(LauncherHideMachine::QUICKLIST_OPEN))
.add("hide-quirks", _hide_machine->DebugHideQuirks().c_str())
.add("hover-quirks", _hover_machine->DebugHoverQuirks().c_str());
}
@@ -520,7 +418,7 @@ void Launcher::SetMousePosition(int x, int y)
_mouse_position = nux::Point2(x, y);
if (beyond_drag_threshold != MouseBeyondDragThreshold())
- SetTimeStruct(&_times[TIME_DRAG_THRESHOLD], &_times[TIME_DRAG_THRESHOLD], ANIM_DURATION_SHORT);
+ TimeUtil::SetTimeStruct(&_times[TIME_DRAG_THRESHOLD], &_times[TIME_DRAG_THRESHOLD], ANIM_DURATION_SHORT);
EnsureScrollTimer();
}
@@ -528,24 +426,11 @@ void Launcher::SetMousePosition(int x, int y)
void Launcher::SetStateMouseOverLauncher(bool over_launcher)
{
_hide_machine->SetQuirk(LauncherHideMachine::MOUSE_OVER_LAUNCHER, over_launcher);
+ _hide_machine->SetQuirk(LauncherHideMachine::REVEAL_PRESSURE_PASS, false);
_hover_machine->SetQuirk(LauncherHoverMachine::MOUSE_OVER_LAUNCHER, over_launcher);
-
- if (!over_launcher)
- {
- // reset state for some corner case like x=0, show dash (leave event not received)
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE, false);
- }
-}
-
-void Launcher::SetStateKeyNav(bool keynav_activated)
-{
- _hide_machine->SetQuirk(LauncherHideMachine::KEY_NAV_ACTIVE, keynav_activated);
- _hover_machine->SetQuirk(LauncherHoverMachine::KEY_NAV_ACTIVE, keynav_activated);
-
- _keynav_activated = keynav_activated;
}
-bool Launcher::MouseBeyondDragThreshold()
+bool Launcher::MouseBeyondDragThreshold() const
{
if (GetActionState() == ACTION_DRAG_ICON)
return _mouse_position.x > GetGeometry().width + _icon_size / 2;
@@ -553,7 +438,7 @@ bool Launcher::MouseBeyondDragThreshold()
}
/* Render Layout Logic */
-float Launcher::GetHoverProgress(struct timespec const& current)
+float Launcher::GetHoverProgress(struct timespec const& current) const
{
if (_hovered)
return CLAMP((float)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_ENTER])) / (float) ANIM_DURATION, 0.0f, 1.0f);
@@ -561,12 +446,12 @@ float Launcher::GetHoverProgress(struct timespec const& current)
return 1.0f - CLAMP((float)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_LEAVE])) / (float) ANIM_DURATION, 0.0f, 1.0f);
}
-float Launcher::DnDExitProgress(struct timespec const& current)
+float Launcher::DnDExitProgress(struct timespec const& current) const
{
return pow(1.0f - CLAMP((float)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_DRAG_END])) / (float) ANIM_DURATION_LONG, 0.0f, 1.0f), 2);
}
-float Launcher::DragOutProgress(struct timespec const& current)
+float Launcher::DragOutProgress(struct timespec const& current) const
{
float timeout = CLAMP((float)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_DRAG_OUT])) / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f);
float progress = CLAMP(_drag_out_delta_x / DRAG_OUT_PIXELS, 0.0f, 1.0f);
@@ -576,7 +461,7 @@ float Launcher::DragOutProgress(struct timespec const& current)
return progress * (1.0f - timeout);
}
-float Launcher::AutohideProgress(struct timespec const& current)
+float Launcher::AutohideProgress(struct timespec const& current) const
{
// time-based progress (full scale or finish the TRIGGER_AUTOHIDE_MIN -> 0.00f on bfb)
float animation_progress;
@@ -587,7 +472,7 @@ float Launcher::AutohideProgress(struct timespec const& current)
return 1.0f - animation_progress;
}
-float Launcher::DragHideProgress(struct timespec const& current)
+float Launcher::DragHideProgress(struct timespec const& current) const
{
if (_drag_edge_touching)
return CLAMP((float)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_DRAG_EDGE_TOUCH])) / (float)(ANIM_DURATION * 3), 0.0f, 1.0f);
@@ -595,7 +480,7 @@ float Launcher::DragHideProgress(struct timespec const& current)
return 1.0f - CLAMP((float)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_DRAG_EDGE_TOUCH])) / (float)(ANIM_DURATION * 3), 0.0f, 1.0f);
}
-float Launcher::DragThresholdProgress(struct timespec const& current)
+float Launcher::DragThresholdProgress(struct timespec const& current) const
{
if (MouseBeyondDragThreshold())
return 1.0f - CLAMP((float)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_DRAG_THRESHOLD])) / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f);
@@ -616,60 +501,60 @@ void Launcher::EnsureAnimation()
NeedRedraw();
}
-bool Launcher::IconNeedsAnimation(LauncherIcon* icon, struct timespec const& current)
+bool Launcher::IconNeedsAnimation(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec time = icon->GetQuirkTime(LauncherIcon::QUIRK_VISIBLE);
+ struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_RUNNING);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_RUNNING);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_STARTING);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
if (unity::TimeUtil::TimeDelta(&current, &time) < (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2))
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_URGENT);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT);
if (unity::TimeUtil::TimeDelta(&current, &time) < (ANIM_DURATION_LONG * URGENT_BLINKS * 2))
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_PULSE_ONCE);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PULSE_ONCE);
if (unity::TimeUtil::TimeDelta(&current, &time) < (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2))
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_PRESENTED);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PRESENTED);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_SHIMMER);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_LONG)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_CENTER_SAVED);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_PROGRESS);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_DROP_DIM);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_DESAT);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT_SHORT)
return true;
- time = icon->GetQuirkTime(LauncherIcon::QUIRK_DROP_PRELIGHT);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_PRELIGHT);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
return false;
}
-bool Launcher::AnimationInProgress()
+bool Launcher::AnimationInProgress() const
{
// performance here can be improved by caching the longer remaining animation found and short circuiting to that each time
// this way extra checks may be avoided
@@ -715,54 +600,35 @@ bool Launcher::AnimationInProgress()
return false;
}
-void Launcher::SetTimeStruct(struct timespec* timer, struct timespec* sister, int sister_relation)
-{
- struct timespec current;
- clock_gettime(CLOCK_MONOTONIC, &current);
-
- if (sister)
- {
- int diff = unity::TimeUtil::TimeDelta(&current, sister);
-
- if (diff < sister_relation)
- {
- int remove = sister_relation - diff;
- SetTimeBack(&current, remove);
- }
- }
-
- timer->tv_sec = current.tv_sec;
- timer->tv_nsec = current.tv_nsec;
-}
/* Min is when you are on the trigger */
-float Launcher::GetAutohidePositionMin()
+float Launcher::GetAutohidePositionMin() const
{
- if (_autohide_animation == SLIDE_ONLY || _autohide_animation == FADE_AND_SLIDE)
+ if (options()->auto_hide_animation() == SLIDE_ONLY || options()->auto_hide_animation() == FADE_AND_SLIDE)
return 0.35f;
else
return 0.25f;
}
/* Max is the initial state over the bfb */
-float Launcher::GetAutohidePositionMax()
+float Launcher::GetAutohidePositionMax() const
{
- if (_autohide_animation == SLIDE_ONLY || _autohide_animation == FADE_AND_SLIDE)
+ if (options()->auto_hide_animation() == SLIDE_ONLY || options()->auto_hide_animation() == FADE_AND_SLIDE)
return 1.00f;
else
return 0.75f;
}
-float IconVisibleProgress(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconVisibleProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- if (icon->GetQuirk(LauncherIcon::QUIRK_VISIBLE))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
{
- struct timespec icon_visible_time = icon->GetQuirkTime(LauncherIcon::QUIRK_VISIBLE);
+ struct timespec icon_visible_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE);
int enter_ms = unity::TimeUtil::TimeDelta(&current, &icon_visible_time);
return CLAMP((float) enter_ms / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f);
}
else
{
- struct timespec icon_hide_time = icon->GetQuirkTime(LauncherIcon::QUIRK_VISIBLE);
+ struct timespec icon_hide_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE);
int hide_ms = unity::TimeUtil::TimeDelta(&current, &icon_hide_time);
return 1.0f - CLAMP((float) hide_ms / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f);
}
@@ -770,7 +636,7 @@ float IconVisibleProgress(LauncherIcon* icon, struct timespec const& current)
void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo, timespec const& current)
{
- LauncherIcon* anchor = 0;
+ AbstractLauncherIcon* anchor = nullptr;
LauncherModel::iterator it;
anchor = MouseIconIntersection(x, _enter_y);
@@ -794,169 +660,169 @@ void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo, timespec
}
}
-float Launcher::IconPresentProgress(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconPresentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec icon_present_time = icon->GetQuirkTime(LauncherIcon::QUIRK_PRESENTED);
+ struct timespec icon_present_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PRESENTED);
int ms = unity::TimeUtil::TimeDelta(&current, &icon_present_time);
float result = CLAMP((float) ms / (float) ANIM_DURATION, 0.0f, 1.0f);
- if (icon->GetQuirk(LauncherIcon::QUIRK_PRESENTED))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED))
return result;
else
return 1.0f - result;
}
-float Launcher::IconUrgentProgress(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconUrgentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec urgent_time = icon->GetQuirkTime(LauncherIcon::QUIRK_URGENT);
+ struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT);
int urgent_ms = unity::TimeUtil::TimeDelta(&current, &urgent_time);
float result;
- if (_urgent_animation == URGENT_ANIMATION_WIGGLE)
+ if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
result = CLAMP((float) urgent_ms / (float)(ANIM_DURATION_SHORT * WIGGLE_CYCLES), 0.0f, 1.0f);
else
result = CLAMP((float) urgent_ms / (float)(ANIM_DURATION_LONG * URGENT_BLINKS * 2), 0.0f, 1.0f);
- if (icon->GetQuirk(LauncherIcon::QUIRK_URGENT))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
return result;
else
return 1.0f - result;
}
-float Launcher::IconDropDimValue(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconDropDimValue(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec dim_time = icon->GetQuirkTime(LauncherIcon::QUIRK_DROP_DIM);
+ struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM);
int dim_ms = unity::TimeUtil::TimeDelta(&current, &dim_time);
float result = CLAMP((float) dim_ms / (float) ANIM_DURATION, 0.0f, 1.0f);
- if (icon->GetQuirk(LauncherIcon::QUIRK_DROP_DIM))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_DROP_DIM))
return 1.0f - result;
else
return result;
}
-float Launcher::IconDesatValue(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconDesatValue(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec dim_time = icon->GetQuirkTime(LauncherIcon::QUIRK_DESAT);
+ struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT);
int ms = unity::TimeUtil::TimeDelta(&current, &dim_time);
float result = CLAMP((float) ms / (float) ANIM_DURATION_SHORT_SHORT, 0.0f, 1.0f);
- if (icon->GetQuirk(LauncherIcon::QUIRK_DESAT))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_DESAT))
return 1.0f - result;
else
return result;
}
-float Launcher::IconShimmerProgress(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconShimmerProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec shimmer_time = icon->GetQuirkTime(LauncherIcon::QUIRK_SHIMMER);
+ struct timespec shimmer_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER);
int shimmer_ms = unity::TimeUtil::TimeDelta(&current, &shimmer_time);
return CLAMP((float) shimmer_ms / (float) ANIM_DURATION_LONG, 0.0f, 1.0f);
}
-float Launcher::IconCenterTransitionProgress(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconCenterTransitionProgress(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec save_time = icon->GetQuirkTime(LauncherIcon::QUIRK_CENTER_SAVED);
+ struct timespec save_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED);
int save_ms = unity::TimeUtil::TimeDelta(&current, &save_time);
return CLAMP((float) save_ms / (float) ANIM_DURATION, 0.0f, 1.0f);
}
-float Launcher::IconUrgentPulseValue(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconUrgentPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- if (!icon->GetQuirk(LauncherIcon::QUIRK_URGENT))
+ if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
return 1.0f; // we are full on in a normal condition
double urgent_progress = (double) IconUrgentProgress(icon, current);
return 0.5f + (float)(std::cos(M_PI * (float)(URGENT_BLINKS * 2) * urgent_progress)) * 0.5f;
}
-float Launcher::IconPulseOnceValue(LauncherIcon *icon, struct timespec const &current)
+float Launcher::IconPulseOnceValue(AbstractLauncherIcon *icon, struct timespec const &current) const
{
- struct timespec pulse_time = icon->GetQuirkTime(LauncherIcon::QUIRK_PULSE_ONCE);
+ struct timespec pulse_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PULSE_ONCE);
int pulse_ms = unity::TimeUtil::TimeDelta(&current, &pulse_time);
double pulse_progress = (double) CLAMP((float) pulse_ms / (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), 0.0f, 1.0f);
if (pulse_progress == 1.0f)
- icon->SetQuirk(LauncherIcon::QUIRK_PULSE_ONCE, false);
+ icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, false);
return 0.5f + (float) (std::cos(M_PI * 2.0 * pulse_progress)) * 0.5f;
}
-float Launcher::IconUrgentWiggleValue(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- if (!icon->GetQuirk(LauncherIcon::QUIRK_URGENT))
+ if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
return 0.0f; // we are full on in a normal condition
double urgent_progress = (double) IconUrgentProgress(icon, current);
return 0.3f * (float)(std::sin(M_PI * (float)(WIGGLE_CYCLES * 2) * urgent_progress)) * 0.5f;
}
-float Launcher::IconStartingBlinkValue(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconStartingBlinkValue(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec starting_time = icon->GetQuirkTime(LauncherIcon::QUIRK_STARTING);
+ struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * STARTING_BLINK_LAMBDA), 0.0f, 1.0f);
double val = IsBackLightModeToggles() ? 3.0f : 4.0f;
return 0.5f + (float)(std::cos(M_PI * val * starting_progress)) * 0.5f;
}
-float Launcher::IconStartingPulseValue(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconStartingPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec starting_time = icon->GetQuirkTime(LauncherIcon::QUIRK_STARTING);
+ struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
int starting_ms = unity::TimeUtil::TimeDelta(&current, &starting_time);
double starting_progress = (double) CLAMP((float) starting_ms / (float)(ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), 0.0f, 1.0f);
- if (starting_progress == 1.0f && !icon->GetQuirk(LauncherIcon::QUIRK_RUNNING))
+ if (starting_progress == 1.0f && !icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING))
{
- icon->SetQuirk(LauncherIcon::QUIRK_STARTING, false);
- icon->ResetQuirkTime(LauncherIcon::QUIRK_STARTING);
+ icon->SetQuirk(AbstractLauncherIcon::QUIRK_STARTING, false);
+ icon->ResetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
}
return 0.5f + (float)(std::cos(M_PI * (float)(MAX_STARTING_BLINKS * 2) * starting_progress)) * 0.5f;
}
-float Launcher::IconBackgroundIntensity(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconBackgroundIntensity(AbstractLauncherIcon* icon, struct timespec const& current) const
{
float result = 0.0f;
- struct timespec running_time = icon->GetQuirkTime(LauncherIcon::QUIRK_RUNNING);
+ struct timespec running_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_RUNNING);
int running_ms = unity::TimeUtil::TimeDelta(&current, &running_time);
float running_progress = CLAMP((float) running_ms / (float) ANIM_DURATION_SHORT, 0.0f, 1.0f);
- if (!icon->GetQuirk(LauncherIcon::QUIRK_RUNNING))
+ if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING))
running_progress = 1.0f - running_progress;
// After we finish a fade in from running, we can reset the quirk
- if (running_progress == 1.0f && icon->GetQuirk(LauncherIcon::QUIRK_RUNNING))
- icon->SetQuirk(LauncherIcon::QUIRK_STARTING, false);
+ if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING))
+ icon->SetQuirk(AbstractLauncherIcon::QUIRK_STARTING, false);
float backlight_strength;
- if (_backlight_mode == BACKLIGHT_ALWAYS_ON)
+ if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON)
backlight_strength = BACKLIGHT_STRENGTH;
else if (IsBackLightModeToggles())
backlight_strength = BACKLIGHT_STRENGTH * running_progress;
else
backlight_strength = 0.0f;
- switch (_launch_animation)
+ switch (options()->launch_animation())
{
case LAUNCH_ANIMATION_NONE:
result = backlight_strength;
break;
case LAUNCH_ANIMATION_BLINK:
- if (_backlight_mode == BACKLIGHT_ALWAYS_ON)
+ if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON)
result = IconStartingBlinkValue(icon, current);
- else if (_backlight_mode == BACKLIGHT_ALWAYS_OFF)
+ else if (options()->backlight_mode() == BACKLIGHT_ALWAYS_OFF)
result = 1.0f - IconStartingBlinkValue(icon, current);
else
result = backlight_strength; // The blink concept is a failure in this case (it just doesn't work right)
break;
case LAUNCH_ANIMATION_PULSE:
- if (running_progress == 1.0f && icon->GetQuirk(LauncherIcon::QUIRK_RUNNING))
- icon->ResetQuirkTime(LauncherIcon::QUIRK_STARTING);
+ if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING))
+ icon->ResetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
result = backlight_strength;
- if (_backlight_mode == BACKLIGHT_ALWAYS_ON)
+ if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON)
result *= CLAMP(running_progress + IconStartingPulseValue(icon, current), 0.0f, 1.0f);
else if (IsBackLightModeToggles())
result += (BACKLIGHT_STRENGTH - result) * (1.0f - IconStartingPulseValue(icon, current));
@@ -965,55 +831,56 @@ float Launcher::IconBackgroundIntensity(LauncherIcon* icon, struct timespec cons
break;
}
- if (icon->GetQuirk(LauncherIcon::QUIRK_PULSE_ONCE))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE))
{
- if (_backlight_mode == BACKLIGHT_ALWAYS_ON)
+ if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON)
result *= CLAMP(running_progress + IconPulseOnceValue(icon, current), 0.0f, 1.0f);
- else if (_backlight_mode == BACKLIGHT_NORMAL)
+ else if (options()->backlight_mode() == BACKLIGHT_NORMAL)
result += (BACKLIGHT_STRENGTH - result) * (1.0f - IconPulseOnceValue(icon, current));
else
result = 1.0f - CLAMP(running_progress + IconPulseOnceValue(icon, current), 0.0f, 1.0f);
}
// urgent serves to bring the total down only
- if (icon->GetQuirk(LauncherIcon::QUIRK_URGENT) && _urgent_animation == URGENT_ANIMATION_PULSE)
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT) && options()->urgent_animation() == URGENT_ANIMATION_PULSE)
result *= 0.2f + 0.8f * IconUrgentPulseValue(icon, current);
return result;
}
-float Launcher::IconProgressBias(LauncherIcon* icon, struct timespec const& current)
+float Launcher::IconProgressBias(AbstractLauncherIcon* icon, struct timespec const& current) const
{
- struct timespec icon_progress_time = icon->GetQuirkTime(LauncherIcon::QUIRK_PROGRESS);
+ struct timespec icon_progress_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS);
int ms = unity::TimeUtil::TimeDelta(&current, &icon_progress_time);
float result = CLAMP((float) ms / (float) ANIM_DURATION, 0.0f, 1.0f);
- if (icon->GetQuirk(LauncherIcon::QUIRK_PROGRESS))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_PROGRESS))
return -1.0f + result;
else
return result;
}
-bool Launcher::IconDrawEdgeOnly(LauncherIcon* icon)
+bool Launcher::IconDrawEdgeOnly(AbstractLauncherIcon* icon) const
{
- if (_backlight_mode == BACKLIGHT_EDGE_TOGGLE)
+ if (options()->backlight_mode() == BACKLIGHT_EDGE_TOGGLE)
return true;
- if (_backlight_mode == BACKLIGHT_NORMAL_EDGE_TOGGLE && !icon->HasWindowOnViewport())
+ if (options()->backlight_mode() == BACKLIGHT_NORMAL_EDGE_TOGGLE && !icon->WindowVisibleOnMonitor(monitor))
return true;
return false;
}
-void Launcher::SetupRenderArg(LauncherIcon* icon, struct timespec const& current, RenderArg& arg)
+void Launcher::SetupRenderArg(AbstractLauncherIcon* icon, struct timespec const& current, RenderArg& arg)
{
float desat_value = IconDesatValue(icon, current);
arg.icon = icon;
arg.alpha = 0.5f + 0.5f * desat_value;
arg.saturation = desat_value;
- arg.running_arrow = icon->GetQuirk(LauncherIcon::QUIRK_RUNNING);
- arg.running_colored = icon->GetQuirk(LauncherIcon::QUIRK_URGENT);
- arg.running_on_viewport = icon->HasWindowOnViewport();
+ arg.colorify = nux::color::White;
+ arg.running_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING);
+ arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT);
+ arg.running_on_viewport = icon->WindowVisibleOnMonitor(monitor);
arg.draw_edge_only = IconDrawEdgeOnly(icon);
arg.active_colored = false;
arg.x_rotation = 0.0f;
@@ -1025,12 +892,12 @@ void Launcher::SetupRenderArg(LauncherIcon* icon, struct timespec const& current
arg.progress_bias = IconProgressBias(icon, current);
arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f);
arg.draw_shortcut = _shortcuts_shown && !_hide_machine->GetQuirk(LauncherHideMachine::PLACES_VISIBLE);
- arg.system_item = icon->Type() == LauncherIcon::TYPE_HOME;
+ arg.system_item = icon->Type() == AbstractLauncherIcon::TYPE_HOME;
if (_dash_is_open)
- arg.active_arrow = icon->Type() == LauncherIcon::TYPE_HOME;
+ arg.active_arrow = icon->Type() == AbstractLauncherIcon::TYPE_HOME;
else
- arg.active_arrow = icon->GetQuirk(LauncherIcon::QUIRK_ACTIVE);
+ arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE);
guint64 shortcut = icon->GetShortcut();
if (shortcut > 32)
@@ -1039,9 +906,9 @@ void Launcher::SetupRenderArg(LauncherIcon* icon, struct timespec const& current
arg.shortcut_label = 0;
// we dont need to show strays
- if (!icon->GetQuirk(LauncherIcon::QUIRK_RUNNING))
+ if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING))
{
- if (icon->GetQuirk(LauncherIcon::QUIRK_URGENT))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
{
arg.running_arrow = true;
arg.window_indicators = 1;
@@ -1051,7 +918,7 @@ void Launcher::SetupRenderArg(LauncherIcon* icon, struct timespec const& current
}
else
{
- arg.window_indicators = icon->RelatedWindows();
+ arg.window_indicators = std::max<int> (icon->WindowsForMonitor(monitor).size(), 1);
}
arg.backlight_intensity = IconBackgroundIntensity(icon, current);
@@ -1059,31 +926,28 @@ void Launcher::SetupRenderArg(LauncherIcon* icon, struct timespec const& current
float urgent_progress = IconUrgentProgress(icon, current);
- if (icon->GetQuirk(LauncherIcon::QUIRK_URGENT))
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
urgent_progress = CLAMP(urgent_progress * 3.0f, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle
else
urgent_progress = CLAMP(urgent_progress * 3.0f - 2.0f, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle
arg.glow_intensity = urgent_progress;
- if (icon->GetQuirk(LauncherIcon::QUIRK_URGENT) && _urgent_animation == URGENT_ANIMATION_WIGGLE)
+ if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT) && options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
{
arg.z_rotation = IconUrgentWiggleValue(icon, current);
}
- // we've to walk the list since it is a STL-list and not a STL-vector, thus
- // we can't use the random-access operator [] :(
- LauncherModel::iterator it;
- int i;
- for (it = _model->begin(), i = 0; it != _model->end(); it++, ++i)
- if (i == _current_icon_index && *it == icon)
- {
+ if (IsInKeyNavMode())
+ {
+ if (icon == _model->Selection())
arg.keyboard_nav_hl = true;
- }
+ }
}
-void Launcher::FillRenderArg(LauncherIcon* icon,
+void Launcher::FillRenderArg(AbstractLauncherIcon* icon,
RenderArg& arg,
nux::Point3& center,
+ nux::Geometry const& parent_abs_geo,
float folding_threshold,
float folded_size,
float folded_spacing,
@@ -1133,7 +997,7 @@ void Launcher::FillRenderArg(LauncherIcon* icon,
float half_size = (folded_size / 2.0f) + (_icon_size / 2.0f - folded_size / 2.0f) * (1.0f - folding_progress);
float icon_hide_offset = autohide_offset;
- icon_hide_offset *= 1.0f - (present_progress * (_hide_machine->GetShowOnEdge() ? icon->PresentUrgency() : 0.0f));
+ icon_hide_offset *= 1.0f - (present_progress * icon->PresentUrgency());
// icon is crossing threshold, start folding
center.z += folded_z_distance * folding_progress;
@@ -1146,7 +1010,7 @@ void Launcher::FillRenderArg(LauncherIcon* icon,
float center_transit_progress = IconCenterTransitionProgress(icon, current);
if (center_transit_progress <= 1.0f)
{
- centerOffset.y = (icon->_saved_center.y - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress);
+ centerOffset.y = (icon->GetSavedCenter(monitor).y - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress);
}
center.y += half_size * size_modifier; // move to center
@@ -1154,7 +1018,7 @@ void Launcher::FillRenderArg(LauncherIcon* icon,
arg.render_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y + centerOffset.y), roundf(center.z));
arg.logical_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y), roundf(center.z));
- icon->SetCenter(nux::Point3(roundf(center.x), roundf(center.y), roundf(center.z)));
+ icon->SetCenter(nux::Point3(roundf(center.x), roundf(center.y), roundf(center.z)), monitor, parent_abs_geo);
// 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
@@ -1173,8 +1037,15 @@ float Launcher::DragLimiter(float x)
return -result;
}
+nux::Color FullySaturateColor (nux::Color color)
+{
+ float max = std::max<float>(color.red, std::max<float>(color.green, color.blue));
+ color = color * (1.0f / max);
+ return color;
+}
+
void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
- nux::Geometry& box_geo, float* launcher_alpha)
+ nux::Geometry& box_geo, float* launcher_alpha, nux::Geometry const& parent_abs_geo)
{
nux::Geometry geo = GetGeometry();
LauncherModel::iterator it;
@@ -1182,6 +1053,8 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
struct timespec current;
clock_gettime(CLOCK_MONOTONIC, &current);
+ nux::Color colorify = FullySaturateColor(_background_color);
+
float hover_progress = GetHoverProgress(current);
float folded_z_distance = _folded_z_distance * (1.0f - hover_progress);
float animation_neg_rads = _neg_folded_angle * (1.0f - hover_progress);
@@ -1222,14 +1095,16 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
{
float autohide_progress = AutohideProgress(current) * (1.0f - DragOutProgress(current));
- if (_autohide_animation == FADE_ONLY)
+ if (options()->auto_hide_animation() == FADE_ONLY)
+ {
*launcher_alpha = 1.0f - autohide_progress;
+ }
else
{
if (autohide_progress > 0.0f)
{
autohide_offset -= geo.width * autohide_progress;
- if (_autohide_animation == FADE_AND_SLIDE)
+ if (options()->auto_hide_animation() == FADE_AND_SLIDE)
*launcher_alpha = 1.0f - 0.5f * autohide_progress;
}
}
@@ -1311,11 +1186,11 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
for (it = _model->main_begin(); it != _model->main_end(); it++)
{
RenderArg arg;
- LauncherIcon* icon = *it;
+ AbstractLauncherIcon* icon = *it;
- FillRenderArg(icon, arg, center, folding_threshold, folded_size, folded_spacing,
+ FillRenderArg(icon, arg, center, parent_abs_geo, folding_threshold, folded_size, folded_spacing,
autohide_offset, folded_z_distance, animation_neg_rads, current);
-
+ arg.colorify = colorify;
launcher_args.push_back(arg);
index++;
}
@@ -1339,9 +1214,9 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
for (it = _model->shelf_begin(); it != _model->shelf_end(); it++)
{
RenderArg arg;
- LauncherIcon* icon = *it;
+ AbstractLauncherIcon* icon = *it;
- FillRenderArg(icon, arg, center, folding_threshold, folded_size, folded_spacing,
+ FillRenderArg(icon, arg, center, parent_abs_geo, folding_threshold, folded_size, folded_spacing,
autohide_offset, folded_z_distance, animation_neg_rads, current);
launcher_args.push_back(arg);
@@ -1350,100 +1225,15 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
/* End Render Layout Logic */
-gboolean Launcher::TapOnSuper()
+void Launcher::ForceReveal(bool force_reveal)
{
- struct timespec current;
- clock_gettime(CLOCK_MONOTONIC, &current);
-
- return (unity::TimeUtil::TimeDelta(&current, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION);
+ _hide_machine->SetQuirk(LauncherHideMachine::TRIGGER_BUTTON_SHOW, force_reveal);
}
-/* Launcher Show/Hide logic */
-
-void Launcher::StartKeyShowLauncher()
+void Launcher::ShowShortcuts(bool show)
{
- _hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
-
- SetTimeStruct(&_times[TIME_TAP_SUPER]);
- SetTimeStruct(&_times[TIME_SUPER_PRESSED]);
-
- if (_super_show_launcher_handle > 0)
- g_source_remove(_super_show_launcher_handle);
- _super_show_launcher_handle = g_timeout_add(SUPER_TAP_DURATION, &Launcher::SuperShowLauncherTimeout, this);
-
- if (_super_show_shortcuts_handle > 0)
- g_source_remove(_super_show_shortcuts_handle);
- _super_show_shortcuts_handle = g_timeout_add(SHORTCUTS_SHOWN_DELAY, &Launcher::SuperShowShortcutsTimeout, this);
-
- ubus_server_send_message(ubus_server_get_default(), UBUS_DASH_ABOUT_TO_SHOW, NULL);
- ubus_server_force_message_pump(ubus_server_get_default());
-}
-
-void Launcher::EndKeyShowLauncher()
-{
- int remaining_time_before_hide;
- struct timespec current;
- clock_gettime(CLOCK_MONOTONIC, &current);
-
- _hover_machine->SetQuirk(LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE, false);
- _shortcuts_shown = false;
- QueueDraw();
-
- // remove further show launcher (which can happen when we close the dash with super)
- if (_super_show_launcher_handle > 0)
- g_source_remove(_super_show_launcher_handle);
- if (_super_show_shortcuts_handle > 0)
- g_source_remove(_super_show_shortcuts_handle);
- _super_show_launcher_handle = 0;
- _super_show_shortcuts_handle = 0;
-
- // it's a tap on super and we didn't use any shortcuts
- if (TapOnSuper() && !_latest_shortcut)
- ubus_server_send_message(ubus_server_get_default(),
- UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
- g_variant_new("(sus)", "home.lens", 0, ""));
-
- remaining_time_before_hide = BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION - CLAMP((int)(unity::TimeUtil::TimeDelta(&current, &_times[TIME_SUPER_PRESSED])), 0, BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION);
-
- if (_super_hide_launcher_handle > 0)
- g_source_remove(_super_hide_launcher_handle);
- _super_hide_launcher_handle = g_timeout_add(remaining_time_before_hide, &Launcher::SuperHideLauncherTimeout, this);
-}
-
-gboolean Launcher::SuperHideLauncherTimeout(gpointer data)
-{
- Launcher* self = (Launcher*) data;
-
- self->_hide_machine->SetQuirk(LauncherHideMachine::TRIGGER_BUTTON_SHOW, false);
-
- self->_super_hide_launcher_handle = 0;
- return false;
-}
-
-gboolean Launcher::SuperShowLauncherTimeout(gpointer data)
-{
- Launcher* self = (Launcher*) data;
-
- self->_hide_machine->SetQuirk(LauncherHideMachine::TRIGGER_BUTTON_SHOW, true);
-
- self->_super_show_launcher_handle = 0;
- return false;
-}
-
-gboolean Launcher::SuperShowShortcutsTimeout(gpointer data)
-{
- Launcher* self = (Launcher*) data;
-
- if (!self->_key_switcher_activated)
- {
- self->_shortcuts_shown = true;
- self->_hover_machine->SetQuirk(LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE, true);
-
- self->QueueDraw();
- }
-
- self->_super_show_shortcuts_handle = 0;
- return false;
+ _shortcuts_shown = show;
+ _hover_machine->SetQuirk(LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE, show);
}
void Launcher::OnBGColorChanged(GVariant *data)
@@ -1460,15 +1250,13 @@ void Launcher::OnLockHideChanged(GVariant *data)
gboolean enable_lock = FALSE;
g_variant_get(data, "(b)", &enable_lock);
- if (enable_lock)
+ if (enable_lock)
{
_hide_machine->SetQuirk(LauncherHideMachine::LOCK_HIDE, true);
- _hide_machine->SetShowOnEdge(false);
}
else
{
_hide_machine->SetQuirk(LauncherHideMachine::LOCK_HIDE, false);
- _hide_machine->SetShowOnEdge(true);
}
}
@@ -1476,8 +1264,8 @@ void Launcher::DesaturateIcons()
{
for (auto icon : *_model)
{
- if (icon->Type () != LauncherIcon::TYPE_HOME)
- icon->SetQuirk(LauncherIcon::QUIRK_DESAT, true);
+ if (icon->Type () != AbstractLauncherIcon::TYPE_HOME)
+ icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true);
icon->HideTooltip();
}
}
@@ -1486,38 +1274,65 @@ void Launcher::SaturateIcons()
{
for (auto icon : *_model)
{
- icon->SetQuirk(LauncherIcon::QUIRK_DESAT, false);
+ icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, false);
}
}
-void Launcher::OnPlaceViewShown(GVariant* data)
+void Launcher::OnOverlayShown(GVariant* data)
{
- LauncherModel::iterator it;
+ // check the type of overlay
+ unity::glib::String overlay_identity;
+ gboolean can_maximise = FALSE;
+ gint32 overlay_monitor = 0;
+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
+ &overlay_identity, &can_maximise, &overlay_monitor);
+
- _dash_is_open = true;
- bg_effect_helper_.enabled = true;
- _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);
- _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);
+ if (!g_strcmp0(overlay_identity, "dash"))
+ {
+ if (overlay_monitor == monitor)
+ {
+ LauncherModel::iterator it;
+
+ _dash_is_open = true;
+ bg_effect_helper_.enabled = true;
+ _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);
+ _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);
- DesaturateIcons();
+ DesaturateIcons();
+ }
+ }
}
-void Launcher::OnPlaceViewHidden(GVariant* data)
+void Launcher::OnOverlayHidden(GVariant* data)
{
- LauncherModel::iterator it;
+ // check the type of overlay
+ unity::glib::String overlay_identity;
+ gboolean can_maximise = FALSE;
+ gint32 overlay_monitor = 0;
+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
+ &overlay_identity, &can_maximise, &overlay_monitor);
- _dash_is_open = false;
- bg_effect_helper_.enabled = false;
- _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);
- _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false);
+ if (!g_strcmp0(overlay_identity, "dash"))
+ {
+ if (!_dash_is_open)
+ return;
+
+ LauncherModel::iterator it;
- // as the leave event is no more received when the place is opened
- // FIXME: remove when we change the mouse grab strategy in nux
- nux::Point pt = nux::GetWindowCompositor().GetMousePosition();
+ _dash_is_open = false;
+ bg_effect_helper_.enabled = false;
+ _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);
+ _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false);
+
+ // as the leave event is no more received when the place is opened
+ // FIXME: remove when we change the mouse grab strategy in nux
+ nux::Point pt = nux::GetWindowCompositor().GetMousePosition();
- SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt));
+ SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt));
- SaturateIcons();
+ SaturateIcons();
+ }
}
void Launcher::OnActionDone(GVariant* data)
@@ -1535,12 +1350,10 @@ void Launcher::SetHidden(bool hidden)
_hover_machine->SetQuirk(LauncherHoverMachine::LAUNCHER_HIDDEN, hidden);
_hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
- if (_hide_machine->GetQuirk(LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE))
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, true);
- else
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, false);
- if (hidden) {
+ if (hidden)
+ {
+ _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, false);
_hide_machine->SetQuirk(LauncherHideMachine::MT_DRAG_OUT, false);
SetStateMouseOverLauncher(false);
}
@@ -1548,7 +1361,7 @@ void Launcher::SetHidden(bool hidden)
_postreveal_mousemove_delta_x = 0;
_postreveal_mousemove_delta_y = 0;
- SetTimeStruct(&_times[TIME_AUTOHIDE], &_times[TIME_AUTOHIDE], ANIM_DURATION_SHORT);
+ TimeUtil::SetTimeStruct(&_times[TIME_AUTOHIDE], &_times[TIME_AUTOHIDE], ANIM_DURATION_SHORT);
_parent->EnableInputWindow(!hidden, "launcher", false, false);
@@ -1561,13 +1374,13 @@ void Launcher::SetHidden(bool hidden)
}
int
-Launcher::GetMouseX()
+Launcher::GetMouseX() const
{
return _mouse_position.x;
}
int
-Launcher::GetMouseY()
+Launcher::GetMouseY() const
{
return _mouse_position.y;
}
@@ -1719,7 +1532,7 @@ Launcher::OnViewPortSwitchEnded()
CheckWindowOverLauncher();
}
-Launcher::LauncherHideMode Launcher::GetHideMode()
+LauncherHideMode Launcher::GetHideMode() const
{
return _hidemode;
}
@@ -1738,6 +1551,44 @@ gboolean Launcher::StrutHack(gpointer data)
return false;
}
+void
+Launcher::OnOptionsChanged(Options::Ptr options)
+{
+ UpdateOptions(options);
+
+ options->option_changed.connect(sigc::mem_fun(this, &Launcher::OnOptionChanged));
+}
+
+void
+Launcher::OnOptionChanged()
+{
+ UpdateOptions(options());
+}
+
+void
+Launcher::UpdateOptions(Options::Ptr options)
+{
+ SetHideMode(options->hide_mode);
+ SetIconSize(options->tile_size, options->icon_size);
+
+ // make the effect half as strong as specified as other values shouldn't scale
+ // as quickly as the max velocity multiplier
+ float responsiveness_mult = ((options->edge_responsiveness() - 1) * .025) + 1;
+
+ decaymulator_->rate_of_decay = options->edge_decay_rate() * responsiveness_mult;
+ _edge_overcome_pressure = options->edge_overcome_pressure() * responsiveness_mult;
+
+ _pointer_barrier->threshold = options->edge_stop_velocity();
+ _pointer_barrier->max_velocity_multiplier = options->edge_responsiveness();
+ _pointer_barrier->DestroyBarrier();
+ _pointer_barrier->ConstructBarrier();
+
+ _hide_machine->reveal_pressure = options->edge_reveal_pressure() * responsiveness_mult;
+ _hide_machine->edge_decay_rate = options->edge_decay_rate() * responsiveness_mult;
+
+ EnsureAnimation();
+}
+
void Launcher::SetHideMode(LauncherHideMode hidemode)
{
if (_hidemode == hidemode)
@@ -1759,45 +1610,14 @@ void Launcher::SetHideMode(LauncherHideMode hidemode)
EnsureAnimation();
}
-Launcher::AutoHideAnimation Launcher::GetAutoHideAnimation()
-{
- return _autohide_animation;
-}
-
-void Launcher::SetAutoHideAnimation(AutoHideAnimation animation)
-{
- if (_autohide_animation == animation)
- return;
-
- _autohide_animation = animation;
-}
-
-void Launcher::SetFloating(bool floating)
-{
- if (_floating == floating)
- return;
-
- _floating = floating;
- EnsureAnimation();
-}
-
-void Launcher::SetBacklightMode(BacklightMode mode)
-{
- if (_backlight_mode == mode)
- return;
-
- _backlight_mode = mode;
- EnsureAnimation();
-}
-
-Launcher::BacklightMode Launcher::GetBacklightMode()
+BacklightMode Launcher::GetBacklightMode() const
{
- return _backlight_mode;
+ return options()->backlight_mode();
}
-bool Launcher::IsBackLightModeToggles()
+bool Launcher::IsBackLightModeToggles() const
{
- switch (_backlight_mode) {
+ switch (options()->backlight_mode()) {
case BACKLIGHT_NORMAL:
case BACKLIGHT_EDGE_TOGGLE:
case BACKLIGHT_NORMAL_EDGE_TOGGLE:
@@ -1808,36 +1628,6 @@ bool Launcher::IsBackLightModeToggles()
}
void
-Launcher::SetLaunchAnimation(LaunchAnimation animation)
-{
- if (_launch_animation == animation)
- return;
-
- _launch_animation = animation;
-}
-
-Launcher::LaunchAnimation
-Launcher::GetLaunchAnimation()
-{
- return _launch_animation;
-}
-
-void
-Launcher::SetUrgentAnimation(UrgentAnimation animation)
-{
- if (_urgent_animation == animation)
- return;
-
- _urgent_animation = animation;
-}
-
-Launcher::UrgentAnimation
-Launcher::GetUrgentAnimation()
-{
- return _urgent_animation;
-}
-
-void
Launcher::SetActionState(LauncherActionState actionstate)
{
if (_launcher_action_state == actionstate)
@@ -1846,13 +1636,10 @@ Launcher::SetActionState(LauncherActionState actionstate)
_launcher_action_state = actionstate;
_hover_machine->SetQuirk(LauncherHoverMachine::LAUNCHER_IN_ACTION, (actionstate != ACTION_NONE));
-
- if (_keynav_activated)
- exitKeyNavMode();
}
Launcher::LauncherActionState
-Launcher::GetActionState()
+Launcher::GetActionState() const
{
return _launcher_action_state;
}
@@ -1868,11 +1655,11 @@ void Launcher::SetHover(bool hovered)
if (_hovered)
{
_enter_y = (int) _mouse_position.y;
- SetTimeStruct(&_times[TIME_ENTER], &_times[TIME_LEAVE], ANIM_DURATION);
+ TimeUtil::SetTimeStruct(&_times[TIME_ENTER], &_times[TIME_LEAVE], ANIM_DURATION);
}
else
{
- SetTimeStruct(&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION);
+ TimeUtil::SetTimeStruct(&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION);
}
if (_dash_is_open && !_hide_machine->GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE))
@@ -1888,7 +1675,7 @@ void Launcher::SetHover(bool hovered)
bool Launcher::MouseOverTopScrollArea()
{
- return _mouse_position.y < 24;
+ return _mouse_position.y < panel_height;
}
bool Launcher::MouseOverTopScrollExtrema()
@@ -1898,7 +1685,7 @@ bool Launcher::MouseOverTopScrollExtrema()
bool Launcher::MouseOverBottomScrollArea()
{
- return _mouse_position.y > GetGeometry().height - 24;
+ return _mouse_position.y > GetGeometry().height - panel_height;
}
bool Launcher::MouseOverBottomScrollExtrema()
@@ -1911,7 +1698,7 @@ gboolean Launcher::OnScrollTimeout(gpointer data)
Launcher* self = (Launcher*) data;
nux::Geometry geo = self->GetGeometry();
- if (self->_keynav_activated || self->_key_switcher_activated || !self->_hovered ||
+ if (self->IsInKeyNavMode() || !self->_hovered ||
self->GetActionState() == ACTION_DRAG_LAUNCHER)
return TRUE;
@@ -1951,50 +1738,58 @@ void Launcher::EnsureScrollTimer()
void Launcher::SetIconSize(int tile_size, int icon_size)
{
- nux::Geometry geo = _parent->GetGeometry();
-
_icon_size = tile_size;
_icon_image_size = icon_size;
_icon_image_size_delta = tile_size - icon_size;
_icon_glow_size = icon_size + 14;
- _parent->SetGeometry(nux::Geometry(geo.x, geo.y, tile_size + 12, geo.height));
-
icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons);
+
+ Resize();
}
-void Launcher::SetBackgroundAlpha(float background_alpha)
+void Launcher::Resize()
{
- if (_background_alpha == background_alpha)
- return;
+ UScreen* uscreen = UScreen::GetDefault();
+ auto geo = uscreen->GetMonitorGeometry(monitor());
+
+ nux::Geometry new_geometry(geo.x, geo.y + panel_height, _icon_size + 12, geo.height - panel_height);
+ SetMaximumHeight(new_geometry.height);
+ _parent->SetGeometry(new_geometry);
+ SetGeometry(new_geometry);
+
+ _pointer_barrier->DestroyBarrier();
+
+ _pointer_barrier->x1 = new_geometry.x;
+ _pointer_barrier->x2 = new_geometry.x;
+ _pointer_barrier->y1 = new_geometry.y;
+ _pointer_barrier->y2 = new_geometry.y + new_geometry.height;
+ _pointer_barrier->threshold = options()->edge_stop_velocity();
+
+ _pointer_barrier->ConstructBarrier();
- _background_alpha = background_alpha;
- NeedRedraw();
}
-void Launcher::OnIconAdded(LauncherIcon* icon)
+void Launcher::OnIconAdded(AbstractLauncherIcon* icon)
{
EnsureAnimation();
- // needs to be disconnected
- icon->needs_redraw_connection = icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));
+ icon->needs_redraw.connect(sigc::mem_fun(this, &Launcher::OnIconNeedsRedraw));
AddChild(icon);
}
-void Launcher::OnIconRemoved(LauncherIcon* icon)
+void Launcher::OnIconRemoved(AbstractLauncherIcon* icon)
{
if (icon->needs_redraw_connection.connected())
icon->needs_redraw_connection.disconnect();
- if (icon == _current_icon)
- _current_icon = 0;
if (icon == _icon_under_mouse)
- _icon_under_mouse = 0;
+ _icon_under_mouse = nullptr;
if (icon == _icon_mouse_down)
- _icon_mouse_down = 0;
+ _icon_mouse_down = nullptr;
if (icon == _drag_icon)
- _drag_icon = 0;
+ _drag_icon = nullptr;
EnsureAnimation();
RemoveChild(icon);
@@ -2009,22 +1804,47 @@ void Launcher::SetModel(LauncherModel* model)
{
_model = model;
- if (_model->on_icon_added_connection.connected())
- _model->on_icon_added_connection.disconnect();
- _model->on_icon_added_connection = _model->icon_added.connect(sigc::mem_fun(this, &Launcher::OnIconAdded));
+ _model->icon_added.connect(sigc::mem_fun(this, &Launcher::OnIconAdded));
+ _model->icon_removed.connect(sigc::mem_fun(this, &Launcher::OnIconRemoved));
+ _model->order_changed.connect(sigc::mem_fun(this, &Launcher::OnOrderChanged));
+ _model->selection_changed.connect(sigc::mem_fun(this, &Launcher::OnSelectionChanged));
+}
+
+LauncherModel* Launcher::GetModel() const
+{
+ return _model;
+}
+
+void Launcher::EnsureIconOnScreen(AbstractLauncherIcon* selection)
+{
+ nux::Point3 center = selection->GetCenter(monitor);
+ nux::Geometry geo = GetGeometry();
+
+ int natural_y = 0;
+ for (auto icon : *_model)
+ {
+ if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
+ continue;
+
+ if (icon == selection)
+ break;
+
+ natural_y += _icon_size + _space_between_icons;
+ }
- if (_model->on_icon_removed_connection.connected())
- _model->on_icon_removed_connection.disconnect();
- _model->on_icon_removed_connection = _model->icon_removed.connect(sigc::mem_fun(this, &Launcher::OnIconRemoved));
+ int max_drag_delta = geo.height - (natural_y + _icon_size + (2 * _space_between_icons));
+ int min_drag_delta = -natural_y;
- if (_model->on_order_changed_connection.connected())
- _model->on_order_changed_connection.disconnect();
- _model->on_order_changed_connection = _model->order_changed.connect(sigc::mem_fun(this, &Launcher::OnOrderChanged));
+ _launcher_drag_delta = std::max<int>(min_drag_delta, std::min<int>(max_drag_delta, _launcher_drag_delta));
}
-LauncherModel* Launcher::GetModel()
+void Launcher::OnSelectionChanged(AbstractLauncherIcon* selection)
{
- return _model;
+ if (IsInKeyNavMode())
+ {
+ EnsureIconOnScreen(selection);
+ EnsureAnimation();
+ }
}
void Launcher::OnIconNeedsRedraw(AbstractLauncherIcon* icon)
@@ -2037,11 +1857,10 @@ void Launcher::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
}
-
-
-
void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
{
+ icon_renderer->monitor = monitor();
+
nux::Geometry base = GetGeometry();
nux::Geometry bkg_box;
std::list<RenderArg> args;
@@ -2057,7 +1876,8 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
ROP.SrcBlend = GL_ONE;
ROP.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- RenderArgs(args, bkg_box, &launcher_alpha);
+ nux::Geometry geo_absolute = GetAbsoluteGeometry();
+ RenderArgs(args, bkg_box, &launcher_alpha, geo_absolute);
if (_drag_icon && _render_drag_window)
{
@@ -2084,8 +1904,6 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
{
if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0))
{
- nux::Geometry geo_absolute = GetAbsoluteGeometry();
-
nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);
auto blur_texture = bg_effect_helper_.GetBlurRegion(blur_geo);
@@ -2126,8 +1944,8 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
nux::TexCoordXForm texxform;
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
- texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()) * (GetAbsoluteGeometry().x); // TODO (gord) don't use absolute values here
- texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * (GetAbsoluteGeometry().y);
+ texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()); // TODO (gord) don't use absolute values here
+ texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * panel_height;
GfxContext.QRP_1Tex(base.x, base.y, base.width, base.height,
launcher_sheen_->GetDeviceTexture(),
texxform,
@@ -2139,7 +1957,7 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
else
{
nux::Color color = _background_color;
- color.alpha = _background_alpha;
+ color.alpha = options()->background_alpha;
gPainter.Paint2DQuadColor(GfxContext, bkg_box, color);
}
@@ -2238,8 +2056,8 @@ gboolean Launcher::StartIconDragTimeout(gpointer data)
{
if (self->_icon_under_mouse)
{
- self->_icon_under_mouse->mouse_leave.emit();
- self->_icon_under_mouse = 0;
+ self->_icon_under_mouse->mouse_leave.emit(self->monitor);
+ self->_icon_under_mouse = nullptr;
}
self->_initial_drag_animation = true;
self->StartIconDragRequest(self->GetMouseX(), self->GetMouseY());
@@ -2250,7 +2068,7 @@ gboolean Launcher::StartIconDragTimeout(gpointer data)
void Launcher::StartIconDragRequest(int x, int y)
{
- LauncherIcon* drag_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
+ AbstractLauncherIcon* drag_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
// FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
// on an internal Launcher property then
@@ -2258,7 +2076,7 @@ void Launcher::StartIconDragRequest(int x, int y)
{
SetActionState(ACTION_DRAG_ICON);
StartIconDrag(drag_icon);
- UpdateDragWindowPosition(drag_icon->GetCenter().x, drag_icon->GetCenter().y);
+ UpdateDragWindowPosition(drag_icon->GetCenter(monitor).x, drag_icon->GetCenter(monitor).y);
if (_initial_drag_animation)
{
_drag_window->SetAnimationTarget(x, y + _drag_window->GetGeometry().height / 2);
@@ -2279,7 +2097,7 @@ void Launcher::StartIconDragRequest(int x, int y)
}
}
-void Launcher::StartIconDrag(LauncherIcon* icon)
+void Launcher::StartIconDrag(AbstractLauncherIcon* icon)
{
if (!icon)
return;
@@ -2308,11 +2126,11 @@ void Launcher::EndIconDrag()
{
if (_drag_window)
{
- LauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
+ AbstractLauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
- if (hovered_icon && hovered_icon->Type() == LauncherIcon::TYPE_TRASH)
+ if (hovered_icon && hovered_icon->Type() == AbstractLauncherIcon::TYPE_TRASH)
{
- hovered_icon->SetQuirk(LauncherIcon::QUIRK_PULSE_ONCE, true);
+ hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, true);
launcher_removerequest.emit(_drag_icon);
@@ -2323,7 +2141,7 @@ void Launcher::EndIconDrag()
{
_model->Save();
- _drag_window->SetAnimationTarget((int)(_drag_icon->GetCenter().x), (int)(_drag_icon->GetCenter().y));
+ _drag_window->SetAnimationTarget((int)(_drag_icon->GetCenter(monitor).x), (int)(_drag_icon->GetCenter(monitor).y));
_drag_window->StartAnimation();
if (_drag_window->on_anim_completed.connected())
@@ -2333,7 +2151,7 @@ void Launcher::EndIconDrag()
}
if (MouseBeyondDragThreshold())
- SetTimeStruct(&_times[TIME_DRAG_THRESHOLD], &_times[TIME_DRAG_THRESHOLD], ANIM_DURATION_SHORT);
+ TimeUtil::SetTimeStruct(&_times[TIME_DRAG_THRESHOLD], &_times[TIME_DRAG_THRESHOLD], ANIM_DURATION_SHORT);
_render_drag_window = false;
@@ -2349,7 +2167,7 @@ void Launcher::UpdateDragWindowPosition(int x, int y)
nux::Geometry geo = _drag_window->GetGeometry();
_drag_window->SetBaseXY(x - geo.width / 2 + _parent->GetGeometry().x, y - geo.height / 2 + _parent->GetGeometry().y);
- LauncherIcon* hovered_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
+ AbstractLauncherIcon* hovered_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y);
struct timespec current;
clock_gettime(CLOCK_MONOTONIC, &current);
@@ -2374,12 +2192,6 @@ void Launcher::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned
EnsureAnimation();
}
-void Launcher::RecvMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags)
-{
- if (_keynav_activated)
- exitKeyNavMode();
-}
-
void Launcher::RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags)
{
SetMousePosition(x, y);
@@ -2423,8 +2235,8 @@ void Launcher::RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_
if (_icon_under_mouse)
{
- _icon_under_mouse->mouse_leave.emit();
- _icon_under_mouse = 0;
+ _icon_under_mouse->mouse_leave.emit(monitor);
+ _icon_under_mouse = nullptr;
}
if (GetActionState() == ACTION_NONE)
@@ -2460,10 +2272,6 @@ void Launcher::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned
SetMousePosition(x, y);
SetStateMouseOverLauncher(true);
- // make sure we actually get a chance to get events before turning this off
- if (x > 0)
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE, false);
-
EventLogic();
EnsureAnimation();
}
@@ -2472,7 +2280,7 @@ void Launcher::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned
{
SetMousePosition(x, y);
SetStateMouseOverLauncher(false);
- LauncherIcon::SetSkipTooltipDelay(false);
+ //AbstractLauncherIcon::SetSkipTooltipDelay(false);
EventLogic();
EnsureAnimation();
@@ -2482,18 +2290,18 @@ void Launcher::RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_
{
SetMousePosition(x, y);
- // make sure we actually get a chance to get events before turning this off
- if (x > 0)
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE, false);
+ if (!_hidden)
+ {
+ _postreveal_mousemove_delta_x += dx;
+ _postreveal_mousemove_delta_y += dy;
- _postreveal_mousemove_delta_x += dx;
- _postreveal_mousemove_delta_y += dy;
+ // check the state before changing it to avoid uneeded hide calls
+ if (!_hide_machine->GetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL) &&
+ (nux::Abs(_postreveal_mousemove_delta_x) > MOUSE_DEADZONE ||
+ nux::Abs(_postreveal_mousemove_delta_y) > MOUSE_DEADZONE))
+ _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, true);
+ }
- // check the state before changing it to avoid uneeded hide calls
- if (!_hide_machine->GetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL) &&
- (nux::Abs(_postreveal_mousemove_delta_x) > MOUSE_DEADZONE ||
- nux::Abs(_postreveal_mousemove_delta_y) > MOUSE_DEADZONE))
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, true);
// Every time the mouse moves, we check if it is inside an icon...
@@ -2519,316 +2327,53 @@ void Launcher::RecvMouseWheel(int x, int y, int wheel_delta, unsigned long butto
EnsureAnimation();
}
-
-gboolean
-Launcher::ResetRepeatShorcutTimeout(gpointer data)
-{
- Launcher* self = (Launcher*) data;
-
- self->_latest_shortcut = 0;
-
- self->_ignore_repeat_shortcut_handle = 0;
- return false;
-}
-
-gboolean
-Launcher::CheckSuperShortcutPressed(Display *x_display,
- unsigned int key_sym,
- unsigned long key_code,
- unsigned long key_state,
- char* key_string)
+void Launcher::OnPointerBarrierEvent(ui::PointerBarrierWrapper* owner, ui::BarrierEvent::Ptr event)
{
- LauncherModel::iterator it;
-
- // Shortcut to start launcher icons. Only relies on Keycode, ignore modifier
- for (it = _model->begin(); it != _model->end(); it++)
+ nux::Geometry abs_geo = GetAbsoluteGeometry();
+ if (_hidden && event->x >= abs_geo.x && event->x <= abs_geo.x + abs_geo.width)
{
- if ((XKeysymToKeycode(x_display, (*it)->GetShortcut()) == key_code) ||
- ((gchar)((*it)->GetShortcut()) == key_string[0]))
- {
- if (_latest_shortcut == (*it)->GetShortcut())
- return true;
-
- if (g_ascii_isdigit((gchar)(*it)->GetShortcut()) && (key_state & ShiftMask))
- (*it)->OpenInstance(ActionArg(ActionArg::LAUNCHER, 0));
- else
- (*it)->Activate(ActionArg(ActionArg::LAUNCHER, 0));
-
- SetLatestShortcut((*it)->GetShortcut());
-
- // disable the "tap on super" check
- _times[TIME_TAP_SUPER].tv_sec = 0;
- _times[TIME_TAP_SUPER].tv_nsec = 0;
- return true;
- }
+ _hide_machine->AddRevealPressure(event->velocity);
+ decaymulator_->value = 0;
}
-
- return false;
-}
-
-void Launcher::SetLatestShortcut(guint64 shortcut)
-{
- _latest_shortcut = shortcut;
- /*
- * 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
- * way to know if a press is an actual press or just an automated repetition
- * because the button is hold down. (key release events are sent in both cases)
- */
- if (_ignore_repeat_shortcut_handle > 0)
- g_source_remove(_ignore_repeat_shortcut_handle);
- _ignore_repeat_shortcut_handle = g_timeout_add(IGNORE_REPEAT_SHORTCUT_DURATION, &Launcher::ResetRepeatShorcutTimeout, this);
-}
-
-void
-Launcher::EdgeRevealTriggered(int mouse_x, int mouse_y)
-{
- SetMousePosition(mouse_x, mouse_y - GetAbsoluteGeometry().y);
-
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_OVER_ACTIVE_EDGE, true);
- _hide_machine->SetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL, true);
-}
-
-void Launcher::SelectPreviousIcon()
-{
- if (_current_icon_index > 0)
+ else if (abs_geo.x > 0)
{
- LauncherModel::iterator it;
- int temp_current_icon_index = _current_icon_index;
- do
- {
- temp_current_icon_index --;
- it = _model->at(temp_current_icon_index);
- }
- while (it != (LauncherModel::iterator)NULL && !(*it)->GetQuirk(LauncherIcon::QUIRK_VISIBLE));
-
- if (it != (LauncherModel::iterator)NULL)
+ decaymulator_->value = decaymulator_->value + event->velocity;
+ if (decaymulator_->value > _edge_overcome_pressure)
{
- _current_icon_index = temp_current_icon_index;
-
- if ((*it)->GetCenter().y - _icon_size / 2 < GetGeometry().y)
- {
- _launcher_drag_delta += (_icon_size + _space_between_icons);
- }
- else if ((*it)->GetCenter().y + _icon_size / 2 > GetGeometry().height)
- {
- _launcher_drag_delta -= (*it)->GetCenter().y + _icon_size/2 +
- _space_between_icons - GetGeometry().height;
- }
+ _pointer_barrier->ReleaseBarrier(event->event_id);
}
-
- EnsureAnimation();
- selection_change.emit();
}
}
-void Launcher::SelectNextIcon()
+bool Launcher::IsInKeyNavMode() const
{
- if (_current_icon_index < _model->Size() - 1)
- {
- LauncherModel::iterator it;
- int temp_current_icon_index = _current_icon_index;
-
- do
- {
- temp_current_icon_index ++;
- it = _model->at(temp_current_icon_index);
- }
- while (it != (LauncherModel::iterator)nullptr &&
- !(*it)->GetQuirk(LauncherIcon::QUIRK_VISIBLE));
-
- if (it != (LauncherModel::iterator)nullptr)
- {
- _current_icon_index = temp_current_icon_index;
-
- if ((*it)->GetCenter().y + _icon_size / 2 > GetGeometry().height)
- {
- _launcher_drag_delta -= (_icon_size + _space_between_icons);
- }
- else if ((*it)->GetCenter().y - _icon_size / 2 < GetGeometry().y)
- {
- _launcher_drag_delta += GetGeometry().y - ((*it)->GetCenter().y - _icon_size);
- }
- }
-
- EnsureAnimation();
- selection_change.emit();
- }
+ return _hide_machine->GetQuirk(LauncherHideMachine::KEY_NAV_ACTIVE);
}
-void Launcher::KeySwitcherActivate()
+void Launcher::EnterKeyNavMode()
{
- if (_key_switcher_activated)
- return;
-
_hide_machine->SetQuirk(LauncherHideMachine::KEY_NAV_ACTIVE, true);
_hover_machine->SetQuirk(LauncherHoverMachine::KEY_NAV_ACTIVE, true);
-
- _key_switcher_activated = true;
-
- ubus_server_send_message(ubus_server_get_default(),
- UBUS_LAUNCHER_START_KEY_SWTICHER,
- g_variant_new_boolean(true));
-
- KeySwitcherNext();
}
-void Launcher::KeySwitcherTerminate()
+void Launcher::ExitKeyNavMode()
{
- if (!_key_switcher_activated)
- return;
-
- LauncherModel::iterator it = _model->at(_current_icon_index);
-
- if (it != (LauncherModel::iterator)NULL)
- (*it)->Activate(ActionArg(ActionArg::LAUNCHER, 0));
-
_hide_machine->SetQuirk(LauncherHideMachine::KEY_NAV_ACTIVE, false);
_hover_machine->SetQuirk(LauncherHoverMachine::KEY_NAV_ACTIVE, false);
-
- ubus_server_send_message(ubus_server_get_default(),
- UBUS_LAUNCHER_END_KEY_SWTICHER,
- g_variant_new_boolean(true));
-
- _key_switcher_activated = false;
- _current_icon_index = -1;
- _last_icon_index = -1;
- QueueDraw();
-
- selection_change.emit();
-}
-
-void Launcher::KeySwitcherCancel()
-{
- if (!_key_switcher_activated)
- return;
-
- _current_icon_index = -1;
- KeySwitcherTerminate();
-}
-
-bool Launcher::KeySwitcherIsActive()
-{
- return _key_switcher_activated;
-}
-
-void Launcher::KeySwitcherNext()
-{
- if (!_key_switcher_activated)
- return;
-
- if (_current_icon_index == _model->Size() - 1)
- {
- _current_icon_index = -1;
- }
-
- SelectNextIcon();
-}
-
-void Launcher::KeySwitcherPrevious()
-{
- if (!_key_switcher_activated)
- return;
-
- if (_current_icon_index == 0)
- {
- _current_icon_index = _model->Size();
- }
-
- SelectPreviousIcon();
}
-void
-Launcher::RecvKeyPressed(unsigned long eventType,
- unsigned long key_sym,
- unsigned long key_state,
- const char* character,
- unsigned short keyCount)
+void Launcher::RecvQuicklistOpened(QuicklistView* quicklist)
{
-
- LauncherModel::iterator it;
-
- /*
- * all key events below are related to keynavigation. Make an additional
- * check that we are in a keynav mode when we inadvertadly receive the focus
- */
- if (!_keynav_activated)
- return;
-
- switch (key_sym)
+ UScreen* uscreen = UScreen::GetDefault();
+ if (uscreen->GetMonitorGeometry(monitor).IsInside(nux::Point(quicklist->GetGeometry().x, quicklist->GetGeometry().y)))
{
- // up (move selection up or go to global-menu if at top-most icon)
- case NUX_VK_UP:
- case NUX_KP_UP:
- SelectPreviousIcon();
- break;
-
- // down (move selection down and unfold launcher if needed)
- case NUX_VK_DOWN:
- case NUX_KP_DOWN:
- SelectNextIcon();
- break;
-
- // esc/left (close quicklist or exit laucher key-focus)
- case NUX_VK_LEFT:
- case NUX_KP_LEFT:
- case NUX_VK_ESCAPE:
- // hide again
- exitKeyNavMode();
- break;
-
- // right/shift-f10 (open quicklist of currently selected icon)
- case XK_F10:
- if (!(key_state & nux::NUX_STATE_SHIFT))
- break;
- case NUX_VK_RIGHT:
- case NUX_KP_RIGHT:
- case XK_Menu:
- // open quicklist of currently selected icon
- it = _model->at(_current_icon_index);
- if (it != (LauncherModel::iterator)NULL)
- {
- if ((*it)->OpenQuicklist(true))
- leaveKeyNavMode(false);
- }
- break;
-
- // <SPACE> (open a new instance)
- case NUX_VK_SPACE:
- // start currently selected icon
- it = _model->at(_current_icon_index);
- if (it != (LauncherModel::iterator)NULL)
- {
- (*it)->OpenInstance(ActionArg(ActionArg::LAUNCHER, 0));
- }
- exitKeyNavMode();
- break;
-
- // <RETURN> (start/activate currently selected icon)
- case NUX_VK_ENTER:
- case NUX_KP_ENTER:
- {
- // start currently selected icon
- it = _model->at(_current_icon_index);
- if (it != (LauncherModel::iterator)NULL)
- (*it)->Activate(ActionArg(ActionArg::LAUNCHER, 0));
- }
- exitKeyNavMode();
- break;
-
- default:
- break;
+ _hide_machine->SetQuirk(LauncherHideMachine::QUICKLIST_OPEN, true);
+ _hover_machine->SetQuirk(LauncherHoverMachine::QUICKLIST_OPEN, true);
+ EventLogic();
+ EnsureAnimation();
}
}
-void Launcher::RecvQuicklistOpened(QuicklistView* quicklist)
-{
- _hide_machine->SetQuirk(LauncherHideMachine::QUICKLIST_OPEN, true);
- _hover_machine->SetQuirk(LauncherHoverMachine::QUICKLIST_OPEN, true);
- EventLogic();
- EnsureAnimation();
-}
-
void Launcher::RecvQuicklistClosed(QuicklistView* quicklist)
{
nux::Point pt = nux::GetWindowCompositor().GetMousePosition();
@@ -2854,10 +2399,9 @@ void Launcher::EventLogic()
GetActionState() == ACTION_DRAG_LAUNCHER)
return;
- LauncherIcon* launcher_icon = 0;
+ AbstractLauncherIcon* launcher_icon = nullptr;
- if (_hide_machine->GetQuirk(LauncherHideMachine::MOUSE_OVER_LAUNCHER)
- && _hide_machine->GetQuirk(LauncherHideMachine::MOUSE_MOVE_POST_REVEAL))
+ if (!_hidden && !IsInKeyNavMode() && _hovered)
{
launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
}
@@ -2865,13 +2409,13 @@ void Launcher::EventLogic()
if (_icon_under_mouse && (_icon_under_mouse != launcher_icon))
{
- _icon_under_mouse->mouse_leave.emit();
- _icon_under_mouse = 0;
+ _icon_under_mouse->mouse_leave.emit(monitor);
+ _icon_under_mouse = nullptr;
}
if (launcher_icon && (_icon_under_mouse != launcher_icon))
{
- launcher_icon->mouse_enter.emit();
+ launcher_icon->mouse_enter.emit(monitor);
_icon_under_mouse = launcher_icon;
_hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
@@ -2880,7 +2424,7 @@ void Launcher::EventLogic()
void Launcher::MouseDownLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)
{
- LauncherIcon* launcher_icon = 0;
+ AbstractLauncherIcon* launcher_icon = nullptr;
launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
_hide_machine->SetQuirk(LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
@@ -2893,15 +2437,13 @@ void Launcher::MouseDownLogic(int x, int y, unsigned long button_flags, unsigned
g_source_remove(_start_dragicon_handle);
_start_dragicon_handle = g_timeout_add(START_DRAGICON_DURATION, &Launcher::StartIconDragTimeout, this);
- launcher_icon->mouse_down.emit(nux::GetEventButton(button_flags));
+ launcher_icon->mouse_down.emit(nux::GetEventButton(button_flags), monitor);
}
-
- KeySwitcherCancel();
}
void Launcher::MouseUpLogic(int x, int y, unsigned long button_flags, unsigned long key_flags)
{
- LauncherIcon* launcher_icon = 0;
+ AbstractLauncherIcon* launcher_icon = nullptr;
launcher_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
@@ -2911,28 +2453,28 @@ void Launcher::MouseUpLogic(int x, int y, unsigned long button_flags, unsigned l
if (_icon_mouse_down && (_icon_mouse_down == launcher_icon))
{
- _icon_mouse_down->mouse_up.emit(nux::GetEventButton(button_flags));
+ _icon_mouse_down->mouse_up.emit(nux::GetEventButton(button_flags), monitor);
if (GetActionState() == ACTION_NONE)
{
- _icon_mouse_down->mouse_click.emit(nux::GetEventButton(button_flags));
+ _icon_mouse_down->mouse_click.emit(nux::GetEventButton(button_flags), monitor);
}
}
if (launcher_icon && (_icon_mouse_down != launcher_icon))
{
- launcher_icon->mouse_up.emit(nux::GetEventButton(button_flags));
+ launcher_icon->mouse_up.emit(nux::GetEventButton(button_flags), monitor);
}
if (GetActionState() == ACTION_DRAG_LAUNCHER)
{
- SetTimeStruct(&_times[TIME_DRAG_END]);
+ TimeUtil::SetTimeStruct(&_times[TIME_DRAG_END]);
}
- _icon_mouse_down = 0;
+ _icon_mouse_down = nullptr;
}
-LauncherIcon* Launcher::MouseIconIntersection(int x, int y)
+AbstractLauncherIcon* Launcher::MouseIconIntersection(int x, int y)
{
LauncherModel::iterator it;
// We are looking for the icon at screen coordinates x, y;
@@ -2941,13 +2483,13 @@ LauncherIcon* Launcher::MouseIconIntersection(int x, int y)
for (it = _model->begin(); it != _model->end(); it++)
{
- if (!(*it)->GetQuirk(LauncherIcon::QUIRK_VISIBLE))
+ if (!(*it)->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
continue;
nux::Point2 screen_coord [4];
for (int i = 0; i < 4; ++i)
{
- auto hit_transform = (*it)->GetTransform(AbstractLauncherIcon::TRANSFORM_HIT_AREA);
+ auto hit_transform = (*it)->GetTransform(AbstractLauncherIcon::TRANSFORM_HIT_AREA, monitor);
screen_coord [i].x = hit_transform [i].x;
screen_coord [i].y = hit_transform [i].y;
}
@@ -2960,14 +2502,14 @@ LauncherIcon* Launcher::MouseIconIntersection(int x, int y)
}
void
-Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, LauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)
+Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)
{
RenderArg arg;
struct timespec current;
clock_gettime(CLOCK_MONOTONIC, &current);
SetupRenderArg(icon, current, arg);
- arg.render_center = nux::Point3(_icon_size / 2.0f, _icon_size / 2.0f, 0.0f);
+ arg.render_center = nux::Point3(roundf(_icon_size / 2.0f), roundf(_icon_size / 2.0f), 0.0f);
arg.logical_center = arg.render_center;
arg.x_rotation = 0.0f;
arg.running_arrow = false;
@@ -2991,14 +2533,17 @@ Launcher::SetOffscreenRenderTarget(nux::ObjectPtr<nux::IOpenGLBaseTexture> textu
int width = texture->GetWidth();
int height = texture->GetHeight();
- nux::GetGraphicsDisplay()->GetGpuDevice()->FormatFrameBufferObject(width, height, nux::BITFMT_R8G8B8A8);
- nux::GetGraphicsDisplay()->GetGpuDevice()->SetColorRenderTargetSurface(0, texture->GetSurfaceLevel(0));
- nux::GetGraphicsDisplay()->GetGpuDevice()->ActivateFrameBuffer();
+ auto graphics_display = nux::GetGraphicsDisplay();
+ auto gpu_device = graphics_display->GetGpuDevice();
+ gpu_device->FormatFrameBufferObject(width, height, nux::BITFMT_R8G8B8A8);
+ gpu_device->SetColorRenderTargetSurface(0, texture->GetSurfaceLevel(0));
+ gpu_device->ActivateFrameBuffer();
- nux::GetGraphicsDisplay()->GetGraphicsEngine()->SetContext(0, 0, width, height);
- nux::GetGraphicsDisplay()->GetGraphicsEngine()->SetViewport(0, 0, width, height);
- nux::GetGraphicsDisplay()->GetGraphicsEngine()->Push2DWindow(width, height);
- nux::GetGraphicsDisplay()->GetGraphicsEngine()->EmptyClippingRegion();
+ auto graphics_engine = graphics_display->GetGraphicsEngine();
+ graphics_engine->SetContext(0, 0, width, height);
+ graphics_engine->SetViewport(0, 0, width, height);
+ graphics_engine->Push2DWindow(width, height);
+ graphics_engine->EmptyClippingRegion();
}
void
@@ -3044,9 +2589,9 @@ void Launcher::OnDNDDataCollected(const std::list<char*>& mimes)
for (auto it : *_model)
{
if (it->QueryAcceptDrop(_dnd_data) != nux::DNDACTION_NONE)
- it->SetQuirk(LauncherIcon::QUIRK_DROP_PRELIGHT, true);
+ it->SetQuirk(AbstractLauncherIcon::QUIRK_DROP_PRELIGHT, true);
else
- it->SetQuirk(LauncherIcon::QUIRK_DROP_DIM, true);
+ it->SetQuirk(AbstractLauncherIcon::QUIRK_DROP_DIM, true);
}
}
}
@@ -3061,7 +2606,7 @@ Launcher::ProcessDndEnter()
_steal_drag = false;
_data_checked = false;
_drag_edge_touching = false;
- _dnd_hovered_icon = 0;
+ _dnd_hovered_icon = nullptr;
}
void
@@ -3071,8 +2616,8 @@ Launcher::DndReset()
for (auto it : *_model)
{
- it->SetQuirk(LauncherIcon::QUIRK_DROP_PRELIGHT, false);
- it->SetQuirk(LauncherIcon::QUIRK_DROP_DIM, false);
+ it->SetQuirk(AbstractLauncherIcon::QUIRK_DROP_PRELIGHT, false);
+ it->SetQuirk(AbstractLauncherIcon::QUIRK_DROP_DIM, false);
}
DndHoveredIconReset();
@@ -3085,18 +2630,18 @@ void Launcher::DndHoveredIconReset()
if (_steal_drag && _dnd_hovered_icon)
{
- _dnd_hovered_icon->SetQuirk(LauncherIcon::QUIRK_VISIBLE, false);
+ _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false);
_dnd_hovered_icon->remove.emit(_dnd_hovered_icon);
}
if (!_steal_drag && _dnd_hovered_icon)
{
_dnd_hovered_icon->SendDndLeave();
- _dnd_hovered_icon = 0;
+ _dnd_hovered_icon = nullptr;
}
_steal_drag = false;
- _dnd_hovered_icon = 0;
+ _dnd_hovered_icon = nullptr;
}
void
@@ -3147,9 +2692,9 @@ Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
for (auto it : *_model)
{
if (it->QueryAcceptDrop(_dnd_data) != nux::DNDACTION_NONE)
- it->SetQuirk(LauncherIcon::QUIRK_DROP_PRELIGHT, true);
+ it->SetQuirk(AbstractLauncherIcon::QUIRK_DROP_PRELIGHT, true);
else
- it->SetQuirk(LauncherIcon::QUIRK_DROP_DIM, true);
+ it->SetQuirk(AbstractLauncherIcon::QUIRK_DROP_DIM, true);
}
}
}
@@ -3162,26 +2707,26 @@ Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
_dnd_hovered_icon->SendDndLeave();
_drag_edge_touching = true;
- SetTimeStruct(&_times[TIME_DRAG_EDGE_TOUCH], &_times[TIME_DRAG_EDGE_TOUCH], ANIM_DURATION * 3);
+ TimeUtil::SetTimeStruct(&_times[TIME_DRAG_EDGE_TOUCH], &_times[TIME_DRAG_EDGE_TOUCH], ANIM_DURATION * 3);
EnsureAnimation();
}
else if (_mouse_position.x != 0 && _drag_edge_touching)
{
_drag_edge_touching = false;
- SetTimeStruct(&_times[TIME_DRAG_EDGE_TOUCH], &_times[TIME_DRAG_EDGE_TOUCH], ANIM_DURATION * 3);
+ TimeUtil::SetTimeStruct(&_times[TIME_DRAG_EDGE_TOUCH], &_times[TIME_DRAG_EDGE_TOUCH], ANIM_DURATION * 3);
EnsureAnimation();
}
EventLogic();
- LauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
+ AbstractLauncherIcon* hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
bool hovered_icon_is_appropriate = false;
if (hovered_icon)
{
- if (hovered_icon->Type() == LauncherIcon::TYPE_TRASH)
+ if (hovered_icon->Type() == AbstractLauncherIcon::TYPE_TRASH)
_steal_drag = false;
- if (hovered_icon->Type() == LauncherIcon::TYPE_APPLICATION || hovered_icon->Type() == LauncherIcon::TYPE_EXPO)
+ if (hovered_icon->Type() == AbstractLauncherIcon::TYPE_APPLICATION || hovered_icon->Type() == AbstractLauncherIcon::TYPE_EXPO)
hovered_icon_is_appropriate = true;
}
@@ -3190,7 +2735,7 @@ Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
_drag_action = nux::DNDACTION_COPY;
if (!_dnd_hovered_icon && hovered_icon_is_appropriate)
{
- _dnd_hovered_icon = new SpacerLauncherIcon(this);
+ _dnd_hovered_icon = new SpacerLauncherIcon();
_dnd_hovered_icon->SetSortPriority(G_MAXINT);
_model->AddIcon(_dnd_hovered_icon);
_model->ReorderBefore(_dnd_hovered_icon, hovered_icon, true);
@@ -3205,9 +2750,9 @@ Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
}
else
{
- _dnd_hovered_icon->SetQuirk(LauncherIcon::QUIRK_VISIBLE, false);
+ _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false);
_dnd_hovered_icon->remove.emit(_dnd_hovered_icon);
- _dnd_hovered_icon = 0;
+ _dnd_hovered_icon = nullptr;
}
}
}
@@ -3251,7 +2796,7 @@ Launcher::ProcessDndDrop(int x, int y)
{
if (g_str_has_suffix(it.c_str(), ".desktop"))
{
- char* path = 0;
+ char* path = nullptr;
if (g_str_has_prefix(it.c_str(), "application://"))
{
@@ -3290,20 +2835,12 @@ Launcher::ProcessDndDrop(int x, int y)
* Returns the current selected icon if it is in keynavmode
* It will return NULL if it is not on keynavmode
*/
-LauncherIcon*
-Launcher::GetSelectedMenuIcon()
+AbstractLauncherIcon*
+Launcher::GetSelectedMenuIcon() const
{
- LauncherModel::iterator it;
-
- if (_current_icon_index == -1)
- return NULL;
-
- it = _model->at(_current_icon_index);
-
- if (it != (LauncherModel::iterator)NULL)
- return *it;
- else
+ if (!IsInKeyNavMode())
return NULL;
+ return _model->Selection();
}
/* dbus handlers */
@@ -3332,9 +2869,9 @@ Launcher::handle_dbus_method_call(GDBusConnection* connection,
g_variant_get(parameters, "(ssiiiss)", &title, &icon, &icon_x, &icon_y, &icon_size, &desktop_file, &aptdaemon_task, NULL);
Launcher* self = (Launcher*)user_data;
- self->launcher_addrequest_special.emit(desktop_file, NULL, aptdaemon_task, icon);
+ self->launcher_addrequest_special.emit(desktop_file, nullptr, aptdaemon_task, icon);
- g_dbus_method_invocation_return_value(invocation, NULL);
+ g_dbus_method_invocation_return_value(invocation, nullptr);
g_free(icon);
g_free(title);
g_free(desktop_file);
diff --git a/plugins/unityshell/src/Launcher.h b/plugins/unityshell/src/Launcher.h
index 6cec077ef..56021053b 100644
--- a/plugins/unityshell/src/Launcher.h
+++ b/plugins/unityshell/src/Launcher.h
@@ -28,12 +28,14 @@
#include <Nux/TimerProc.h>
#include <NuxGraphics/IOpenGLAsmShader.h>
+#include "PointerBarrier.h"
#include "AbstractIconRenderer.h"
#include "BackgroundEffectHelper.h"
#include "DNDCollectionWindow.h"
#include "DndData.h"
#include "GeisAdapter.h"
#include "Introspectable.h"
+#include "LauncherOptions.h"
#include "LauncherDragWindow.h"
#include "LauncherHideMachine.h"
#include "LauncherHoverMachine.h"
@@ -44,128 +46,66 @@
#define ANIM_DURATION 200
#define ANIM_DURATION_LONG 350
-#define SUPER_TAP_DURATION 250
-#define SHORTCUTS_SHOWN_DELAY 750
-#define START_DRAGICON_DURATION 250
-#define BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION 1000
-
-#define IGNORE_REPEAT_SHORTCUT_DURATION 250
-
#define MAX_SUPERKEY_LABELS 10
+#define START_DRAGICON_DURATION 250
+
class QuicklistView;
namespace unity
{
namespace launcher
{
-class LauncherIcon;
+class AbstractLauncherIcon;
class LauncherModel;
class Launcher : public unity::debug::Introspectable, public nux::View
{
NUX_DECLARE_OBJECT_TYPE(Launcher, nux::View);
public:
- typedef enum
- {
- LAUNCHER_HIDE_NEVER,
- LAUNCHER_HIDE_AUTOHIDE,
- LAUNCHER_HIDE_DODGE_WINDOWS,
- LAUNCHER_HIDE_DODGE_ACTIVE_WINDOW,
- } LauncherHideMode;
-
- typedef enum
- {
- LAUNCH_ANIMATION_NONE,
- LAUNCH_ANIMATION_PULSE,
- LAUNCH_ANIMATION_BLINK,
- } LaunchAnimation;
-
- typedef enum
- {
- URGENT_ANIMATION_NONE,
- URGENT_ANIMATION_PULSE,
- URGENT_ANIMATION_WIGGLE,
- } UrgentAnimation;
-
- typedef enum
- {
- FADE_OR_SLIDE,
- SLIDE_ONLY,
- FADE_ONLY,
- FADE_AND_SLIDE,
- } AutoHideAnimation;
-
- typedef enum
- {
- BACKLIGHT_ALWAYS_ON,
- BACKLIGHT_NORMAL,
- BACKLIGHT_ALWAYS_OFF,
- BACKLIGHT_EDGE_TOGGLE,
- BACKLIGHT_NORMAL_EDGE_TOGGLE
- } BacklightMode;
Launcher(nux::BaseWindow* parent, NUX_FILE_LINE_PROTO);
~Launcher();
nux::Property<Display*> display;
+ nux::Property<int> monitor;
+ nux::Property<Options::Ptr> options;
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
- LauncherIcon* GetSelectedMenuIcon();
+ AbstractLauncherIcon* GetSelectedMenuIcon() const;
void SetIconSize(int tile_size, int icon_size);
- void SetBackgroundAlpha(float background_alpha);
LauncherHideMachine* HideMachine() { return _hide_machine; }
- bool Hidden()
+ bool Hidden() const
{
return _hidden;
}
- bool ShowOnEdge()
- {
- return _hide_machine->GetShowOnEdge();
- }
-
- void SetModel(LauncherModel* model);
- LauncherModel* GetModel();
- void SetFloating(bool floating);
+ void ForceReveal(bool force);
+ void ShowShortcuts(bool show);
- void SetHideMode(LauncherHideMode hidemode);
- LauncherHideMode GetHideMode();
+ void SetModel(LauncherModel* model);
+ LauncherModel* GetModel() const;
void StartKeyShowLauncher();
void EndKeyShowLauncher();
- void SetBacklightMode(BacklightMode mode);
- BacklightMode GetBacklightMode();
- bool IsBackLightModeToggles();
-
- void SetLaunchAnimation(LaunchAnimation animation);
- LaunchAnimation GetLaunchAnimation();
-
- void SetUrgentAnimation(UrgentAnimation animation);
- UrgentAnimation GetUrgentAnimation();
+ void EnsureIconOnScreen(AbstractLauncherIcon* icon);
- void SetAutoHideAnimation(AutoHideAnimation animation);
- AutoHideAnimation GetAutoHideAnimation();
-
- void EdgeRevealTriggered(int x, int y);
-
- gboolean CheckSuperShortcutPressed(Display *x_display, unsigned int key_sym, unsigned long key_code, unsigned long key_state, char* key_string);
- void SetLatestShortcut(guint64 shortcut);
+ void SetBacklightMode(BacklightMode mode);
+ BacklightMode GetBacklightMode() const;
+ bool IsBackLightModeToggles() const;
- nux::BaseWindow* GetParent()
+ nux::BaseWindow* GetParent() const
{
return _parent;
};
- static void SetTimeStruct(struct timespec* timer, struct timespec* sister = 0, int sister_relation = 0);
-
virtual void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
virtual void RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
virtual void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
@@ -173,48 +113,31 @@ public:
virtual void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
virtual void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
virtual void RecvMouseWheel(int x, int y, int wheel_delta, unsigned long button_flags, unsigned long key_flags);
- virtual void RecvMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags);
-
- virtual void RecvKeyPressed(unsigned long eventType , /*event type*/
- unsigned long keysym , /*event keysym*/
- unsigned long state , /*event state*/
- const char* character , /*character*/
- unsigned short keyCount /*key repeat count*/);
virtual void RecvQuicklistOpened(QuicklistView* quicklist);
virtual void RecvQuicklistClosed(QuicklistView* quicklist);
- void startKeyNavMode();
- void leaveKeyNavMode(bool preserve_focus = true);
+ int GetMouseX() const;
+ int GetMouseY() const;
- void exitKeyNavMode(); // Connected to signal OnEndFocus
-
- int GetMouseX();
- int GetMouseY();
+ void Resize();
void CheckWindowOverLauncher();
void EnableCheckWindowOverLauncher(gboolean enabled);
- sigc::signal<void, char*, LauncherIcon*> launcher_addrequest;
- sigc::signal<void, char*, LauncherIcon*, char*, char*> launcher_addrequest_special;
- sigc::signal<void, LauncherIcon*> launcher_removerequest;
+ sigc::signal<void, char*, AbstractLauncherIcon*> launcher_addrequest;
+ sigc::signal<void, std::string const&, AbstractLauncherIcon*, std::string const&, std::string const&> launcher_addrequest_special;
+ sigc::signal<void, AbstractLauncherIcon*> launcher_removerequest;
sigc::signal<void> selection_change;
sigc::signal<void> hidden_changed;
- // Key navigation
virtual bool InspectKeyEvent(unsigned int eventType,
unsigned int keysym,
const char* character);
- void SelectPreviousIcon();
- void SelectNextIcon();
-
- void KeySwitcherActivate();
- void KeySwitcherTerminate();
- void KeySwitcherCancel();
- bool KeySwitcherIsActive();
- void KeySwitcherNext();
- void KeySwitcherPrevious();
+ void EnterKeyNavMode();
+ void ExitKeyNavMode();
+ bool IsInKeyNavMode() const;
protected:
// Introspectable methods
@@ -228,6 +151,9 @@ protected:
private:
typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
+ LauncherHideMode GetHideMode() const;
+ void SetHideMode(LauncherHideMode hidemode);
+
typedef enum
{
ACTION_NONE,
@@ -251,6 +177,10 @@ private:
TIME_LAST
} LauncherActionTimes;
+ void OnOptionsChanged(Options::Ptr options);
+ void OnOptionChanged();
+ void UpdateOptions(Options::Ptr options);
+
void OnWindowMaybeIntellihide(guint32 xid);
void OnWindowMaybeIntellihideDelayed(guint32 xid);
static gboolean CheckWindowOverLauncherSync(Launcher* self);
@@ -261,35 +191,33 @@ private:
void OnDragUpdate(GeisAdapter::GeisDragData* data);
void OnDragFinish(GeisAdapter::GeisDragData* data);
+ void OnPointerBarrierEvent(ui::PointerBarrierWrapper* owner, ui::BarrierEvent::Ptr event);
+
void OnPluginStateChanged();
+ void OnSelectionChanged(AbstractLauncherIcon* selection);
+
void OnViewPortSwitchStarted();
void OnViewPortSwitchEnded();
static gboolean AnimationTimeout(gpointer data);
- static gboolean SuperShowLauncherTimeout(gpointer data);
- static gboolean SuperHideLauncherTimeout(gpointer data);
- static gboolean SuperShowShortcutsTimeout(gpointer data);
static gboolean StrutHack(gpointer data);
- static gboolean MoveFocusToKeyNavModeTimeout(gpointer data);
static gboolean StartIconDragTimeout(gpointer data);
- static gboolean ResetRepeatShorcutTimeout(gpointer data);
void SetMousePosition(int x, int y);
void SetStateMouseOverLauncher(bool over_launcher);
- void SetStateKeyNav(bool keynav_activated);
- bool MouseBeyondDragThreshold();
+ bool MouseBeyondDragThreshold() const;
void OnDragWindowAnimCompleted();
- bool IconNeedsAnimation(LauncherIcon* icon, struct timespec const& current);
- bool IconDrawEdgeOnly(LauncherIcon* icon);
- bool AnimationInProgress();
+ bool IconNeedsAnimation(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ bool IconDrawEdgeOnly(AbstractLauncherIcon* icon) const;
+ bool AnimationInProgress() const;
void SetActionState(LauncherActionState actionstate);
- LauncherActionState GetActionState();
+ LauncherActionState GetActionState() const;
void EnsureAnimation();
void EnsureScrollTimer();
@@ -303,26 +231,27 @@ private:
static gboolean OnScrollTimeout(gpointer data);
static gboolean OnUpdateDragManagerTimeout(gpointer data);
- float DnDStartProgress(struct timespec const& current);
- float DnDExitProgress(struct timespec const& current);
- float GetHoverProgress(struct timespec const& current);
- float AutohideProgress(struct timespec const& current);
- float DragThresholdProgress(struct timespec const& current);
- float DragHideProgress(struct timespec const& current);
- float DragOutProgress(struct timespec const& current);
- float IconDesatValue(LauncherIcon* icon, struct timespec const& current);
- float IconPresentProgress(LauncherIcon* icon, struct timespec const& current);
- float IconUrgentProgress(LauncherIcon* icon, struct timespec const& current);
- float IconShimmerProgress(LauncherIcon* icon, struct timespec const& current);
- float IconUrgentPulseValue(LauncherIcon* icon, struct timespec const& current);
- float IconPulseOnceValue(LauncherIcon *icon, struct timespec const &current);
- float IconUrgentWiggleValue(LauncherIcon* icon, struct timespec const& current);
- float IconStartingBlinkValue(LauncherIcon* icon, struct timespec const& current);
- float IconStartingPulseValue(LauncherIcon* icon, struct timespec const& current);
- float IconBackgroundIntensity(LauncherIcon* icon, struct timespec const& current);
- float IconProgressBias(LauncherIcon* icon, struct timespec const& current);
- float IconDropDimValue(LauncherIcon* icon, struct timespec const& current);
- float IconCenterTransitionProgress(LauncherIcon* icon, struct timespec const& current);
+ float DnDStartProgress(struct timespec const& current) const;
+ float DnDExitProgress(struct timespec const& current) const;
+ float GetHoverProgress(struct timespec const& current) const;
+ float AutohideProgress(struct timespec const& current) const;
+ float DragThresholdProgress(struct timespec const& current) const;
+ float DragHideProgress(struct timespec const& current) const;
+ float DragOutProgress(struct timespec const& current) const;
+ float IconDesatValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconPresentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconUrgentProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconShimmerProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconUrgentPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconPulseOnceValue(AbstractLauncherIcon *icon, struct timespec const &current) const;
+ float IconUrgentWiggleValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconStartingBlinkValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconStartingPulseValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconBackgroundIntensity(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconProgressBias(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconDropDimValue(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconCenterTransitionProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
+ float IconVisibleProgress(AbstractLauncherIcon* icon, struct timespec const& current) const;
void SetHover(bool hovered);
void SetHidden(bool hidden);
@@ -330,10 +259,11 @@ private:
void SetDndDelta(float x, float y, nux::Geometry const& geo, timespec const& current);
float DragLimiter(float x);
- void SetupRenderArg(LauncherIcon* icon, struct timespec const& current, ui::RenderArg& arg);
- void FillRenderArg(LauncherIcon* icon,
+ void SetupRenderArg(AbstractLauncherIcon* icon, struct timespec const& current, ui::RenderArg& arg);
+ void FillRenderArg(AbstractLauncherIcon* icon,
ui::RenderArg& arg,
nux::Point3& center,
+ nux::Geometry const& parent_abs_geo,
float folding_threshold,
float folded_size,
float folded_spacing,
@@ -343,16 +273,16 @@ private:
struct timespec const& current);
void RenderArgs(std::list<ui::RenderArg> &launcher_args,
- nux::Geometry& box_geo, float* launcher_alpha);
+ nux::Geometry& box_geo, float* launcher_alpha, nux::Geometry const& parent_abs_geo);
- void OnIconAdded(LauncherIcon* icon);
- void OnIconRemoved(LauncherIcon* icon);
+ void OnIconAdded(AbstractLauncherIcon* icon);
+ void OnIconRemoved(AbstractLauncherIcon* icon);
void OnOrderChanged();
void OnIconNeedsRedraw(AbstractLauncherIcon* icon);
- void OnPlaceViewHidden(GVariant* data);
- void OnPlaceViewShown(GVariant* data);
+ void OnOverlayHidden(GVariant* data);
+ void OnOverlayShown(GVariant* data);
void DesaturateIcons();
void SaturateIcons();
@@ -363,20 +293,20 @@ private:
void OnActionDone(GVariant* data);
- void RenderIconToTexture(nux::GraphicsEngine& GfxContext, LauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
+ void RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon* icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
- LauncherIcon* MouseIconIntersection(int x, int y);
+ AbstractLauncherIcon* MouseIconIntersection(int x, int y);
void EventLogic();
void MouseDownLogic(int x, int y, unsigned long button_flags, unsigned long key_flags);
void MouseUpLogic(int x, int y, unsigned long button_flags, unsigned long key_flags);
void StartIconDragRequest(int x, int y);
- void StartIconDrag(LauncherIcon* icon);
+ void StartIconDrag(AbstractLauncherIcon* icon);
void EndIconDrag();
void UpdateDragWindowPosition(int x, int y);
- float GetAutohidePositionMin();
- float GetAutohidePositionMax();
+ float GetAutohidePositionMin() const;
+ float GetAutohidePositionMax() const;
virtual void PreLayoutManagement();
virtual long PostLayoutManagement(long LayoutResult);
@@ -385,8 +315,6 @@ private:
void SetOffscreenRenderTarget(nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
void RestoreSystemRenderTarget();
- gboolean TapOnSuper();
-
void OnDisplayChanged(Display* display);
void OnDNDDataCollected(const std::list<char*>& mimes);
@@ -394,30 +322,20 @@ private:
void DndHoveredIconReset();
nux::HLayout* m_Layout;
- int m_ContentOffsetY;
// used by keyboard/a11y-navigation
- LauncherIcon* _current_icon;
- LauncherIcon* m_ActiveTooltipIcon;
- LauncherIcon* _icon_under_mouse;
- LauncherIcon* _icon_mouse_down;
- LauncherIcon* _drag_icon;
-
- int _current_icon_index;
- int _last_icon_index;
+ AbstractLauncherIcon* _icon_under_mouse;
+ AbstractLauncherIcon* _icon_mouse_down;
+ AbstractLauncherIcon* _drag_icon;
QuicklistView* _active_quicklist;
bool _hovered;
- bool _floating;
bool _hidden;
bool _render_drag_window;
bool _check_window_over_launcher;
bool _shortcuts_shown;
- bool _keynav_activated;
- bool _key_switcher_activated;
- guint64 _latest_shortcut;
BacklightMode _backlight_mode;
@@ -426,16 +344,19 @@ private:
float _folded_z_distance;
float _launcher_top_y;
float _launcher_bottom_y;
+ float _edge_overcome_pressure;
LauncherHideMode _hidemode;
LauncherActionState _launcher_action_state;
LaunchAnimation _launch_animation;
UrgentAnimation _urgent_animation;
- AutoHideAnimation _autohide_animation;
nux::ObjectPtr<nux::IOpenGLBaseTexture> _offscreen_drag_texture;
+ ui::PointerBarrierWrapper::Ptr _pointer_barrier;
+ ui::Decaymulator::Ptr decaymulator_;
+
int _space_between_icons;
int _icon_size;
int _icon_image_size;
@@ -452,21 +373,11 @@ private:
float _drag_out_delta_x;
float _background_alpha;
- int _bfb_width;
- int _bfb_height;
-
guint _autoscroll_handle;
- guint _focus_keynav_handle;
- guint _super_show_launcher_handle;
- guint _super_hide_launcher_handle;
- guint _super_show_shortcuts_handle;
guint _start_dragicon_handle;
guint _dnd_check_handle;
- guint _ignore_repeat_shortcut_handle;
nux::Point2 _mouse_position;
- nux::Point2 _bfb_mouse_position;
- nux::AbstractPaintLayer* m_BackgroundLayer;
nux::BaseWindow* _parent;
LauncherModel* _model;
LauncherDragWindow* _drag_window;
@@ -478,7 +389,7 @@ private:
bool _data_checked;
bool _steal_drag;
bool _drag_edge_touching;
- LauncherIcon* _dnd_hovered_icon;
+ AbstractLauncherIcon* _dnd_hovered_icon;
unity::DNDCollectionWindow* _collection_window;
sigc::connection _on_data_collected_connection;
diff --git a/plugins/unityshell/src/LauncherController.cpp b/plugins/unityshell/src/LauncherController.cpp
index a06ab3042..ef0236d37 100644
--- a/plugins/unityshell/src/LauncherController.cpp
+++ b/plugins/unityshell/src/LauncherController.cpp
@@ -20,14 +20,13 @@
#include <glib/gi18n-lib.h>
#include <libbamf/libbamf.h>
-/* Compiz */
-#include <core/core.h>
#include <Nux/Nux.h>
#include <Nux/HLayout.h>
#include <Nux/BaseWindow.h>
#include <NuxCore/Logger.h>
+#include "LauncherOptions.h"
#include "BamfLauncherIcon.h"
#include "DesktopLauncherIcon.h"
#include "DeviceLauncherIcon.h"
@@ -37,12 +36,16 @@
#include "LauncherController.h"
#include "LauncherEntryRemote.h"
#include "LauncherEntryRemoteModel.h"
-#include "LauncherIcon.h"
+#include "AbstractLauncherIcon.h"
#include "SoftwareCenterLauncherIcon.h"
#include "LauncherModel.h"
#include "WindowManager.h"
#include "TrashLauncherIcon.h"
#include "BFBLauncherIcon.h"
+#include "UScreen.h"
+#include "UBusWrapper.h"
+#include "UBusMessages.h"
+#include "TimeUtil.h"
namespace unity
{
@@ -53,27 +56,47 @@ namespace
nux::logging::Logger logger("unity.launcher");
}
+namespace local
+{
+namespace
+{
+ const int super_tap_duration = 250;
+ const int launcher_minimum_show_duration = 1250;
+ const int shortcuts_show_delay = 750;
+ const int ignore_repeat_shortcut_duration = 250;
+}
+}
+
+// FIXME: key-code defines for Up/Down/Left/Right of numeric keypad - needs to
+// be moved to the correct place in NuxGraphics-headers
+#define NUX_KP_DOWN 0xFF99
+#define NUX_KP_UP 0xFF97
+#define NUX_KP_LEFT 0xFF96
+#define NUX_KP_RIGHT 0xFF98
+
class Controller::Impl
{
public:
- Impl(Display* display);
+ Impl(Display* display, Controller* parent);
~Impl();
void UpdateNumWorkspaces(int workspaces);
+ Launcher* CreateLauncher(int monitor);
+
void Save();
void SortAndUpdate();
- void OnIconAdded(LauncherIcon* icon);
- void OnIconRemoved(LauncherIcon* icon);
+ void OnIconAdded(AbstractLauncherIcon* icon);
+ void OnIconRemoved(AbstractLauncherIcon* icon);
- void OnLauncherAddRequest(char* path, LauncherIcon* before);
- void OnLauncherAddRequestSpecial(char* path, LauncherIcon* before, char* aptdaemon_trans_id, char* icon_path);
- void OnLauncherRemoveRequest(LauncherIcon* icon);
+ void OnLauncherAddRequest(char* path, AbstractLauncherIcon* before);
+ void OnLauncherAddRequestSpecial(std::string const& path, AbstractLauncherIcon* before, std::string const& aptdaemon_trans_id, std::string const& icon_path);
+ void OnLauncherRemoveRequest(AbstractLauncherIcon* icon);
void OnLauncherEntryRemoteAdded(LauncherEntryRemote* entry);
void OnLauncherEntryRemoteRemoved(LauncherEntryRemote* entry);
-
+
void OnFavoriteStoreFavoriteAdded(std::string const& entry, std::string const& pos, bool before);
void OnFavoriteStoreFavoriteRemoved(std::string const& entry);
void OnFavoriteStoreReordered();
@@ -85,26 +108,45 @@ public:
void InsertDesktopIcon();
void RemoveDesktopIcon();
+ bool TapTimeUnderLimit();
+
+ void SendHomeActivationRequest();
+
+ int TimeSinceLauncherKeyPress();
+
+ int MonitorWithMouse();
+
void InsertTrash();
- void RegisterIcon(LauncherIcon* icon);
+ void RegisterIcon(AbstractLauncherIcon* icon);
- LauncherIcon* CreateFavorite(const char* file_path);
+ AbstractLauncherIcon* CreateFavorite(const char* file_path);
- SoftwareCenterLauncherIcon* CreateSCLauncherIcon(const char* file_path, const char* aptdaemon_trans_id, char* icon_path);
+ SoftwareCenterLauncherIcon* CreateSCLauncherIcon(std::string const& file_path, std::string const& aptdaemon_trans_id, std::string const& icon_path);
void SetupBamf();
void OnExpoActivated();
+ void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors);
+
+ void ReceiveMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags);
+
+ void ReceiveLauncherKeyPress(unsigned long eventType,
+ unsigned long keysym,
+ unsigned long state,
+ const char* character,
+ unsigned short keyCount);
+
/* statics */
static void OnViewOpened(BamfMatcher* matcher, BamfView* view, gpointer data);
+ Controller* parent_;
glib::Object<BamfMatcher> matcher_;
LauncherModel::Ptr model_;
- nux::ObjectPtr<nux::BaseWindow> launcher_window_;
nux::ObjectPtr<Launcher> launcher_;
+ nux::ObjectPtr<Launcher> keyboard_launcher_;
int sort_priority_;
DeviceLauncherSection* device_section_;
LauncherEntryRemoteModel remote_model_;
@@ -113,53 +155,59 @@ public:
nux::ObjectPtr<AbstractLauncherIcon> desktop_icon_;
int num_workspaces_;
bool show_desktop_icon_;
+ Display* display_;
+
+ guint bamf_timer_handler_id_;
+ guint on_view_opened_id_;
+ guint launcher_key_press_handler_id_;
+ guint launcher_label_show_handler_id_;
+ guint launcher_hide_handler_id_;
- guint bamf_timer_handler_id_;
+ bool launcher_open;
+ bool launcher_keynav;
+ bool launcher_grabbed;
+ bool reactivate_keynav;
+ int reactivate_index;
- guint32 on_view_opened_id_;
+ UBusManager ubus;
+
+ struct timespec launcher_key_press_time_;
+
+ LauncherList launchers;
sigc::connection on_expoicon_activate_connection_;
+ sigc::connection launcher_key_press_connection_;
+ sigc::connection launcher_event_outside_connection_;
};
-Controller::Impl::Impl(Display* display)
- : matcher_(nullptr)
+Controller::Impl::Impl(Display* display, Controller* parent)
+ : parent_(parent)
+ , matcher_(nullptr)
, model_(new LauncherModel())
, sort_priority_(0)
, show_desktop_icon_(false)
+ , display_(display)
{
- // NOTE: should the launcher itself hold the base window?
- // seems like it probably should...
- launcher_window_ = new nux::BaseWindow(TEXT("LauncherWindow"));
+ UScreen* uscreen = UScreen::GetDefault();
+ auto monitors = uscreen->GetMonitors();
- Launcher* raw_launcher = new Launcher(launcher_window_.GetPointer());
- launcher_ = raw_launcher;
- launcher_->display = display;
- launcher_->SetIconSize(54, 48);
- launcher_->SetBacklightMode(Launcher::BACKLIGHT_ALWAYS_ON);
- launcher_->SetHideMode(Launcher::LAUNCHER_HIDE_DODGE_WINDOWS);
- launcher_->SetLaunchAnimation(Launcher::LAUNCH_ANIMATION_PULSE);
- launcher_->SetUrgentAnimation(Launcher::URGENT_ANIMATION_WIGGLE);
+ launcher_open = false;
+ launcher_keynav = false;
+ launcher_grabbed = false;
+ reactivate_keynav = false;
- nux::HLayout* layout = new nux::HLayout(NUX_TRACKER_LOCATION);
- layout->AddView(raw_launcher, 1);
- layout->SetContentDistribution(nux::eStackLeft);
- layout->SetVerticalExternalMargin(0);
- layout->SetHorizontalExternalMargin(0);
-
- launcher_window_->SetLayout(layout);
- launcher_window_->SetBackgroundColor(nux::color::Transparent);
- launcher_window_->ShowWindow(true);
- launcher_window_->EnableInputWindow(true, "launcher", false, false);
- launcher_window_->InputWindowEnableStruts(false);
- launcher_window_->SetEnterFocusInputArea(raw_launcher);
+ int i = 0;
+ for (auto monitor : monitors)
+ {
+ Launcher* launcher = CreateLauncher(i);
+ launchers.push_back(nux::ObjectPtr<Launcher> (launcher));
+ i++;
+ }
- launcher_->SetModel(model_.get());
- launcher_->launcher_addrequest.connect(sigc::mem_fun(this, &Impl::OnLauncherAddRequest));
- launcher_->launcher_addrequest_special.connect(sigc::mem_fun(this, &Impl::OnLauncherAddRequestSpecial));
- launcher_->launcher_removerequest.connect(sigc::mem_fun(this, &Impl::OnLauncherRemoveRequest));
+ launcher_ = launchers[0];
- device_section_ = new DeviceLauncherSection(raw_launcher);
+ device_section_ = new DeviceLauncherSection();
device_section_->IconAdded.connect(sigc::mem_fun(this, &Impl::OnIconAdded));
num_workspaces_ = WindowManager::Default()->WorkspaceCount();
@@ -184,13 +232,23 @@ Controller::Impl::Impl(Display* display)
remote_model_.entry_added.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteAdded));
remote_model_.entry_removed.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteRemoved));
-
+
FavoriteStore::GetDefault().favorite_added.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteAdded));
FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved));
FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));
- RegisterIcon(new BFBLauncherIcon(raw_launcher));
- desktop_icon_ = new DesktopLauncherIcon(raw_launcher);
+ RegisterIcon(new BFBLauncherIcon());
+ desktop_icon_ = new DesktopLauncherIcon();
+
+ uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));
+
+ launcher_key_press_time_ = { 0, 0 };
+
+ ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [&](GVariant * args) {
+ if (reactivate_keynav)
+ parent_->KeyNavGrab();
+ model_->SetSelection(reactivate_index);
+ });
}
Controller::Impl::~Impl()
@@ -204,12 +262,57 @@ Controller::Impl::~Impl()
delete device_section_;
}
+void Controller::Impl::OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors)
+{
+ unsigned int num_monitors = monitors.size();
+
+ for (unsigned int i = 0; i < num_monitors; i++)
+ {
+ if (i >= launchers.size())
+ launchers.push_back(nux::ObjectPtr<Launcher> (CreateLauncher(i)));
+
+ launchers[i]->Resize();
+ }
+
+ launchers.resize(num_monitors);
+}
+
+Launcher* Controller::Impl::CreateLauncher(int monitor)
+{
+ nux::BaseWindow* launcher_window = new nux::BaseWindow(TEXT("LauncherWindow"));
+
+ Launcher* launcher = new Launcher(launcher_window);
+ launcher->display = display_;
+ launcher->monitor = monitor;
+ launcher->options = parent_->options();
+
+ nux::HLayout* layout = new nux::HLayout(NUX_TRACKER_LOCATION);
+ layout->AddView(launcher, 1);
+ layout->SetContentDistribution(nux::eStackLeft);
+ layout->SetVerticalExternalMargin(0);
+ layout->SetHorizontalExternalMargin(0);
+
+ launcher_window->SetLayout(layout);
+ launcher_window->SetBackgroundColor(nux::color::Transparent);
+ launcher_window->ShowWindow(true);
+ launcher_window->EnableInputWindow(true, "launcher", false, false);
+ launcher_window->InputWindowEnableStruts(false);
+ launcher_window->SetEnterFocusInputArea(launcher);
+
+ launcher->SetModel(model_.get());
+ launcher->launcher_addrequest.connect(sigc::mem_fun(this, &Impl::OnLauncherAddRequest));
+ launcher->launcher_removerequest.connect(sigc::mem_fun(this, &Impl::OnLauncherRemoveRequest));
+
+ parent_->AddChild(launcher);
+
+ return launcher;
+}
-void Controller::Impl::OnLauncherAddRequest(char* path, LauncherIcon* before)
+void Controller::Impl::OnLauncherAddRequest(char* path, AbstractLauncherIcon* before)
{
for (auto it : model_->GetSublist<BamfLauncherIcon> ())
{
- if (!g_strcmp0(path, it->DesktopFile()))
+ if (path && path == it->DesktopFile())
{
it->Stick();
model_->ReorderBefore(it, before, false);
@@ -218,7 +321,7 @@ void Controller::Impl::OnLauncherAddRequest(char* path, LauncherIcon* before)
}
}
- LauncherIcon* result = CreateFavorite(path);
+ AbstractLauncherIcon* result = CreateFavorite(path);
if (result)
{
RegisterIcon(result);
@@ -240,25 +343,27 @@ void Controller::Impl::Save()
if (!icon->IsSticky())
continue;
- const char* desktop_file = icon->DesktopFile();
+ std::string const& desktop_file = icon->DesktopFile();
- if (desktop_file && strlen(desktop_file) > 0)
- desktop_paths.push_back(desktop_file);
+ if (!desktop_file.empty())
+ desktop_paths.push_back(desktop_file.c_str());
}
unity::FavoriteStore::GetDefault().SetFavorites(desktop_paths);
}
void
-Controller::Impl::OnLauncherAddRequestSpecial(char* path, LauncherIcon* before, char* aptdaemon_trans_id, char* icon_path)
+Controller::Impl::OnLauncherAddRequestSpecial(std::string const& path,
+ AbstractLauncherIcon* before,
+ std::string const& aptdaemon_trans_id,
+ std::string const& icon_path)
{
std::list<BamfLauncherIcon*> launchers;
- std::list<BamfLauncherIcon*>::iterator it;
- launchers = model_->GetSublist<BamfLauncherIcon> ();
- for (it = launchers.begin(); it != launchers.end(); it++)
+ launchers = model_->GetSublist<BamfLauncherIcon>();
+ for (auto icon : launchers)
{
- if (g_strcmp0(path, (*it)->DesktopFile()) == 0)
+ if (icon->DesktopFile() == path)
return;
}
@@ -276,41 +381,40 @@ Controller::Impl::OnLauncherAddRequestSpecial(char* path, LauncherIcon* before,
void Controller::Impl::SortAndUpdate()
{
gint shortcut = 1;
- gchar* buff;
std::list<BamfLauncherIcon*> launchers = model_->GetSublist<BamfLauncherIcon> ();
- for (auto it : launchers)
+ for (auto icon : launchers)
{
- if (shortcut < 11 && it->GetQuirk(LauncherIcon::QUIRK_VISIBLE))
+ if (shortcut <= 10 && icon->IsVisible())
{
- buff = g_strdup_printf("%d", shortcut % 10);
- it->SetShortcut(buff[0]);
- g_free(buff);
+ std::stringstream shortcut_string;
+ shortcut_string << (shortcut % 10);
+ icon->SetShortcut(shortcut_string.str()[0]);
shortcut++;
}
// reset shortcut
else
{
- it->SetShortcut(0);
+ icon->SetShortcut(0);
}
}
}
-void Controller::Impl::OnIconAdded(LauncherIcon* icon)
+void Controller::Impl::OnIconAdded(AbstractLauncherIcon* icon)
{
this->RegisterIcon(icon);
}
-void Controller::Impl::OnIconRemoved(LauncherIcon* icon)
+void Controller::Impl::OnIconRemoved(AbstractLauncherIcon* icon)
{
SortAndUpdate();
}
-void Controller::Impl::OnLauncherRemoveRequest(LauncherIcon* icon)
+void Controller::Impl::OnLauncherRemoveRequest(AbstractLauncherIcon* icon)
{
switch (icon->Type())
{
- case LauncherIcon::TYPE_APPLICATION:
+ case AbstractLauncherIcon::TYPE_APPLICATION:
{
BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon);
@@ -322,7 +426,7 @@ void Controller::Impl::OnLauncherRemoveRequest(LauncherIcon* icon)
break;
}
- case LauncherIcon::TYPE_DEVICE:
+ case AbstractLauncherIcon::TYPE_DEVICE:
{
DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon);
@@ -359,19 +463,19 @@ void Controller::Impl::OnLauncherEntryRemoteRemoved(LauncherEntryRemote* entry)
}
void Controller::Impl::OnFavoriteStoreFavoriteAdded(std::string const& entry, std::string const& pos, bool before)
-{
- auto bamf_list = model_->GetSublist<BamfLauncherIcon>();
- LauncherIcon* other = (bamf_list.size() > 0) ? *(bamf_list.begin()) : nullptr;
-
+{
+ auto bamf_list = model_->GetSublist<BamfLauncherIcon>();
+ AbstractLauncherIcon* other = (bamf_list.size() > 0) ? *(bamf_list.begin()) : nullptr;
+
if (!pos.empty())
{
for (auto it : bamf_list)
{
- if (it->GetQuirk(LauncherIcon::QUIRK_VISIBLE) && pos == it->DesktopFile())
+ if (it->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) && pos == it->DesktopFile())
other = it;
}
}
-
+
for (auto it : bamf_list)
{
if (entry == it->DesktopFile())
@@ -385,7 +489,7 @@ void Controller::Impl::OnFavoriteStoreFavoriteAdded(std::string const& entry, st
}
}
- LauncherIcon* result = CreateFavorite(entry.c_str());
+ AbstractLauncherIcon* result = CreateFavorite(entry.c_str());
if (result)
{
RegisterIcon(result);
@@ -409,28 +513,28 @@ void Controller::Impl::OnFavoriteStoreFavoriteRemoved(std::string const& entry)
}
void Controller::Impl::OnFavoriteStoreReordered()
-{
+{
FavoriteList const& favs = FavoriteStore::GetDefault().GetFavorites();
auto bamf_list = model_->GetSublist<BamfLauncherIcon>();
-
+
int i = 0;
for (auto it : favs)
- {
+ {
auto icon = std::find_if(bamf_list.begin(), bamf_list.end(),
[&it](BamfLauncherIcon* x) { return (x->DesktopFile() == it); });
-
+
if (icon != bamf_list.end())
{
(*icon)->SetSortPriority(i++);
}
}
-
+
for (auto it : bamf_list)
{
if (!it->IsSticky())
it->SetSortPriority(i++);
}
-
+
model_->Sort();
}
@@ -442,7 +546,7 @@ void Controller::Impl::OnExpoActivated()
void Controller::Impl::InsertTrash()
{
TrashLauncherIcon* icon;
- icon = new TrashLauncherIcon(launcher_.GetPointer());
+ icon = new TrashLauncherIcon();
RegisterIcon(icon);
}
@@ -462,13 +566,13 @@ void Controller::Impl::UpdateNumWorkspaces(int workspaces)
void Controller::Impl::InsertExpoAction()
{
- expo_icon_ = new SimpleLauncherIcon(launcher_.GetPointer());
+ expo_icon_ = new SimpleLauncherIcon();
expo_icon_->tooltip_text = _("Workspace Switcher");
expo_icon_->icon_name = "workspace-switcher";
- expo_icon_->SetQuirk(LauncherIcon::QUIRK_VISIBLE, true);
- expo_icon_->SetQuirk(LauncherIcon::QUIRK_RUNNING, false);
- expo_icon_->SetIconType(LauncherIcon::TYPE_EXPO);
+ expo_icon_->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
+ expo_icon_->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false);
+ expo_icon_->SetIconType(AbstractLauncherIcon::TYPE_EXPO);
expo_icon_->SetShortcut('s');
on_expoicon_activate_connection_ = expo_icon_->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated));
@@ -485,8 +589,8 @@ void Controller::Impl::RemoveExpoAction()
void Controller::Impl::InsertDesktopIcon()
{
- desktop_launcher_icon_ = new DesktopLauncherIcon(launcher_.GetPointer());
- desktop_launcher_icon_->SetIconType(LauncherIcon::TYPE_DESKTOP);
+ desktop_launcher_icon_ = new DesktopLauncherIcon();
+ desktop_launcher_icon_->SetIconType(AbstractLauncherIcon::TYPE_DESKTOP);
desktop_launcher_icon_->SetShowInSwitcher(false);
RegisterIcon(desktop_launcher_icon_);
@@ -497,7 +601,7 @@ void Controller::Impl::RemoveDesktopIcon()
model_->RemoveIcon(desktop_launcher_icon_);
}
-void Controller::Impl::RegisterIcon(LauncherIcon* icon)
+void Controller::Impl::RegisterIcon(AbstractLauncherIcon* icon)
{
model_->AddIcon(icon);
@@ -505,10 +609,9 @@ void Controller::Impl::RegisterIcon(LauncherIcon* icon)
if (bamf_icon)
{
LauncherEntryRemote* entry = NULL;
- const char* path;
- path = bamf_icon->DesktopFile();
- if (path)
- entry = remote_model_.LookupByDesktopFile(path);
+ std::string const& path = bamf_icon->DesktopFile();
+ if (!path.empty())
+ entry = remote_model_.LookupByDesktopFile(path.c_str());
if (entry)
icon->InsertEntryRemote(entry);
}
@@ -531,14 +634,14 @@ void Controller::Impl::OnViewOpened(BamfMatcher* matcher, BamfView* view, gpoint
return;
}
- BamfLauncherIcon* icon = new BamfLauncherIcon(self->launcher_.GetPointer(), app);
- icon->SetIconType(LauncherIcon::TYPE_APPLICATION);
+ BamfLauncherIcon* icon = new BamfLauncherIcon(app);
+ icon->SetIconType(AbstractLauncherIcon::TYPE_APPLICATION);
icon->SetSortPriority(self->sort_priority_++);
self->RegisterIcon(icon);
}
-LauncherIcon* Controller::Impl::CreateFavorite(const char* file_path)
+AbstractLauncherIcon* Controller::Impl::CreateFavorite(const char* file_path)
{
BamfApplication* app;
BamfLauncherIcon* icon;
@@ -556,20 +659,22 @@ LauncherIcon* Controller::Impl::CreateFavorite(const char* file_path)
g_object_set_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen"), GINT_TO_POINTER(1));
bamf_view_set_sticky(BAMF_VIEW(app), true);
- icon = new BamfLauncherIcon(launcher_.GetPointer(), app);
- icon->SetIconType(LauncherIcon::TYPE_APPLICATION);
+ icon = new BamfLauncherIcon(app);
+ icon->SetIconType(AbstractLauncherIcon::TYPE_APPLICATION);
icon->SetSortPriority(sort_priority_++);
return icon;
}
SoftwareCenterLauncherIcon*
-Controller::Impl::CreateSCLauncherIcon(const char* file_path, const char* aptdaemon_trans_id, char* icon_path)
+Controller::Impl::CreateSCLauncherIcon(std::string const& file_path,
+ std::string const& aptdaemon_trans_id,
+ std::string const& icon_path)
{
BamfApplication* app;
SoftwareCenterLauncherIcon* icon;
- app = bamf_matcher_get_application_for_desktop_file(matcher_, file_path, true);
+ app = bamf_matcher_get_application_for_desktop_file(matcher_, file_path.c_str(), true);
if (!BAMF_IS_APPLICATION(app))
return NULL;
@@ -582,7 +687,7 @@ Controller::Impl::CreateSCLauncherIcon(const char* file_path, const char* aptdae
g_object_set_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen"), GINT_TO_POINTER(1));
bamf_view_set_sticky(BAMF_VIEW(app), true);
- icon = new SoftwareCenterLauncherIcon(launcher_.GetPointer(), app, (char*)aptdaemon_trans_id, icon_path);
+ icon = new SoftwareCenterLauncherIcon(app, aptdaemon_trans_id, icon_path);
icon->SetIconType(LauncherIcon::TYPE_APPLICATION);
icon->SetSortPriority(sort_priority_++);
@@ -606,7 +711,7 @@ void Controller::Impl::SetupBamf()
for (FavoriteList::const_iterator i = favs.begin(), end = favs.end();
i != end; ++i)
{
- LauncherIcon* fav = CreateFavorite(i->c_str());
+ AbstractLauncherIcon* fav = CreateFavorite(i->c_str());
if (fav)
{
@@ -627,7 +732,7 @@ void Controller::Impl::SetupBamf()
continue;
g_object_set_qdata(G_OBJECT(app), g_quark_from_static_string("unity-seen"), GINT_TO_POINTER(1));
- icon = new BamfLauncherIcon(launcher_.GetPointer(), app);
+ icon = new BamfLauncherIcon(app);
icon->SetSortPriority(sort_priority_++);
RegisterIcon(icon);
}
@@ -639,10 +744,29 @@ void Controller::Impl::SetupBamf()
bamf_timer_handler_id_ = 0;
}
+int Controller::Impl::TimeSinceLauncherKeyPress()
+{
+ struct timespec current;
+ unity::TimeUtil::SetTimeStruct(&current);
+ return unity::TimeUtil::TimeDelta(&current, &launcher_key_press_time_);
+}
+
+bool Controller::Impl::TapTimeUnderLimit()
+{
+ int time_difference = TimeSinceLauncherKeyPress();
+ return time_difference < local::super_tap_duration;
+}
+
+void Controller::Impl::SendHomeActivationRequest()
+{
+ ubus.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST, g_variant_new("(sus)", "home.lens", 0, ""));
+}
Controller::Controller(Display* display)
- : pimpl(new Impl(display))
{
+ options = Options::Ptr(new Options());
+ // options must be set before creating pimpl which loads launchers
+ pimpl = new Impl(display, this);
}
Controller::~Controller()
@@ -655,12 +779,17 @@ void Controller::UpdateNumWorkspaces(int workspaces)
pimpl->UpdateNumWorkspaces(workspaces);
}
-Launcher& Controller::launcher()
+Launcher& Controller::launcher() const
{
return *(pimpl->launcher_);
}
-std::vector<char> Controller::GetAllShortcuts()
+Controller::LauncherList& Controller::launchers() const
+{
+ return pimpl->launchers;
+}
+
+std::vector<char> Controller::GetAllShortcuts() const
{
std::vector<char> shortcuts;
for (auto icon : *(pimpl->model_))
@@ -673,50 +802,34 @@ std::vector<char> Controller::GetAllShortcuts()
return shortcuts;
}
-std::vector<AbstractLauncherIcon*> Controller::GetAltTabIcons()
+std::vector<AbstractLauncherIcon*> Controller::GetAltTabIcons(bool current) const
{
std::vector<AbstractLauncherIcon*> results;
results.push_back(pimpl->desktop_icon_.GetPointer());
for (auto icon : *(pimpl->model_))
- if (icon->ShowInSwitcher())
+ if (icon->ShowInSwitcher(current))
results.push_back(icon);
return results;
}
-void Controller::PrimaryMonitorGeometryChanged(nux::Geometry const& rect)
+Window Controller::LauncherWindowId(int launcher) const
{
- const int panel_height = 24;
-
- int launcher_width = pimpl->launcher_window_->GetGeometry().width;
-
- nux::Geometry new_geometry(rect.x,
- rect.y + panel_height,
- launcher_width,
- rect.height - panel_height);
-
- LOG_DEBUG(logger) << "Setting to launcher rect:"
- << " x=" << new_geometry.x
- << " y=" << new_geometry.y
- << " w=" << new_geometry.width
- << " h=" << new_geometry.height;
-
- pimpl->launcher_->SetMaximumHeight(new_geometry.height);
-
- pimpl->launcher_window_->SetGeometry(new_geometry);
- pimpl->launcher_->SetGeometry(new_geometry);
+ return pimpl->launchers[launcher]->GetParent()->GetInputWindowId();
}
-Window Controller::launcher_input_window_id()
+Window Controller::KeyNavLauncherInputWindowId() const
{
- return pimpl->launcher_window_->GetInputWindowId();
+ if (KeyNavIsActive())
+ return pimpl->keyboard_launcher_->GetParent()->GetInputWindowId();
+ return 0;
}
void Controller::PushToFront()
{
- pimpl->launcher_window_->PushToFront();
+ pimpl->launcher_->GetParent()->PushToFront();
}
void Controller::SetShowDesktopIcon(bool show_desktop_icon)
@@ -732,6 +845,298 @@ void Controller::SetShowDesktopIcon(bool show_desktop_icon)
pimpl->RemoveDesktopIcon();
}
+int Controller::Impl::MonitorWithMouse()
+{
+ UScreen* uscreen = UScreen::GetDefault();
+ return uscreen->GetMonitorWithMouse();
+}
+
+void Controller::HandleLauncherKeyPress()
+{
+ unity::TimeUtil::SetTimeStruct(&pimpl->launcher_key_press_time_);
+
+ auto show_launcher = [](gpointer user_data) -> gboolean
+ {
+ Impl* self = static_cast<Impl*>(user_data);
+ if (self->keyboard_launcher_.IsNull())
+ self->keyboard_launcher_ = self->launchers[self->MonitorWithMouse()];
+
+ if (self->launcher_hide_handler_id_ > 0)
+ {
+ g_source_remove(self->launcher_hide_handler_id_);
+ self->launcher_hide_handler_id_ = 0;
+ }
+
+ self->keyboard_launcher_->ForceReveal(true);
+ self->launcher_open = true;
+ self->launcher_key_press_handler_id_ = 0;
+ return FALSE;
+ };
+ pimpl->launcher_key_press_handler_id_ = g_timeout_add(local::super_tap_duration, show_launcher, pimpl);
+
+ auto show_shortcuts = [](gpointer user_data) -> gboolean
+ {
+ Impl* self = static_cast<Impl*>(user_data);
+ if (!self->launcher_keynav)
+ {
+ if (self->keyboard_launcher_.IsNull())
+ self->keyboard_launcher_ = self->launchers[self->MonitorWithMouse()];
+
+ self->keyboard_launcher_->ShowShortcuts(true);
+ self->launcher_open = true;
+ self->launcher_label_show_handler_id_ = 0;
+ }
+ return FALSE;
+ };
+ pimpl->launcher_label_show_handler_id_ = g_timeout_add(local::shortcuts_show_delay, show_shortcuts, pimpl);
+}
+
+void Controller::HandleLauncherKeyRelease()
+{
+ if (pimpl->TapTimeUnderLimit())
+ {
+ pimpl->SendHomeActivationRequest();
+ }
+
+ if (pimpl->launcher_label_show_handler_id_)
+ {
+ g_source_remove(pimpl->launcher_label_show_handler_id_);
+ pimpl->launcher_label_show_handler_id_ = 0;
+ }
+
+ if (pimpl->launcher_key_press_handler_id_)
+ {
+ g_source_remove(pimpl->launcher_key_press_handler_id_);
+ pimpl->launcher_key_press_handler_id_ = 0;
+ }
+
+ if (pimpl->keyboard_launcher_.IsValid())
+ {
+ pimpl->keyboard_launcher_->ShowShortcuts(false);
+
+ int ms_since_show = pimpl->TimeSinceLauncherKeyPress();
+ if (ms_since_show > local::launcher_minimum_show_duration)
+ {
+ pimpl->keyboard_launcher_->ForceReveal(false);
+ pimpl->launcher_open = false;
+
+ if (!pimpl->launcher_keynav)
+ pimpl->keyboard_launcher_.Release();
+ }
+ else
+ {
+ int time_left = local::launcher_minimum_show_duration - ms_since_show;
+ auto hide_launcher = [](gpointer user_data) -> gboolean
+ {
+ Impl *self = static_cast<Impl*>(user_data);
+ if (self->keyboard_launcher_.IsValid())
+ {
+ self->keyboard_launcher_->ForceReveal(false);
+ self->launcher_open = false;
+
+ if (!self->launcher_keynav)
+ self->keyboard_launcher_.Release();
+ }
+
+ self->launcher_hide_handler_id_ = 0;
+ return FALSE;
+ };
+
+ pimpl->launcher_hide_handler_id_ = g_timeout_add(time_left, hide_launcher, pimpl);
+ }
+ }
+}
+
+bool Controller::HandleLauncherKeyEvent(Display *display, unsigned int key_sym, unsigned long key_code, unsigned long key_state, char* key_string)
+{
+ LauncherModel::iterator it;
+
+ // Shortcut to start launcher icons. Only relies on Keycode, ignore modifier
+ for (it = pimpl->model_->begin(); it != pimpl->model_->end(); it++)
+ {
+ if ((XKeysymToKeycode(display, (*it)->GetShortcut()) == key_code) ||
+ ((gchar)((*it)->GetShortcut()) == key_string[0]))
+ {
+ struct timespec last_action_time = (*it)->GetQuirkTime(AbstractLauncherIcon::QUIRK_LAST_ACTION);
+ struct timespec current;
+ TimeUtil::SetTimeStruct(&current);
+ if (TimeUtil::TimeDelta(&current, &last_action_time) > local::ignore_repeat_shortcut_duration)
+ {
+ if (g_ascii_isdigit((gchar)(*it)->GetShortcut()) && (key_state & ShiftMask))
+ (*it)->OpenInstance(ActionArg(ActionArg::LAUNCHER, 0));
+ else
+ (*it)->Activate(ActionArg(ActionArg::LAUNCHER, 0));
+ }
+
+ // disable the "tap on super" check
+ pimpl->launcher_key_press_time_ = { 0, 0 };
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void Controller::Impl::ReceiveMouseDownOutsideArea(int x, int y, unsigned long button_flags, unsigned long key_flags)
+{
+ if (launcher_grabbed)
+ parent_->KeyNavTerminate(false);
+}
+
+void Controller::KeyNavGrab()
+{
+ KeyNavActivate();
+ pimpl->keyboard_launcher_->GrabKeyboard();
+ pimpl->launcher_grabbed = true;
+
+ pimpl->launcher_key_press_connection_ =
+ pimpl->keyboard_launcher_->key_down.connect(sigc::mem_fun(pimpl, &Controller::Impl::ReceiveLauncherKeyPress));
+ pimpl->launcher_event_outside_connection_ =
+ pimpl->keyboard_launcher_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(pimpl, &Controller::Impl::ReceiveMouseDownOutsideArea));
+}
+
+void Controller::KeyNavActivate()
+{
+ if (pimpl->launcher_keynav)
+ return;
+
+ pimpl->reactivate_keynav = false;
+ pimpl->launcher_keynav = true;
+ pimpl->keyboard_launcher_ = pimpl->launchers[pimpl->MonitorWithMouse()];
+ pimpl->keyboard_launcher_->ShowShortcuts(false);
+
+ pimpl->keyboard_launcher_->EnterKeyNavMode();
+ pimpl->model_->SetSelection(0);
+
+ pimpl->ubus.SendMessage(UBUS_LAUNCHER_START_KEY_SWTICHER, g_variant_new_boolean(true));
+}
+
+void Controller::KeyNavNext()
+{
+ pimpl->model_->SelectNext();
+}
+
+void Controller::KeyNavPrevious()
+{
+ pimpl->model_->SelectPrevious();
+}
+
+void Controller::KeyNavTerminate(bool activate)
+{
+ if (!pimpl->launcher_keynav)
+ return;
+
+ pimpl->keyboard_launcher_->ExitKeyNavMode();
+ if (pimpl->launcher_grabbed)
+ {
+ pimpl->keyboard_launcher_->UnGrabKeyboard();
+ pimpl->launcher_key_press_connection_.disconnect();
+ pimpl->launcher_event_outside_connection_.disconnect();
+ pimpl->launcher_grabbed = false;
+ }
+
+ if (activate)
+ pimpl->model_->Selection()->Activate(ActionArg(ActionArg::LAUNCHER, 0));
+
+ pimpl->launcher_keynav = false;
+ if (!pimpl->launcher_open)
+ pimpl->keyboard_launcher_.Release();
+
+ pimpl->ubus.SendMessage(UBUS_LAUNCHER_END_KEY_SWTICHER, g_variant_new_boolean(true));
+}
+
+bool Controller::KeyNavIsActive() const
+{
+ return pimpl->launcher_keynav;
+}
+
+std::string
+Controller::GetName() const
+{
+ return "LauncherController";
+}
+
+void
+Controller::AddProperties(GVariantBuilder* builder)
+{
+ timespec current;
+ clock_gettime(CLOCK_MONOTONIC, &current);
+
+ unity::variant::BuilderWrapper(builder)
+ .add("key_nav_is_active", KeyNavIsActive())
+ .add("key_nav_launcher_monitor", pimpl->keyboard_launcher_.IsValid() ? pimpl->keyboard_launcher_->monitor : -1)
+ .add("key_nav_selection", pimpl->model_->SelectionIndex())
+ .add("key_nav_is_grabbed", pimpl->launcher_grabbed);
+}
+
+void Controller::Impl::ReceiveLauncherKeyPress(unsigned long eventType,
+ unsigned long keysym,
+ unsigned long state,
+ const char* character,
+ unsigned short keyCount)
+{
+ /*
+ * all key events below are related to keynavigation. Make an additional
+ * check that we are in a keynav mode when we inadvertadly receive the focus
+ */
+ if (!launcher_grabbed)
+ return;
+
+ switch (keysym)
+ {
+ // up (move selection up or go to global-menu if at top-most icon)
+ case NUX_VK_UP:
+ case NUX_KP_UP:
+ parent_->KeyNavPrevious();
+ break;
+
+ // down (move selection down and unfold launcher if needed)
+ case NUX_VK_DOWN:
+ case NUX_KP_DOWN:
+ parent_->KeyNavNext();
+ break;
+
+ // esc/left (close quicklist or exit laucher key-focus)
+ case NUX_VK_LEFT:
+ case NUX_KP_LEFT:
+ case NUX_VK_ESCAPE:
+ // hide again
+ parent_->KeyNavTerminate(false);
+ break;
+
+ // right/shift-f10 (open quicklist of currently selected icon)
+ case XK_F10:
+ if (!(state & nux::NUX_STATE_SHIFT))
+ break;
+ case NUX_VK_RIGHT:
+ case NUX_KP_RIGHT:
+ case XK_Menu:
+ if (model_->Selection()->OpenQuicklist(true, keyboard_launcher_->monitor()))
+ {
+ reactivate_keynav = true;
+ reactivate_index = model_->SelectionIndex();
+ parent_->KeyNavTerminate(false);
+ }
+ break;
+
+ // <SPACE> (open a new instance)
+ case NUX_VK_SPACE:
+ model_->Selection()->OpenInstance(ActionArg(ActionArg::LAUNCHER, 0));
+ parent_->KeyNavTerminate(false);
+ break;
+
+ // <RETURN> (start/activate currently selected icon)
+ case NUX_VK_ENTER:
+ case NUX_KP_ENTER:
+ model_->Selection()->Activate(ActionArg(ActionArg::LAUNCHER, 0));
+ parent_->KeyNavTerminate(false);
+ break;
+
+ default:
+ break;
+ }
+}
+
} // namespace launcher
} // namespace unity
diff --git a/plugins/unityshell/src/LauncherController.h b/plugins/unityshell/src/LauncherController.h
index d8492a2ad..b9cb20601 100644
--- a/plugins/unityshell/src/LauncherController.h
+++ b/plugins/unityshell/src/LauncherController.h
@@ -24,7 +24,6 @@
#include <memory>
#include <vector>
#include <sigc++/sigc++.h>
-#include <core/core.h>
#include "SoftwareCenterLauncherIcon.h"
@@ -36,26 +35,50 @@ class AbstractLauncherIcon;
class Launcher;
class LauncherModel;
-class Controller : public sigc::trackable
+class Controller : public unity::debug::Introspectable, public sigc::trackable
{
public:
typedef std::shared_ptr<Controller> Ptr;
+ typedef std::vector<nux::ObjectPtr<Launcher> > LauncherList;
+
+ nux::Property<Options::Ptr> options;
Controller(Display* display);
~Controller();
- Launcher& launcher();
- Window launcher_input_window_id();
+ Launcher& launcher() const;
+ LauncherList& launchers() const;
+ Window LauncherWindowId(int launcher) const;
+ Window KeyNavLauncherInputWindowId() const;
void UpdateNumWorkspaces(int workspaces);
- std::vector<char> GetAllShortcuts();
- std::vector<AbstractLauncherIcon*> GetAltTabIcons();
+ std::vector<char> GetAllShortcuts() const;
+ std::vector<AbstractLauncherIcon*> GetAltTabIcons(bool current) const;
- void PrimaryMonitorGeometryChanged(nux::Geometry const& geo);
void PushToFront();
void SetShowDesktopIcon(bool show_desktop_icon);
+ void HandleLauncherKeyPress();
+ void HandleLauncherKeyRelease();
+ bool HandleLauncherKeyEvent(Display *display,
+ unsigned int key_sym,
+ unsigned long key_code,
+ unsigned long key_state,
+ char* key_string);
+
+ void KeyNavActivate();
+ void KeyNavGrab();
+ void KeyNavTerminate(bool activate = true);
+ void KeyNavNext();
+ void KeyNavPrevious();
+ bool KeyNavIsActive() const;
+
+protected:
+ // Introspectable methods
+ std::string GetName() const;
+ void AddProperties(GVariantBuilder* builder);
+
private:
class Impl;
Impl* pimpl;
diff --git a/plugins/unityshell/src/LauncherHideMachine.cpp b/plugins/unityshell/src/LauncherHideMachine.cpp
index e7fc62c1c..2389fd851 100644
--- a/plugins/unityshell/src/LauncherHideMachine.cpp
+++ b/plugins/unityshell/src/LauncherHideMachine.cpp
@@ -35,13 +35,23 @@ LauncherHideMachine::LauncherHideMachine()
_mode = HIDE_NEVER;
_quirks = DEFAULT;
_should_hide = false;
- _show_on_edge = true;
_latest_emit_should_hide = false;
_hide_changed_emit_handle = 0;
+ reveal_progress = 0;
_hide_delay_handle = 0;
_hide_delay_timeout_length = 750;
+
+ decaymulator_ = unity::ui::Decaymulator::Ptr(new unity::ui::Decaymulator());
+ decaymulator_->value.changed.connect([&](int value) -> void { reveal_progress = (float)value / (float)reveal_pressure; });
+
+ edge_decay_rate.changed.connect(sigc::mem_fun (this, &LauncherHideMachine::OnDecayRateChanged));
+}
+
+void LauncherHideMachine::OnDecayRateChanged(int value)
+{
+ decaymulator_->rate_of_decay = value;
}
LauncherHideMachine::~LauncherHideMachine()
@@ -59,6 +69,19 @@ LauncherHideMachine::~LauncherHideMachine()
}
void
+LauncherHideMachine::AddRevealPressure(int pressure)
+{
+ decaymulator_->value = decaymulator_->value + pressure;
+
+ if (decaymulator_->value > reveal_pressure)
+ {
+ SetQuirk(REVEAL_PRESSURE_PASS, true);
+ SetQuirk(MOUSE_MOVE_POST_REVEAL, true);
+ decaymulator_->value = 0;
+ }
+}
+
+void
LauncherHideMachine::SetShouldHide(bool value, bool skip_delay)
{
if (_should_hide == value)
@@ -99,7 +122,6 @@ LauncherHideMachine::SetShouldHide(bool value, bool skip_delay)
SCALE_ACTIVE = 1 << 16, 64k #VISIBLE_REQUIRED
EXPO_ACTIVE = 1 << 17, 128k #VISIBLE_REQUIRED
MT_DRAG_OUT = 1 << 18, 256k #VISIBLE_REQUIRED
- MOUSE_OVER_ACTIVE_EDGE = 1 << 19, 512k
LAUNCHER_PULSE = 1 << 20, 1M #VISIBLE_REQUIRED
LOCK_HIDE = 1 << 21, 2M
*/
@@ -156,11 +178,7 @@ LauncherHideMachine::EnsureHideState(bool skip_delay)
HideQuirk _should_show_quirk;
if (GetQuirk(LAUNCHER_HIDDEN))
{
- _should_show_quirk = (HideQuirk)(VISIBLE_REQUIRED);
-
- if (_show_on_edge)
- _should_show_quirk = (HideQuirk)(_should_show_quirk | MOUSE_OVER_ACTIVE_EDGE);
-
+ _should_show_quirk = (HideQuirk) ((VISIBLE_REQUIRED) | REVEAL_PRESSURE_PASS);
}
else
{
@@ -168,9 +186,6 @@ LauncherHideMachine::EnsureHideState(bool skip_delay)
// mouse position over launcher is only taken into account if we move it after the revealing state
if (GetQuirk(MOUSE_MOVE_POST_REVEAL))
_should_show_quirk = (HideQuirk)(_should_show_quirk | MOUSE_OVER_LAUNCHER);
-
- if (_show_on_edge)
- _should_show_quirk = (HideQuirk)(_should_show_quirk | MOUSE_OVER_ACTIVE_EDGE);
}
if (GetQuirk(_should_show_quirk))
@@ -199,7 +214,7 @@ LauncherHideMachine::SetMode(LauncherHideMachine::HideMode mode)
}
LauncherHideMachine::HideMode
-LauncherHideMachine::GetMode()
+LauncherHideMachine::GetMode() const
{
return _mode;
}
@@ -229,7 +244,7 @@ LauncherHideMachine::SetQuirk(LauncherHideMachine::HideQuirk quirk, bool active)
}
bool
-LauncherHideMachine::GetQuirk(LauncherHideMachine::HideQuirk quirk, bool allow_partial)
+LauncherHideMachine::GetQuirk(LauncherHideMachine::HideQuirk quirk, bool allow_partial) const
{
if (allow_partial)
return _quirks & quirk;
@@ -237,28 +252,11 @@ LauncherHideMachine::GetQuirk(LauncherHideMachine::HideQuirk quirk, bool allow_p
}
bool
-LauncherHideMachine::ShouldHide()
+LauncherHideMachine::ShouldHide() const
{
return _should_hide;
}
-void
-LauncherHideMachine::SetShowOnEdge(bool value)
-{
- if (value == _show_on_edge)
- return;
-
- _show_on_edge = value;
-
- LOG_DEBUG(logger) << "Shows on edge: " << _show_on_edge;
-}
-
-bool
-LauncherHideMachine::GetShowOnEdge()
-{
- return _show_on_edge;
-}
-
gboolean
LauncherHideMachine::OnHideDelayTimeout(gpointer data)
{
@@ -285,7 +283,7 @@ LauncherHideMachine::EmitShouldHideChanged(gpointer data)
}
std::string
-LauncherHideMachine::DebugHideQuirks()
+LauncherHideMachine::DebugHideQuirks() const
{
// Although I do wonder why we are returning a string representation
// of the enum value as an integer anyway.
diff --git a/plugins/unityshell/src/LauncherHideMachine.h b/plugins/unityshell/src/LauncherHideMachine.h
index e5efeacb5..efe4835ed 100644
--- a/plugins/unityshell/src/LauncherHideMachine.h
+++ b/plugins/unityshell/src/LauncherHideMachine.h
@@ -24,6 +24,8 @@
#include <glib.h>
#include <string>
+#include "Decaymulator.h"
+
class LauncherHideMachine : public sigc::trackable
{
public:
@@ -55,28 +57,32 @@ public:
SCALE_ACTIVE = 1 << 16,
EXPO_ACTIVE = 1 << 17,
MT_DRAG_OUT = 1 << 18,
- MOUSE_OVER_ACTIVE_EDGE = 1 << 19,
+ REVEAL_PRESSURE_PASS = 1 << 19,
LAUNCHER_PULSE = 1 << 20,
LOCK_HIDE = 1 << 21
} HideQuirk;
+ nux::Property<int> reveal_pressure;
+ nux::Property<int> edge_decay_rate;
+
+ nux::Property<float> reveal_progress;
+
LauncherHideMachine();
virtual ~LauncherHideMachine();
void SetMode(HideMode mode);
- HideMode GetMode();
+ HideMode GetMode() const;
- void SetShowOnEdge(bool value);
- bool GetShowOnEdge();
+ void AddRevealPressure(int pressure);
void SetQuirk(HideQuirk quirk, bool active);
- bool GetQuirk(HideQuirk quirk, bool allow_partial = true);
+ bool GetQuirk(HideQuirk quirk, bool allow_partial = true) const;
- bool ShouldHide();
+ bool ShouldHide() const;
sigc::signal<void, bool> should_hide_changed;
- std::string DebugHideQuirks();
+ std::string DebugHideQuirks() const;
private:
void EnsureHideState(bool skip_delay);
@@ -85,9 +91,12 @@ private:
static gboolean OnHideDelayTimeout(gpointer data);
static gboolean EmitShouldHideChanged(gpointer data);
+ void OnDecayRateChanged (int value);
+
+ unity::ui::Decaymulator::Ptr decaymulator_;
+
bool _should_hide;
bool _latest_emit_should_hide;
- bool _show_on_edge;
HideQuirk _quirks;
HideMode _mode;
unsigned int _hide_delay_timeout_length;
diff --git a/plugins/unityshell/src/LauncherIcon.cpp b/plugins/unityshell/src/LauncherIcon.cpp
index cdfbd8b52..d615511fe 100644
--- a/plugins/unityshell/src/LauncherIcon.cpp
+++ b/plugins/unityshell/src/LauncherIcon.cpp
@@ -33,6 +33,7 @@
#include "CairoTexture.h"
#include "LauncherIcon.h"
#include "Launcher.h"
+#include "TimeUtil.h"
#include "QuicklistManager.h"
#include "QuicklistMenuItem.h"
@@ -69,12 +70,9 @@ QuicklistView* LauncherIcon::_current_quicklist = 0;
int LauncherIcon::_current_theme_is_mono = -1;
GtkIconTheme* LauncherIcon::_unity_theme = NULL;
-gboolean LauncherIcon::_skip_tooltip_delay = false;
-LauncherIcon::LauncherIcon(Launcher* launcher)
- : _launcher(launcher)
- , _menuclient_dynamic_quicklist(nullptr)
- , _has_visible_window(false)
+LauncherIcon::LauncherIcon()
+ : _menuclient_dynamic_quicklist(nullptr)
, _quicklist_is_initialized(false)
, _remote_urgent(false)
, _present_urgency(0)
@@ -82,14 +80,19 @@ LauncherIcon::LauncherIcon(Launcher* launcher)
, _center_stabilize_handle(0)
, _present_time_handle(0)
, _time_delay_handle(0)
- , _tooltip_delay_handle(0)
- , _related_windows(0)
, _sort_priority(0)
, _background_color(nux::color::White)
, _glow_color(nux::color::White)
, _shortcut(0)
, _icon_type(TYPE_NONE)
{
+ _has_visible_window.resize(max_num_monitors);
+ _center.resize(max_num_monitors);
+ _saved_center.resize(max_num_monitors);
+ _last_stable.resize(max_num_monitors);
+ _parent_geo.resize(max_num_monitors);
+ transform_map.resize(max_num_monitors);
+
for (int i = 0; i < QUIRK_LAST; i++)
{
_quirks[i] = false;
@@ -141,9 +144,6 @@ LauncherIcon::~LauncherIcon()
g_source_remove(_time_delay_handle);
_time_delay_handle = 0;
- if (_tooltip_delay_handle)
- g_source_remove(_tooltip_delay_handle);
- _tooltip_delay_handle = 0;
// clean up the whole signal-callback mess
if (needs_redraw_connection.connected())
needs_redraw_connection.disconnect();
@@ -168,9 +168,9 @@ LauncherIcon::~LauncherIcon()
}
const bool
-LauncherIcon::HasWindowOnViewport()
+LauncherIcon::WindowVisibleOnMonitor(int monitor)
{
- return _has_visible_window;
+ return _has_visible_window[monitor];
}
std::string
@@ -183,10 +183,10 @@ void
LauncherIcon::AddProperties(GVariantBuilder* builder)
{
unity::variant::BuilderWrapper(builder)
- .add("x", _center.x)
- .add("y", _center.y)
- .add("z", _center.z)
- .add("related-windows", _related_windows)
+ .add("x", _center[0].x)
+ .add("y", _center[0].y)
+ .add("z", _center[0].z)
+ .add("related-windows", (int)Windows().size())
.add("icon-type", _icon_type)
.add("tooltip-text", tooltip_text().c_str())
.add("sort-priority", _sort_priority)
@@ -206,6 +206,8 @@ LauncherIcon::Activate(ActionArg arg)
WindowManager::Default()->TerminateScale();
ActivateLauncherIcon(arg);
+
+ UpdateQuirkTime(QUIRK_LAST_ACTION);
}
void
@@ -215,6 +217,8 @@ LauncherIcon::OpenInstance(ActionArg arg)
WindowManager::Default()->TerminateScale();
OpenInstanceLauncherIcon(arg);
+
+ UpdateQuirkTime(QUIRK_LAST_ACTION);
}
nux::Color LauncherIcon::BackgroundColor()
@@ -479,71 +483,51 @@ LauncherIcon::GetShortcut()
}
void
-LauncherIcon::SetSkipTooltipDelay(gboolean skip_tooltip_delay)
-{
- _skip_tooltip_delay = skip_tooltip_delay;
-}
-
-gboolean
-LauncherIcon::OnTooltipTimeout(gpointer data)
+LauncherIcon::ShowTooltip()
{
- LauncherIcon* self = (LauncherIcon*) data;
-
- if (!self->_launcher)
- return FALSE;
-
- nux::Geometry geo = self->_launcher->GetAbsoluteGeometry();
- int tip_x = geo.x + geo.width + 1;
- int tip_y = geo.y + self->_center.y;
-
- self->_tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
+ if (_quicklist->IsVisible())
+ return;
- if (!self->_quicklist->IsVisible())
+ int tip_x = 100;
+ int tip_y = 100;
+ if (_last_monitor >= 0)
{
- self->_tooltip->ShowWindow(!self->tooltip_text().empty());
- _skip_tooltip_delay = TRUE;
+ nux::Geometry geo = _parent_geo[_last_monitor];
+ tip_x = geo.x + geo.width + 1;
+ tip_y = geo.y + _center[_last_monitor].y;
}
- self->_tooltip_delay_handle = 0;
- return FALSE;
+ _tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
+ _tooltip->ShowWindow(!tooltip_text().empty());
}
void
-LauncherIcon::RecvMouseEnter()
+LauncherIcon::RecvMouseEnter(int monitor)
{
+ _last_monitor = monitor;
if (QuicklistManager::Default()->Current())
{
// A quicklist is active
return;
}
- if (!_skip_tooltip_delay)
- _tooltip_delay_handle = g_timeout_add(500, &LauncherIcon::OnTooltipTimeout, this);
- else
- OnTooltipTimeout(this);
+ ShowTooltip();
}
-void LauncherIcon::RecvMouseLeave()
+void LauncherIcon::RecvMouseLeave(int monitor)
{
- if (_tooltip_delay_handle)
- g_source_remove(_tooltip_delay_handle);
- _tooltip_delay_handle = 0;
+ _last_monitor = -1;
_tooltip->ShowWindow(false);
}
-bool LauncherIcon::OpenQuicklist(bool default_to_first_item)
+bool LauncherIcon::OpenQuicklist(bool default_to_first_item, int monitor)
{
std::list<DbusmenuMenuitem*> menus = Menus();
if (menus.empty())
return false;
- if (_tooltip_delay_handle)
- g_source_remove(_tooltip_delay_handle);
- _tooltip_delay_handle = 0;
- _skip_tooltip_delay = false;
-
_tooltip->ShowWindow(false);
_quicklist->RemoveAllMenuItem();
@@ -582,19 +566,18 @@ bool LauncherIcon::OpenQuicklist(bool default_to_first_item)
if (default_to_first_item)
_quicklist->DefaultToFirstItem();
- int tip_x, tip_y;
- if (_launcher)
+ if (monitor < 0)
{
- nux::Geometry geo = _launcher->GetAbsoluteGeometry();
- tip_x = geo.x + geo.width + 1;
- tip_y = geo.y + _center.y;
- }
- else
- {
- tip_x = 0;
- tip_y = _center.y;
+ if (_last_monitor >= 0)
+ monitor = _last_monitor;
+ else
+ monitor = 0;
}
+ nux::Geometry geo = _parent_geo[monitor];
+ int tip_x = geo.x + geo.width + 1;
+ int tip_y = geo.y + _center[monitor].y;
+
auto win_manager = WindowManager::Default();
if (win_manager->IsScaleActive())
@@ -617,13 +600,13 @@ bool LauncherIcon::OpenQuicklist(bool default_to_first_item)
return true;
}
-void LauncherIcon::RecvMouseDown(int button)
+void LauncherIcon::RecvMouseDown(int button, int monitor)
{
if (button == 3)
OpenQuicklist();
}
-void LauncherIcon::RecvMouseUp(int button)
+void LauncherIcon::RecvMouseUp(int button, int monitor)
{
if (button == 3)
{
@@ -632,9 +615,11 @@ void LauncherIcon::RecvMouseUp(int button)
}
}
-void LauncherIcon::RecvMouseClick(int button)
+void LauncherIcon::RecvMouseClick(int button, int monitor)
{
ActionArg arg(ActionArg::LAUNCHER, button);
+ arg.monitor = monitor;
+
if (button == 1)
Activate(arg);
else if (button == 2)
@@ -643,11 +628,6 @@ void LauncherIcon::RecvMouseClick(int button)
void LauncherIcon::HideTooltip()
{
- if (_tooltip_delay_handle)
- g_source_remove(_tooltip_delay_handle);
- _tooltip_delay_handle = 0;
- _skip_tooltip_delay = false;
-
_tooltip->ShowWindow(false);
}
@@ -656,7 +636,7 @@ LauncherIcon::OnCenterTimeout(gpointer data)
{
LauncherIcon* self = (LauncherIcon*)data;
- if (self->_last_stable != self->_center)
+ if (!std::equal(self->_center.begin(), self->_center.end(), self->_last_stable.begin()))
{
self->OnCenterStabilized(self->_center);
self->_last_stable = self->_center;
@@ -667,27 +647,22 @@ LauncherIcon::OnCenterTimeout(gpointer data)
}
void
-LauncherIcon::SetCenter(nux::Point3 center)
+LauncherIcon::SetCenter(nux::Point3 center, int monitor, nux::Geometry geo)
{
- _center = center;
+ _center[monitor] = center;
+ _parent_geo[monitor] = geo;
- int tip_x, tip_y;
- if (_launcher)
+ if (monitor == _last_monitor)
{
- nux::Geometry geo = _launcher->GetAbsoluteGeometry();
+ int tip_x, tip_y;
tip_x = geo.x + geo.width + 1;
- tip_y = geo.y + _center.y;
- }
- else
- {
- tip_x = 0;
- tip_y = _center.y;
- }
+ tip_y = geo.y + _center[monitor].y;
- if (_quicklist->IsVisible())
- QuicklistManager::Default()->ShowQuicklist(_quicklist, tip_x, tip_y);
- else if (_tooltip->IsVisible())
- _tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
+ if (_quicklist->IsVisible())
+ QuicklistManager::Default()->ShowQuicklist(_quicklist, tip_x, tip_y);
+ else if (_tooltip->IsVisible())
+ _tooltip->ShowTooltipWithTipAt(tip_x, tip_y);
+ }
if (_center_stabilize_handle)
g_source_remove(_center_stabilize_handle);
@@ -696,7 +671,18 @@ LauncherIcon::SetCenter(nux::Point3 center)
}
nux::Point3
-LauncherIcon::GetCenter()
+LauncherIcon::GetCenter(int monitor)
+{
+ return _center[monitor];
+}
+
+nux::Point3
+LauncherIcon::GetSavedCenter(int monitor)
+{
+ return _saved_center[monitor];
+}
+
+std::vector<nux::Point3> LauncherIcon::GetCenters()
{
return _center;
}
@@ -709,12 +695,12 @@ LauncherIcon::SaveCenter()
}
void
-LauncherIcon::SetHasWindowOnViewport(bool val)
+LauncherIcon::SetWindowVisibleOnMonitor(bool val, int monitor)
{
- if (_has_visible_window == val)
+ if (_has_visible_window[monitor] == val)
return;
- _has_visible_window = val;
+ _has_visible_window[monitor] = val;
needs_redraw.emit(this);
}
@@ -763,16 +749,6 @@ LauncherIcon::Unpresent()
}
void
-LauncherIcon::SetRelatedWindows(int windows)
-{
- if (_related_windows == windows)
- return;
-
- _related_windows = windows;
- needs_redraw.emit(this);
-}
-
-void
LauncherIcon::Remove()
{
if (_quicklist->IsVisible())
@@ -807,7 +783,7 @@ LauncherIcon::Type()
}
bool
-LauncherIcon::GetQuirk(LauncherIcon::Quirk quirk)
+LauncherIcon::GetQuirk(LauncherIcon::Quirk quirk) const
{
return _quirks[quirk];
}
@@ -817,13 +793,10 @@ LauncherIcon::SetQuirk(LauncherIcon::Quirk quirk, bool value)
{
if (_quirks[quirk] == value)
return;
-
- if (quirk == QUIRK_PULSE_ONCE)
- _launcher->HideMachine()->SetQuirk(LauncherHideMachine::LAUNCHER_PULSE, value);
_quirks[quirk] = value;
if (quirk == QUIRK_VISIBLE)
- Launcher::SetTimeStruct(&(_quirk_times[quirk]), &(_quirk_times[quirk]), ANIM_DURATION_SHORT);
+ TimeUtil::SetTimeStruct(&(_quirk_times[quirk]), &(_quirk_times[quirk]), ANIM_DURATION_SHORT);
else
clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));
needs_redraw.emit(this);
@@ -887,12 +860,6 @@ LauncherIcon::GetQuirkTime(LauncherIcon::Quirk quirk)
return _quirk_times[quirk];
}
-int
-LauncherIcon::RelatedWindows()
-{
- return _related_windows;
-}
-
void
LauncherIcon::SetProgress(float progress)
{
@@ -949,12 +916,12 @@ LauncherIcon::SetEmblemIconName(const char* name)
}
std::vector<nux::Vector4> &
-LauncherIcon::GetTransform(TransformIndex index)
+LauncherIcon::GetTransform(TransformIndex index, int monitor)
{
- auto iter = transform_map.find(index);
- if (iter == transform_map.end())
+ auto iter = transform_map[monitor].find(index);
+ if (iter == transform_map[monitor].end())
{
- auto iter2 = transform_map.insert(std::map<TransformIndex, std::vector<nux::Vector4> >::value_type(index, std::vector<nux::Vector4>(4)));
+ auto iter2 = transform_map[monitor].insert(std::map<TransformIndex, std::vector<nux::Vector4> >::value_type(index, std::vector<nux::Vector4>(4)));
return iter2.first->second;
}
diff --git a/plugins/unityshell/src/LauncherIcon.h b/plugins/unityshell/src/LauncherIcon.h
index 5d455f7a2..d36568208 100644
--- a/plugins/unityshell/src/LauncherIcon.h
+++ b/plugins/unityshell/src/LauncherIcon.h
@@ -51,6 +51,8 @@ namespace unity
namespace launcher
{
+const int max_num_monitors = 6;
+
class Launcher;
class LauncherIcon : public AbstractLauncherIcon
@@ -60,15 +62,10 @@ class LauncherIcon : public AbstractLauncherIcon
public:
typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
- LauncherIcon(Launcher* launcher);
+ LauncherIcon();
virtual ~LauncherIcon();
- Launcher* GetLauncher()
- {
- return _launcher;
- };
-
bool SetTooltipText(std::string& target, std::string const& value);
void SetShortcut(guint64 shortcut);
@@ -77,23 +74,25 @@ public:
void SetSortPriority(int priority);
- void RecvMouseEnter();
+ void RecvMouseEnter(int monitor);
- void RecvMouseLeave();
+ void RecvMouseLeave(int monitor);
- void RecvMouseDown(int button);
+ void RecvMouseDown(int button, int monitor);
- void RecvMouseUp(int button);
+ void RecvMouseUp(int button, int monitor);
- void RecvMouseClick(int button);
+ void RecvMouseClick(int button, int monitor);
void HideTooltip();
- bool OpenQuicklist(bool default_to_first_item = false);
+ void ShowTooltip();
- void SetCenter(nux::Point3 center);
+ bool OpenQuicklist(bool default_to_first_item = false, int monitor = -1);
- nux::Point3 GetCenter();
+ void SetCenter(nux::Point3 center, int parent_monitor, nux::Geometry parent_geo);
+
+ nux::Point3 GetCenter(int monitor);
virtual void Activate(ActionArg arg);
@@ -101,15 +100,17 @@ public:
void SaveCenter();
+ nux::Point3 GetSavedCenter(int monitor);
+
int SortPriority();
- int RelatedWindows();
+ virtual std::vector<Window> Windows () { return std::vector<Window> (); }
- virtual std::vector<Window> RelatedXids () { return std::vector<Window> (); }
+ virtual std::vector<Window> WindowsForMonitor (int monitor) { return std::vector<Window> (); }
virtual std::string NameForWindow (Window window) { return std::string(); }
- const bool HasWindowOnViewport();
+ const bool WindowVisibleOnMonitor(int monitor);
virtual bool IsSpacer()
{
@@ -126,7 +127,7 @@ public:
void DeleteEmblem();
- virtual bool ShowInSwitcher()
+ virtual bool ShowInSwitcher(bool current)
{
return false;
};
@@ -136,7 +137,7 @@ public:
return 0;
}
- bool GetQuirk(Quirk quirk);
+ bool GetQuirk(Quirk quirk) const;
void SetQuirk(Quirk quirk, bool value);
@@ -185,19 +186,11 @@ public:
void SetIconType(IconType type);
- std::vector<nux::Vector4> & GetTransform(TransformIndex index);
-
- static void SetSkipTooltipDelay(gboolean skip_tooltip_delay);
-
- sigc::signal<void, LauncherIcon*> remove;
-
- sigc::connection needs_redraw_connection;
- sigc::connection on_icon_added_connection;
- sigc::connection on_icon_removed_connection;
- sigc::connection on_order_changed_connection;
- sigc::connection on_expo_terminated_connection;
+ std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor);
protected:
+ std::vector<nux::Point3> GetCenters();
+
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);
@@ -208,13 +201,11 @@ protected:
void ResetQuirkTime(Quirk quirk);
- void SetRelatedWindows(int windows);
-
void Remove();
void SetProgress(float progress);
- void SetHasWindowOnViewport(bool val);
+ void SetWindowVisibleOnMonitor(bool val, int monitor);
void Present(float urgency, int length);
@@ -226,7 +217,7 @@ protected:
virtual nux::BaseTexture* GetTextureForSize(int size) = 0;
- virtual void OnCenterStabilized(nux::Point3 center) {}
+ virtual void OnCenterStabilized(std::vector<nux::Point3> center) {}
virtual const gchar* GetRemoteUri()
{
@@ -276,8 +267,6 @@ protected:
void OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote);
- Launcher* _launcher;
-
nux::Tooltip* _tooltip;
QuicklistView* _quicklist;
@@ -304,31 +293,29 @@ private:
static gboolean OnPresentTimeout(gpointer data);
static gboolean OnCenterTimeout(gpointer data);
static gboolean OnDelayedUpdateTimeout(gpointer data);
- static gboolean OnTooltipTimeout(gpointer data);
void ColorForIcon(GdkPixbuf* pixbuf, nux::Color& background, nux::Color& glow);
- bool _has_visible_window;
- bool _quicklist_is_initialized;
- bool _remote_urgent;
- float _present_urgency;
- float _progress;
- guint _center_stabilize_handle;
- guint _present_time_handle;
- guint _time_delay_handle;
- guint _tooltip_delay_handle;
- int _related_windows;
- int _sort_priority;
- nux::Color _background_color;
- nux::Color _glow_color;
- static gboolean _skip_tooltip_delay;
-
- gint64 _shortcut;
-
- nux::Point3 _center;
- nux::Point3 _last_stable;
- nux::Point3 _saved_center;
- IconType _icon_type;
+ std::vector<bool> _has_visible_window;
+ bool _quicklist_is_initialized;
+ bool _remote_urgent;
+ float _present_urgency;
+ float _progress;
+ guint _center_stabilize_handle;
+ guint _present_time_handle;
+ guint _time_delay_handle;
+ int _sort_priority;
+ int _last_monitor;
+ nux::Color _background_color;
+ nux::Color _glow_color;
+
+ gint64 _shortcut;
+
+ std::vector<nux::Point3> _center;
+ std::vector<nux::Point3> _last_stable;
+ std::vector<nux::Point3> _saved_center;
+ std::vector<nux::Geometry> _parent_geo;
+ IconType _icon_type;
static GtkIconTheme* _unity_theme;
@@ -338,7 +325,7 @@ private:
struct timespec _quirk_times[QUIRK_LAST];
std::list<LauncherEntryRemote*> _entry_list;
- std::map<TransformIndex, std::vector<nux::Vector4> > transform_map;
+ std::vector<std::map<TransformIndex, std::vector<nux::Vector4> > > transform_map;
};
diff --git a/plugins/unityshell/src/LauncherModel.cpp b/plugins/unityshell/src/LauncherModel.cpp
index ea9769bc6..fff074786 100644
--- a/plugins/unityshell/src/LauncherModel.cpp
+++ b/plugins/unityshell/src/LauncherModel.cpp
@@ -18,7 +18,7 @@
*/
#include "LauncherModel.h"
-#include "LauncherIcon.h"
+#include "AbstractLauncherIcon.h"
namespace unity
{
@@ -27,12 +27,13 @@ namespace launcher
typedef struct
{
- LauncherIcon* icon;
+ AbstractLauncherIcon* icon;
LauncherModel* self;
} RemoveArg;
LauncherModel::LauncherModel()
{
+ selection_ = 0;
}
LauncherModel::~LauncherModel()
@@ -44,12 +45,12 @@ LauncherModel::~LauncherModel()
icon->UnReference();
}
-bool LauncherModel::IconShouldShelf(LauncherIcon* icon)
+bool LauncherModel::IconShouldShelf(AbstractLauncherIcon* icon) const
{
- return icon->Type() == LauncherIcon::TYPE_TRASH;
+ return icon->Type() == AbstractLauncherIcon::TYPE_TRASH;
}
-bool LauncherModel::CompareIcons(LauncherIcon* first, LauncherIcon* second)
+bool LauncherModel::CompareIcons(AbstractLauncherIcon* first, AbstractLauncherIcon* second)
{
if (first->Type() < second->Type())
return true;
@@ -66,31 +67,35 @@ LauncherModel::Populate()
_inner.clear();
+ iterator it, it2;
+
int i = 0;
- for (auto icon : _inner_main)
+ for (it = main_begin(); it != main_end(); it++)
{
- _inner.push_back(icon);
- icon->SetSortPriority(i++);
+ _inner.push_back(*it);
+ (*it)->SetSortPriority(i);
+ ++i;
}
- for (auto icon : _inner_shelf)
+ for (it = shelf_begin(); it != shelf_end(); it++)
{
- _inner.push_back(icon);
- icon->SetSortPriority(i++);
+ _inner.push_back(*it);
+ (*it)->SetSortPriority(i);
+ ++i;
}
- return !std::equal(begin(), end(), copy.begin());
+ return copy.size() == _inner.size() && !std::equal(begin(), end(), copy.begin());
}
void
-LauncherModel::AddIcon(LauncherIcon* icon)
+LauncherModel::AddIcon(AbstractLauncherIcon* icon)
{
icon->SinkReference();
if (IconShouldShelf(icon))
- _inner_shelf.push_front(icon);
+ _inner_shelf.push_back(icon);
else
- _inner_main.push_front(icon);
+ _inner_main.push_back(icon);
Sort();
@@ -102,15 +107,15 @@ LauncherModel::AddIcon(LauncherIcon* icon)
}
void
-LauncherModel::RemoveIcon(LauncherIcon* icon)
+LauncherModel::RemoveIcon(AbstractLauncherIcon* icon)
{
size_t size;
- _inner_shelf.remove(icon);
- _inner_main.remove(icon);
+ _inner_shelf.erase(std::remove(_inner_shelf.begin(), _inner_shelf.end(), icon), _inner_shelf.end());
+ _inner_main.erase(std::remove(_inner_main.begin(), _inner_main.end(), icon), _inner_main.end());
size = _inner.size();
- _inner.remove(icon);
+ _inner.erase(std::remove(_inner.begin(), _inner.end(), icon), _inner.end());
if (size != _inner.size())
{
@@ -131,7 +136,7 @@ LauncherModel::RemoveCallback(gpointer data)
}
void
-LauncherModel::OnIconRemove(LauncherIcon* icon)
+LauncherModel::OnIconRemove(AbstractLauncherIcon* icon)
{
RemoveArg* arg = (RemoveArg*) g_malloc0(sizeof(RemoveArg));
arg->icon = icon;
@@ -149,36 +154,36 @@ LauncherModel::Save()
void
LauncherModel::Sort()
{
- _inner_shelf.sort(&LauncherModel::CompareIcons);
- _inner_main.sort(&LauncherModel::CompareIcons);
+ std::stable_sort(_inner_shelf.begin(), _inner_shelf.end(), &LauncherModel::CompareIcons);
+ std::stable_sort(_inner_main.begin(), _inner_main.end(), &LauncherModel::CompareIcons);
if (Populate())
order_changed.emit();
}
bool
-LauncherModel::IconHasSister(LauncherIcon* icon)
+LauncherModel::IconHasSister(AbstractLauncherIcon* icon) const
{
- iterator it;
- iterator end;
+ const_iterator it;
+ const_iterator end;
if (icon && icon->Type() == AbstractLauncherIcon::TYPE_DEVICE)
return true;
if (IconShouldShelf(icon))
{
- it = shelf_begin();
- end = shelf_end();
+ it = _inner_shelf.begin();
+ end = _inner_shelf.end();
}
else
{
- it = main_begin();
- end = main_end();
+ it = _inner_main.begin();
+ end = _inner_main.end();
}
for (; it != end; ++it)
{
- LauncherIcon* iter_icon = *it;
+ AbstractLauncherIcon* iter_icon = *it;
if ((iter_icon != icon)
&& iter_icon->Type() == icon->Type())
return true;
@@ -188,7 +193,7 @@ LauncherModel::IconHasSister(LauncherIcon* icon)
}
void
-LauncherModel::ReorderAfter(LauncherIcon* icon, LauncherIcon* other)
+LauncherModel::ReorderAfter(AbstractLauncherIcon* icon, AbstractLauncherIcon* other)
{
if (icon == other)
return;
@@ -218,7 +223,7 @@ LauncherModel::ReorderAfter(LauncherIcon* icon, LauncherIcon* other)
}
void
-LauncherModel::ReorderBefore(LauncherIcon* icon, LauncherIcon* other, bool save)
+LauncherModel::ReorderBefore(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save)
{
if (icon == other)
return;
@@ -259,7 +264,7 @@ LauncherModel::ReorderBefore(LauncherIcon* icon, LauncherIcon* other, bool save)
}
void
-LauncherModel::ReorderSmart(LauncherIcon* icon, LauncherIcon* other, bool save)
+LauncherModel::ReorderSmart(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save)
{
if (icon == other)
return;
@@ -313,11 +318,73 @@ LauncherModel::ReorderSmart(LauncherIcon* icon, LauncherIcon* other, bool save)
}
int
-LauncherModel::Size()
+LauncherModel::Size() const
{
return _inner.size();
}
+AbstractLauncherIcon* LauncherModel::Selection () const
+{
+ return _inner[selection_];
+}
+
+int LauncherModel::SelectionIndex() const
+{
+ return selection_;
+}
+
+void LauncherModel::SetSelection(int selection)
+{
+ int new_selection = std::min<int>(Size() - 1, std::max<int> (0, selection));
+
+ if (new_selection == selection_)
+ return;
+
+ selection_ = new_selection;
+ selection_changed.emit(Selection());
+}
+
+void LauncherModel::SelectNext()
+{
+ int temp = selection_;
+
+ temp++;
+ while (temp != selection_)
+ {
+ if (temp >= Size())
+ temp = 0;
+
+ if (_inner[temp]->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
+ {
+ selection_ = temp;
+ selection_changed.emit(Selection());
+ break;
+ }
+ temp++;
+ }
+}
+
+void LauncherModel::SelectPrevious()
+{
+ int temp = selection_;
+
+ temp--;
+ while (temp != selection_)
+ {
+ if (temp < 0)
+ temp = Size() - 1;
+
+ if (_inner[temp]->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
+ {
+ selection_ = temp;
+ selection_changed.emit(Selection());
+ break;
+ }
+ temp--;
+ }
+}
+
+
/* iterators */
LauncherModel::iterator
diff --git a/plugins/unityshell/src/LauncherModel.h b/plugins/unityshell/src/LauncherModel.h
index e2113f3ea..bbf80d45e 100644
--- a/plugins/unityshell/src/LauncherModel.h
+++ b/plugins/unityshell/src/LauncherModel.h
@@ -22,7 +22,7 @@
#include <memory>
-#include "LauncherIcon.h"
+#include "AbstractLauncherIcon.h"
#include <sigc++/sigc++.h>
namespace unity
@@ -34,27 +34,35 @@ class LauncherModel : public sigc::trackable
{
public:
typedef std::shared_ptr<LauncherModel> Ptr;
- typedef std::list<LauncherIcon*> Base;
+ typedef std::vector<AbstractLauncherIcon*> Base;
typedef Base::iterator iterator;
+ typedef Base::const_iterator const_iterator;
typedef Base::reverse_iterator reverse_iterator;
+ typedef Base::reverse_iterator const_reverse_iterator;
LauncherModel();
~LauncherModel();
- void AddIcon(LauncherIcon* icon);
- void RemoveIcon(LauncherIcon* icon);
+ void AddIcon(AbstractLauncherIcon* icon);
+ void RemoveIcon(AbstractLauncherIcon* icon);
void Save();
void Sort();
- int Size();
+ int Size() const;
- void OnIconRemove(LauncherIcon* icon);
+ void OnIconRemove(AbstractLauncherIcon* icon);
- bool IconHasSister(LauncherIcon* icon);
+ bool IconHasSister(AbstractLauncherIcon* icon) const;
- void ReorderAfter(LauncherIcon* icon, LauncherIcon* other);
- void ReorderBefore(LauncherIcon* icon, LauncherIcon* other, bool save);
+ void ReorderAfter(AbstractLauncherIcon* icon, AbstractLauncherIcon* other);
+ void ReorderBefore(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save);
- void ReorderSmart(LauncherIcon* icon, LauncherIcon* other, bool save);
+ void ReorderSmart(AbstractLauncherIcon* icon, AbstractLauncherIcon* other, bool save);
+
+ AbstractLauncherIcon* Selection() const;
+ int SelectionIndex() const;
+ void SetSelection(int selection);
+ void SelectNext();
+ void SelectPrevious();
iterator begin();
iterator end();
@@ -72,28 +80,25 @@ public:
reverse_iterator shelf_rbegin();
reverse_iterator shelf_rend();
- sigc::signal<void, LauncherIcon*> icon_added;
- sigc::signal<void, LauncherIcon*> icon_removed;
+ sigc::signal<void, AbstractLauncherIcon*> icon_added;
+ sigc::signal<void, AbstractLauncherIcon*> icon_removed;
sigc::signal<void> order_changed;
sigc::signal<void> saved;
-
- // connected to from class Launcher
- sigc::connection on_icon_added_connection;
- sigc::connection on_icon_removed_connection;
- sigc::connection on_order_changed_connection;
-
+ sigc::signal<void, AbstractLauncherIcon*> selection_changed;
+
private:
Base _inner;
Base _inner_shelf;
Base _inner_main;
+ int selection_;
bool Populate();
- bool IconShouldShelf(LauncherIcon* icon);
+ bool IconShouldShelf(AbstractLauncherIcon* icon) const;
static gboolean RemoveCallback(gpointer data);
- static bool CompareIcons(LauncherIcon* first, LauncherIcon* second);
+ static bool CompareIcons(AbstractLauncherIcon* first, AbstractLauncherIcon* second);
/* Template Methods */
public:
diff --git a/plugins/unityshell/src/LauncherOptions.cpp b/plugins/unityshell/src/LauncherOptions.cpp
new file mode 100644
index 000000000..c77045371
--- /dev/null
+++ b/plugins/unityshell/src/LauncherOptions.cpp
@@ -0,0 +1,62 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2010, 2011 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ * Tim Penhey <tim.penhey@canonical.com>
+ */
+
+#include "LauncherOptions.h"
+
+namespace unity
+{
+namespace launcher
+{
+
+Options::Options()
+{
+ // defaults from XML file
+ auto_hide_animation = FADE_AND_SLIDE;
+ background_alpha = 0.6667;
+ backlight_mode = BACKLIGHT_ALWAYS_ON;
+ edge_decay_rate = 1500;
+ edge_overcome_pressure = 2000;
+ edge_responsiveness = 1.0f;
+ edge_reveal_pressure = 2000;
+ edge_stop_velocity = 4500;
+ hide_mode = LAUNCHER_HIDE_DODGE_WINDOWS;
+ icon_size = 48;
+ launch_animation = LAUNCH_ANIMATION_PULSE;
+ tile_size = 54;
+ urgent_animation = URGENT_ANIMATION_WIGGLE;
+
+ auto_hide_animation.changed.connect ([&] (AutoHideAnimation value)-> void { option_changed.emit(); });
+ background_alpha.changed.connect ([&] (float value) -> void { option_changed.emit(); });
+ backlight_mode.changed.connect ([&] (BacklightMode value) -> void { option_changed.emit(); });
+ edge_decay_rate.changed.connect ([&] (int value) -> void { option_changed.emit(); });
+ edge_overcome_pressure.changed.connect([&] (int value) -> void { option_changed.emit(); });
+ edge_responsiveness.changed.connect ([&] (float value) -> void { option_changed.emit(); });
+ edge_reveal_pressure.changed.connect ([&] (int value) -> void { option_changed.emit(); });
+ edge_stop_velocity.changed.connect ([&] (int value) -> void { option_changed.emit(); });
+ hide_mode.changed.connect ([&] (LauncherHideMode value) -> void { option_changed.emit(); });
+ icon_size.changed.connect ([&] (int value) -> void { option_changed.emit(); });
+ launch_animation.changed.connect ([&] (LaunchAnimation value) -> void { option_changed.emit(); });
+ tile_size.changed.connect ([&] (int value) -> void { option_changed.emit(); });
+ urgent_animation.changed.connect ([&] (UrgentAnimation value) -> void { option_changed.emit(); });
+}
+
+
+}
+} \ No newline at end of file
diff --git a/plugins/unityshell/src/LauncherOptions.h b/plugins/unityshell/src/LauncherOptions.h
new file mode 100644
index 000000000..6acea99ff
--- /dev/null
+++ b/plugins/unityshell/src/LauncherOptions.h
@@ -0,0 +1,102 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ * Tim Penhey <tim.penhey@canonical.com>
+ */
+
+#ifndef LAUNCHEROPTIONS_H
+#define LAUNCHEROPTIONS_H
+
+#include <memory>
+#include <vector>
+#include <sigc++/sigc++.h>
+#include <core/core.h>
+
+#include <Nux/Nux.h>
+
+namespace unity
+{
+namespace launcher
+{
+
+typedef enum
+{
+ LAUNCHER_HIDE_NEVER,
+ LAUNCHER_HIDE_AUTOHIDE,
+ LAUNCHER_HIDE_DODGE_WINDOWS,
+ LAUNCHER_HIDE_DODGE_ACTIVE_WINDOW,
+} LauncherHideMode;
+
+typedef enum
+{
+ LAUNCH_ANIMATION_NONE,
+ LAUNCH_ANIMATION_PULSE,
+ LAUNCH_ANIMATION_BLINK,
+} LaunchAnimation;
+
+typedef enum
+{
+ URGENT_ANIMATION_NONE,
+ URGENT_ANIMATION_PULSE,
+ URGENT_ANIMATION_WIGGLE,
+} UrgentAnimation;
+
+typedef enum
+{
+ FADE_OR_SLIDE,
+ SLIDE_ONLY,
+ FADE_ONLY,
+ FADE_AND_SLIDE,
+} AutoHideAnimation;
+
+typedef enum
+{
+ BACKLIGHT_ALWAYS_ON,
+ BACKLIGHT_NORMAL,
+ BACKLIGHT_ALWAYS_OFF,
+ BACKLIGHT_EDGE_TOGGLE,
+ BACKLIGHT_NORMAL_EDGE_TOGGLE
+} BacklightMode;
+
+class Options : public sigc::trackable
+{
+public:
+ typedef std::shared_ptr<Options> Ptr;
+
+ Options();
+
+ nux::Property<LauncherHideMode> hide_mode;
+ nux::Property<LaunchAnimation> launch_animation;
+ nux::Property<UrgentAnimation> urgent_animation;
+ nux::Property<AutoHideAnimation> auto_hide_animation;
+ nux::Property<BacklightMode> backlight_mode;
+ nux::Property<int> icon_size;
+ nux::Property<int> tile_size;
+ nux::Property<float> background_alpha;
+ nux::Property<int> edge_decay_rate;
+ nux::Property<int> edge_overcome_pressure;
+ nux::Property<int> edge_stop_velocity;
+ nux::Property<int> edge_reveal_pressure;
+ nux::Property<float> edge_responsiveness;
+
+ sigc::signal<void> option_changed;
+};
+
+}
+}
+
+#endif // LAUNCHEROPTIONS_H
diff --git a/plugins/unityshell/src/LensBarIcon.cpp b/plugins/unityshell/src/LensBarIcon.cpp
index c96f2021c..6b1c420a7 100644
--- a/plugins/unityshell/src/LensBarIcon.cpp
+++ b/plugins/unityshell/src/LensBarIcon.cpp
@@ -39,6 +39,8 @@ LensBarIcon::LensBarIcon(std::string id_, std::string icon_hint)
SetMaximumHeight(24);
SetOpacity(inactive_opacity_);
+ SetAcceptKeyNavFocusOnMouseDown(false);
+
active.changed.connect(sigc::mem_fun(this, &LensBarIcon::OnActiveChanged));
mouse_enter.connect([&]
(int, int, unsigned long, unsigned long) { QueueDraw(); });
diff --git a/plugins/unityshell/src/MockLauncherIcon.h b/plugins/unityshell/src/MockLauncherIcon.h
index f8cba68a2..454215e22 100644
--- a/plugins/unityshell/src/MockLauncherIcon.h
+++ b/plugins/unityshell/src/MockLauncherIcon.h
@@ -27,6 +27,8 @@
#include <Nux/BaseWindow.h>
#include <Nux/View.h>
+#include <gtk/gtk.h>
+
#include <sigc++/sigc++.h>
#include <libdbusmenu-glib/menuitem.h>
@@ -45,6 +47,9 @@ public:
: icon_(0)
{
tooltip_text = "Mock Icon";
+ transform_map.resize(10);
+ sort_priority_ = 0;
+ type_ = TYPE_APPLICATION;
}
std::string GetName() const { return "MockLauncherIcon"; }
@@ -60,7 +65,23 @@ public:
return 0;
}
- std::vector<Window> RelatedXids ()
+ std::vector<Window> Windows ()
+ {
+ std::vector<Window> result;
+
+ result.push_back ((100 << 16) + 200);
+ result.push_back ((500 << 16) + 200);
+ result.push_back ((300 << 16) + 200);
+ result.push_back ((200 << 16) + 200);
+ result.push_back ((300 << 16) + 200);
+ result.push_back ((100 << 16) + 200);
+ result.push_back ((300 << 16) + 200);
+ result.push_back ((600 << 16) + 200);
+
+ return result;
+ }
+
+ std::vector<Window> WindowsForMonitor (int monitor)
{
std::vector<Window> result;
@@ -81,26 +102,37 @@ public:
return std::string();
}
- void SetSortPriority(int priority) {}
+ void SetSortPriority(int priority) { sort_priority_ = priority; }
- bool OpenQuicklist(bool default_to_first_item = false)
+ bool OpenQuicklist(bool default_to_first_item = false, int monitor = -1)
{
return false;
}
- void SetCenter(nux::Point3 center) {}
+ void SetCenter(nux::Point3 center, int monitor, nux::Geometry geo) {}
- nux::Point3 GetCenter()
+ nux::Point3 GetCenter(int monitor)
{
return nux::Point3();
}
- std::vector<nux::Vector4> & GetTransform(TransformIndex index)
+ nux::Point3 GetSavedCenter(int monitor)
+ {
+ return nux::Point3();
+ }
+
+ void SaveCenter() {}
+
+ std::vector<nux::Vector4> & GetTransform(TransformIndex index, int monitor)
{
- if (transform_map.find(index) == transform_map.end())
- transform_map[index] = std::vector<nux::Vector4> (4);
+ auto iter = transform_map[monitor].find(index);
+ if (iter == transform_map[monitor].end())
+ {
+ auto iter2 = transform_map[monitor].insert(std::map<TransformIndex, std::vector<nux::Vector4> >::value_type(index, std::vector<nux::Vector4>(4)));
+ return iter2.first->second;
+ }
- return transform_map[index];
+ return iter->second;
}
void Activate(ActionArg arg) {}
@@ -109,7 +141,7 @@ public:
int SortPriority()
{
- return 0;
+ return sort_priority_;
}
int RelatedWindows()
@@ -117,7 +149,7 @@ public:
return 7;
}
- const bool HasWindowOnViewport()
+ const bool WindowVisibleOnMonitor(int monitor)
{
return false;
}
@@ -137,23 +169,29 @@ public:
return 0.0f;
}
- bool ShowInSwitcher()
+ bool ShowInSwitcher(bool current)
{
return true;
}
+ void InsertEntryRemote(LauncherEntryRemote* remote) {}
+
+ void RemoveEntryRemote(LauncherEntryRemote* remote) {}
+
unsigned long long SwitcherPriority()
{
return 0;
}
- bool GetQuirk(Quirk quirk)
+ bool GetQuirk(Quirk quirk) const
{
return false;
}
void SetQuirk(Quirk quirk, bool value) {}
+ void ResetQuirkTime(Quirk quirk) {};
+
struct timespec GetQuirkTime(Quirk quirk)
{
timespec tv;
@@ -162,7 +200,7 @@ public:
IconType Type()
{
- return TYPE_APPLICATION;
+ return type_;
}
nux::Color BackgroundColor()
@@ -263,9 +301,10 @@ private:
}
- std::map<TransformIndex, std::vector<nux::Vector4> > transform_map;
+ std::vector<std::map<TransformIndex, std::vector<nux::Vector4> > > transform_map;
nux::BaseTexture* icon_;
-
+ int sort_priority_;
+ IconType type_;
};
}
diff --git a/plugins/unityshell/src/OverlayRenderer.cpp b/plugins/unityshell/src/OverlayRenderer.cpp
index f976ee073..d0cecee8c 100644
--- a/plugins/unityshell/src/OverlayRenderer.cpp
+++ b/plugins/unityshell/src/OverlayRenderer.cpp
@@ -277,8 +277,8 @@ void OverlayRendererImpl::Draw(nux::GraphicsEngine& gfx_context, nux::Geometry c
texxform_absolute_bg.flip_v_coord = false;
- texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * (absolute_geo.x);
- texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * (absolute_geo.y);
+ texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset;
+ texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset;
gfx_context.GetRenderStates().SetColorMask(true, true, true, false);
gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE);
@@ -384,8 +384,8 @@ void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geo
rop.SrcBlend = GL_DST_COLOR;
rop.DstBlend = GL_ONE;
texxform_absolute_bg.flip_v_coord = false;
- texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * (absolute_geo.x);
- texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * (absolute_geo.y);
+ texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * parent->x_offset;
+ texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * parent->y_offset;
nux::GetPainter().PushTextureLayer(gfx_context, bg_layer_->GetGeometry(),
bg_shine_texture_,
diff --git a/plugins/unityshell/src/OverlayRenderer.h b/plugins/unityshell/src/OverlayRenderer.h
index ba41c22b2..f4bd624f1 100644
--- a/plugins/unityshell/src/OverlayRenderer.h
+++ b/plugins/unityshell/src/OverlayRenderer.h
@@ -36,6 +36,9 @@ public:
// We only ever want one OverlayRenderer per view, so if you must take a pointer, take this unique one that will die
// when it goes out of scope
typedef std::unique_ptr<OverlayRenderer> Ptr;
+
+ nux::Property<int> x_offset;
+ nux::Property<int> y_offset;
OverlayRenderer();
~OverlayRenderer();
diff --git a/plugins/unityshell/src/PanelController.cpp b/plugins/unityshell/src/PanelController.cpp
index 54c7c22ee..af40a0155 100644
--- a/plugins/unityshell/src/PanelController.cpp
+++ b/plugins/unityshell/src/PanelController.cpp
@@ -36,7 +36,7 @@ namespace
nux::logging::Logger logger("unity.panel");
}
-class Controller::Impl : public sigc::trackable
+class Controller::Impl
{
public:
Impl();
@@ -58,14 +58,15 @@ public:
void SetMenuShowTimings(int fadein, int fadeout, int discovery,
int discovery_fadein, int discovery_fadeout);
+ void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors, Introspectable *iobj);
private:
unity::PanelView* ViewForWindow(nux::BaseWindow* window);
- void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors);
static void WindowConfigureCallback(int window_width,
int window_height,
nux::Geometry& geo,
void* user_data);
+
private:
std::vector<nux::BaseWindow*> windows_;
float opacity_;
@@ -89,9 +90,6 @@ Controller::Impl::Impl()
, menus_discovery_fadein_(0)
, menus_discovery_fadeout_(0)
{
- UScreen* screen = UScreen::GetDefault();
- screen->changed.connect(sigc::mem_fun(this, &Impl::OnScreenChanged));
- OnScreenChanged(screen->GetPrimaryMonitor(), screen->GetMonitors());
}
Controller::Impl::~Impl()
@@ -200,7 +198,8 @@ PanelView* Controller::Impl::ViewForWindow(nux::BaseWindow* window)
// We need to put a panel on every monitor, and try and re-use the panels we already have
void Controller::Impl::OnScreenChanged(int primary_monitor,
- std::vector<nux::Geometry>& monitors)
+ std::vector<nux::Geometry>& monitors,
+ Introspectable *iobj)
{
std::vector<nux::BaseWindow*>::iterator it, eit = windows_.end();
int n_monitors = monitors.size();
@@ -270,6 +269,9 @@ void Controller::Impl::OnScreenChanged(int primary_monitor,
windows_.push_back(window);
+ // add to introspectable tree:
+ iobj->AddChild(view);
+
LOG_DEBUG(logger) << "Added Panel for Monitor " << i;
}
}
@@ -301,10 +303,12 @@ float Controller::Impl::opacity() const
return opacity_;
}
-
Controller::Controller()
: pimpl(new Impl())
{
+ UScreen* screen = UScreen::GetDefault();
+ screen->changed.connect(sigc::mem_fun(this, &Controller::OnScreenChanged));
+ OnScreenChanged(screen->GetPrimaryMonitor(), screen->GetMonitors());
}
Controller::~Controller()
@@ -358,6 +362,20 @@ float Controller::opacity() const
return pimpl->opacity();
}
+std::string Controller::GetName() const
+{
+ return "PanelController";
+}
+
+void Controller::AddProperties(GVariantBuilder* builder)
+{
+ g_variant_builder_add(builder, "{sv}", "opacity", g_variant_new_double(pimpl->opacity()));
+}
+
+void Controller::OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors)
+{
+ pimpl->OnScreenChanged(primary_monitor, monitors, this);
+}
} // namespace panel
} // namespace unity
diff --git a/plugins/unityshell/src/PanelController.h b/plugins/unityshell/src/PanelController.h
index e41dab9b4..0b76f2fe0 100644
--- a/plugins/unityshell/src/PanelController.h
+++ b/plugins/unityshell/src/PanelController.h
@@ -25,12 +25,13 @@
#include <Nux/Nux.h>
+#include "Introspectable.h"
namespace unity
{
namespace panel
{
-class Controller
+class Controller : public sigc::trackable, public unity::debug::Introspectable
{
public:
typedef std::shared_ptr<Controller> Ptr;
@@ -52,7 +53,10 @@ public:
float opacity() const;
+ std::string GetName() const;
+ void AddProperties(GVariantBuilder* builder);
private:
+ void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors);
class Impl;
Impl* pimpl;
};
diff --git a/plugins/unityshell/src/PanelIndicatorsView.cpp b/plugins/unityshell/src/PanelIndicatorsView.cpp
index ca7f533f3..f328b09fa 100644
--- a/plugins/unityshell/src/PanelIndicatorsView.cpp
+++ b/plugins/unityshell/src/PanelIndicatorsView.cpp
@@ -340,11 +340,6 @@ std::string PanelIndicatorsView::GetName() const
return "IndicatorsView";
}
-std::string PanelIndicatorsView::GetChildsName() const
-{
- return "entries";
-}
-
void
PanelIndicatorsView::AddProperties(GVariantBuilder* builder)
{
diff --git a/plugins/unityshell/src/PanelIndicatorsView.h b/plugins/unityshell/src/PanelIndicatorsView.h
index 284fca95d..9f7383a0d 100644
--- a/plugins/unityshell/src/PanelIndicatorsView.h
+++ b/plugins/unityshell/src/PanelIndicatorsView.h
@@ -83,7 +83,6 @@ protected:
Entries entries_;
std::string GetName() const;
- std::string GetChildsName() const;
void AddProperties(GVariantBuilder* builder);
private:
diff --git a/plugins/unityshell/src/PanelMenuView.cpp b/plugins/unityshell/src/PanelMenuView.cpp
index d4491f4d8..562033d23 100644
--- a/plugins/unityshell/src/PanelMenuView.cpp
+++ b/plugins/unityshell/src/PanelMenuView.cpp
@@ -155,10 +155,10 @@ PanelMenuView::PanelMenuView(int padding)
// Register for all the interesting events
UBusServer* ubus = ubus_server_get_default();
- _ubus_interests.push_back(ubus_server_register_interest(ubus, UBUS_PLACE_VIEW_SHOWN,
+ _ubus_interests.push_back(ubus_server_register_interest(ubus, UBUS_OVERLAY_SHOWN,
(UBusCallback)PanelMenuView::OnPlaceViewShown,
this));
- _ubus_interests.push_back(ubus_server_register_interest(ubus, UBUS_PLACE_VIEW_HIDDEN,
+ _ubus_interests.push_back(ubus_server_register_interest(ubus, UBUS_OVERLAY_HIDDEN,
(UBusCallback)PanelMenuView::OnPlaceViewHidden,
this));
diff --git a/plugins/unityshell/src/PanelView.cpp b/plugins/unityshell/src/PanelView.cpp
index dccb4ad5e..5eb7b1933 100644
--- a/plugins/unityshell/src/PanelView.cpp
+++ b/plugins/unityshell/src/PanelView.cpp
@@ -103,11 +103,11 @@ PanelView::PanelView(NUX_FILE_LINE_DECL)
(UBusCallback)&PanelView::OnBackgroundUpdate,
this);
- _handle_dash_hidden = ubus_server_register_interest(ubus, UBUS_PLACE_VIEW_HIDDEN,
+ _handle_dash_hidden = ubus_server_register_interest(ubus, UBUS_OVERLAY_HIDDEN,
(UBusCallback)&PanelView::OnDashHidden,
this);
- _handle_dash_shown = ubus_server_register_interest(ubus, UBUS_PLACE_VIEW_SHOWN,
+ _handle_dash_shown = ubus_server_register_interest(ubus, UBUS_OVERLAY_SHOWN,
(UBusCallback)&PanelView::OnDashShown,
this);
// request the latest colour from bghash
@@ -182,7 +182,13 @@ void PanelView::OnDashHidden(GVariant* data, PanelView* self)
void PanelView::OnDashShown(GVariant* data, PanelView* self)
{
- if (self->_is_primary)
+ unity::glib::String overlay_identity;
+ gboolean can_maximise = FALSE;
+ gint32 overlay_monitor = 0;
+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
+ &overlay_identity, &can_maximise, &overlay_monitor);
+
+ if (self->_monitor == overlay_monitor)
{
self->bg_effect_helper_.enabled = true;
self->_dash_is_open = true;
@@ -205,11 +211,6 @@ std::string PanelView::GetName() const
return "UnityPanel";
}
-std::string PanelView::GetChildsName() const
-{
- return "indicators";
-}
-
void PanelView::AddProperties(GVariantBuilder* builder)
{
variant::BuilderWrapper(builder)
diff --git a/plugins/unityshell/src/PanelView.h b/plugins/unityshell/src/PanelView.h
index 8880e2a86..66804b116 100644
--- a/plugins/unityshell/src/PanelView.h
+++ b/plugins/unityshell/src/PanelView.h
@@ -81,7 +81,6 @@ public:
protected:
// Introspectable methods
std::string GetName() const;
- std::string GetChildsName() const;
void AddProperties(GVariantBuilder* builder);
private:
diff --git a/plugins/unityshell/src/PlacesSimpleTile.cpp b/plugins/unityshell/src/PlacesSimpleTile.cpp
index 7ee262538..f6545a491 100644
--- a/plugins/unityshell/src/PlacesSimpleTile.cpp
+++ b/plugins/unityshell/src/PlacesSimpleTile.cpp
@@ -238,12 +238,6 @@ PlacesSimpleTile::GetName() const
return "PlacesTile";
}
-std::string
-PlacesSimpleTile::GetChildsName() const
-{
- return "PlacesTileContents";
-}
-
void
PlacesSimpleTile::AddProperties(GVariantBuilder* builder)
{
diff --git a/plugins/unityshell/src/PlacesSimpleTile.h b/plugins/unityshell/src/PlacesSimpleTile.h
index 36ecec887..561cc3b6a 100644
--- a/plugins/unityshell/src/PlacesSimpleTile.h
+++ b/plugins/unityshell/src/PlacesSimpleTile.h
@@ -49,7 +49,6 @@ protected:
nux::Geometry GetHighlightGeometry();
std::string GetName() const;
- std::string GetChildsName() const;
void AddProperties(GVariantBuilder* builder);
virtual bool DndSourceDragBegin();
diff --git a/plugins/unityshell/src/PluginAdapter.cpp b/plugins/unityshell/src/PluginAdapter.cpp
index dbc300053..82e18fd92 100644
--- a/plugins/unityshell/src/PluginAdapter.cpp
+++ b/plugins/unityshell/src/PluginAdapter.cpp
@@ -572,10 +572,11 @@ PluginAdapter::Lower(guint32 xid)
}
void
-PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility)
+PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility, int monitor)
{
CompPoint target_vp = m_Screen->vp();
- CompWindow* top_win = NULL;
+ CompWindow* top_window = NULL;
+ CompWindow* top_window_on_monitor = NULL;
bool any_on_current = false;
bool any_mapped = false;
bool forced_unminimize = false;
@@ -632,7 +633,9 @@ PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility
win->mapNum () == 0))
{
bool is_mapped = win->mapNum () != 0;
- top_win = win;
+ top_window = win;
+ if (monitor >= 0 && win->outputDevice() == monitor)
+ top_window_on_monitor = win;
win->unminimize ();
forced_unminimize = true;
@@ -646,14 +649,18 @@ PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility
if (!forced_unminimize || target_vp == m_Screen->vp())
{
win->raise();
- top_win = win;
+ top_window = win;
+ if (monitor >= 0 && win->outputDevice() == monitor)
+ top_window_on_monitor = win;
}
}
}
}
- if (top_win)
- top_win->activate();
+ if (monitor > 0 && top_window_on_monitor)
+ top_window_on_monitor->activate();
+ else if (top_window)
+ top_window->activate();
}
bool
diff --git a/plugins/unityshell/src/PluginAdapter.h b/plugins/unityshell/src/PluginAdapter.h
index 153fe563c..8071a3a4a 100644
--- a/plugins/unityshell/src/PluginAdapter.h
+++ b/plugins/unityshell/src/PluginAdapter.h
@@ -128,7 +128,7 @@ public:
void SetWindowIconGeometry(Window window, nux::Geometry const& geo);
- void FocusWindowGroup(std::vector<Window> windows, FocusVisibility);
+ void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor = -1);
bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force);
bool IsScreenGrabbed();
diff --git a/plugins/unityshell/src/PointerBarrier.cpp b/plugins/unityshell/src/PointerBarrier.cpp
new file mode 100644
index 000000000..81fae0be9
--- /dev/null
+++ b/plugins/unityshell/src/PointerBarrier.cpp
@@ -0,0 +1,165 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+* Copyright (C) 2011 Canonical Ltd
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 3 as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <X11/extensions/Xfixes.h>
+
+#include "PointerBarrier.h"
+
+namespace unity
+{
+namespace ui
+{
+
+namespace local
+{
+namespace
+{
+ bool is_selected_for = false;
+}
+}
+
+PointerBarrierWrapper::PointerBarrierWrapper()
+{
+ last_event_ = 0;
+ last_y_ = 0;
+ last_x_ = 0;
+ active = false;
+ smoothing = 75;
+ smoothing_count_ = 0;
+ smoothing_accum_ = 0;
+ smoothing_handle_ = 0;
+ max_velocity_multiplier = 1.0f;
+}
+
+void PointerBarrierWrapper::ConstructBarrier()
+{
+ if (active)
+ return;
+
+ Display *dpy = nux::GetGraphicsDisplay()->GetX11Display();
+
+ XFixesQueryExtension(dpy, &event_base_, &error_base_);
+
+ int maj,min;
+ XFixesQueryVersion(dpy, &maj, &min);
+
+ barrier = XFixesCreatePointerBarrierVelocity(dpy,
+ DefaultRootWindow(dpy),
+ x1, y1,
+ x2, y2,
+ 0,
+ threshold,
+ 0,
+ NULL);
+
+ if (!local::is_selected_for)
+ {
+ XFixesSelectBarrierInput(dpy, DefaultRootWindow(dpy), 0xdeadbeef);
+ local::is_selected_for = true;
+ }
+
+ active = true;
+
+ nux::GraphicsDisplay::EventFilterArg event_filter;
+ event_filter.filter = &PointerBarrierWrapper::HandleEventWrapper;
+ event_filter.data = this;
+
+ nux::GetGraphicsDisplay()->AddEventFilter(event_filter);
+}
+
+void PointerBarrierWrapper::DestroyBarrier()
+{
+ if (!active)
+ return;
+
+ active = false;
+
+ Display *dpy = nux::GetGraphicsDisplay()->GetX11Display();
+ XFixesDestroyPointerBarrier(dpy, barrier);
+
+ nux::GetGraphicsDisplay()->RemoveEventFilter(this);
+}
+
+void PointerBarrierWrapper::ReleaseBarrier(int event_id)
+{
+ XFixesBarrierReleasePointer (nux::GetGraphicsDisplay()->GetX11Display(), barrier, event_id);
+}
+
+void PointerBarrierWrapper::EmitCurrentData()
+{
+ if (smoothing_count_ <= 0)
+ return;
+
+ BarrierEvent::Ptr event (new BarrierEvent());
+ event->x = last_x_;
+ event->y = last_y_;
+ event->velocity = std::min<int> (600 * max_velocity_multiplier, smoothing_accum_ / smoothing_count_);
+ event->event_id = last_event_;
+
+ barrier_event.emit(this, event);
+
+ smoothing_accum_ = 0;
+ smoothing_count_ = 0;
+}
+
+bool PointerBarrierWrapper::HandleEvent(XEvent xevent)
+{
+ if(xevent.type - event_base_ == XFixesBarrierNotify)
+ {
+ XFixesBarrierNotifyEvent *notify_event = (XFixesBarrierNotifyEvent *)&xevent;
+
+ if (notify_event->barrier == barrier && notify_event->subtype == XFixesBarrierHitNotify)
+ {
+ last_x_ = notify_event->x;
+ last_y_ = notify_event->y;
+ last_event_ = notify_event->event_id;
+ smoothing_accum_ += notify_event->velocity;
+ smoothing_count_++;
+
+ if (!smoothing_handle_)
+ {
+ auto smoothing_cb = [](gpointer user_data) -> gboolean
+ {
+ PointerBarrierWrapper* self = (PointerBarrierWrapper*)user_data;
+ self->EmitCurrentData();
+
+ self->smoothing_handle_ = 0;
+ return FALSE;
+ };
+
+ smoothing_handle_ = g_timeout_add(smoothing(), smoothing_cb, this);
+ }
+
+ }
+
+ return notify_event->barrier == barrier;
+ }
+
+ return false;
+}
+
+bool PointerBarrierWrapper::HandleEventWrapper(XEvent event, void* data)
+{
+ PointerBarrierWrapper* wrapper = (PointerBarrierWrapper*)data;
+ return wrapper->HandleEvent(event);
+}
+
+}
+}
diff --git a/plugins/unityshell/src/PointerBarrier.h b/plugins/unityshell/src/PointerBarrier.h
new file mode 100644
index 000000000..10af894ec
--- /dev/null
+++ b/plugins/unityshell/src/PointerBarrier.h
@@ -0,0 +1,91 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2010 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ */
+
+#ifndef UNITY_POINTERWRAPPER_H
+#define UNITY_POINTERWRAPPER_H
+
+#include <Nux/Nux.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/Xfixes.h>
+#include <sigc++/sigc++.h>
+
+namespace unity
+{
+namespace ui
+{
+
+class BarrierEvent
+{
+public:
+ typedef std::shared_ptr<BarrierEvent> Ptr;
+
+ int x;
+ int y;
+ int velocity;
+ int event_id;
+};
+
+class PointerBarrierWrapper
+{
+public:
+ typedef std::shared_ptr<PointerBarrierWrapper> Ptr;
+
+ nux::Property<int> x1;
+ nux::Property<int> x2;
+ nux::Property<int> y1;
+ nux::Property<int> y2;
+
+ nux::Property<int> threshold;
+
+ nux::Property<bool> active;
+
+ nux::Property<int> smoothing;
+
+ nux::Property<float> max_velocity_multiplier;
+
+ PointerBarrierWrapper();
+
+ void ConstructBarrier();
+ void DestroyBarrier();
+ void ReleaseBarrier(int event_id);
+
+ sigc::signal<void, PointerBarrierWrapper*, BarrierEvent::Ptr> barrier_event;
+
+private:
+ void EmitCurrentData();
+ bool HandleEvent (XEvent event);
+ static bool HandleEventWrapper(XEvent event, void* data);
+
+ int last_event_;
+ int last_x_;
+ int last_y_;
+
+ int event_base_;
+ int error_base_;
+ PointerBarrier barrier;
+
+ int smoothing_count_;
+ int smoothing_accum_;
+ guint smoothing_handle_;
+};
+
+}
+}
+
+#endif \ No newline at end of file
diff --git a/plugins/unityshell/src/ShortcutController.cpp b/plugins/unityshell/src/ShortcutController.cpp
index 56b9e54b4..0a1dbd6d8 100644
--- a/plugins/unityshell/src/ShortcutController.cpp
+++ b/plugins/unityshell/src/ShortcutController.cpp
@@ -51,7 +51,7 @@ Controller::Controller(std::list<AbstractHint*>& hints)
enabled_ = true;
});
- ubus_manager_.RegisterInterest(UBUS_PLACE_VIEW_SHOWN, [&] (GVariant*) {
+ ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, [&] (GVariant*) {
Hide();
});
@@ -60,7 +60,6 @@ Controller::Controller(std::list<AbstractHint*>& hints)
model_.reset(new Model(hints));
model_->Fill();
- ConstructView();
fade_in_animator_.animation_updated.connect(sigc::mem_fun(this, &Controller::OnFadeInUpdated));
fade_in_animator_.animation_ended.connect(sigc::mem_fun(this, &Controller::OnFadeInEnded));
@@ -115,10 +114,12 @@ void Controller::Show()
g_source_remove (show_timer_);
if (enabled_)
+ {
show_timer_ = g_timeout_add(SUPER_TAP_DURATION, &Controller::OnShowTimer, this);
+ model_->Fill();
+ visible_ = true;
+ }
- model_->Fill();
- visible_ = true;
}
gboolean Controller::OnShowTimer(gpointer data)
@@ -130,10 +131,14 @@ gboolean Controller::OnShowTimer(gpointer data)
return FALSE;
}
+ if (!self->view_window_)
+ self->ConstructView();
+
self->ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
if (self->visible_)
{
+ self->view_window_->SetGeometry(self->workarea_);
self->view_->SetupBackground(true);
self->fade_out_animator_.Stop();
self->fade_in_animator_.Start(self->view_window_->GetOpacity());
@@ -171,7 +176,6 @@ void Controller::ConstructView()
void Controller::SetWorkspace(nux::Geometry const& geo)
{
workarea_ = geo;
- view_window_->SetGeometry(workarea_);
}
void Controller::Hide()
diff --git a/plugins/unityshell/src/ShortcutView.cpp b/plugins/unityshell/src/ShortcutView.cpp
index de2e39fb9..ef75e824d 100644
--- a/plugins/unityshell/src/ShortcutView.cpp
+++ b/plugins/unityshell/src/ShortcutView.cpp
@@ -42,19 +42,14 @@ namespace
NUX_IMPLEMENT_OBJECT_TYPE(View);
-View::View(NUX_FILE_LINE_DECL)
- : nux::View(NUX_FILE_LINE_PARAM)
+View::View()
+ : ui::UnityWindowView()
{
layout_ = new nux::VLayout();
layout_->SetPadding(50, 38);
layout_->SetSpaceBetweenChildren(20);
SetLayout(layout_);
- background_top_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_top.png", -1, true);
- background_left_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_left.png", -1, true);
- background_corner_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_corner.png", -1, true);
- rounding_texture_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_round_rect.png", -1, true);
-
std::string header = "<b>";
header += _("Keyboard Shortcuts");
header += "</b>";
@@ -77,23 +72,10 @@ View::View(NUX_FILE_LINE_DECL)
// Column 2...
columns_.push_back(new nux::VLayout());
columns_layout_->AddLayout(columns_[1], 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
-
- bg_effect_helper_.owner = this;
}
View::~View()
{
- if (background_top_ != NULL)
- background_top_->UnReference();
-
- if (background_left_ != NULL)
- background_left_->UnReference();
-
- if (background_corner_ != NULL)
- background_corner_->UnReference();
-
- if (rounding_texture_ != NULL)
- rounding_texture_->UnReference();
}
void View::SetModel(Model::Ptr model)
@@ -109,11 +91,6 @@ Model::Ptr View::GetModel()
return model_;
}
-void View::SetupBackground(bool enabled)
-{
- bg_effect_helper_.enabled = enabled;
-}
-
nux::LinearLayout* View::CreateSectionLayout(const char* section_name)
{
nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
@@ -197,19 +174,9 @@ nux::LinearLayout* View::CreateIntermediateLayout()
return layout;
}
-void View::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
+nux::Geometry View::GetBackgroundGeometry()
{
- return;
-}
-
-void View::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
-{
nux::Geometry base = GetGeometry();
- GfxContext.PushClippingRectangle(base);
-
- // clear region
- gPainter.PaintBackground(GfxContext, base);
-
nux::Geometry background_geo;
background_geo.width = base.width;
@@ -217,165 +184,12 @@ void View::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
background_geo.x = (base.width - background_geo.width)/2;
background_geo.y = (base.height - background_geo.height)/2;
- // magic constant comes from texture contents (distance to cleared area)
- const int internal_offset = 20;
- nux::Geometry internal_clip(background_geo.x + internal_offset,
- background_geo.y + internal_offset,
- background_geo.width - internal_offset * 2,
- background_geo.height - internal_offset * 2);
- GfxContext.PushClippingRectangle(internal_clip);
-
- nux::Geometry geo_absolute = GetAbsoluteGeometry();
- if (BackgroundEffectHelper::blur_type != BLUR_NONE)
- {
- nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);
- auto blur_texture = bg_effect_helper_.GetBlurRegion(blur_geo);
-
- if (blur_texture.IsValid())
- {
- nux::TexCoordXForm texxform_blur_bg;
- texxform_blur_bg.flip_v_coord = true;
- texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
- texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width;
- texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height;
-
- nux::ROPConfig rop;
- rop.Blend = false;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
-
- gPainter.PushDrawTextureLayer(GfxContext, base,
- blur_texture,
- texxform_blur_bg,
- nux::color::White,
- true,
- rop);
- }
- }
-
- nux::ROPConfig rop;
- rop.Blend = true;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- gPainter.PushDrawColorLayer(GfxContext, internal_clip, background_color, false, rop);
-
- // Make round corners
- rop.Blend = true;
- rop.SrcBlend = GL_ZERO;
- rop.DstBlend = GL_SRC_ALPHA;
- gPainter.PaintShapeCornerROP(GfxContext,
- internal_clip,
- nux::color::White,
- nux::eSHAPE_CORNER_ROUND4,
- nux::eCornerTopLeft | nux::eCornerTopRight |
- nux::eCornerBottomLeft | nux::eCornerBottomRight,
- true,
- rop);
-
- GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
-
- GfxContext.PopClippingRectangle();
- GfxContext.PopClippingRectangle();
-
- DrawBackground(GfxContext, background_geo);
-
-
- layout_->ProcessDraw(GfxContext, force_draw);
+ return background_geo;
}
-
-void View::DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo)
-{
- int border = 30;
-
- GfxContext.GetRenderStates().SetBlend(TRUE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-
- nux::TexCoordXForm texxform;
- texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
- texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
-
- // Draw TOP-LEFT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- GfxContext.QRP_1Tex(geo.x, geo.y,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw TOP-RIGHT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- texxform.flip_u_coord = true;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex(geo.x + geo.width - border, geo.y,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw BOTTOM-LEFT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = true;
- GfxContext.QRP_1Tex(geo.x, geo.y + geo.height - border,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw BOTTOM-RIGHT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- texxform.flip_u_coord = true;
- texxform.flip_v_coord = true;
- GfxContext.QRP_1Tex(geo.x + geo.width - border, geo.y + geo.height - border,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- int top_width = background_top_->GetWidth();
- int top_height = background_top_->GetHeight();
-
- // Draw TOP BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = top_width;
- texxform.v1 = top_height;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex(geo.x + border, geo.y, geo.width - border - border, border, background_top_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw BOTTOM BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = top_width;
- texxform.v1 = top_height;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = true;
- GfxContext.QRP_1Tex(geo.x + border, geo.y + geo.height - border, geo.width - border - border, border, background_top_->GetDeviceTexture(), texxform, nux::color::White);
-
-
- int left_width = background_left_->GetWidth();
- int left_height = background_left_->GetHeight();
-
- // Draw LEFT BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = left_width;
- texxform.v1 = left_height;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex(geo.x, geo.y + border, border, geo.height - border - border, background_left_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw RIGHT BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = left_width;
- texxform.v1 = left_height;
- texxform.flip_u_coord = true;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex(geo.x + geo.width - border, geo.y + border, border, geo.height - border - border, background_left_->GetDeviceTexture(), texxform, nux::color::White);
-
- GfxContext.GetRenderStates().SetBlend(FALSE);
+void View::DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip)
+{
+ layout_->ProcessDraw(GfxContext, force_draw);
}
void View::RenderColumns()
diff --git a/plugins/unityshell/src/ShortcutView.h b/plugins/unityshell/src/ShortcutView.h
index 2f58c4f7e..259a1f0f1 100644
--- a/plugins/unityshell/src/ShortcutView.h
+++ b/plugins/unityshell/src/ShortcutView.h
@@ -28,6 +28,7 @@
#include <Nux/View.h>
#include <Nux/VLayout.h>
+#include "UnityWindowView.h"
#include "BackgroundEffectHelper.h"
#include "ShortcutModel.h"
@@ -36,29 +37,24 @@ namespace unity
namespace shortcut
{
-class View : public nux::View
+class View : public ui::UnityWindowView
{
- NUX_DECLARE_OBJECT_TYPE(View, nux::View);
+ NUX_DECLARE_OBJECT_TYPE(View, ui::UnityWindowView);
public:
typedef nux::ObjectPtr<View> Ptr;
// Ctor and dtor
- View(NUX_FILE_LINE_PROTO);
+ View();
~View();
// Public methods
void SetModel(Model::Ptr model);
Model::Ptr GetModel();
-
- void SetupBackground(bool enabled);
-
- // Properties
- nux::Property<nux::Color> background_color;
protected:
// Protected methods
- void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
- void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
+ void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip);
+ nux::Geometry GetBackgroundGeometry();
private:
// Private methods
@@ -66,23 +62,14 @@ private:
nux::LinearLayout* CreateShortKeyEntryLayout(AbstractHint* hint);
nux::LinearLayout* CreateIntermediateLayout();
- void DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo);
void RenderColumns();
// Private members
Model::Ptr model_;
- nux::BaseTexture* background_top_;
- nux::BaseTexture* background_left_;
- nux::BaseTexture* background_corner_;
- nux::BaseTexture* rounding_texture_;
-
nux::VLayout* layout_;
nux::HLayout* columns_layout_;
std::vector<nux::VLayout*> columns_;
-
- BackgroundEffectHelper bg_effect_helper_;
-
};
} // namespace shortcut
diff --git a/plugins/unityshell/src/SimpleLauncherIcon.cpp b/plugins/unityshell/src/SimpleLauncherIcon.cpp
index 3731a6c40..6d04ee58e 100644
--- a/plugins/unityshell/src/SimpleLauncherIcon.cpp
+++ b/plugins/unityshell/src/SimpleLauncherIcon.cpp
@@ -17,12 +17,14 @@
* Authored by: Jason Smith <jason.smith@canonical.com>
*/
+#ifndef UNITY_SIMPLELAUNCHERICON_H
+#define UNITY_SIMPLELAUNCHERICON_H
+
#include <NuxCore/Logger.h>
#include <Nux/Nux.h>
#include <Nux/BaseWindow.h>
#include "SimpleLauncherIcon.h"
-#include "Launcher.h"
#include "PluginAdapter.h"
#include "ubus-server.h"
@@ -38,8 +40,8 @@ namespace
nux::logging::Logger logger("unity.dash.CategoryViewGrid");
}
-SimpleLauncherIcon::SimpleLauncherIcon(Launcher* IconManager)
- : LauncherIcon(IconManager)
+SimpleLauncherIcon::SimpleLauncherIcon()
+ : LauncherIcon()
, icon_name("", sigc::mem_fun(this, &SimpleLauncherIcon::SetIconName))
, theme_changed_id_(0)
{
@@ -65,23 +67,23 @@ SimpleLauncherIcon::~SimpleLauncherIcon()
g_signal_handler_disconnect(gtk_icon_theme_get_default(), theme_changed_id_);
}
-void SimpleLauncherIcon::OnMouseDown(int button)
+void SimpleLauncherIcon::OnMouseDown(int button, int monitor)
{
}
-void SimpleLauncherIcon::OnMouseUp(int button)
+void SimpleLauncherIcon::OnMouseUp(int button, int monitor)
{
}
-void SimpleLauncherIcon::OnMouseClick(int button)
+void SimpleLauncherIcon::OnMouseClick(int button, int monitor)
{
}
-void SimpleLauncherIcon::OnMouseEnter()
+void SimpleLauncherIcon::OnMouseEnter(int monitor)
{
}
-void SimpleLauncherIcon::OnMouseLeave()
+void SimpleLauncherIcon::OnMouseLeave(int monitor)
{
}
@@ -142,3 +144,5 @@ void SimpleLauncherIcon::OnIconThemeChanged(GtkIconTheme* icon_theme, gpointer d
} // namespace launcher
} // namespace unity
+
+#endif \ No newline at end of file
diff --git a/plugins/unityshell/src/SimpleLauncherIcon.h b/plugins/unityshell/src/SimpleLauncherIcon.h
index af3af5264..15479ec4c 100644
--- a/plugins/unityshell/src/SimpleLauncherIcon.h
+++ b/plugins/unityshell/src/SimpleLauncherIcon.h
@@ -32,7 +32,7 @@ class Launcher;
class SimpleLauncherIcon : public LauncherIcon
{
public:
- SimpleLauncherIcon(Launcher* IconManager);
+ SimpleLauncherIcon();
virtual ~SimpleLauncherIcon();
// override
@@ -45,11 +45,11 @@ public:
sigc::signal<void> activate;
protected:
- virtual void OnMouseDown(int button);
- virtual void OnMouseUp(int button);
- virtual void OnMouseClick(int button);
- virtual void OnMouseEnter();
- virtual void OnMouseLeave();
+ virtual void OnMouseDown(int button, int monitor);
+ virtual void OnMouseUp(int button, int monitor);
+ virtual void OnMouseClick(int button, int monitor);
+ virtual void OnMouseEnter(int monitor);
+ virtual void OnMouseLeave(int monitor);
virtual void ActivateLauncherIcon(ActionArg arg);
private:
diff --git a/plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp b/plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp
index 90e4a9f82..babbce605 100644
--- a/plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp
+++ b/plugins/unityshell/src/SoftwareCenterLauncherIcon.cpp
@@ -15,28 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Bilal Akhtar <bilalakhtar@ubuntu.com>
+ * Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
*/
-#include "Nux/Nux.h"
-#include "Nux/BaseWindow.h"
-
-#include "BamfLauncherIcon.h"
-#include "Launcher.h"
-#include "LauncherController.h"
-#include "PluginAdapter.h"
-#include "FavoriteStore.h"
-
-#include "ubus-server.h"
-#include "UBusMessages.h"
-
-#include <glib.h>
-#include <glib/gvariant.h>
#include <glib/gi18n-lib.h>
-#include <gio/gio.h>
-#include <libindicator/indicator-desktop-shortcuts.h>
-#include <core/core.h>
-#include <core/atoms.h>
-
#include "SoftwareCenterLauncherIcon.h"
namespace unity
@@ -44,58 +26,48 @@ namespace unity
namespace launcher
{
-SoftwareCenterLauncherIcon::SoftwareCenterLauncherIcon(Launcher* IconManager, BamfApplication* app, char* aptdaemon_trans_id, char* icon_path)
-: BamfLauncherIcon(IconManager, app)
+SoftwareCenterLauncherIcon::SoftwareCenterLauncherIcon(BamfApplication* app,
+ std::string const& aptdaemon_trans_id,
+ std::string const& icon_path)
+: BamfLauncherIcon(app),
+ _aptdaemon_trans("org.debian.apt",
+ aptdaemon_trans_id,
+ "org.debian.apt.transaction",
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START)
{
- _aptdaemon_trans_id = aptdaemon_trans_id;
-
- g_debug("Aptdaemon transaction ID: %s", _aptdaemon_trans_id);
-
- _aptdaemon_trans = new unity::glib::DBusProxy("org.debian.apt",
- _aptdaemon_trans_id,
- "org.debian.apt.transaction",
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START);
-
- _aptdaemon_trans->Connect("Finished", sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnFinished));
- _aptdaemon_trans->Connect("PropertyChanged", sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnPropertyChanged));
-
- icon_name = icon_path;
-}
-
-SoftwareCenterLauncherIcon::~SoftwareCenterLauncherIcon() {
-
+ _aptdaemon_trans.Connect("PropertyChanged", sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnPropertyChanged));
+ _aptdaemon_trans.Connect("Finished", [&] (GVariant *) {
+ tooltip_text = BamfName();
+ SetQuirk(QUIRK_PROGRESS, false);
+ SetProgress(0.0f);
+ });
+
+ icon_name = icon_path.c_str();
+ tooltip_text = _("Waiting to install");
}
void
-SoftwareCenterLauncherIcon::OnFinished(GVariant* params) {
-
- tooltip_text = BamfName();
-
- SetQuirk(LauncherIcon::QUIRK_PROGRESS, FALSE);
-}
+SoftwareCenterLauncherIcon::OnPropertyChanged(GVariant* params)
+{
+ gint32 progress;
+ glib::String property_name;
+ GVariant* property_value;
-void
-SoftwareCenterLauncherIcon::OnPropertyChanged(GVariant* params) {
+ g_variant_get_child(params, 0, "s", property_name.AsOutParam());
- gint32 progress;
- gchar* property_name;
- GVariant* property_value;
+ if (property_name.Str() == "Progress")
+ {
+ g_variant_get_child(params, 1, "v", &property_value);
+ g_variant_get(property_value, "i", &progress);
- g_variant_get_child (params, 0, "s", &property_name);
- if (g_strcmp0 (property_name, "Progress") == 0) {
- g_variant_get_child (params,1,"v",&property_value);
- g_variant_get (property_value, "i", &progress);
+ if (progress < 100)
+ SetQuirk(QUIRK_PROGRESS, true);
- if (progress < 100) {
- SetQuirk(LauncherIcon::QUIRK_PROGRESS, TRUE);
- tooltip_text = _("Waiting to install");
- }
- SetProgress(((float)progress) / ((float)100));
- }
- g_variant_unref(property_value);
- g_free(property_name);
+ SetProgress(progress/100.0f);
+ }
+ g_variant_unref(property_value);
}
}
diff --git a/plugins/unityshell/src/SoftwareCenterLauncherIcon.h b/plugins/unityshell/src/SoftwareCenterLauncherIcon.h
index c6f441c11..258c3e947 100644
--- a/plugins/unityshell/src/SoftwareCenterLauncherIcon.h
+++ b/plugins/unityshell/src/SoftwareCenterLauncherIcon.h
@@ -1,6 +1,6 @@
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
/*
- * Copyright (C) 2010 Canonical Ltd
+ * Copyright (C) 2012 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -15,46 +15,34 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Bilal Akhtar <bilalakhtar@ubuntu.com>
+ * Marco Trevisan (Treviño) <3v1n0@ubuntu.com>
*/
-#ifndef SOFTWARECENTERLAUNCHERICON_H
-#define SOFTWARECENTERLAUNCHERICON_H
+#ifndef SOFTWARE_CENTER_LAUNCHERICON_H
+#define SOFTWARE_CENTER_LAUNCHERICON_H
#include "BamfLauncherIcon.h"
-#include <Nux/BaseWindow.h>
-#include <NuxCore/Math/MathInc.h>
-#include <core/core.h>
-#include <gio/gio.h>
-#include <glib.h>
-#include <glib/gvariant.h>
#include <UnityCore/GLibDBusProxy.h>
-
namespace unity
{
namespace launcher
{
-
class SoftwareCenterLauncherIcon : public BamfLauncherIcon
{
public:
-
- SoftwareCenterLauncherIcon(Launcher* IconManager, BamfApplication* app, char* aptdaemon_trans_id, char* icon_path);
- virtual ~SoftwareCenterLauncherIcon();
-
- gchar* original_tooltip_text;
+ SoftwareCenterLauncherIcon(BamfApplication* app,
+ std::string const& aptdaemon_trans_id,
+ std::string const& icon_path);
private:
- char* _aptdaemon_trans_id;
- unity::glib::DBusProxy* _aptdaemon_trans;
-
- void OnFinished(GVariant* params);
+ void OnPropertyChanged(GVariant* params);
- void OnPropertyChanged(GVariant* params);
+ glib::DBusProxy _aptdaemon_trans;
};
}
}
-#endif
+#endif //SOFTWARE_CENTER_LAUNCHERICON_H
diff --git a/plugins/unityshell/src/SpacerLauncherIcon.cpp b/plugins/unityshell/src/SpacerLauncherIcon.cpp
index 98dbcca36..74d420ba2 100644
--- a/plugins/unityshell/src/SpacerLauncherIcon.cpp
+++ b/plugins/unityshell/src/SpacerLauncherIcon.cpp
@@ -27,8 +27,8 @@ namespace unity
namespace launcher
{
-SpacerLauncherIcon::SpacerLauncherIcon(Launcher* IconManager)
- : SimpleLauncherIcon(IconManager)
+SpacerLauncherIcon::SpacerLauncherIcon()
+ : SimpleLauncherIcon()
{
SetQuirk(QUIRK_VISIBLE, true);
SetQuirk(QUIRK_RUNNING, false);
diff --git a/plugins/unityshell/src/SpacerLauncherIcon.h b/plugins/unityshell/src/SpacerLauncherIcon.h
index 41d76ce2f..a326357aa 100644
--- a/plugins/unityshell/src/SpacerLauncherIcon.h
+++ b/plugins/unityshell/src/SpacerLauncherIcon.h
@@ -30,7 +30,7 @@ namespace launcher
class SpacerLauncherIcon : public SimpleLauncherIcon
{
public:
- SpacerLauncherIcon(Launcher* launcher);
+ SpacerLauncherIcon();
bool IsSpacer()
{
diff --git a/plugins/unityshell/src/SwitcherController.cpp b/plugins/unityshell/src/SwitcherController.cpp
index bc3df3307..0a4e5a46e 100644
--- a/plugins/unityshell/src/SwitcherController.cpp
+++ b/plugins/unityshell/src/SwitcherController.cpp
@@ -45,6 +45,7 @@ Controller::Controller()
timeout_length = 150;
detail_on_timeout = true;
detail_timeout_length = 1500;
+ monitor_ = 0;
bg_color_ = nux::Color(0.0, 0.0, 0.0, 0.5);
@@ -72,11 +73,6 @@ void Controller::OnBackgroundUpdate(GVariant* data, Controller* self)
self->view_->background_color = self->bg_color_;
}
-bool IsOnOtherViewport (AbstractLauncherIcon* icon)
-{
- return !icon->HasWindowOnViewport();
-}
-
void Controller::Show(ShowMode show, SortMode sort, bool reverse,
std::vector<AbstractLauncherIcon*> results)
{
@@ -85,11 +81,6 @@ void Controller::Show(ShowMode show, SortMode sort, bool reverse,
std::sort(results.begin(), results.end(), CompareSwitcherItemsPriority);
}
- if (show == ShowMode::CURRENT_VIEWPORT)
- {
- results.erase(std::remove_if(results.begin(), results.end(), IsOnOtherViewport), results.end());
- }
-
model_.reset(new SwitcherModel(results));
AddChild(model_.get());
model_->selection_changed.connect(sigc::mem_fun(this, &Controller::OnModelSelectionChanged));
@@ -177,6 +168,7 @@ void Controller::ConstructView()
AddChild(view_.GetPointer());
view_->SetModel(model_);
view_->background_color = bg_color_;
+ view_->monitor = monitor_;
if (!view_window_)
{
@@ -197,9 +189,13 @@ void Controller::ConstructView()
view_window_->ShowWindow(true);
}
-void Controller::SetWorkspace(nux::Geometry geo)
+void Controller::SetWorkspace(nux::Geometry geo, int monitor)
{
+ monitor_ = monitor;
workarea_ = geo;
+
+ if (view_)
+ view_->monitor = monitor_;
}
void Controller::Hide(bool accept_state)
@@ -269,7 +265,7 @@ void Controller::Next()
switch (detail_mode_)
{
case TAB_NEXT_WINDOW:
- if (model_->detail_selection_index < model_->Selection()->RelatedXids ().size () - 1)
+ if (model_->detail_selection_index < model_->Selection()->Windows().size () - 1)
model_->NextDetail();
else
model_->Next();
@@ -324,7 +320,7 @@ SwitcherView* Controller::GetView()
void Controller::SetDetail(bool value, unsigned int min_windows)
{
- if (value && model_->Selection()->RelatedXids().size () >= min_windows)
+ if (value && model_->Selection()->Windows().size () >= min_windows)
{
model_->detail_selection = true;
detail_mode_ = TAB_NEXT_WINDOW_LOOP;
@@ -409,7 +405,7 @@ void Controller::SelectFirstItem()
unsigned int first_second = 0; // first icons second highest active
unsigned int second_first = 0; // second icons first highest active
- for (guint32 xid : first->RelatedXids())
+ for (guint32 xid : first->Windows())
{
unsigned int num = WindowManager::Default()->GetWindowActiveNumber(xid);
@@ -424,7 +420,7 @@ void Controller::SelectFirstItem()
}
}
- for (guint32 xid : second->RelatedXids())
+ for (guint32 xid : second->Windows())
{
second_first = MAX (WindowManager::Default()->GetWindowActiveNumber(xid), second_first);
}
diff --git a/plugins/unityshell/src/SwitcherController.h b/plugins/unityshell/src/SwitcherController.h
index 81cd29dbf..1c1afe134 100644
--- a/plugins/unityshell/src/SwitcherController.h
+++ b/plugins/unityshell/src/SwitcherController.h
@@ -87,7 +87,7 @@ public:
void SelectFirstItem();
- void SetWorkspace(nux::Geometry geo);
+ void SetWorkspace(nux::Geometry geo, int monitor);
SwitcherView * GetView ();
@@ -120,6 +120,7 @@ private:
nux::BaseWindow* view_window_;
nux::HLayout* main_layout_;
+ int monitor_;
bool visible_;
guint show_timer_;
guint detail_timer_;
diff --git a/plugins/unityshell/src/SwitcherModel.cpp b/plugins/unityshell/src/SwitcherModel.cpp
index f475b30d1..9141ea509 100644
--- a/plugins/unityshell/src/SwitcherModel.cpp
+++ b/plugins/unityshell/src/SwitcherModel.cpp
@@ -152,7 +152,7 @@ std::vector<Window>
SwitcherModel::DetailXids()
{
std::vector<Window> results;
- results = Selection()->RelatedXids ();
+ results = Selection()->Windows();
if (only_detail_on_viewport)
{
diff --git a/plugins/unityshell/src/SwitcherView.cpp b/plugins/unityshell/src/SwitcherView.cpp
index eb73b7102..a75ee16bb 100644
--- a/plugins/unityshell/src/SwitcherView.cpp
+++ b/plugins/unityshell/src/SwitcherView.cpp
@@ -40,8 +40,8 @@ namespace switcher
NUX_IMPLEMENT_OBJECT_TYPE(SwitcherView);
-SwitcherView::SwitcherView(NUX_FILE_LINE_DECL)
- : View(NUX_FILE_LINE_PARAM)
+SwitcherView::SwitcherView()
+ : UnityWindowView()
, target_sizes_set_(false)
, redraw_handle_(0)
{
@@ -57,6 +57,7 @@ SwitcherView::SwitcherView(NUX_FILE_LINE_DECL)
vertical_size = tile_size + 80;
text_size = 15;
animation_length = 250;
+ monitor = -1;
spread_size = 3.5f;
render_boxes = false;
@@ -67,9 +68,6 @@ SwitcherView::SwitcherView(NUX_FILE_LINE_DECL)
render_targets_.clear ();
- background_top_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_top.png", -1, true);
- background_left_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_left.png", -1, true);
- background_corner_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_corner.png", -1, true);
rounding_texture_ = nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_round_rect.png", -1, true);
text_view_ = new nux::StaticCairoText("Testing");
@@ -81,15 +79,10 @@ SwitcherView::SwitcherView(NUX_FILE_LINE_DECL)
icon_size.changed.connect (sigc::mem_fun (this, &SwitcherView::OnIconSizeChanged));
tile_size.changed.connect (sigc::mem_fun (this, &SwitcherView::OnTileSizeChanged));
-
- bg_effect_helper_.owner = this;
}
SwitcherView::~SwitcherView()
{
- background_top_->UnReference();
- background_left_->UnReference();
- background_corner_->UnReference();
rounding_texture_->UnReference();
text_view_->UnReference();
if (redraw_handle_ > 0)
@@ -116,11 +109,7 @@ void SwitcherView::AddProperties(GVariantBuilder* builder)
.add("spread-size", (float)spread_size);
}
-void
-SwitcherView::SetupBackground()
-{
- bg_effect_helper_.enabled = true;
-}
+
LayoutWindowList SwitcherView::ExternalTargets ()
{
@@ -196,11 +185,6 @@ SwitcherModel::Ptr SwitcherView::GetModel()
return model_;
}
-void SwitcherView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
-{
- return;
-}
-
RenderArg SwitcherView::CreateBaseArgForIcon(AbstractLauncherIcon* icon)
{
RenderArg arg;
@@ -210,7 +194,7 @@ RenderArg SwitcherView::CreateBaseArgForIcon(AbstractLauncherIcon* icon)
// tells the renderer to render arrows by number
arg.running_on_viewport = true;
- arg.window_indicators = icon->RelatedWindows();
+ arg.window_indicators = icon->WindowsForMonitor(monitor).size();
if (arg.window_indicators > 1)
arg.running_arrow = true;
else
@@ -555,104 +539,9 @@ gboolean SwitcherView::OnDrawTimeout(gpointer data)
return FALSE;
}
-void SwitcherView::DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo)
-{
- int border = 30;
-
- GfxContext.GetRenderStates().SetBlend (TRUE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-
- nux::TexCoordXForm texxform;
- texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_COORD);
- texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
-
- // Draw TOP-LEFT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- GfxContext.QRP_1Tex (geo.x, geo.y,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw TOP-RIGHT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- texxform.flip_u_coord = true;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw BOTTOM-LEFT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = true;
- GfxContext.QRP_1Tex (geo.x, geo.y + geo.height - border,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw BOTTOM-RIGHT CORNER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = border;
- texxform.v1 = border;
- texxform.flip_u_coord = true;
- texxform.flip_v_coord = true;
- GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + geo.height - border,
- border, border, background_corner_->GetDeviceTexture(), texxform, nux::color::White);
-
- int top_width = background_top_->GetWidth();
- int top_height = background_top_->GetHeight();
-
- // Draw TOP BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = top_width;
- texxform.v1 = top_height;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex (geo.x + border, geo.y, geo.width - border - border, border, background_top_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw BOTTOM BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = top_width;
- texxform.v1 = top_height;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = true;
- GfxContext.QRP_1Tex (geo.x + border, geo.y + geo.height - border, geo.width - border - border, border, background_top_->GetDeviceTexture(), texxform, nux::color::White);
-
-
- int left_width = background_left_->GetWidth();
- int left_height = background_left_->GetHeight();
-
- // Draw LEFT BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = left_width;
- texxform.v1 = left_height;
- texxform.flip_u_coord = false;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex (geo.x, geo.y + border, border, geo.height - border - border, background_left_->GetDeviceTexture(), texxform, nux::color::White);
-
- // Draw RIGHT BORDER
- texxform.u0 = 0;
- texxform.v0 = 0;
- texxform.u1 = left_width;
- texxform.v1 = left_height;
- texxform.flip_u_coord = true;
- texxform.flip_v_coord = false;
- GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + border, border, geo.height - border - border, background_left_->GetDeviceTexture(), texxform, nux::color::White);
-
- GfxContext.GetRenderStates().SetBlend (FALSE);
-}
-
-void SwitcherView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
+void SwitcherView::PreDraw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
- timespec current;
- clock_gettime(CLOCK_MONOTONIC, &current);
+ clock_gettime(CLOCK_MONOTONIC, &current_);
if (!target_sizes_set_)
{
@@ -660,74 +549,21 @@ void SwitcherView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
target_sizes_set_ = true;
}
- nux::Geometry base = GetGeometry();
- GfxContext.PushClippingRectangle(base);
-
- // clear region
- gPainter.PaintBackground(GfxContext, base);
-
nux::Geometry background_geo;
-
- last_args_ = RenderArgsFlat(background_geo, model_->SelectionIndex(), current);
+ last_args_ = RenderArgsFlat(background_geo, model_->SelectionIndex(), current_);
last_background_ = background_geo;
- // magic constant comes from texture contents (distance to cleared area)
- const int internal_offset = 20;
- nux::Geometry internal_clip(background_geo.x + internal_offset,
- background_geo.y + internal_offset,
- background_geo.width - internal_offset * 2,
- background_geo.height - internal_offset * 2);
- GfxContext.PushClippingRectangle(internal_clip);
-
-
- nux::Geometry geo_absolute = GetAbsoluteGeometry ();
- if (BackgroundEffectHelper::blur_type != BLUR_NONE)
- {
- nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);
- auto blur_texture = bg_effect_helper_.GetBlurRegion(blur_geo);
+ icon_renderer_->PreprocessIcons(last_args_, GetGeometry());
+}
- if (blur_texture.IsValid())
- {
- nux::TexCoordXForm texxform_blur_bg;
- texxform_blur_bg.flip_v_coord = true;
- texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
- texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width;
- texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height;
-
- nux::ROPConfig rop;
- rop.Blend = false;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
-
- gPainter.PushDrawTextureLayer(GfxContext, base,
- blur_texture,
- texxform_blur_bg,
- nux::color::White,
- true,
- rop);
- }
- }
+nux::Geometry SwitcherView::GetBackgroundGeometry()
+{
+ return last_background_;
+}
- nux::ROPConfig rop;
- rop.Blend = true;
- rop.SrcBlend = GL_ONE;
- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
- gPainter.PushDrawColorLayer (GfxContext, internal_clip, background_color, false, rop);
-
- // Make round corners
- rop.Blend = true;
- rop.SrcBlend = GL_ZERO;
- rop.DstBlend = GL_SRC_ALPHA;
- gPainter.PaintShapeCornerROP(GfxContext,
- internal_clip,
- nux::color::White,
- nux::eSHAPE_CORNER_ROUND4,
- nux::eCornerTopLeft | nux::eCornerTopRight |
- nux::eCornerBottomLeft | nux::eCornerBottomRight,
- true,
- rop);
-
- icon_renderer_->PreprocessIcons(last_args_, base);
+void SwitcherView::DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry internal_clip)
+{
+ nux::Geometry base = GetGeometry();
GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
std::list<RenderArg>::iterator it;
@@ -779,6 +615,7 @@ void SwitcherView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
// render orange box that will encirlce active item(s)
for (LayoutWindow::Ptr window : ExternalTargets())
{
+ nux::Geometry geo_absolute = GetAbsoluteGeometry();
if (window->alpha >= 1.0f)
{
nux::Geometry orange_box = window->result;
@@ -790,15 +627,10 @@ void SwitcherView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
}
}
- GfxContext.PopClippingRectangle();
- GfxContext.PopClippingRectangle();
-
- DrawBackground(GfxContext, background_geo);
-
- text_view_->SetBaseY(background_geo.y + background_geo.height - 45);
+ text_view_->SetBaseY(last_background_.y + last_background_.height - 45);
text_view_->Draw(GfxContext, force_draw);
- int ms_since_change = TimeUtil::TimeDelta(&current, &save_time_);
+ int ms_since_change = TimeUtil::TimeDelta(&current_, &save_time_);
if (ms_since_change < animation_length && redraw_handle_ == 0)
redraw_handle_ = g_idle_add_full (G_PRIORITY_DEFAULT, &SwitcherView::OnDrawTimeout, this, NULL);
diff --git a/plugins/unityshell/src/SwitcherView.h b/plugins/unityshell/src/SwitcherView.h
index 2058aaba8..f0e460fcd 100644
--- a/plugins/unityshell/src/SwitcherView.h
+++ b/plugins/unityshell/src/SwitcherView.h
@@ -25,6 +25,7 @@
#include "StaticCairoText.h"
#include "LayoutSystem.h"
#include "BackgroundEffectHelper.h"
+#include "UnityWindowView.h"
#include "Introspectable.h"
@@ -36,6 +37,8 @@
#include <NuxCore/Property.h>
+
+
namespace unity
{
namespace launcher
@@ -45,13 +48,13 @@ class AbstractLauncherIcon;
namespace switcher
{
-class SwitcherView : public debug::Introspectable, public nux::View
+class SwitcherView : public debug::Introspectable, public ui::UnityWindowView
{
- NUX_DECLARE_OBJECT_TYPE(SwitcherView, nux::View);
+ NUX_DECLARE_OBJECT_TYPE(SwitcherView, ui::UnityWindowView);
public:
typedef nux::ObjectPtr<SwitcherView> Ptr;
- SwitcherView(NUX_FILE_LINE_PROTO);
+ SwitcherView();
virtual ~SwitcherView();
ui::LayoutWindowList ExternalTargets ();
@@ -59,8 +62,6 @@ public:
void SetModel(SwitcherModel::Ptr model);
SwitcherModel::Ptr GetModel();
- void SetupBackground ();
-
nux::Property<bool> render_boxes;
nux::Property<int> border_size;
nux::Property<int> flat_spacing;
@@ -70,16 +71,17 @@ public:
nux::Property<int> vertical_size;
nux::Property<int> text_size;
nux::Property<int> animation_length;
+ nux::Property<int> monitor;
nux::Property<double> spread_size;
- nux::Property<nux::Color> background_color;
protected:
// Introspectable methods
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);
- void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
- void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
+ void PreDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
+ void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip);
+ nux::Geometry GetBackgroundGeometry();
ui::RenderArg InterpolateRenderArgs(ui::RenderArg const& start, ui::RenderArg const& end, float progress);
nux::Geometry InterpolateBackground (nux::Geometry const& start, nux::Geometry const& end, float progress);
@@ -88,8 +90,6 @@ protected:
ui::RenderArg CreateBaseArgForIcon(launcher::AbstractLauncherIcon* icon);
private:
- void DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo);
-
void OnSelectionChanged(launcher::AbstractLauncherIcon* selection);
void OnDetailSelectionChanged (bool detail);
void OnDetailSelectionIndexChanged (unsigned int index);
@@ -121,9 +121,6 @@ private:
guint redraw_handle_;
- nux::BaseTexture* background_top_;
- nux::BaseTexture* background_left_;
- nux::BaseTexture* background_corner_;
nux::BaseTexture* rounding_texture_;
nux::StaticCairoText* text_view_;
@@ -136,11 +133,10 @@ private:
ui::LayoutWindowList render_targets_;
+ timespec current_;
timespec save_time_;
bool animation_draw_;
-
- BackgroundEffectHelper bg_effect_helper_;
};
}
diff --git a/plugins/unityshell/src/TimeUtil.h b/plugins/unityshell/src/TimeUtil.h
index 9f4e4fddc..ab4d109db 100644
--- a/plugins/unityshell/src/TimeUtil.h
+++ b/plugins/unityshell/src/TimeUtil.h
@@ -25,13 +25,44 @@ namespace unity {
class TimeUtil
{
public:
-static int TimeDelta (struct timespec const* x, struct timespec const* y);
+ static int TimeDelta (struct timespec const* x, struct timespec const* y)
+ {
+ return ((x->tv_sec - y->tv_sec) * 1000) + ((x->tv_nsec - y->tv_nsec) / 1000000);
+ }
+
+ static void SetTimeStruct(struct timespec* timer, struct timespec* sister = 0, int sister_relation = 0)
+ {
+ struct timespec current;
+ clock_gettime(CLOCK_MONOTONIC, &current);
+
+ if (sister)
+ {
+ int diff = TimeDelta(&current, sister);
+
+ if (diff < sister_relation)
+ {
+ int remove = sister_relation - diff;
+ SetTimeBack(&current, remove);
+ }
+ }
+
+ timer->tv_sec = current.tv_sec;
+ timer->tv_nsec = current.tv_nsec;
+ }
+
+ static void SetTimeBack(struct timespec* timeref, int remove)
+ {
+ timeref->tv_sec -= remove / 1000;
+ remove = remove % 1000;
+
+ if (remove > timeref->tv_nsec / 1000000)
+ {
+ timeref->tv_sec--;
+ timeref->tv_nsec += 1000000000;
+ }
+ timeref->tv_nsec -= remove * 1000000;
+ }
};
-inline
-int TimeUtil::TimeDelta (struct timespec const* x, struct timespec const* y)
-{
- return ((x->tv_sec - y->tv_sec) * 1000) + ((x->tv_nsec - y->tv_nsec) / 1000000);
-}
}
diff --git a/plugins/unityshell/src/TrashLauncherIcon.cpp b/plugins/unityshell/src/TrashLauncherIcon.cpp
index 2c666d27e..68d6c89fd 100644
--- a/plugins/unityshell/src/TrashLauncherIcon.cpp
+++ b/plugins/unityshell/src/TrashLauncherIcon.cpp
@@ -32,8 +32,8 @@ namespace unity
namespace launcher
{
-TrashLauncherIcon::TrashLauncherIcon(Launcher* IconManager)
- : SimpleLauncherIcon(IconManager)
+TrashLauncherIcon::TrashLauncherIcon()
+ : SimpleLauncherIcon()
, proxy_("org.gnome.Nautilus", "/org/gnome/Nautilus", "org.gnome.Nautilus.FileOperations")
{
tooltip_text = _("Trash");
diff --git a/plugins/unityshell/src/TrashLauncherIcon.h b/plugins/unityshell/src/TrashLauncherIcon.h
index d6b461193..f09319cc7 100644
--- a/plugins/unityshell/src/TrashLauncherIcon.h
+++ b/plugins/unityshell/src/TrashLauncherIcon.h
@@ -36,7 +36,7 @@ class TrashLauncherIcon : public SimpleLauncherIcon
{
public:
- TrashLauncherIcon(Launcher* launcher);
+ TrashLauncherIcon();
~TrashLauncherIcon();
virtual nux::Color BackgroundColor();
diff --git a/plugins/unityshell/src/UBusMessages.h b/plugins/unityshell/src/UBusMessages.h
index ccdfb4bd2..69ba90366 100644
--- a/plugins/unityshell/src/UBusMessages.h
+++ b/plugins/unityshell/src/UBusMessages.h
@@ -34,9 +34,11 @@
#define UBUS_PLACE_ENTRY_ACTIVATE_REQUEST "PLACE_ENTRY_ACTIVATE_REQUEST"
#define UBUS_DASH_ABOUT_TO_SHOW "DASH_ABOUT_TO_SHOW"
-// Signal send when places are shown or hidden
-#define UBUS_PLACE_VIEW_HIDDEN "PLACE_VIEW_HIDDEN"
-#define UBUS_PLACE_VIEW_SHOWN "PLACE_VIEW_SHOWN"
+// Signal sent when an overlay interface is shown, includes a gvariant
+// gvariant format is (sb), (interface-name, can_maximize?)
+#define UBUS_OVERLAY_FORMAT_STRING "(sbi)"
+#define UBUS_OVERLAY_HIDDEN "OVERLAY_HIDDEN"
+#define UBUS_OVERLAY_SHOWN "OVERLAY_SHOWN"
#define UBUS_PLACE_VIEW_QUEUE_DRAW "PLACE_VIEW_QUEUE_DRAW"
diff --git a/plugins/unityshell/src/UScreen.cpp b/plugins/unityshell/src/UScreen.cpp
index 1f4ec8131..51b86c9bf 100644
--- a/plugins/unityshell/src/UScreen.cpp
+++ b/plugins/unityshell/src/UScreen.cpp
@@ -54,6 +54,24 @@ UScreen::GetDefault()
}
int
+UScreen::GetMonitorWithMouse()
+{
+ GdkScreen* screen;
+ GdkDevice* device;
+ GdkDisplay *display;
+ int x;
+ int y;
+
+ screen = gdk_screen_get_default();
+ display = gdk_display_get_default();
+ device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(display));
+
+ gdk_device_get_position(device, NULL, &x, &y);
+
+ return gdk_screen_get_monitor_at_point(screen, x, y);
+}
+
+int
UScreen::GetPrimaryMonitor()
{
return primary_;
diff --git a/plugins/unityshell/src/UScreen.h b/plugins/unityshell/src/UScreen.h
index b66a8b607..bb0a60312 100644
--- a/plugins/unityshell/src/UScreen.h
+++ b/plugins/unityshell/src/UScreen.h
@@ -33,6 +33,7 @@ public:
static UScreen* GetDefault();
int GetPrimaryMonitor();
+ int GetMonitorWithMouse();
nux::Geometry& GetMonitorGeometry(int monitor);
std::vector<nux::Geometry>& GetMonitors();
diff --git a/plugins/unityshell/src/UnityWindowStyle.cpp b/plugins/unityshell/src/UnityWindowStyle.cpp
new file mode 100644
index 000000000..826f7669d
--- /dev/null
+++ b/plugins/unityshell/src/UnityWindowStyle.cpp
@@ -0,0 +1,64 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ */
+
+#include "UnityWindowStyle.h"
+
+namespace unity {
+namespace ui {
+
+UnityWindowStyle::UnityWindowStyle()
+{
+ background_top_ = BaseTexturePtr(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_top.png", -1, true));
+ background_left_ = BaseTexturePtr(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_left.png", -1, true));
+ background_corner_ = BaseTexturePtr(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_corner.png", -1, true));
+}
+
+UnityWindowStyle::~UnityWindowStyle()
+{
+ // nothing to do
+}
+
+int UnityWindowStyle::GetBorderSize() const
+{
+ return 30; // as measured from textures
+}
+
+int UnityWindowStyle::GetInternalOffset() const
+{
+ return 20;
+}
+
+nux::BaseTexture* UnityWindowStyle::GetBackgroundTop() const
+{
+ return background_top_.GetPointer();
+}
+
+nux::BaseTexture* UnityWindowStyle::GetBackgroundLeft() const
+{
+ return background_left_.GetPointer();
+}
+
+nux::BaseTexture* UnityWindowStyle::GetBackgroundCorner() const
+{
+ return background_corner_.GetPointer();
+}
+
+
+}
+} \ No newline at end of file
diff --git a/plugins/unityshell/src/UnityWindowStyle.h b/plugins/unityshell/src/UnityWindowStyle.h
new file mode 100644
index 000000000..ca0a5b797
--- /dev/null
+++ b/plugins/unityshell/src/UnityWindowStyle.h
@@ -0,0 +1,54 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ */
+
+#ifndef UNITYWINDOWSTYLE_H
+#define UNITYWINDOWSTYLE_H
+
+#include <sigc++/sigc++.h>
+#include <Nux/Nux.h>
+
+namespace unity {
+namespace ui {
+
+class UnityWindowStyle
+{
+public:
+ typedef std::shared_ptr<UnityWindowStyle> Ptr;
+ typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
+
+ UnityWindowStyle();
+ ~UnityWindowStyle();
+
+ nux::BaseTexture* GetBackgroundTop() const;
+ nux::BaseTexture* GetBackgroundLeft() const;
+ nux::BaseTexture* GetBackgroundCorner() const;
+ int GetBorderSize() const;
+ int GetInternalOffset() const;
+
+private:
+ BaseTexturePtr background_top_;
+ BaseTexturePtr background_left_;
+ BaseTexturePtr background_corner_;
+
+};
+
+}
+}
+
+#endif
diff --git a/plugins/unityshell/src/UnityWindowView.cpp b/plugins/unityshell/src/UnityWindowView.cpp
new file mode 100644
index 000000000..5f5448af8
--- /dev/null
+++ b/plugins/unityshell/src/UnityWindowView.cpp
@@ -0,0 +1,222 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ */
+
+#include "UnityWindowView.h"
+
+namespace unity {
+namespace ui {
+
+NUX_IMPLEMENT_OBJECT_TYPE(UnityWindowView);
+
+UnityWindowView::UnityWindowView(NUX_FILE_LINE_DECL) : View(NUX_FILE_LINE_PARAM)
+{
+ style = UnityWindowStyle::Ptr(new UnityWindowStyle());
+ bg_helper_.owner = this;
+}
+
+UnityWindowView::~UnityWindowView()
+{
+
+}
+
+void
+UnityWindowView::SetupBackground(bool enabled)
+{
+ bg_helper_.enabled = enabled;
+}
+
+void UnityWindowView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
+{
+ // fixme???
+}
+
+void UnityWindowView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
+{
+ PreDraw(GfxContext, force_draw);
+
+ nux::Geometry base = GetGeometry();
+ GfxContext.PushClippingRectangle(base);
+
+ // clear region
+ gPainter.PaintBackground(GfxContext, base);
+
+ nux::Geometry background_geo = GetBackgroundGeometry();
+ int internal_offset = style()->GetInternalOffset();
+
+ nux::Geometry internal_clip(background_geo.x + internal_offset,
+ background_geo.y + internal_offset,
+ background_geo.width - internal_offset * 2,
+ background_geo.height - internal_offset * 2);
+ GfxContext.PushClippingRectangle(internal_clip);
+
+
+ nux::Geometry geo_absolute = GetAbsoluteGeometry ();
+ if (BackgroundEffectHelper::blur_type != BLUR_NONE)
+ {
+ nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);
+ auto blur_texture = bg_helper_.GetBlurRegion(blur_geo);
+
+ if (blur_texture.IsValid())
+ {
+ nux::TexCoordXForm texxform_blur_bg;
+ texxform_blur_bg.flip_v_coord = true;
+ texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
+ texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width;
+ texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height;
+
+ nux::ROPConfig rop;
+ rop.Blend = false;
+ rop.SrcBlend = GL_ONE;
+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
+
+ gPainter.PushDrawTextureLayer(GfxContext, base,
+ blur_texture,
+ texxform_blur_bg,
+ nux::color::White,
+ true,
+ rop);
+ }
+ }
+
+ nux::ROPConfig rop;
+ rop.Blend = true;
+ rop.SrcBlend = GL_ONE;
+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
+ gPainter.PushDrawColorLayer (GfxContext, internal_clip, background_color, false, rop);
+
+ // Make round corners
+ rop.Blend = true;
+ rop.SrcBlend = GL_ZERO;
+ rop.DstBlend = GL_SRC_ALPHA;
+ gPainter.PaintShapeCornerROP(GfxContext,
+ internal_clip,
+ nux::color::White,
+ nux::eSHAPE_CORNER_ROUND4,
+ nux::eCornerTopLeft | nux::eCornerTopRight |
+ nux::eCornerBottomLeft | nux::eCornerBottomRight,
+ true,
+ rop);
+
+ DrawOverlay(GfxContext, force_draw, internal_clip);
+
+ GfxContext.PopClippingRectangle();
+ GfxContext.PopClippingRectangle();
+
+ DrawBackground(GfxContext, background_geo);
+
+ PostDraw(GfxContext, force_draw);
+}
+
+void UnityWindowView::DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo)
+{
+ int border = style()->GetBorderSize();
+
+ GfxContext.GetRenderStates().SetBlend (TRUE, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ nux::TexCoordXForm texxform;
+ texxform.SetTexCoordType (nux::TexCoordXForm::OFFSET_COORD);
+ texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
+
+ // Draw TOP-LEFT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ GfxContext.QRP_1Tex (geo.x, geo.y,
+ border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw TOP-RIGHT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ texxform.flip_u_coord = true;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y,
+ border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw BOTTOM-LEFT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = true;
+ GfxContext.QRP_1Tex (geo.x, geo.y + geo.height - border,
+ border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw BOTTOM-RIGHT CORNER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = border;
+ texxform.v1 = border;
+ texxform.flip_u_coord = true;
+ texxform.flip_v_coord = true;
+ GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + geo.height - border,
+ border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White);
+
+ int top_width = style()->GetBackgroundTop()->GetWidth();
+ int top_height = style()->GetBackgroundTop()->GetHeight();
+
+ // Draw TOP BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = top_width;
+ texxform.v1 = top_height;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x + border, geo.y, geo.width - border - border, border, style()->GetBackgroundTop()->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw BOTTOM BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = top_width;
+ texxform.v1 = top_height;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = true;
+ GfxContext.QRP_1Tex (geo.x + border, geo.y + geo.height - border, geo.width - border - border, border, style()->GetBackgroundTop()->GetDeviceTexture(), texxform, nux::color::White);
+
+
+ int left_width = style()->GetBackgroundLeft()->GetWidth();
+ int left_height = style()->GetBackgroundLeft()->GetHeight();
+
+ // Draw LEFT BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = left_width;
+ texxform.v1 = left_height;
+ texxform.flip_u_coord = false;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x, geo.y + border, border, geo.height - border - border, style()->GetBackgroundLeft()->GetDeviceTexture(), texxform, nux::color::White);
+
+ // Draw RIGHT BORDER
+ texxform.u0 = 0;
+ texxform.v0 = 0;
+ texxform.u1 = left_width;
+ texxform.v1 = left_height;
+ texxform.flip_u_coord = true;
+ texxform.flip_v_coord = false;
+ GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + border, border, geo.height - border - border, style()->GetBackgroundLeft()->GetDeviceTexture(), texxform, nux::color::White);
+
+ GfxContext.GetRenderStates().SetBlend (FALSE);
+}
+
+
+}
+}
diff --git a/plugins/unityshell/src/UnityWindowView.h b/plugins/unityshell/src/UnityWindowView.h
new file mode 100644
index 000000000..f5342982b
--- /dev/null
+++ b/plugins/unityshell/src/UnityWindowView.h
@@ -0,0 +1,65 @@
+// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ */
+
+#ifndef UNITYWINDOWVIEW_H
+#define UNITYWINDOWVIEW_H
+
+#include "BackgroundEffectHelper.h"
+#include "UnityWindowStyle.h"
+#include <sigc++/sigc++.h>
+
+#include <Nux/Nux.h>
+#include <Nux/View.h>
+#include <NuxCore/ObjectPtr.h>
+#include <NuxCore/Property.h>
+
+namespace unity {
+namespace ui {
+
+class UnityWindowView : public nux::View
+{
+ NUX_DECLARE_OBJECT_TYPE(UnityWindowView, nux::View)
+public:
+ nux::Property<nux::Color> background_color;
+ nux::Property<UnityWindowStyle::Ptr> style;
+
+ UnityWindowView(NUX_FILE_LINE_PROTO);
+ virtual ~UnityWindowView();
+
+ void SetupBackground(bool enabled = true);
+
+protected:
+ void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
+ void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
+
+ virtual void PreDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {};
+ virtual void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip) = 0;
+ virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {};
+ virtual nux::Geometry GetBackgroundGeometry() = 0;
+
+private:
+ void DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo);
+
+ BackgroundEffectHelper bg_helper_;
+};
+
+}
+}
+
+#endif
diff --git a/plugins/unityshell/src/WindowButtons.cpp b/plugins/unityshell/src/WindowButtons.cpp
index 663677123..e552870b8 100644
--- a/plugins/unityshell/src/WindowButtons.cpp
+++ b/plugins/unityshell/src/WindowButtons.cpp
@@ -54,7 +54,7 @@ public:
_normal_dash_tex(NULL),
_prelight_dash_tex(NULL),
_pressed_dash_tex(NULL),
- _dash_is_open(false),
+ _overlay_is_open(false),
_mouse_is_down(false),
_place_shown_interest(0),
_place_hidden_interest(0),
@@ -66,11 +66,11 @@ public:
dash::Settings::Instance().changed.connect(sigc::mem_fun(this, &WindowButton::UpdateDashUnmaximize));
UBusServer* ubus = ubus_server_get_default();
- _place_shown_interest = ubus_server_register_interest(ubus, UBUS_PLACE_VIEW_SHOWN,
- (UBusCallback)&WindowButton::OnPlaceViewShown,
+ _place_shown_interest = ubus_server_register_interest(ubus, UBUS_OVERLAY_SHOWN,
+ (UBusCallback)&WindowButton::OnOverlayShown,
this);
- _place_hidden_interest = ubus_server_register_interest(ubus, UBUS_PLACE_VIEW_HIDDEN,
- (UBusCallback)&WindowButton::OnPlaceViewHidden,
+ _place_hidden_interest = ubus_server_register_interest(ubus, UBUS_OVERLAY_HIDDEN,
+ (UBusCallback)&WindowButton::OnOverlayHidden,
this);
/* FIXME HasMouseFocus() doesn't seem to work correctly, so we use this workaround */
@@ -106,7 +106,7 @@ public:
GfxContext.PushClippingRectangle(geo);
- if (_dash_is_open)
+ if (_overlay_is_open)
{
//FIXME should use HasMouseFocus()
if (_mouse_is_down && IsMouseInside())
@@ -163,7 +163,7 @@ public:
_prelight_dash_tex = GetDashWindowButton(_type, panel::WindowState::PRELIGHT);
_pressed_dash_tex = GetDashWindowButton(_type, panel::WindowState::PRESSED);
- if (_dash_is_open)
+ if (_overlay_is_open)
{
if (_normal_dash_tex)
SetMinMaxSize(_normal_dash_tex->GetWidth(), _normal_dash_tex->GetHeight());
@@ -190,6 +190,7 @@ public:
if (_pressed_dash_tex)
_pressed_dash_tex->UnReference();
+ //!!FIXME!! - don't have disabled instances of the (un)maximize buttons
if (dash::Settings::Instance().GetFormFactor() == dash::FormFactor::DESKTOP)
{
// get maximize buttons
@@ -208,7 +209,7 @@ public:
// still check if the dash is really opened,
// someone could change the form factor through dconf
// when the dash is closed
- if (_dash_is_open)
+ if (_overlay_is_open)
{
if (_normal_dash_tex)
SetMinMaxSize(_normal_dash_tex->GetWidth(), _normal_dash_tex->GetHeight());
@@ -239,28 +240,37 @@ private:
nux::BaseTexture* _normal_dash_tex;
nux::BaseTexture* _prelight_dash_tex;
nux::BaseTexture* _pressed_dash_tex;
- bool _dash_is_open;
+ bool _overlay_is_open;
+ bool _overlay_can_maximize;
bool _mouse_is_down;
guint32 _place_shown_interest;
guint32 _place_hidden_interest;
double _opacity;
- static void OnPlaceViewShown(GVariant* data, void* val)
+ static void OnOverlayShown(GVariant* data, void* val)
{
+ unity::glib::String overlay_identity;
+ gboolean can_maximise = FALSE;
+ gint32 overlay_monitor = 0;
+ g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
+ &overlay_identity, &can_maximise, &overlay_monitor);
+
WindowButton* self = (WindowButton*)val;
- self->_dash_is_open = true;
+ self->_overlay_is_open = true;
if (self->_normal_dash_tex)
self->SetMinMaxSize(self->_normal_dash_tex->GetWidth(), self->_normal_dash_tex->GetHeight());
+ self->_overlay_can_maximize = (can_maximise) ? true : false;
+
self->QueueDraw();
}
- static void OnPlaceViewHidden(GVariant* data, void* val)
+ static void OnOverlayHidden(GVariant* data, void* val)
{
WindowButton* self = (WindowButton*)val;
- self->_dash_is_open = false;
+ self->_overlay_is_open = false;
if (self->_normal_tex)
self->SetMinMaxSize(self->_normal_tex->GetWidth(), self->_normal_tex->GetHeight());
diff --git a/plugins/unityshell/src/WindowManager.cpp b/plugins/unityshell/src/WindowManager.cpp
index 979609046..39c66de6a 100644
--- a/plugins/unityshell/src/WindowManager.cpp
+++ b/plugins/unityshell/src/WindowManager.cpp
@@ -103,7 +103,7 @@ class WindowManagerDummy : public WindowManager
g_debug("%s", G_STRFUNC);
}
- void FocusWindowGroup(std::vector<Window> windows, FocusVisibility)
+ void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor)
{
g_debug("%s", G_STRFUNC);
}
diff --git a/plugins/unityshell/src/WindowManager.h b/plugins/unityshell/src/WindowManager.h
index 6d2a0809d..5663483b7 100644
--- a/plugins/unityshell/src/WindowManager.h
+++ b/plugins/unityshell/src/WindowManager.h
@@ -78,7 +78,7 @@ public:
virtual void InitiateExpo() = 0;
virtual bool IsExpoActive() = 0;
- virtual void FocusWindowGroup(std::vector<Window> windows, FocusVisibility) = 0;
+ virtual void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor = -1) = 0;
virtual bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force) = 0;
virtual void Decorate(guint32 xid) {};
diff --git a/plugins/unityshell/src/unity-launcher-accessible.cpp b/plugins/unityshell/src/unity-launcher-accessible.cpp
index e7cffcd96..7f9eacb52 100644
--- a/plugins/unityshell/src/unity-launcher-accessible.cpp
+++ b/plugins/unityshell/src/unity-launcher-accessible.cpp
@@ -23,7 +23,7 @@
* @see_also: Launcher
*
* #UnityLauncherAccessible implements the required ATK interfaces for
- * #Launcher, ie: exposing the different LauncherIcon on the model as
+ * #Launcher, ie: exposing the different AbstractLauncherIcon on the model as
* #child of the object.
*
*/
@@ -38,7 +38,7 @@
#include "LauncherModel.h"
using unity::launcher::Launcher;
-using unity::launcher::LauncherIcon;
+using unity::launcher::AbstractLauncherIcon;
using unity::launcher::LauncherModel;
/* GObject */
@@ -64,8 +64,8 @@ static gboolean unity_launcher_accessible_is_child_selected(AtkSelection* sele
/* private */
static void on_selection_change_cb(UnityLauncherAccessible* launcher_accessible);
-static void on_icon_added_cb(LauncherIcon* icon, UnityLauncherAccessible* self);
-static void on_icon_removed_cb(LauncherIcon* icon, UnityLauncherAccessible* self);
+static void on_icon_added_cb(AbstractLauncherIcon* icon, UnityLauncherAccessible* self);
+static void on_icon_removed_cb(AbstractLauncherIcon* icon, UnityLauncherAccessible* self);
static void on_order_change_cb(UnityLauncherAccessible* self);
static void update_children_index(UnityLauncherAccessible* self);
@@ -287,7 +287,7 @@ unity_launcher_accessible_ref_selection(AtkSelection* selection,
gint i)
{
Launcher* launcher = NULL;
- LauncherIcon* selected_icon = NULL;
+ AbstractLauncherIcon* selected_icon = NULL;
nux::Object* nux_object = NULL;
AtkObject* accessible_selected = NULL;
@@ -315,7 +315,7 @@ static gint
unity_launcher_accessible_get_selection_count(AtkSelection* selection)
{
Launcher* launcher = NULL;
- LauncherIcon* selected_icon = NULL;
+ AbstractLauncherIcon* selected_icon = NULL;
nux::Object* nux_object = NULL;
g_return_val_if_fail(UNITY_IS_LAUNCHER_ACCESSIBLE(selection), 0);
@@ -338,8 +338,8 @@ unity_launcher_accessible_is_child_selected(AtkSelection* selection,
gint i)
{
Launcher* launcher = NULL;
- LauncherIcon* icon = NULL;
- LauncherIcon* selected_icon = NULL;
+ AbstractLauncherIcon* icon = NULL;
+ AbstractLauncherIcon* selected_icon = NULL;
LauncherModel* launcher_model = NULL;
LauncherModel::iterator it;
nux::Object* nux_object = NULL;
@@ -354,7 +354,7 @@ unity_launcher_accessible_is_child_selected(AtkSelection* selection,
launcher_model = launcher->GetModel();
it = launcher_model->begin();
std::advance(it, i);
- icon = dynamic_cast<LauncherIcon*>(*it);
+ icon = dynamic_cast<AbstractLauncherIcon*>(*it);
selected_icon = launcher->GetSelectedMenuIcon();
@@ -372,7 +372,7 @@ static void on_selection_change_cb(UnityLauncherAccessible* launcher_accessible)
static void
-on_icon_added_cb(LauncherIcon* icon,
+on_icon_added_cb(AbstractLauncherIcon* icon,
UnityLauncherAccessible* self)
{
AtkObject* icon_accessible = NULL;
@@ -396,7 +396,7 @@ on_icon_added_cb(LauncherIcon* icon,
}
static void
-on_icon_removed_cb(LauncherIcon* icon,
+on_icon_removed_cb(AbstractLauncherIcon* icon,
UnityLauncherAccessible* self)
{
AtkObject* icon_accessible = NULL;
diff --git a/plugins/unityshell/src/unity-switcher-accessible.cpp b/plugins/unityshell/src/unity-switcher-accessible.cpp
index e49ccbf22..a61fcfbd7 100644
--- a/plugins/unityshell/src/unity-switcher-accessible.cpp
+++ b/plugins/unityshell/src/unity-switcher-accessible.cpp
@@ -391,7 +391,7 @@ create_children(UnitySwitcherAccessible* self)
SwitcherView* switcher = NULL;
SwitcherModel::Ptr switcher_model;
SwitcherModel::iterator it;
- LauncherIcon* child = NULL;
+ AbstractLauncherIcon* child = NULL;
AtkObject* child_accessible = NULL;
nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(self));
@@ -406,7 +406,7 @@ create_children(UnitySwitcherAccessible* self)
for (it = switcher_model->begin(); it != switcher_model->end(); it++)
{
- child = dynamic_cast<LauncherIcon*>(*it);
+ child = dynamic_cast<AbstractLauncherIcon*>(*it);
child_accessible = unity_launcher_icon_accessible_new(child);
atk_object_set_parent(child_accessible, ATK_OBJECT(self));
self->priv->children = g_slist_append(self->priv->children,
diff --git a/plugins/unityshell/src/unitya11ytests.cpp b/plugins/unityshell/src/unitya11ytests.cpp
index 9ffbd122c..70bf6bb7b 100644
--- a/plugins/unityshell/src/unitya11ytests.cpp
+++ b/plugins/unityshell/src/unitya11ytests.cpp
@@ -224,7 +224,7 @@ a11y_unit_test_launcher_connection(void)
g_debug("[a11y] Launcher accessible created correctly");
}
- launcher_icon = new SimpleLauncherIcon(launcher);
+ launcher_icon = new SimpleLauncherIcon();
launcher_icon->SinkReference();
launcher_icon_accessible = unity_a11y_get_accessible(launcher_icon);
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 257f1bada..0f62e751f 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -52,6 +52,7 @@
#include "unitya11y.h"
+#include "ubus-server.h"
#include "UBusMessages.h"
#include "UScreen.h"
@@ -66,6 +67,7 @@ COMPIZ_PLUGIN_20090315(unityshell, unity::UnityPluginVTable);
namespace unity
{
+using namespace launcher;
using launcher::AbstractLauncherIcon;
using launcher::Launcher;
using ui::KeyboardUtil;
@@ -104,10 +106,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
, needsRelayout(false)
, _in_paint(false)
, relayoutSourceId(0)
- , _edge_trigger_handle(0)
, _redraw_handle(0)
- , _edge_pointerY(0)
- , _escape_action(nullptr)
, newFocusedWindow(nullptr)
, doShellRepaint(false)
, allowWindowPaint(false)
@@ -238,7 +237,6 @@ UnityScreen::UnityScreen(CompScreen* screen)
debugger = new unity::debug::DebugDBusInterface(this, this->screen);
- _edge_timeout = optionGetLauncherRevealEdgeTimeout ();
_in_paint = false;
#ifndef USE_GLES
@@ -286,8 +284,6 @@ UnityScreen::UnityScreen(CompScreen* screen)
optionSetExecuteCommandInitiate(boost::bind(&UnityScreen::executeCommand, this, _1, _2, _3));
optionSetPanelFirstMenuInitiate(boost::bind(&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3));
optionSetPanelFirstMenuTerminate(boost::bind(&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3));
- optionSetLauncherRevealEdgeInitiate(boost::bind(&UnityScreen::launcherRevealEdgeInitiate, this, _1, _2, _3));
- optionSetLauncherRevealEdgeTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetAltTabBiasViewportNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
@@ -311,6 +307,11 @@ UnityScreen::UnityScreen(CompScreen* screen)
optionSetLauncherSwitcherPrevInitiate(boost::bind(&UnityScreen::launcherSwitcherPrevInitiate, this, _1, _2, _3));
optionSetLauncherSwitcherForwardTerminate(boost::bind(&UnityScreen::launcherSwitcherTerminate, this, _1, _2, _3));
+ optionSetStopVelocityNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
+ optionSetRevealPressureNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
+ optionSetEdgeResponsivenessNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
+ optionSetOvercomePressureNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
+ optionSetDecayRateNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetShowMinimizedWindowsNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
@@ -319,9 +320,6 @@ UnityScreen::UnityScreen(CompScreen* screen)
ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_NAV,
sigc::mem_fun(this, &UnityScreen::OnLauncherEndKeyNav));
- ubus_manager_.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV,
- sigc::mem_fun(this, &UnityScreen::OnQuicklistEndKeyNav));
-
g_idle_add_full (G_PRIORITY_DEFAULT, &UnityScreen::initPluginActions, this, NULL);
super_keypressed_ = false;
@@ -335,11 +333,12 @@ UnityScreen::UnityScreen(CompScreen* screen)
BackgroundEffectHelper::updates_enabled = true;
- ubus_manager_.RegisterInterest(UBUS_PLACE_VIEW_SHOWN, [&](GVariant * args) {
+ ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, [&](GVariant * args) {
dash_is_open_ = true;
+ dash_monitor_ = g_variant_get_int32(args);
RaiseInputWindows();
});
- ubus_manager_.RegisterInterest(UBUS_PLACE_VIEW_HIDDEN, [&](GVariant * args) { dash_is_open_ = false; });
+ ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, [&](GVariant * args) { dash_is_open_ = false; });
LOG_INFO(logger) << "UnityScreen constructed: " << timer.ElapsedSeconds() << "s";
}
}
@@ -441,25 +440,6 @@ void UnityScreen::CreateSuperNewAction(char shortcut, bool use_shift, bool use_n
_shortcut_actions.push_back(action);
}
-void UnityScreen::EnableCancelAction(bool enabled, int modifiers)
-{
- if (enabled)
- {
- /* Create a new keybinding for the Escape key and the current modifiers */
- CompAction::KeyBinding binding(9, modifiers);
-
- _escape_action = CompActionPtr(new CompAction());
- _escape_action->setKey(binding);
-
- screen->addAction(_escape_action.get());
- }
- else if (!enabled && _escape_action.get())
- {
- screen->removeAction(_escape_action.get());
- _escape_action = nullptr;
- }
-}
-
void UnityScreen::nuxPrologue()
{
#ifndef USE_GLES
@@ -517,14 +497,6 @@ void UnityScreen::nuxEpilogue()
glDisable(GL_SCISSOR_TEST);
}
-void UnityScreen::OnLauncherHiddenChanged()
-{
- if (launcher_controller_->launcher().Hidden())
- screen->addAction(&optionGetLauncherRevealEdge());
- else
- screen->removeAction(&optionGetLauncherRevealEdge());
-}
-
void UnityScreen::paintPanelShadow(const GLMatrix& matrix)
{
#ifndef USE_GLES
@@ -553,7 +525,22 @@ void UnityScreen::paintPanelShadow(const GLMatrix& matrix)
vc[2] = y1;
vc[3] = y2;
- if (!dash_is_open_ && panel_controller_->opacity() > 0.0f)
+ // compiz doesn't use the same method of tracking monitors as our toolkit
+ // we need to make sure we properly associate with the right monitor
+ int current_monitor = -1;
+ auto monitors = UScreen::GetDefault()->GetMonitors();
+ int i = 0;
+ for (auto monitor : monitors)
+ {
+ if (monitor.x == output->x() && monitor.y == output->y())
+ {
+ current_monitor = i;
+ break;
+ }
+ i++;
+ }
+
+ if (!(dash_is_open_ && current_monitor == dash_monitor_) && panel_controller_->opacity() > 0.0f)
{
foreach(GLTexture * tex, _shadow_texture)
{
@@ -615,7 +602,22 @@ void UnityScreen::paintPanelShadow(const GLMatrix& matrix)
vc[2] = y1;
vc[3] = y2;
- if (!dash_is_open_ && panel_controller_->opacity() > 0.0f)
+ // compiz doesn't use the same method of tracking monitors as our toolkit
+ // we need to make sure we properly associate with the right monitor
+ int current_monitor = -1;
+ auto monitors = UScreen::GetDefault()->GetMonitors();
+ int i = 0;
+ for (auto monitor : monitors)
+ {
+ if (monitor.x == output->x() && monitor.y == output->y())
+ {
+ current_monitor = i;
+ break;
+ }
+ i++;
+ }
+
+ if (!(dash_is_open_ && current_monitor == dash_monitor_) && panel_controller_->opacity() > 0.0f)
{
foreach(GLTexture * tex, _shadow_texture)
{
@@ -844,6 +846,25 @@ void UnityWindow::paintThumbnail (nux::Geometry const& bounding, float alpha)
geo.height);
}
+void UnityScreen::EnableCancelAction(bool enabled, int modifiers)
+{
+ if (enabled)
+ {
+ /* Create a new keybinding for the Escape key and the current modifiers */
+ CompAction::KeyBinding binding(9, modifiers);
+
+ _escape_action = CompActionPtr(new CompAction());
+ _escape_action->setKey(binding);
+
+ screen->addAction(_escape_action.get());
+ }
+ else if (!enabled && _escape_action.get())
+ {
+ screen->removeAction(_escape_action.get());
+ _escape_action = nullptr;
+ }
+}
+
void UnityScreen::enterShowDesktopMode ()
{
for (CompWindow *w : screen->windows ())
@@ -1275,7 +1296,6 @@ void UnityScreen::damageNuxRegions()
void UnityScreen::handleEvent(XEvent* event)
{
bool skip_other_plugins = false;
- Launcher& launcher = launcher_controller_->launcher();
switch (event->type)
{
case FocusIn:
@@ -1288,13 +1308,13 @@ void UnityScreen::handleEvent(XEvent* event)
cScreen->damageScreen(); // evil hack
#endif
if (_key_nav_mode_requested)
- launcher.startKeyNavMode();
+ launcher_controller_->KeyNavGrab();
_key_nav_mode_requested = false;
break;
case ButtonPress:
if (super_keypressed_)
{
- launcher.KeySwitcherCancel();
+ launcher_controller_->KeyNavTerminate(false);
EnableCancelAction(false);
}
break;
@@ -1313,7 +1333,7 @@ void UnityScreen::handleEvent(XEvent* event)
{
g_idle_add([] (gpointer data) -> gboolean {
auto self = static_cast<UnityScreen*>(data);
- if (!self->launcher_controller_->launcher().KeySwitcherIsActive())
+ if (!self->launcher_controller_->KeyNavIsActive())
{
self->shortcut_controller_->SetEnabled(false);
self->shortcut_controller_->Hide();
@@ -1321,13 +1341,9 @@ void UnityScreen::handleEvent(XEvent* event)
return FALSE;
}, this);
- skip_other_plugins = launcher.CheckSuperShortcutPressed(screen->dpy(), key_sym, event->xkey.keycode, event->xkey.state, key_string);
+ skip_other_plugins = launcher_controller_->HandleLauncherKeyEvent(screen->dpy(), key_sym, event->xkey.keycode, event->xkey.state, key_string);
if (!skip_other_plugins)
- {
skip_other_plugins = dash_controller_->CheckShortcutActivation(key_string);
- if (skip_other_plugins)
- launcher.SetLatestShortcut(key_string[0]);
- }
}
}
break;
@@ -1433,14 +1449,14 @@ bool UnityScreen::showLauncherKeyInitiate(CompAction* action,
action->setState(action->state() | CompAction::StateTermKey);
super_keypressed_ = true;
- launcher_controller_->launcher().StartKeyShowLauncher();
+ launcher_controller_->HandleLauncherKeyPress();
EnsureSuperKeybindings ();
if (!shortcut_controller_->Visible() && shortcut_controller_->IsEnabled())
{
static nux::Geometry last_geo;
UScreen* uscreen = UScreen::GetDefault();
- int primary_monitor = uscreen->GetPrimaryMonitor();
+ int primary_monitor = uscreen->GetMonitorWithMouse();
auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor);
int width = 970;
@@ -1472,11 +1488,16 @@ bool UnityScreen::showLauncherKeyTerminate(CompAction* action,
if (state & CompAction::StateCancel)
return false;
+ bool accept_state = (state & CompAction::StateCancel) == 0;
+
super_keypressed_ = false;
- launcher_controller_->launcher().EndKeyShowLauncher();
+ launcher_controller_->KeyNavTerminate(accept_state);
+ launcher_controller_->HandleLauncherKeyRelease();
+ EnableCancelAction(false);
shortcut_controller_->SetEnabled(enable_shortcut_overlay_);
shortcut_controller_->Hide();
+ action->setState (action->state() & (unsigned)~(CompAction::StateTermKey));
return false;
}
@@ -1501,67 +1522,6 @@ bool UnityScreen::showPanelFirstMenuKeyTerminate(CompAction* action,
return false;
}
-gboolean UnityScreen::OnEdgeTriggerTimeout(gpointer data)
-{
- UnityScreen* self = reinterpret_cast<UnityScreen*>(data);
-
- if (pointerX <= 1)
- {
- if (pointerY <= 24)
- return true;
-
- if (abs(pointerY - self->_edge_pointerY) <= 5)
- {
- self->launcher_controller_->launcher().EdgeRevealTriggered(pointerX, pointerY);
- }
- else
- {
- /* We are still in the edge, but moving in Y, maybe we need another chance */
-
- if (abs(pointerY - self->_edge_pointerY) > 20)
- {
- /* We're quite far from the first hit spot, let's wait again */
- self->_edge_pointerY = pointerY;
- return true;
- }
- else
- {
- /* We're quite near to the first hit spot, so we can reduce our timeout */
- self->_edge_pointerY = pointerY;
- g_source_remove(self->_edge_trigger_handle);
- self->_edge_trigger_handle = g_timeout_add(self->_edge_timeout/2,
- &UnityScreen::OnEdgeTriggerTimeout,
- self);
- return false;
- }
- }
- }
-
- self->_edge_trigger_handle = 0;
- return false;
-}
-
-bool UnityScreen::launcherRevealEdgeInitiate(CompAction* action,
- CompAction::State state,
- CompOption::Vector& options)
-{
- if (screen->grabbed())
- return false;
-
- if (_edge_trigger_handle)
- g_source_remove(_edge_trigger_handle);
-
- if (pointerX <= 1)
- {
- _edge_pointerY = pointerY;
- _edge_trigger_handle = g_timeout_add(_edge_timeout,
- &UnityScreen::OnEdgeTriggerTimeout,
- this);
- }
-
- return false;
-}
-
void UnityScreen::SendExecuteCommand()
{
ubus_manager_.SendMessage(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST,
@@ -1576,20 +1536,10 @@ bool UnityScreen::executeCommand(CompAction* action,
return false;
}
-void UnityScreen::restartLauncherKeyNav()
-{
- // set input-focus on launcher-window and start key-nav mode
- if (newFocusedWindow != NULL)
- {
- newFocusedWindow->moveInputFocusTo();
- launcher_controller_->launcher().startKeyNavMode();
- }
-}
-
void UnityScreen::startLauncherKeyNav()
{
// get CompWindow* of launcher-window
- newFocusedWindow = screen->findWindow(launcher_controller_->launcher_input_window_id());
+ newFocusedWindow = screen->findWindow(launcher_controller_->KeyNavLauncherInputWindowId());
// check if currently focused window isn't the launcher-window
if (newFocusedWindow != screen->findWindow(screen->activeWindow()))
@@ -1624,8 +1574,6 @@ bool UnityScreen::altTabInitiateCommon(CompAction *action,
if (!grab_index_)
return false;
- std::vector<unity::launcher::AbstractLauncherIcon*> results = launcher_controller_->GetAltTabIcons();
-
screen->addAction(&optionGetAltTabRight());
screen->addAction(&optionGetAltTabDetailStart());
screen->addAction(&optionGetAltTabDetailStop());
@@ -1637,12 +1585,19 @@ bool UnityScreen::altTabInitiateCommon(CompAction *action,
switcher_controller_->SetWorkspace(nux::Geometry(screen->outputDevs()[device].x1() + 100,
screen->outputDevs()[device].y1() + 100,
screen->outputDevs()[device].width() - 200,
- screen->outputDevs()[device].height() - 200));
+ screen->outputDevs()[device].height() - 200), device);
switcher::ShowMode show_mode = optionGetAltTabBiasViewport() ? switcher::ShowMode::CURRENT_VIEWPORT : switcher::ShowMode::ALL;
RaiseInputWindows();
- switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results);
+
+ int show_monitor = (show_mode == switcher::ShowMode::CURRENT_VIEWPORT) ? device : -1;
+
+ std::vector<unity::launcher::AbstractLauncherIcon*> results = launcher_controller_->GetAltTabIcons(show_monitor);
+
+ if (!(results.size() == 1 && results[0]->Type() == AbstractLauncherIcon::IconType::TYPE_BEGIN))
+ switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results);
+
return true;
}
@@ -1731,47 +1686,32 @@ bool UnityScreen::altTabPrevWindowInitiate(CompAction* action, CompAction::State
bool UnityScreen::launcherSwitcherForwardInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options)
{
- Launcher& launcher = launcher_controller_->launcher();
-
- if (!launcher.KeySwitcherIsActive())
+ if (!launcher_controller_->KeyNavIsActive())
{
+ launcher_controller_->KeyNavActivate();
EnableCancelAction(true, action->key().modifiers());
- launcher.KeySwitcherActivate();
}
else
{
- launcher.KeySwitcherNext();
+ launcher_controller_->KeyNavNext();
}
action->setState(action->state() | CompAction::StateTermKey);
return false;
}
-
bool UnityScreen::launcherSwitcherPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options)
{
- launcher_controller_->launcher().KeySwitcherPrevious();
+ launcher_controller_->KeyNavPrevious();
return false;
}
-
bool UnityScreen::launcherSwitcherTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options)
{
- Launcher& launcher = launcher_controller_->launcher();
-
- if (launcher.KeySwitcherIsActive())
- {
- if (state & CompAction::StateCancel)
- {
- launcher.KeySwitcherCancel();
- }
- else
- {
- launcher.KeySwitcherTerminate();
- }
-
- EnableCancelAction(false);
- }
+ bool accept_state = (state & CompAction::StateCancel) == 0;
+ launcher_controller_->KeyNavTerminate(accept_state);
+ EnableCancelAction(false);
+ action->setState (action->state() & (unsigned)~(CompAction::StateTermKey));
return false;
}
@@ -1795,11 +1735,6 @@ void UnityScreen::OnLauncherEndKeyNav(GVariant* data)
PluginAdapter::Default ()->restoreInputFocus ();
}
-void UnityScreen::OnQuicklistEndKeyNav(GVariant* data)
-{
- restartLauncherKeyNav();
-}
-
gboolean UnityScreen::initPluginActions(gpointer data)
{
CompPlugin* p = CompPlugin::find("expo");
@@ -2163,7 +2098,7 @@ void UnityWindow::windowNotify(CompWindowNotify n)
if (us->dash_is_open_)
{
- lw = screen->findWindow(us->launcher_controller_->launcher_input_window_id());
+ lw = screen->findWindow(us->launcher_controller_->LauncherWindowId(0));
lw->moveInputFocusTo();
}
}
@@ -2211,81 +2146,51 @@ void UnityWindow::resizeNotify(int x, int y, int w, int h)
CompPoint UnityWindow::tryNotIntersectUI(CompPoint& pos)
{
UnityScreen* us = UnityScreen::get(screen);
- Launcher& launcher = us->launcher_controller_->launcher();
- nux::Geometry geo = launcher.GetAbsoluteGeometry();
- CompRegion allowedWorkArea (screen->workArea ());
- CompRect launcherGeo(geo.x, geo.y, geo.width, geo.height);
- CompRegion wRegion (window->borderRect ());
- CompRegion intRegion;
-
- wRegion.translate (pos.x () - wRegion.boundingRect ().x (),
- pos.y () - wRegion.boundingRect ().y ());
+ auto window_geo = window->borderRect ();
+ nux::Geometry target_monitor;
+ nux::Point result(pos.x(), pos.y());
- /* subtract launcher and panel geometries from allowed workarea */
- if (!launcher.Hidden())
+ // seriously why does compiz not track monitors XRandR style???
+ auto monitors = UScreen::GetDefault()->GetMonitors();
+ for (auto monitor : monitors)
{
- switch (launcher.GetHideMode())
+ if (monitor.IsInside(result))
{
- case Launcher::LAUNCHER_HIDE_DODGE_WINDOWS:
- case Launcher::LAUNCHER_HIDE_DODGE_ACTIVE_WINDOW:
- allowedWorkArea -= launcherGeo;
- break;
-
- default:
- break;
+ target_monitor = monitor;
+ break;
}
}
- for (nux::Geometry &g : us->panel_controller_->GetGeometries ())
+ auto launchers = us->launcher_controller_->launchers();
+ for (auto launcher : launchers)
{
- CompRect pg (g.x, g.y, g.width, g.height);
- allowedWorkArea -= pg;
- }
-
- /* Invert allowed work area */
- allowedWorkArea = CompRegion (screen->workArea ()) - allowedWorkArea;
-
- /* Now intersect the window region with the allowed work area
- * region, such that it splits up into a number of rects */
- intRegion = wRegion.intersected (allowedWorkArea);
-
- if (intRegion.rects ().size () > 1)
- {
- /* Now find the largest rect, this will be the area that we want to move to */
- CompRect largest;
-
- for (CompRect &r : intRegion.rects ())
+ nux::Geometry geo = launcher->GetAbsoluteGeometry();
+
+ if (launcher->Hidden() || launcher->options()->hide_mode == LAUNCHER_HIDE_NEVER || launcher->options()->hide_mode == LAUNCHER_HIDE_AUTOHIDE)
+ continue;
+
+ if (geo.IsInside(result))
{
- if (r.area () > largest.area ())
- largest = r;
+ if (geo.x + geo.width + 1 + window_geo.width() < target_monitor.x + target_monitor.width)
+ {
+ result.x = geo.x + geo.width + 1;
+ }
}
+ }
- /* Now pad the largest rect with the other rectangles that
- * were intersecting, padding the opposite side to the one
- * that they are currently on on the large rect
- */
-
- intRegion -= largest;
-
- for (CompRect &r : intRegion.rects ())
+ for (nux::Geometry &geo : us->panel_controller_->GetGeometries ())
+ {
+ if (geo.IsInside(result))
{
- if (r.x1 () > largest.x2 ())
- largest.setX (largest.x () - r.width ());
- else if (r.x2 () < largest.x ())
- largest.setWidth (largest.width () + r.width ());
-
- if (r.y1 () > largest.y2 ())
- largest.setY (largest.y () - r.height ());
- else if (r.y2 () < largest.y ())
- largest.setWidth (largest.height () + r.height ());
+ if (geo.y + geo.height + window_geo.height() < target_monitor.y + target_monitor.height)
+ {
+ result.y = geo.y + geo.height;
+ }
}
-
- pos = largest.pos ();
}
- if (launcherGeo.contains(pos))
- pos.setX(launcherGeo.x() + launcherGeo.width() + 1);
-
+ pos.setX(result.x);
+ pos.setY(result.y);
return pos;
}
@@ -2349,7 +2254,7 @@ void UnityScreen::onRedrawRequested()
void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
{
// Note: perhaps we should put the options here into the controller.
- Launcher& launcher = launcher_controller_->launcher();
+ unity::launcher::Options::Ptr launcher_options = launcher_controller_->options();
switch (num)
{
case UnityshellOptions::BackgroundColor:
@@ -2366,16 +2271,16 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
break;
}
case UnityshellOptions::LauncherHideMode:
- launcher.SetHideMode((Launcher::LauncherHideMode) optionGetLauncherHideMode());
+ launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode();
break;
case UnityshellOptions::BacklightMode:
- launcher.SetBacklightMode((Launcher::BacklightMode) optionGetBacklightMode());
+ launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode();
break;
case UnityshellOptions::LaunchAnimation:
- launcher.SetLaunchAnimation((Launcher::LaunchAnimation) optionGetLaunchAnimation());
+ launcher_options->launch_animation = (unity::launcher::LaunchAnimation) optionGetLaunchAnimation();
break;
case UnityshellOptions::UrgentAnimation:
- launcher.SetUrgentAnimation((Launcher::UrgentAnimation) optionGetUrgentAnimation());
+ launcher_options->urgent_animation = (unity::launcher::UrgentAnimation) optionGetUrgentAnimation();
break;
case UnityshellOptions::PanelOpacity:
panel_controller_->SetOpacity(optionGetPanelOpacity());
@@ -2395,13 +2300,15 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
optionGetMenusDiscoveryFadeout());
break;
case UnityshellOptions::LauncherOpacity:
- launcher.SetBackgroundAlpha(optionGetLauncherOpacity());
+ launcher_options->background_alpha = optionGetLauncherOpacity();
break;
case UnityshellOptions::IconSize:
{
CompPlugin *p = CompPlugin::find ("expo");
- launcher.SetIconSize(optionGetIconSize() + 6, optionGetIconSize());
+ launcher_options->icon_size = optionGetIconSize();
+ launcher_options->tile_size = optionGetIconSize() + 6;
+
dash_controller_->launcher_width = optionGetIconSize() + 18;
if (p)
@@ -2423,7 +2330,7 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
break;
}
case UnityshellOptions::AutohideAnimation:
- launcher.SetAutoHideAnimation((Launcher::AutoHideAnimation) optionGetAutohideAnimation());
+ launcher_options->auto_hide_animation = (unity::launcher::AutoHideAnimation) optionGetAutohideAnimation();
break;
case UnityshellOptions::DashBlurExperimental:
BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental();
@@ -2434,9 +2341,6 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
case UnityshellOptions::DevicesOption:
unity::DevicesSettings::GetDefault().SetDevicesOption((unity::DevicesSettings::DevicesOption) optionGetDevicesOption());
break;
- case UnityshellOptions::LauncherRevealEdgeTimeout:
- _edge_timeout = optionGetLauncherRevealEdgeTimeout();
- break;
case UnityshellOptions::AltTabTimeout:
switcher_controller_->detail_on_timeout = optionGetAltTabTimeout();
case UnityshellOptions::AltTabBiasViewport:
@@ -2454,6 +2358,20 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
case UnityshellOptions::ShowDesktopIcon:
launcher_controller_->SetShowDesktopIcon(optionGetShowDesktopIcon());
break;
+ case UnityshellOptions::DecayRate:
+ launcher_options->edge_decay_rate = optionGetDecayRate() * 100;
+ break;
+ case UnityshellOptions::OvercomePressure:
+ launcher_options->edge_overcome_pressure = optionGetOvercomePressure() * 100;
+ break;
+ case UnityshellOptions::StopVelocity:
+ launcher_options->edge_stop_velocity = optionGetStopVelocity() * 100;
+ break;
+ case UnityshellOptions::RevealPressure:
+ launcher_options->edge_reveal_pressure = optionGetRevealPressure() * 100;
+ case UnityshellOptions::EdgeResponsiveness:
+ launcher_options->edge_responsiveness = optionGetEdgeResponsiveness();
+ break;
default:
break;
}
@@ -2556,12 +2474,7 @@ void UnityScreen::initLauncher()
{
Timer timer;
launcher_controller_.reset(new launcher::Controller(screen->dpy()));
- primary_monitor_.changed.connect(sigc::mem_fun(launcher_controller_.get(),
- &launcher::Controller::PrimaryMonitorGeometryChanged));
-
- Launcher& launcher = launcher_controller_->launcher();
- launcher.hidden_changed.connect(sigc::mem_fun(this, &UnityScreen::OnLauncherHiddenChanged));
- AddChild(&launcher);
+ AddChild(launcher_controller_.get());
switcher_controller_.reset(new switcher::Controller());
AddChild(switcher_controller_.get());
@@ -2571,6 +2484,7 @@ void UnityScreen::initLauncher()
/* Setup panel */
timer.Reset();
panel_controller_.reset(new panel::Controller());
+ AddChild(panel_controller_.get());
panel_controller_->SetMenuShowTimings(optionGetMenusFadein(),
optionGetMenusFadeout(),
optionGetMenusDiscoveryDuration(),
@@ -2588,13 +2502,7 @@ void UnityScreen::initLauncher()
AddChild(dash_controller_.get());
- launcher.SetHideMode(Launcher::LAUNCHER_HIDE_DODGE_WINDOWS);
- launcher.SetLaunchAnimation(Launcher::LAUNCH_ANIMATION_PULSE);
- launcher.SetUrgentAnimation(Launcher::URGENT_ANIMATION_WIGGLE);
-
ScheduleRelayout(0);
-
- OnLauncherHiddenChanged();
}
void UnityScreen::InitHints()
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 18d95ed31..0b05ef4f4 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -187,7 +187,6 @@ public:
bool executeCommand(CompAction* action, CompAction::State state, CompOption::Vector& options);
bool setKeyboardFocusKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options);
- bool launcherRevealEdgeInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options);
bool altTabInitiateCommon(CompAction* action,
CompAction::State state,
@@ -248,16 +247,13 @@ private:
static void initUnity(nux::NThread* thread, void* InitData);
static void OnStartKeyNav(GVariant* data, void* value);
static void OnExitKeyNav(GVariant* data, void* value);
- static gboolean OnEdgeTriggerTimeout(gpointer data);
static gboolean OnRedrawTimeout(gpointer data);
void startLauncherKeyNav();
void restartLauncherKeyNav();
- void OnLauncherHiddenChanged();
void OnDashRealized ();
- void OnQuicklistEndKeyNav(GVariant* data);
void OnLauncherStartKeyNav(GVariant* data);
void OnLauncherEndKeyNav(GVariant* data);
@@ -285,16 +281,12 @@ private:
bool needsRelayout;
bool _in_paint;
guint32 relayoutSourceId;
- guint _edge_timeout;
- guint _edge_trigger_handle;
guint32 _redraw_handle;
- gint _edge_pointerY;
-
typedef std::shared_ptr<CompAction> CompActionPtr;
typedef std::vector<CompActionPtr> ShortcutActions;
ShortcutActions _shortcut_actions;
- CompActionPtr _escape_action;
bool super_keypressed_;
+ CompActionPtr _escape_action;
/* keyboard-nav mode */
CompWindow* newFocusedWindow;
@@ -325,6 +317,7 @@ private:
UBusManager ubus_manager_;
bool dash_is_open_;
+ int dash_monitor_;
CompScreen::GrabHandle grab_index_;
CompWindowList fullscreen_windows_;
bool painting_tray_;
diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in
index 8a12f90a1..f59218603 100644
--- a/plugins/unityshell/unityshell.xml.in
+++ b/plugins/unityshell/unityshell.xml.in
@@ -42,20 +42,6 @@
<options>
<group>
<_short>Behaviour</_short>
- <option name="launcher_reveal_edge" type="edge">
- <_short>Reveal Mode</_short>
- <_long>From which edge should the launcher reveal.</_long>
- <default>
- <edge name="Left"/>
- </default>
- </option>
- <option name="launcher_reveal_edge_timeout" type="int">
- <_short>Edge Reveal Timeout</_short>
- <_long>How long (in ms) wait before revealing the launcher when the mouse pointer is touching the edge.</_long>
- <min>1</min>
- <max>1000</max>
- <default>150</default>
- </option>
<option name="launcher_hide_mode" type="int">
<_short>Hide Launcher</_short>
<_long>Make the launcher hide automatically after some time of inactivity: always or just when the focussed window is not over the launcher</_long>
@@ -282,6 +268,46 @@
<max>64</max>
<precision>1</precision>
</option>
+ <option name="edge_responsiveness" type="float">
+ <_short>Launcher Reveal Edge Responsiveness</_short>
+ <_long>A conglomerate setting that modifies the overall responsiveness of the launcher reveal</_long>
+ <default>1.0</default>
+ <min>0.2</min>
+ <max>8.0</max>
+ <precision>0.1</precision>
+ </option>
+ <option name="reveal_pressure" type="int">
+ <_short>Launcher Reveal Pressure</_short>
+ <_long>Amount of mouse pressure required to reveal launcher</_long>
+ <default>20</default>
+ <min>1</min>
+ <max>1000</max>
+ <precision>1</precision>
+ </option>
+ <option name="overcome_pressure" type="int">
+ <_short>Launcher Edge Stop Overcome Pressure</_short>
+ <_long>Amount of mouse pressure required to push into the next monitor</_long>
+ <default>20</default>
+ <min>1</min>
+ <max>1000</max>
+ <precision>1</precision>
+ </option>
+ <option name="decay_rate" type="int">
+ <_short>Pressure Decay Rate</_short>
+ <_long>The rate at which mouse pressure decays</_long>
+ <default>15</default>
+ <min>1</min>
+ <max>1000</max>
+ <precision>1</precision>
+ </option>
+ <option name="stop_velocity" type="int">
+ <_short>Edge Stop Velocity</_short>
+ <_long>The maximum velocity at which the mouse will still be stoped</_long>
+ <default>45</default>
+ <min>1</min>
+ <max>1000</max>
+ <precision>1</precision>
+ </option>
<option name="autohide_animation" type="int">
<_short>Hide Animation</_short>
<_long>Animation played when the launcher is showing or hiding</_long>
diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt
index 2e5153c1a..286b9cc1f 100644
--- a/services/CMakeLists.txt
+++ b/services/CMakeLists.txt
@@ -2,7 +2,7 @@
# Panel Service
#
find_package(PkgConfig)
-pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4 x11 gconf-2.0)
+pkg_check_modules(SERVICE_DEPS REQUIRED gtk+-3.0>=3.3 gobject-2.0 gio-2.0 gthread-2.0 indicator3-0.4 x11 gconf-2.0)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable indicatordir OUTPUT_VARIABLE _indicatordir OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} indicator3-0.4 --variable iconsdir OUTPUT_VARIABLE _iconsdir OUTPUT_STRIP_TRAILING_WHITESPACE)
diff --git a/services/panel-service.c b/services/panel-service.c
index e9ca7c449..d3a0e59b4 100644
--- a/services/panel-service.c
+++ b/services/panel-service.c
@@ -56,6 +56,8 @@ struct _PanelServicePrivate
gint32 timeouts[N_TIMEOUT_SLOTS];
IndicatorObjectEntry *last_entry;
+ GtkWidget *menubar;
+ GtkWidget *offscreen_window;
GtkMenu *last_menu;
guint32 last_menu_id;
guint32 last_menu_move_id;
@@ -139,6 +141,24 @@ panel_service_class_dispose (GObject *object)
gdk_window_remove_filter (NULL, (GdkFilterFunc)event_filter, object);
+ if (G_IS_OBJECT (priv->menubar))
+ {
+ g_object_unref (priv->menubar);
+ priv->menubar = NULL;
+ }
+
+ if (G_IS_OBJECT (priv->offscreen_window))
+ {
+ g_object_unref (priv->offscreen_window);
+ priv->offscreen_window = NULL;
+ }
+
+ if (G_IS_OBJECT (priv->last_menu))
+ {
+ g_object_unref (priv->last_menu);
+ priv->last_menu = NULL;
+ }
+
if (priv->initial_sync_id)
{
g_source_remove (priv->initial_sync_id);
@@ -415,6 +435,10 @@ panel_service_init (PanelService *self)
PanelServicePrivate *priv;
priv = self->priv = GET_PRIVATE (self);
+ priv->offscreen_window = gtk_offscreen_window_new ();
+ priv->menubar = gtk_menu_bar_new ();
+ gtk_container_add (GTK_CONTAINER (priv->offscreen_window), priv->menubar);
+
gdk_window_add_filter (NULL, (GdkFilterFunc)event_filter, self);
priv->entry2indicator_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
@@ -1105,6 +1129,11 @@ on_active_menu_hidden (GtkMenu *menu, PanelService *self)
g_signal_handler_disconnect (priv->last_menu, priv->last_menu_id);
g_signal_handler_disconnect (priv->last_menu, priv->last_menu_move_id);
+
+ GtkWidget *top_win = gtk_widget_get_toplevel (GTK_WIDGET (priv->last_menu));
+ if (GTK_IS_WINDOW (top_win))
+ gtk_window_set_attached_to (GTK_WINDOW (top_win), NULL);
+
priv->last_menu = NULL;
priv->last_menu_id = 0;
priv->last_menu_move_id = 0;
@@ -1477,6 +1506,16 @@ panel_service_show_entry (PanelService *self,
G_CALLBACK (gtk_widget_destroyed), &priv->last_menu);
}
+ GtkWidget *top_widget = gtk_widget_get_toplevel (GTK_WIDGET (priv->last_menu));
+
+ if (GTK_IS_WINDOW (top_widget))
+ {
+ GtkWindow *top_win = GTK_WINDOW (top_widget);
+
+ if (gtk_window_get_attached_to (top_win) != priv->menubar)
+ gtk_window_set_attached_to (top_win, priv->menubar);
+ }
+
priv->last_entry = entry;
priv->last_x = x;
priv->last_y = y;
@@ -1487,6 +1526,7 @@ panel_service_show_entry (PanelService *self,
G_CALLBACK (on_active_menu_move_current), self);
indicator_object_entry_activate (object, entry, CurrentTime);
+
gtk_menu_popup (priv->last_menu, NULL, NULL, positon_menu, self, 0, CurrentTime);
GdkWindow *gdkwin = gtk_widget_get_window (GTK_WIDGET (priv->last_menu));
if (gdkwin != NULL)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 80a738161..c7e2bd3f9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -110,6 +110,7 @@ if (GTEST_FOUND AND
# The actual test executable (xless) - do not put anything that requires X in here
add_executable(test-gtest-xless
test_animator.cpp
+ test_launcher_model.cpp
test_glib_object.cpp
test_glib_object_utils.cpp
test_glib_object_utils.h
@@ -138,6 +139,8 @@ if (GTEST_FOUND AND
${UNITY_SRC}/FavoriteStore.h
${UNITY_SRC}/FavoriteStoreGSettings.cpp
${UNITY_SRC}/FavoriteStoreGSettings.h
+ ${UNITY_SRC}/LauncherModel.cpp
+ ${UNITY_SRC}/LauncherModel.h
${UNITY_SRC}/FavoriteStorePrivate.cpp
${UNITY_SRC}/FavoriteStorePrivate.h
${UNITY_SRC}/MockLauncherIcon.h
diff --git a/tests/autopilot/autopilot/emulators/X11.py b/tests/autopilot/autopilot/emulators/X11.py
index 5d2fd7606..8ee7c0d65 100644
--- a/tests/autopilot/autopilot/emulators/X11.py
+++ b/tests/autopilot/autopilot/emulators/X11.py
@@ -22,16 +22,22 @@ from Xlib import X
from Xlib import XK
from Xlib.display import Display
from Xlib.ext.xtest import fake_input
+import gtk.gdk
class Keyboard(object):
'''Wrapper around xlib to make faking keyboard input possible'''
_lame_hardcoded_keycodes = {
+ 'E' : 9, # escape
'A' : 64,
'C' : 37,
'S' : 50,
'T' : 23,
'W' : 133,
- 'U' : 111
+ 'U' : 111, # up arrow
+ 'D' : 116, # down arrow
+ 'L' : 113, # left arrow
+ 'R' : 114, # right arrow
+ '1' : 67 # f1
}
_special_X_keysyms = {
@@ -168,7 +174,7 @@ class Keyboard(object):
class Mouse(object):
'''Wrapper around xlib to make moving the mouse easier'''
-
+
def __init__(self):
self._display = Display()
@@ -179,62 +185,90 @@ class Mouse(object):
@property
def y(self):
return self.position()[1]
-
+
def press(self, button=1):
'''Press mouse button at current mouse location'''
fake_input(self._display, X.ButtonPress, button)
self._display.sync()
-
+
def release(self, button=1):
'''Releases mouse button at current mouse location'''
fake_input(self._display, X.ButtonRelease, button)
self._display.sync()
-
+
def click(self, button=1):
'''Click mouse at current location'''
self.press(button)
sleep(0.25)
self.release(button)
-
- def move(self, x, y, animate=True):
- '''Moves mouse to location (x, y)'''
- def perform_move(x, y):
- fake_input(self._display, X.MotionNotify, x=x, y=y)
+
+ def move(self, x, y, animate=True, rate=100, time_between_events=0.001):
+ '''Moves mouse to location (x, y, pixels_per_event, time_between_event)'''
+ def perform_move(x, y, sync):
+ fake_input(self._display, X.MotionNotify, sync, X.CurrentTime, X.NONE, x=x, y=y)
self._display.sync()
- sleep(0.001)
+ sleep(time_between_events)
if not animate:
- perform_move(x, y)
-
+ perform_move(x, y, False)
+
dest_x, dest_y = x, y
curr_x, curr_y = self.position()
-
+
# calculate a path from our current position to our destination
dy = float(curr_y - dest_y)
dx = float(curr_x - dest_x)
slope = dy/dx if dx > 0 else 0
yint = curr_y - (slope * curr_x)
- xscale = 1 if dest_x > curr_x else -1
-
+ xscale = rate if dest_x > curr_x else -rate
+
while (int(curr_x) != dest_x):
- curr_x += xscale;
- curr_y = int(slope * curr_x + yint) if curr_y > 0 else dest_y
-
- perform_move(curr_x, curr_y)
-
+ target_x = min(curr_x + xscale, dest_x) if dest_x > curr_x else max(curr_x + xscale, dest_x)
+ perform_move(target_x - curr_x, 0, True)
+ curr_x = target_x;
+
if (curr_y != dest_y):
- yscale = 1 if dest_y > curr_y else -1
+ yscale = rate if dest_y > curr_y else -rate
while (curr_y != dest_y):
- curr_y += yscale
- perform_move(curr_x, curr_y)
-
+ target_y = min(curr_y + yscale, dest_y) if dest_y > curr_y else max(curr_y + yscale, dest_y)
+ perform_move(0, target_y - curr_y, True)
+ curr_y = target_y
+
def position(self):
'''Returns the current position of the mouse pointer'''
coord = self._display.screen().root.query_pointer()._data
x, y = coord["root_x"], coord["root_y"]
return x, y
-
+
def reset(self):
self.move(16, 13, animate=False)
self.click()
self.move(800, 500, animate=False)
+
+
+class ScreenGeometry:
+ """Get details about screen geometry."""
+
+ def __init__(self):
+ self._default_screen = gtk.gdk.screen_get_default()
+
+ def get_num_monitors(self):
+ """Get the number of monitors attached to the PC."""
+ return self._default_screen.get_n_monitors()
+
+ def get_monitor_geometry(self, monitor_number):
+ """Get the geometry for a particular monitor.
+
+ Returns a tuple containing (x,y,width,height).
+
+ """
+ if monitor_number >= self.get_num_monitors():
+ raise ValueError('Specified monitor number is out of range.')
+ return tuple(self._default_screen.get_monitor_geometry(monitor_number))
+
+ def move_mouse_to_monitor(self, monitor_number):
+ """Move the mouse to the center of the specified monitor."""
+ geo = self.get_monitor_geometry(monitor_number)
+ x = geo[0] + (geo[2]/2)
+ y = geo[1] + (geo[3]/2)
+ Mouse().move(x,y, False) #dont animate this or it might not get there due to barriers
diff --git a/tests/autopilot/autopilot/emulators/unity.py b/tests/autopilot/autopilot/emulators/unity.py
index c3f5219e4..dfcd89a14 100644
--- a/tests/autopilot/autopilot/emulators/unity.py
+++ b/tests/autopilot/autopilot/emulators/unity.py
@@ -2,11 +2,11 @@
# Copyright 2011 Canonical
# Author: Alex Launi
#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 3, as published
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
-# This script is designed to run unity in a test drive manner. It will drive
+# This script is designed to run unity in a test drive manner. It will drive
# X and test the GL calls that Unity makes, so that we can easily find out if
# we are triggering graphics driver/X bugs.
@@ -19,7 +19,7 @@ from compizconfig import Plugin
import dbus
from time import sleep
-from autopilot.emulators.X11 import Keyboard, Mouse
+from autopilot.emulators.X11 import Keyboard, Mouse, ScreenGeometry
from autopilot.globals import global_context
class Unity(object):
@@ -39,6 +39,7 @@ class Unity(object):
self.INTROSPECTION_IFACE = 'com.canonical.Unity.Debug.Introspection'
self._mouse = Mouse()
self._keyboard = Keyboard()
+ self._screen = ScreenGeometry()
self._bus = dbus.SessionBus()
self._debug_proxy_obj = self._bus.get_object(self.UNITY_BUS_NAME,
@@ -67,22 +68,113 @@ class Launcher(Unity):
self.height = 0
self.show_timeout = 1
self.hide_timeout = 1
+ self.grabbed = False
- def move_mouse_to_reveal_pos(self):
- self._mouse.move(self.x, self.y)
+ def move_mouse_to_right_of_launcher(self, monitor):
+ (x, y, w, h) = self.launcher_geometry(monitor)
+ self._mouse.move(x + w + 15, y + h / 2, False)
sleep(self.show_timeout)
+
+ def move_mouse_over_launcher(self, monitor):
+ (x, y, w, h) = self.launcher_geometry(monitor)
+ self._screen.move_mouse_to_monitor(monitor);
+ self._mouse.move(x + w / 2, y + h / 2);
+
+ def reveal_launcher(self, monitor):
+ (x, y, w, h) = self.launcher_geometry(monitor)
+ self._mouse.move(x - 920, y + h / 2, True, 5, .002)
+ sleep(self.show_timeout)
+
+ def keyboard_reveal_launcher(self):
+ self._keyboard.press('^W')
+ sleep(1)
+
+ def keyboard_unreveal_launcher(self):
+ self._keyboard.release('^W')
+ sleep(1)
- def move_mouse_outside_of_boundry(self):
- self._mouse.move(self.x + (self.width *2), self._mouse.y)
- sleep(self.hide_timeout)
+ def grab_switcher(self):
+ self._keyboard.press_and_release('^A^1')
+ self.grabbed = True
- def is_showing(self):
- state = self.__get_state()
+ def switcher_enter_quicklist(self):
+ if self.grabbed:
+ self._keyboard.press_and_release('^R')
+
+ def switcher_exit_quicklist(self):
+ if self.grabbed:
+ self._keyboard.press_and_release('^L')
+
+ def start_switcher(self):
+ self._keyboard.press('^W^T')
+ self._keyboard.release('^T')
+ sleep(1)
+
+ def end_switcher(self, cancel):
+ if cancel:
+ self._keyboard.press_and_release('^E')
+ if self.grabbed != True:
+ self._keyboard.release('^W')
+ else:
+ if self.grabbed:
+ self._keyboard.press_and_release('\n')
+ else:
+ self._keyboard.release('^W')
+ self.grabbed = False
+
+ def switcher_next(self):
+ if self.grabbed:
+ self._keyboard.press_and_release('^D')
+ else:
+ self._keyboard.press_and_release('^T')
+
+ def switcher_prev(self):
+ if self.grabbed:
+ self._keyboard.press_and_release('^U')
+ else:
+ self._keyboard.press_and_release('^S^T')
+
+ def quicklist_open(self, monitor):
+ state = self.__get_state(monitor)
+ return bool(state['quicklist-open'])
+
+ def is_showing(self, monitor):
+ state = self.__get_state(monitor)
return not bool(state['hidden'])
-
- def __get_state(self):
+
+ def key_nav_is_active(self):
+ state = self.__get_controller_state()
+ return bool(state['key_nav_is_active'])
+
+ def key_nav_monitor(self):
+ state = self.__get_controller_state()
+ return int(state['key_nav_launcher_monitor'])
+
+ def key_nav_is_grabbed(self):
+ state = self.__get_controller_state()
+ return bool(state['key_nav_is_grabbed'])
+
+ def key_nav_selection(self):
+ state = self.__get_controller_state()
+ return int(state['key_nav_selection'])
+
+ def launcher_geometry(self, monitor):
+ state = self.__get_state(monitor);
+ x = int(state['x'])
+ y = int(state['y'])
+ width = int(state['width'])
+ height = int(state['height'])
+ return (x, y, width, height)
+
+ def num_launchers(self):
+ return len(super(Launcher, self).get_state('/Unity/LauncherController/Launcher'))
+
+ def __get_controller_state(self):
+ return super(Launcher, self).get_state('/Unity/LauncherController')[0]
+
+ def __get_state(self, monitor):
# get the state for the 'launcher' piece
- return super(Launcher, self).get_state('/Unity/Launcher')[0]
+ return super(Launcher, self).get_state('/Unity/LauncherController/Launcher[monitor=%s]' % (monitor))[0]
class UnityLauncherIconTooltip(Unity):
diff --git a/tests/autopilot/autopilot/tests/test_launcher.py b/tests/autopilot/autopilot/tests/test_launcher.py
index 924def309..c53831448 100644
--- a/tests/autopilot/autopilot/tests/test_launcher.py
+++ b/tests/autopilot/autopilot/tests/test_launcher.py
@@ -1,9 +1,12 @@
from testtools import TestCase
from testtools.matchers import Equals
+from testtools.matchers import LessThan
from autopilot.emulators.unity import Launcher
from autopilot.glibrunner import GlibRunner
+from time import sleep
+
class LauncherTests(TestCase):
run_test_with = GlibRunner
@@ -11,7 +14,108 @@ class LauncherTests(TestCase):
super(LauncherTests, self).setUp()
self.server = Launcher()
+ def test_launcher_switcher_ungrabbed(self):
+ """Tests basic key nav integration without keyboard grabs."""
+ sleep(.5)
+
+ self.server.start_switcher()
+ sleep(.5)
+
+ self.assertThat(self.server.key_nav_is_active(), Equals(True))
+ self.assertThat(self.server.key_nav_is_grabbed(), Equals(False))
+ self.assertThat(self.server.key_nav_selection(), Equals(0))
+
+ self.server.switcher_next()
+ sleep(.5)
+ self.assertThat(0, LessThan(self.server.key_nav_selection()))
+
+ self.server.switcher_prev()
+ sleep(.5)
+ self.assertThat(self.server.key_nav_selection(), Equals(0))
+
+ self.server.end_switcher(True)
+ sleep(.5)
+ self.assertThat(self.server.key_nav_is_active(), Equals(False))
+
+ def test_launcher_switcher_grabbed(self):
+ """Tests basic key nav integration via keyboard grab."""
+ sleep(.5)
+
+ self.server.grab_switcher()
+ sleep(.5)
+
+ self.assertThat(self.server.key_nav_is_active(), Equals(True))
+ self.assertThat(self.server.key_nav_is_grabbed(), Equals(True))
+ self.assertThat(self.server.key_nav_selection(), Equals(0))
+
+ self.server.switcher_next()
+ sleep(.5)
+ self.assertThat(0, LessThan(self.server.key_nav_selection()))
+
+ self.server.switcher_prev()
+ sleep(.5)
+ self.assertThat(self.server.key_nav_selection(), Equals(0))
+
+ self.server.end_switcher(True)
+ sleep(.5)
+ self.assertThat(self.server.key_nav_is_active(), Equals(False))
+
+ def test_launcher_switcher_quicklist_interaction(self):
+ """Tests that the key nav opens and closes quicklists properly and regrabs afterwards."""
+ self.server.move_mouse_to_right_of_launcher(0)
+ sleep(.5)
+
+ self.server.grab_switcher()
+ sleep(.5)
+
+ self.assertThat(self.server.key_nav_is_active(), Equals(True))
+ self.assertThat(self.server.key_nav_is_grabbed(), Equals(True))
+
+ self.server.switcher_next()
+ sleep(.5)
+
+ self.server.switcher_enter_quicklist()
+ sleep(.5)
+ self.assertThat(self.server.quicklist_open(0), Equals(True))
+ self.server.switcher_exit_quicklist()
+ sleep(.5)
+
+ self.assertThat(self.server.quicklist_open(0), Equals(False))
+ self.assertThat(self.server.key_nav_is_active(), Equals(True))
+ self.assertThat(self.server.key_nav_is_grabbed(), Equals(True))
+
+ self.server.end_switcher(True)
+ sleep(.5)
+ self.assertThat(self.server.key_nav_is_active(), Equals(False))
+
def test_reveal_on_mouse_to_edge(self):
- self.server.move_mouse_outside_of_boundry()
- self.server.move_mouse_to_reveal_pos()
- self.assertThat(self.server.is_showing(), Equals(True))
+ """Tests reveal of launchers by mouse pressure."""
+ num_launchers = self.server.num_launchers()
+
+ for x in range(num_launchers):
+ self.server.move_mouse_to_right_of_launcher(x)
+ self.server.reveal_launcher(x)
+ self.assertThat(self.server.is_showing(x), Equals(True))
+
+ def test_reveal_with_mouse_under_launcher(self):
+ """Tests that the launcher hides properly if the
+ mouse is under the launcher when it is revealed."""
+ num_launchers = self.server.num_launchers()
+
+ for x in range(num_launchers):
+ self.server.move_mouse_over_launcher(x)
+ self.server.keyboard_reveal_launcher()
+ self.server.keyboard_unreveal_launcher()
+ self.assertThat(self.server.is_showing(x), Equals(False))
+
+ def test_reveal_does_not_hide_again(self):
+ """Tests reveal of launchers by mouse pressure to ensure it doesn't automatically hide again."""
+ num_launchers = self.server.num_launchers()
+
+ for x in range(num_launchers):
+ self.server.move_mouse_to_right_of_launcher(x)
+ self.server.reveal_launcher(x)
+ sleep(2)
+ self.assertThat(self.server.is_showing(x), Equals(True))
+
+
diff --git a/tests/test_launcher_model.cpp b/tests/test_launcher_model.cpp
new file mode 100644
index 000000000..e64d3b9d6
--- /dev/null
+++ b/tests/test_launcher_model.cpp
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2011 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 3 along with this program. If not, see
+ * <http://www.gnu.org/licenses/>
+ *
+ * Authored by: Jason Smith <jason.smith@canonical.com>
+ *
+ */
+
+#include <gtest/gtest.h>
+
+#include "LauncherModel.h"
+#include "MockLauncherIcon.h"
+#include "AbstractLauncherIcon.h"
+
+#include <vector>
+
+
+using namespace unity::launcher;
+
+namespace
+{
+
+class EventListener
+{
+ public:
+ EventListener()
+ {
+ icon_added = false;
+ icon_removed = false;
+ }
+
+ void OnIconAdded (AbstractLauncherIcon* icon)
+ {
+ icon_added = true;
+ }
+
+ void OnIconRemoved (AbstractLauncherIcon* icon)
+ {
+ icon_removed = true;
+ }
+
+ bool icon_added;
+ bool icon_removed;
+};
+//bool seen_result;
+
+TEST(TestLauncherModel, TestConstructor)
+{
+ LauncherModel::Ptr model(new LauncherModel());
+ EXPECT_EQ(model->Size(), 0);
+}
+
+TEST(TestLauncherModel, TestAdd)
+{
+ AbstractLauncherIcon* first = new MockLauncherIcon();
+ LauncherModel::Ptr model(new LauncherModel());
+
+ EXPECT_EQ(model->Size(), 0);
+ model->AddIcon(first);
+ EXPECT_EQ(model->Size(), 1);
+}
+
+TEST(TestLauncherModel, TestRemove)
+{
+ AbstractLauncherIcon* first = new MockLauncherIcon();
+ LauncherModel::Ptr model(new LauncherModel());
+
+ EXPECT_EQ(model->Size(), 0);
+ model->AddIcon(first);
+ EXPECT_EQ(model->Size(), 1);
+ model->RemoveIcon(first);
+ EXPECT_EQ(model->Size(), 0);
+}
+
+TEST(TestLauncherModel, TestAddSignal)
+{
+ AbstractLauncherIcon* first = new MockLauncherIcon();
+ LauncherModel::Ptr model(new LauncherModel());
+
+ EventListener *listener = new EventListener();
+
+ model->icon_added.connect(sigc::mem_fun(listener, &EventListener::OnIconAdded));
+ model->AddIcon(first);
+ EXPECT_EQ(listener->icon_added, true);
+
+ delete listener;
+}
+
+TEST(TestLauncherModel, TestRemoveSignal)
+{
+ AbstractLauncherIcon* first = new MockLauncherIcon();
+ LauncherModel::Ptr model(new LauncherModel());
+
+ EventListener *listener = new EventListener();
+
+ model->icon_removed.connect(sigc::mem_fun(listener, &EventListener::OnIconRemoved));
+ model->AddIcon(first);
+ EXPECT_EQ(listener->icon_removed, false);
+ model->RemoveIcon(first);
+ EXPECT_EQ(listener->icon_removed, true);
+
+ delete listener;
+}
+
+TEST(TestLauncherModel, TestSort)
+{
+ AbstractLauncherIcon* first = new MockLauncherIcon();
+ AbstractLauncherIcon* second = new MockLauncherIcon();
+ AbstractLauncherIcon* third = new MockLauncherIcon();
+ AbstractLauncherIcon* fourth = new MockLauncherIcon();
+
+ LauncherModel::Ptr model(new LauncherModel());
+
+ third->SetSortPriority(0);
+ model->AddIcon(third);
+
+ first->SetSortPriority(-1);
+ model->AddIcon(first);
+
+ fourth->SetSortPriority(2);
+ model->AddIcon(fourth);
+
+ second->SetSortPriority(0);
+ model->AddIcon(second);
+
+ LauncherModel::iterator it;
+ it = model->begin();
+
+ EXPECT_EQ(first, *it);
+ it++;
+ EXPECT_EQ(second, *it);
+ it++;
+ EXPECT_EQ(third, *it);
+ it++;
+ EXPECT_EQ(fourth, *it);
+}
+
+TEST(TestLauncherModel, TestReorderBefore)
+{
+ AbstractLauncherIcon* first = new MockLauncherIcon();
+ AbstractLauncherIcon* second = new MockLauncherIcon();
+ AbstractLauncherIcon* third = new MockLauncherIcon();
+ AbstractLauncherIcon* fourth = new MockLauncherIcon();
+
+ LauncherModel::Ptr model(new LauncherModel());
+
+ first->SetSortPriority(0);
+ second->SetSortPriority(1);
+ third->SetSortPriority(2);
+ fourth->SetSortPriority(3);
+
+ model->AddIcon(first);
+ model->AddIcon(second);
+ model->AddIcon(third);
+ model->AddIcon(fourth);
+
+ model->ReorderBefore(third, second, false);
+
+ LauncherModel::iterator it;
+ it = model->begin();
+
+ EXPECT_EQ(first, *it);
+ it++;
+ EXPECT_EQ(third, *it);
+ it++;
+ EXPECT_EQ(second, *it);
+ it++;
+ EXPECT_EQ(fourth, *it);
+}
+
+TEST(TestLauncherModel, TestReorderSmart)
+{
+ AbstractLauncherIcon* first = new MockLauncherIcon();
+ AbstractLauncherIcon* second = new MockLauncherIcon();
+ AbstractLauncherIcon* third = new MockLauncherIcon();
+ AbstractLauncherIcon* fourth = new MockLauncherIcon();
+
+ LauncherModel::Ptr model(new LauncherModel());
+
+ first->SetSortPriority(0);
+ second->SetSortPriority(1);
+ third->SetSortPriority(2);
+ fourth->SetSortPriority(3);
+
+ model->AddIcon(first);
+ model->AddIcon(second);
+ model->AddIcon(third);
+ model->AddIcon(fourth);
+
+ model->ReorderSmart(third, second, false);
+
+ LauncherModel::iterator it;
+ it = model->begin();
+
+ EXPECT_EQ(first, *it);
+ it++;
+ EXPECT_EQ(third, *it);
+ it++;
+ EXPECT_EQ(second, *it);
+ it++;
+ EXPECT_EQ(fourth, *it);
+}
+
+}