summaryrefslogtreecommitdiff
diff options
authorBrandon Schaefer <brandontschaefer@gmail.com>2012-08-10 10:42:45 -0700
committerBrandon Schaefer <brandontschaefer@gmail.com>2012-08-10 10:42:45 -0700
commitd7f688b344ed13af76cbb9096c4dbf101e9886bd (patch)
tree07315613392bffb88c7252a985f778e599e79153
parent914bafa3fc58355122be510de4a166f93aa767e7 (diff)
parent0c9f0ef0dda3d34abf3de49d98a620614b37d8c1 (diff)
* Merged trunk.
(bzr r2529.9.10)
-rw-r--r--AUTHORS5
-rw-r--r--CMakeLists.txt7
-rw-r--r--ChangeLog1505
-rw-r--r--HACKING1
-rw-r--r--UnityCore/CMakeLists.txt4
-rw-r--r--UnityCore/HomeLens.cpp6
-rw-r--r--dash/ResultView.cpp2
-rw-r--r--dash/ResultViewGrid.cpp2
-rw-r--r--launcher/AbstractLauncherIcon.h70
-rw-r--r--launcher/BFBLauncherIcon.cpp8
-rw-r--r--launcher/BamfLauncherIcon.cpp36
-rw-r--r--launcher/BamfLauncherIcon.h6
-rw-r--r--launcher/CMakeLists.txt1
-rw-r--r--launcher/DesktopLauncherIcon.cpp6
-rw-r--r--launcher/DeviceLauncherIcon.cpp16
-rw-r--r--launcher/FavoriteStoreGSettings.cpp48
-rw-r--r--launcher/FavoriteStoreGSettings.h10
-rw-r--r--launcher/GeisAdapter.cpp521
-rw-r--r--launcher/GeisAdapter.h172
-rw-r--r--launcher/HudLauncherIcon.cpp16
-rw-r--r--launcher/Launcher.cpp307
-rw-r--r--launcher/Launcher.h11
-rw-r--r--launcher/LauncherController.cpp32
-rw-r--r--launcher/LauncherIcon.cpp76
-rw-r--r--launcher/LauncherIcon.h4
-rw-r--r--launcher/LauncherModel.cpp14
-rw-r--r--launcher/MockLauncherIcon.h10
-rw-r--r--launcher/SoftwareCenterLauncherIcon.cpp12
-rw-r--r--launcher/SpacerLauncherIcon.cpp6
-rw-r--r--launcher/StandaloneLauncher.cpp1
-rw-r--r--launcher/SwitcherController.cpp9
-rw-r--r--launcher/SwitcherModel.cpp2
-rw-r--r--launcher/TrashLauncherIcon.cpp40
-rw-r--r--launcher/TrashLauncherIcon.h14
-rw-r--r--manual-tests/Launcher.txt28
-rw-r--r--panel/PanelIndicatorEntryView.cpp3
-rw-r--r--panel/PanelMenuView.cpp2
-rw-r--r--plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp2
-rw-r--r--plugins/unitydialog/src/unitydialog.cpp7
-rw-r--r--plugins/unityshell/CMakeLists.txt3
-rw-r--r--plugins/unityshell/src/GestureEngine.cpp280
-rw-r--r--plugins/unityshell/src/GestureEngine.h68
-rw-r--r--plugins/unityshell/src/UnityGestureBroker.cpp129
-rw-r--r--plugins/unityshell/src/UnityGestureBroker.h45
-rw-r--r--plugins/unityshell/src/UnityGestureTarget.cpp54
-rw-r--r--plugins/unityshell/src/UnityGestureTarget.h44
-rw-r--r--plugins/unityshell/src/WindowGestureTarget.cpp215
-rw-r--r--plugins/unityshell/src/WindowGestureTarget.h57
-rw-r--r--plugins/unityshell/src/nux-layout-accessible.cpp2
-rw-r--r--plugins/unityshell/src/unity-launcher-accessible.cpp2
-rw-r--r--plugins/unityshell/src/unity-launcher-icon-accessible.cpp2
-rw-r--r--plugins/unityshell/src/unity-switcher-accessible.cpp2
-rw-r--r--plugins/unityshell/src/unityshell.cpp71
-rw-r--r--plugins/unityshell/src/unityshell.h19
-rw-r--r--po/POTFILES.in4
-rw-r--r--services/panel-main.c8
-rw-r--r--tests/CMakeLists.txt16
-rw-r--r--tests/autopilot/unity/tests/launcher/test_icon_behavior.py58
-rw-r--r--tests/autopilot/unity/tests/test_dash.py11
-rw-r--r--tests/autopilot/unity/tests/test_panel.py4
-rw-r--r--tests/autopilot/unity/tests/test_quicklist.py36
-rw-r--r--tests/autopilot/unity/tests/test_switcher.py36
-rw-r--r--tests/test-gesture-engine/CMakeLists.txt40
-rw-r--r--tests/test-gesture-engine/GeisAdapterMock.cpp31
-rw-r--r--tests/test-gesture-engine/GeisAdapterMock.h148
-rw-r--r--tests/test-gesture-engine/test_gesture_engine.cpp251
-rw-r--r--tests/test-gestures/CMakeLists.txt71
-rw-r--r--tests/test-gestures/FakeGestureEvent.h63
-rw-r--r--tests/test-gestures/NuxMock.h19
-rw-r--r--tests/test-gestures/PluginAdapterMock.cpp (renamed from tests/test-gesture-engine/PluginAdapterMock.cpp)0
-rw-r--r--tests/test-gestures/PluginAdapterMock.h (renamed from tests/test-gesture-engine/PluginAdapterMock.h)0
-rw-r--r--tests/test-gestures/UnityGestureTargetMock.h15
-rw-r--r--tests/test-gestures/WindowGestureTargetMock.h55
-rw-r--r--tests/test-gestures/X11_mock.cpp (renamed from tests/test-gesture-engine/X11_mock.cpp)0
-rw-r--r--tests/test-gestures/X11_mock.h (renamed from tests/test-gesture-engine/X11_mock.h)0
-rw-r--r--tests/test-gestures/compiz_mock/core/core.h (renamed from tests/test-gesture-engine/compiz_mock/core/core.h)0
-rw-r--r--tests/test-gestures/compiz_mock/core/screen.h (renamed from tests/test-gesture-engine/compiz_mock/core/screen.h)35
-rw-r--r--tests/test-gestures/compiz_mock/core/window.h (renamed from tests/test-gesture-engine/compiz_mock/core/window.h)56
-rw-r--r--tests/test-gestures/sed_script_broker11
-rw-r--r--tests/test-gestures/sed_script_gesture (renamed from tests/test-gesture-engine/sed_script)8
-rw-r--r--tests/test-gestures/test_gesture_broker.cpp137
-rw-r--r--tests/test-gestures/test_gestures_main.cpp56
-rw-r--r--tests/test-gestures/test_window_gesture_target.cpp235
-rw-r--r--tests/test-gestures/ubus-server-mock.cpp (renamed from tests/test-gesture-engine/ubus-server-mock.cpp)0
-rw-r--r--tests/test-gestures/ubus-server-mock.h (renamed from tests/test-gesture-engine/ubus-server-mock.h)0
-rw-r--r--tests/test-gestures/unityshell_mock.h52
-rw-r--r--tests/test_favorite_store_gsettings.cpp77
-rw-r--r--tests/test_launcher.cpp6
-rw-r--r--tests/test_launcher_controller.cpp33
-rw-r--r--tests/test_main.cpp2
-rw-r--r--tests/test_panel_style.cpp81
-rw-r--r--tests/test_switcher_controller.cpp14
-rw-r--r--unity-shared/BGHash.cpp2
-rw-r--r--unity-shared/DashStyle.cpp2
-rw-r--r--unity-shared/IconRenderer.cpp5
-rw-r--r--unity-shared/PanelStyle.cpp25
-rw-r--r--unity-shared/PanelStyle.h8
-rw-r--r--unity-shared/PluginAdapterCompiz.cpp2
-rw-r--r--unity-standalone/StandaloneUnity.cpp1
99 files changed, 3587 insertions, 2142 deletions
diff --git a/AUTHORS b/AUTHORS
index e2c2fd90a..e7cf1f0f1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -37,6 +37,7 @@
Didier Roche <didrocks@ubuntu.com>
foxoman <foxoman.u@gmail.com>
Gabor Kelemen <kelemeng@ubuntu.com>
+ Gary Lasker <gary.lasker@canonical.com>
Gordon Allott <gord.allott@canonical.com>
Henri De Veene <henri.deveene@gmail.com>
Jani Monoses <jani.monoses@canonical.com>
@@ -55,6 +56,7 @@
Jay Taoko <jay.taoko@canonical.com>, Mirco Müller <mirco.mueller@ubuntu.com>
Jay Taoko <jay.taoko@canonical.com>, Robert Carr <racarr@canonical.com>
Jeremy Bicha <jbicha@ubuntu.com>
+ jokerdino@bvm128.zdom.org
Kevin DuBois <kevin.dubois@canonical.com>
Koichi Akabe <vbkaisetsu@gmail.com>
Lars Uebernickel <lars.uebernickel@canonical.com>
@@ -75,7 +77,9 @@
Marco Trevisan (Treviño) <mail@3v1n0.net>, Thomi Richards <thomi.richards@canonical.com>
Marius Gedminas <marius@gedmin.as>
Martin Albisetti <argentina@gmail.com>
+ Martin Mrazik <martin.mrazik@canonical.com>
Martin Mrazik <mrazik@gmail.com>
+ MC Return <mc.return@gmx.net>
Michael Rawson <michaelrawson76@gmail.com>
Michael Terry <michael.terry@canonical.com>
Michael Terry <mike@mterry.name>
@@ -91,6 +95,7 @@
Paolo Rotolo <paolorotolo@ubuntu-it.org>
Paul Sladen <sladen@canonical.com>
Paul Sladen <sladen@canonical.com>, Andrea Cimitan <andrea.cimitan@canonical.com>
+ Pawel Stolowski <pawel.stolowski@canonical.com>
Rafał Cieślak <rafalcieslak256@gmail.com>
Ricardo Mendoza <ricardo.mendoza@canonical.com>
Robert Carr <racarr@canonical.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac6990d02..069f7b534 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ include (cmake/Documentation.cmake)
#
set (PROJECT_NAME "unity")
set (UNITY_MAJOR 6)
-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 "6.0")
@@ -133,11 +133,14 @@ endif (DISABLE_MAINTAINER_CFLAGS)
#
# Compiz Plugins
#
-set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.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>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;libutouch-geis;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.93.1")
+
+set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.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>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.93.1")
# FIXME: unity-protocol-private shouldn't be there, but building of unityshell is just broken
+set (UNITY_PROTOCOL_PRIVATE_DEPS "unity-protocol-private>=5.93.1")
find_package (PkgConfig)
pkg_check_modules (CACHED_UNITY_DEPS REQUIRED ${UNITY_PLUGIN_DEPS})
+pkg_check_modules (CACHED_UNITY_PRIVATE_DEPS REQUIRED ${UNITY_PROTOCOL_PRIVATE_DEPS})
add_subdirectory(unity-shared)
add_subdirectory(panel)
add_subdirectory(dash)
diff --git a/ChangeLog b/ChangeLog
index 59866cb19..3175dde5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,1508 @@
+2012-08-09 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Calculator and Mahjongg can only have 1 instances now; this breaks AP tests. Character map is now used when you need more then 1 instance.. Fixes: . Approved by Łukasz Zemczak.
+
+2012-08-09 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Fixs panel test
+
+2012-08-08 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * You cannot have 2 gcalctools open anymore. Switched to Character map
+
+2012-08-09 Thomi Richards <thomi.richards@canonical.com>
+
+ Use the new clipboard emulator in autopilot. Fixes some hanging tests.. Fixes: . Approved by Brandon Schaefer.
+
+2012-08-03 Thomi Richards <thomi.richards@canonical.com>
+
+ Don't use the gtk Clipboard class. Instead, use the new clipboard emulator in autopilot.
+
+2012-08-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Cherrypick rev 2539 from lp:~3v1n0/unity/launcher-icon-construction-type.. Fixes: . Approved by Łukasz Zemczak.
+
+2012-08-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Cherrypick rev 2539 from lp:~3v1n0/unity/launcher-icon-construction-type. Thank you Marco.
+
+2012-08-09 Sebastien Bacher <seb128@ubuntu.com>
+
+ Update the POTFILE.in list of sources. Fixes: . Approved by Łukasz Zemczak.
+
+2012-08-09 Sebastien Bacher <seb128@ubuntu.com>
+
+ Update sources in POTFILES.in
+
+2012-08-03 Andrea Azzarone <azzaronea@gmail.com>
+
+ Revert rev 2525. Fixes: . Approved by Michal Hruby.
+
+2012-08-03 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-08-03 Andrea Azzarone <azzaronea@gmail.com>
+
+ Revert rev 2525.
+
+2012-08-03 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ FavoriteStoreGSettings: remove unneeded methods, use glib::Signal, refactor tests to use memory backend. Fixes: . Approved by Brandon Schaefer.
+
+2012-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ FavoriteStoreGSettings: use constant values for settings name and keys
+
+2012-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ FavoriteStoreGSettings: remove unneeded methods, use glib::Signal
+
+2012-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_favorite_store_gsettings: refactored to use gsettings memory backend
+
+ Plus remove unneeded timeouts
+
+2012-08-03 Sebastien Bacher <seb128@ubuntu.com>
+
+ Don't specify a specific destination for the dbus signals. Fixes: https://bugs.launchpad.net/bugs/1014850. Approved by Michal Hruby.
+
+2012-08-02 Sebastien Bacher <seb128@ubuntu.com>
+
+ Don't specify a specific destination for the dbus signals, that
+ creates issues with the new dbus eavedropping behaviour,
+ thanks Neil J. Patel for the fix!
+
+2012-08-03 Łukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
+
+ Add the libunity private directory to unityshell.so and libunity-core-6.0.so RPATHs, so that they can easily find the libunity-protocol-private.so library on load.. Fixes: . Approved by Michal Hruby.
+
+2012-08-03 Łukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
+
+ As proposed by mhr3, we just re-add unity-protocol-private to the main deps
+
+2012-08-03 Łukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
+
+ Fixed some build issues to incomplete merges and invalid thought process
+
+2012-08-03 Łukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
+
+ Merge in latest trunk changes
+
+2012-08-03 Łukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
+
+ Also added the same RPATH for unity-core.
+
+2012-08-02 Łukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
+
+ Add the libunity private directory to unityshell.so RPATH, so that it can easily find the libunity-protocol-private.so library on load.
+
+2012-08-03 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ unityshell: fix the nvidia crash on glDrawArrays disabling/enabling the client state on nuxPrologue/Epilogue (LP: #982626) (LP: #1031554). Fixes: https://bugs.launchpad.net/bugs/982626, https://bugs.launchpad.net/bugs/1031554. Approved by Daniel van Vugt, Sam Spilsbury.
+
+2012-08-01 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ unityshell: fix the nvidia crash on glDrawArrays disabling/enabling the client state on nuxPrologue/Epilogue
+
+2012-08-03 jokerdino@bvm128.zdom.org
+
+ Add keyboard shortcut for the video lens in the shortcut overlay.. Fixes: https://bugs.launchpad.net/bugs/937334. Approved by Łukasz Zemczak.
+
+2012-07-16 jokerdino@bvm128.zdom.org
+
+ Add shortcut for video lens
+
+2012-08-03 MC Return <mc.return@gmx.net>
+
+ Optimized performance and style following suggestions reported by cppcheck:
+
+ 1. Reduced the scope of various variables.
+
+ 2. Used prefix ++ operators for non-primitive types, because those can be more efficient than post-increment. Post-increment usually keeps a copy of the previous value, adds extra code and is slower.. Fixes: . Approved by Brandon Schaefer, Marco Trevisan (Treviño).
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variable 'TextureObjectLocation' in IconRenderer.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variable 'radius' in DashStyle.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variable 'closest_diff' in BGHash.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variable 'useFbo' in unityshell.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variable 'key_code' in unityshell.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variables 'hdirection' and 'vdirection' in unitydialog.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variable 'fading_pixels' in PanelMenuView.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Reduced the scope of the variable 'text_width' in PanelIndicatorEntryView.cpp
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in PluginAdapterCompiz.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in IconRenderer.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in unityshell.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in unity-switcher-accessible.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in unity-launcher-accessible.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in nux-layout-accessible.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in unitydialog.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in unity-mt-grab-handles.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issues in LauncherModel.cpp by replacement of postfix ++ operators with prefix ones
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in LauncherController.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issues in Launcher.cpp by replacement of postfix ++ operators with prefix ones
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in ResultViewGrid.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issue in ResultView.cpp by replacement of postfix ++ operator with prefix one
+
+2012-07-30 MC Return <mc.return@gmx.net>
+
+ Fixed possible performance issues in HomeLens.cpp by replacement of postfix ++ operators with prefix ones
+
+2012-08-03 Andrea Azzarone <azzaronea@gmail.com>
+
+ Don't set mouse position on mouse leaving.. Fixes: https://bugs.launchpad.net/bugs/980942. Approved by Brandon Schaefer.
+
+2012-08-02 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix bug 980942.
+
+2012-08-03 Andrea Azzarone <azzaronea@gmail.com>
+
+ Remove gconf dep in panel::Style.. Fixes: . Approved by Marco Trevisan (Treviño).
+
+2012-08-01 Andrea Azzarone <azzaronea@gmail.com>
+
+ Use glib::Signal.
+
+2012-08-01 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix indent bug.
+
+2012-08-01 Andrea Azzarone <azzaronea@gmail.com>
+
+ Use g_setenv("GSETTINGS_BACKEND", "memory", TRUE);
+
+2012-08-01 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor changes.
+
+2012-08-01 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add unit test.
+
+2012-08-01 Andrea Azzarone <azzaronea@gmail.com>
+
+ Remove check. This key is installed on precise too.
+
+2012-08-01 Andrea Azzarone <azzaronea@gmail.com>
+
+ Don't use glib::Signal for "changed" signal.
+
+2012-07-31 Andrea Azzarone <azzaronea@gmail.com>
+
+ Remove gconf dep in panel::Style.
+
+2012-08-03 Daniel d'Andrada <daniel.dandrada@canonical.com>
+
+ use the gestures support from nux instead of talking to libgeis directly.. Fixes: . Approved by .
+
+2012-07-27 Daniel d'Andrada <daniel.dandrada@canonical.com>
+
+ make tests compilation succeed even if compiz lib is at a non-standard dir
+
+2012-07-27 Daniel d'Andrada <daniel.dandrada@canonical.com>
+
+ Use gestures support from Nux and adapt code for regular gesture rules
+
+ Remove GeisAdapter as we are getting gesture events from Nux instead.
+
+ Then modify code to handle geisv2-style gestures. They require
+ acceptance/rejection and enable multiple simultaneous gestures
+
+2012-08-02 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ The switcher causes a crash if the current desktop has zero results. (Can only happen if you disable Show Desktop Icon). Fixes: . Approved by Marco Trevisan (Treviño).
+
+2012-08-01 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * added and fixed test
+
+2012-08-01 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * fixes a crash if zero results are there in a current workspace
+
+2012-07-30 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Add the option to disable the ShowDesktop icon in the switcher in CCSM.. Fixes: . Approved by Marco Trevisan (Treviño).
+
+2012-07-30 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Adds a unit test
+
+2012-07-27 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Removed extra space
+
+2012-07-27 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ *Merged trunk. Fixed an AP test
+
+2012-07-26 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Fixed AP test, as well as the switcher code
+
+2012-07-26 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Now the switcher ap test will run all test with and with out the Show Desktop icon.
+
+2012-07-26 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Adds the option to disable the ShowDesktop icon in the switcher
+
+2012-07-30 Andrea Azzarone <azzaronea@gmail.com>
+
+ Avoid extra calls to GetGeometry and GetAbsoluteGeometry.. Fixes: . Approved by Marco Trevisan (Treviño).
+
+2012-07-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Avoid calls to GetGeometry and GetAbsoluteGeometry.
+
+2012-07-29 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix typo in QuicklistView::RecvItemMouseDrag. It was the cause of the bug #1027955.. Fixes: https://bugs.launchpad.net/bugs/1027955. Approved by Marco Trevisan (Treviño).
+
+2012-07-25 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix typo.
+
+2012-07-25 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix bug 1027955.
+
+2012-07-27 Pawel Stolowski <pawel.stolowski@canonical.com>
+
+ Added image_source_uri property to Preview base class. Fixes: . Approved by Michal Hruby.
+
+2012-07-26 Pawel Stolowski <pawel.stolowski@canonical.com>
+
+ Previews: renamed image_source to image_source_uri in unity protocol lib.
+
+2012-07-26 Pawel Stolowski <pawel.stolowski@canonical.com>
+
+ Require unity-protocol-private 5.93.1, not 5.94.0.
+
+2012-07-26 Pawel Stolowski <pawel.stolowski@canonical.com>
+
+ Previews: renamed thumbnail to image in protocol lib.
+
+2012-07-26 Pawel Stolowski <pawel.stolowski@canonical.com>
+
+ Bumped required verison of unity-protocol-private.
+
+2012-07-26 Pawel Stolowski <pawel.stolowski@canonical.com>
+
+ Previews: renamed image_source preview property to image_source_uri.
+
+2012-07-26 Pawel Stolowski <pawel.stolowski@canonical.com>
+
+ Previews - added image_source preview property (wraps thumbnail_source from the libunity protocol).
+
+2012-07-27 Andrea Azzarone <azzaronea@gmail.com>
+
+ Remove "strut hack" in launcher.cpp. Fixes: https://bugs.launchpad.net/bugs/1024113. Approved by Marco Trevisan (Treviño), jenkins.
+
+2012-07-27 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor change.
+
+2012-07-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix typo.
+
+2012-07-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add manual test.
+
+2012-07-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-07-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Remove strut hack. It seems to cause bug 1024113.
+
+2012-07-26 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ The switcher in detail mode will now focus the last active window, instead of the current one. If the current focus window activated the switcher.. Fixes: https://bugs.launchpad.net/bugs/1029215. Approved by Christopher Lee.
+
+2012-07-25 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Fixes detail mode not selecting the last active window.
+ * This also fixes the problem with Detail mode swaping icons.
+
+2012-07-26 Martin Mrazik <martin.mrazik@canonical.com>
+
+ Fixed few manual test-cases which were not consistent with the TEST_TEMPLATE.txt and other manual test-cases.. Fixes: . Approved by Thomi Richards.
+
+2012-07-25 Martin Mrazik <martin.mrazik@canonical.com>
+
+ Fixed occurence of Expected Result_s_
+
+2012-07-25 Martin Mrazik <martin.mrazik@canonical.com>
+
+ Changing few manual tests to be consistent with the TEST_TEMPLATE.txt
+
+2012-07-26 Thomi Richards <thomi.richards@canonical.com>
+
+ Make the autopilot unity logging functions more stable when unity crashes & restarts.. Fixes: . Approved by Christopher Lee.
+
+2012-07-27 Thomi Richards <thomi.richards@canonical.com>
+
+ Don't cache the unity debug logging dbus interface, so if unity crashes and comes back we can continue the test run.
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherController: Rewritten EnsureLaunchers() added tests, fix a crash caused by invalid barrier subscriptions.. Fixes: https://bugs.launchpad.net/bugs/1020075. Approved by Andrea Azzarone.
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_launcher_controller: initialize also GeisAdapter
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: use auto const& for type
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merging with trunk
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_launcher_controller: more barrier subscriptions tests
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_launcher_controller: check the barrier controller subscriptions
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherController: make TestLauncherController friend of it
+
+2012-07-26 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: make GetSubscriber public
+
+2012-07-25 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherController: move launcher::Controller::Impl definition in LauncherControllerPrivate
+
+ So that we can test it!
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: add subscribing tests
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: Add test for GetSubscriber
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: fix the monitor/size comparisons
+
+ This fixes a crash, plus add GetSubscriber protected member
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: check the breaking events with invalid monitor values
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_uscreen_mock.h: add MockUscreen and use it in tests
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherController: use only one cycle to ensure launchers, and correctly unsubscribe barriers
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_launcher_controller: test removal of internal monitors
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_launcher_controller: add switching tests
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_launcher_controller: added multimonitor launchers tests
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: be safer, always resize the barrier list on setup barriers
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UScreen: make the default screen a static member, so that we can mock it
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_launcher_controller: added basic LauncherController test
+
+2012-07-24 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ SoftwareCenterLauncherIcon: avoid the "Waiting to Install" tooltip to stay after installation
+
+ Be consistent with auto-hiding launcher.. Fixes: https://bugs.launchpad.net/bugs/925014. Approved by Brandon Schaefer, Tim Penhey, Marco Trevisan (Treviño).
+
+2012-06-06 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix string{,.h} include, thanks Tim
+
+2012-06-05 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ If the aptdaemon transaction ID isn't supplied, then don't change tooltip to "Waiting to install" (Bug #925014)
+
+2012-07-24 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ The launcher will auto hide when installing a program from the software center now.. Fixes: https://bugs.launchpad.net/bugs/1002440. Approved by Brandon Schaefer, Marco Trevisan (Treviño).
+
+2012-06-17 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Fix string comparison with SC agent, thanks Tim
+
+2012-06-13 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Merge from trunk
+
+2012-06-13 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Semicolon missed, ah well, blame Python.
+
+2012-06-13 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Return early if the desktop file wasn't specified, or is set to SC agent
+
+2012-06-09 Bilal Akhtar <bilalakhtar@ubuntu.com>
+
+ Unhide launcher only when the animation is feasable (with a desktop file and all) LP: #1002440
+
+2012-07-24 Gary Lasker <gary.lasker@canonical.com>
+
+ manual-tests/SoftwareCenter.txt: added tests for Ubuntu Software Center/Unity launcher integration feature. Fixes: . Approved by Brandon Schaefer, jenkins.
+
+2012-07-22 Gary Lasker <gary.lasker@canonical.com>
+
+ fix typo
+
+2012-07-21 Gary Lasker <gary.lasker@canonical.com>
+
+ clarify tests per Brandon Schaefer's recommendations in the corresponding Unity 5.0 branch MR, https://code.launchpad.net/~gary-lasker/unity/software-center-launcher-integration-tests-for-5.0/+merge/114241
+
+2012-07-21 Gary Lasker <gary.lasker@canonical.com>
+
+ merge trunk
+
+2012-06-25 Gary Lasker <gary.lasker@canonical.com>
+
+ more test details
+
+2012-06-25 Gary Lasker <gary.lasker@canonical.com>
+
+ additional tests to round out the suite, these will thoroughly test all of the bug fixes for Unity branch https://code.launchpad.net/~bilalakhtar/unity/5.0series-sru-software-center-integration-fixes/+merge/110214 and the corresponding Software Center branch https://code.launchpad.net/~gary-lasker/software-center/unity-launcher-integration-fixes
+
+2012-06-25 Gary Lasker <gary.lasker@canonical.com>
+
+ start adding a suite of manual tests for the Ubuntu Software Center Unity launcher integration feature
+
+2012-07-24 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ BarrierEdgeController, PointerBarrier: release the sticky edge after that the user has broken it for configurable ms. Fixes: https://bugs.launchpad.net/bugs/1020058. Approved by jenkins, Brandon Schaefer.
+
+2012-07-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: disable the lambda based proxy version
+
+ Nux does not support that yet
+
+2012-07-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: add test for sticky edge property
+
+2012-07-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: make sticky_edges property a proxy to launcher options
+
+2012-07-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ unityshell.xml.in: changed the short name of the setting
+
+2012-07-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ merging with trunk
+
+2012-07-20 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: added tests for temporary released barrier
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: no need to explictly set an unhandling subscriber
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: add MakeBarrierEvent function to generate events
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: add tests to check the event Processing
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: add ProcessBarrierEvent as protected member
+
+ So we can use it for testing
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_edge_barrier_controller: added skeleton test
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: use make_shared, avoid unneeded namespaces
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_pointer_barrier.cpp can be xless
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_pointer_barrier: added tests for PointerBarrier
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PointerBarrier: make pointer barrier more testable
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PointerBarrier: use reinterpret cast
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ unityshell: add option to set the launcher sticky edge disabled duration
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: use the launcher option to set the disable timeout duration
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherOptions: add edge_passed_disabled_time option
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherOptions: use initializer list
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: use the barrier's released property to disable the sticky edge
+
+2012-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PointerBarrier: add released property, if set remove the notify delay
+
+2012-07-18 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: temporary disable the barrier when just passed through
+
+2012-07-18 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibSource: use std::to_string instead of lexical cast
+
+2012-07-18 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PointerBarrier: use by-value callback data instead of class data in timeout
+
+ Also use initializer list in BarrierEvent
+
+2012-07-18 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherHideMachine, LauncherHoverMachine: use std::to_string instead of boost
+
+2012-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: use unsigned integers for monitor
+
+ (remove evil casts)
+
+2012-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherHideMachine, EdgeBarrierController: use stack allocated Decaymulator
+
+2012-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ EdgeBarrierController: use std::unique_ptr for pimpl
+
+ FIXES MEMORY LEAK!
+
+2012-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherController: use stack allcoated EdgeBarrierController
+
+2012-07-23 Martin Mrazik <martin.mrazik@canonical.com>
+
+ Adding gtest_output=xml to unit tests to generate Junit XML. Fixes: . Approved by Tim Penhey, jenkins, Sam Spilsbury.
+
+2012-06-13 Martin Mrazik <martin.mrazik@canonical.com>
+
+ Adding gtest_output=xml to unit tests to generate Junit XML
+
+2012-07-23 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ KeyboardUtil: fix possible crash if XkbGetKeyboard returns null
+
+ Also use initializer list. Fixes: https://bugs.launchpad.net/bugs/920258. Approved by Tim Penhey, Andrea Azzarone, jenkins.
+
+2012-07-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ KeyboardUtil: fixed typo
+
+2012-07-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ KeyboardUtil: oops fix return value.
+
+2012-07-06 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ KeyboardUtil: fix possible crash if XkbGetKeyboard returns null
+
+ Also use initializer list
+
+2012-07-22 Tim Penhey <tim.penhey@canonical.com>
+
+ Remove the -Wno-uninitialized to bring back the compiler warning for uninitialized variables.. Fixes: . Approved by Christopher Lee.
+
+2012-07-23 Tim Penhey <tim.penhey@canonical.com>
+
+ Initialize some colors.
+
+2012-07-23 Tim Penhey <tim.penhey@canonical.com>
+
+ Make sure that weight is always set.
+
+2012-07-23 Tim Penhey <tim.penhey@canonical.com>
+
+ Merge trunk.
+
+2012-07-18 Tim Penhey <tim.penhey@canonical.com>
+
+ Stop turning off the uninitialized check.
+
+2012-07-19 Martin Mrazik <martin.mrazik@canonical.com>
+
+ Making manual test-cases consistent with TEST_TEMPLATE.txt. Fixes: . Approved by Tim Penhey, jenkins.
+
+2012-07-12 Martin Mrazik <martin.mrazik@canonical.com>
+
+ updated README.txt
+
+2012-07-12 Martin Mrazik <martin.mrazik@canonical.com>
+
+ Making manual test-cases consistent with TEST_TEMPLATE.txt
+
+2012-07-19 Didier Roche <didier.roche@canonical.com>
+
+ Migration session from /desktop/unity/ to /com/canonical/unity/ as the dconf
+ documentation recommends. Fixes: . Approved by jenkins, Michal Hruby.
+
+2012-07-19 Didier Roche <didier.roche@canonical.com>
+
+ move schema and value from old /desktop/unity/ location to /com/canonical/unity/ new one as the dconf documentation recommends
+
+2012-07-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix duplicated device launcher icons.. Fixes: https://bugs.launchpad.net/bugs/1010714, https://bugs.launchpad.net/bugs/1010858. Approved by Marco Trevisan (Treviño).
+
+2012-07-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix build issue on precise.
+
+2012-07-19 Andrea Azzarone <azzaronea@gmail.com>
+
+ Remove _ prefix.
+
+2012-07-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor change.
+
+2012-07-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix build issue.
+
+2012-07-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix build issue.
+
+2012-07-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Mock GVolume too.
+
+2012-07-18 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor changes.
+
+2012-07-17 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor changes.
+
+2012-07-17 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add unit test.
+
+2012-07-17 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add a wrapper for GVolumeMonitor.
+
+2012-07-17 Andrea Azzarone <azzaronea@gmail.com>
+
+ Don't duplicate device launcher icons.
+
+2012-07-18 Michal Hruby <michal.mhr@gmail.com>
+
+ Updated the Preview API present in UnityCore to match latest protocol used by libunity. Fixes: . Approved by Marco Trevisan (Treviño), Gord Allott.
+
+2012-07-17 Michal Hruby <michal.mhr@gmail.com>
+
+ Get rid of NoReplyCallback usage, as it disappeared
+
+2012-07-17 Michal Hruby <michal.mhr@gmail.com>
+
+ Merge trunk
+
+2012-07-17 Michal Hruby <michal.mhr@gmail.com>
+
+ Use enum for Track play_state, not just a bool
+
+2012-07-10 Michal Hruby <michal.mhr@gmail.com>
+
+ Add missing properties to ApplicationPreview and LayoutHint enum
+
+2012-07-04 Michal Hruby <michal.mhr@gmail.com>
+
+ Merge trunk
+
+2012-07-02 Michal Hruby <michal.mhr@gmail.com>
+
+ Use unique_ptr for pimpl even in Preview subclasses (and it actually works when one uses proper incantations)
+
+2012-07-02 Michal Hruby <michal.mhr@gmail.com>
+
+ Make Marco happy, get rid of g_strdup...
+
+2012-06-29 Michal Hruby <michal.mhr@gmail.com>
+
+ A couple of issues brought up during review
+
+2012-06-29 Michal Hruby <michal.mhr@gmail.com>
+
+ Merge trunk
+
+2012-06-29 Michal Hruby <michal.mhr@gmail.com>
+
+ Add more tests
+
+2012-06-29 Michal Hruby <michal.mhr@gmail.com>
+
+ Propagate preview_lens and uri to child preview
+
+2012-06-29 Michal Hruby <michal.mhr@gmail.com>
+
+ Implement Preview::PerformAction
+
+2012-06-29 Michal Hruby <michal.mhr@gmail.com>
+
+ Added TestPreviewSignal
+
+2012-06-28 Michal Hruby <michal.mhr@gmail.com>
+
+ Enable TestLens.TestPreview
+
+2012-06-28 Michal Hruby <michal.mhr@gmail.com>
+
+ Whoops parent_lens can't be a shared_ptr
+
+2012-06-28 Michal Hruby <michal.mhr@gmail.com>
+
+ Fix segfault caused by TestFilter
+
+2012-06-28 Michal Hruby <michal.mhr@gmail.com>
+
+ Commit the music signals
+
+2012-06-26 Michal Hruby <michal.mhr@gmail.com>
+
+ Signal lens when SeriesPreview::selected_item_index changes
+
+2012-06-26 Michal Hruby <michal.mhr@gmail.com>
+
+ Prepare base Preview methods for interaction with previews
+
+2012-06-21 Michal Hruby <michal.mhr@gmail.com>
+
+ Merge trunk
+
+2012-06-19 Michal Hruby <michal.mhr@gmail.com>
+
+ Implement SeriesPreview
+
+2012-06-19 Michal Hruby <michal.mhr@gmail.com>
+
+ Add test for MusicPreview
+
+2012-06-19 Michal Hruby <michal.mhr@gmail.com>
+
+ Implement MusicPreview
+
+2012-06-19 Michal Hruby <michal.mhr@gmail.com>
+
+ Implement ApplicationPreview
+
+2012-06-19 Michal Hruby <michal.mhr@gmail.com>
+
+ Implement MoviePreview
+
+2012-06-19 Michal Hruby <michal.mhr@gmail.com>
+
+ Hide stuff under pimpl
+
+2012-06-18 Michal Hruby <michal.mhr@gmail.com>
+
+ Hook up the Preview method
+
+2012-06-18 Michal Hruby <michal.mhr@gmail.com>
+
+ Add a few tests
+
+2012-06-18 Michal Hruby <michal.mhr@gmail.com>
+
+ Wrap actions and info hints
+
+2012-06-18 Michal Hruby <michal.mhr@gmail.com>
+
+ Make it link as well
+
+2012-06-15 Michal Hruby <michal.mhr@gmail.com>
+
+ Start new Preview API
+
+2012-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibDBusProxy: use glib::Variant instead of std::shared_ptr. Fixes: . Approved by Michal Hruby.
+
+2012-07-17 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibDBusProxy: use glib::Variant instead of std::shared_ptr
+
+2012-07-17 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix 'Launcher Edge Stop Overcome Pressure' when the Launcher is set to autohide and 'Sticky edges' are turned off.. Fixes: https://bugs.launchpad.net/bugs/987955. Approved by Marco Trevisan (Treviño), jenkins.
+
+2012-06-29 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor changes.
+
+2012-06-28 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add AP test.
+
+2012-06-28 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix bug 987955.
+
+2012-07-16 Thomi Richards <thomi.richards@canonical.com>
+
+ Fix an autopilot panel test and add additional logging to other autopilot tests.. Fixes: . Approved by jenkins, Brandon Schaefer.
+
+2012-07-17 Thomi Richards <thomi.richards@canonical.com>
+
+ Made the test much simpler.
+
+2012-07-17 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed failing test.
+
+2012-07-16 Thomi Richards <thomi.richards@canonical.com>
+
+ Made the panel assertion a bit more verbose, and removed an error about the Try object being missing.
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_bamflaunchericon: don't try to run an application, just test for the icon name. Fixes: . Approved by jenkins, Brandon Schaefer.
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_bamflaunchericon: updated copyright
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_bamflaunchericon: check default icon for empty application
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ PluginAdapterStandalone: remove the unneeded close implementation
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ test_bamflaunchericon: don't try to run an application, just test for the icon name
+
+2012-07-16 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix launcher autoscroll during dnd.. Fixes: https://bugs.launchpad.net/bugs/987223. Approved by Brandon Schaefer, jenkins.
+
+2012-07-11 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add a manual test.
+
+2012-07-11 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix bug 987223.
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Fix blinking/flickering of the launcher and panel, especially when running
+ LibreOffice or Emacs. (LP: #1024459). Fixes: https://bugs.launchpad.net/bugs/1024459. Approved by jenkins, Łukasz Zemczak.
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Don't force shell repaint on every fullscreen redraw. That will cause the
+ panel and launcher to appear over the top of fullscreen windows,
+ intermittently. Which is bad.
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Rebase on latest upstream lp:unity
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Add test cases.
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Fix blinking/flickering of the launcher and panel, especially when running
+ LibreOffice or Emacs. (LP: #1024459)
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Don't bind the FBO if it's possible it won't get painted and unbound. That
+ could lead the the screen freezing while fullscreen windows are open.
+ (LP: #1024911)
+ . Fixes: https://bugs.launchpad.net/bugs/1024911. Approved by Łukasz Zemczak, jenkins.
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Add test case.
+
+2012-07-16 Daniel van Vugt <daniel.van.vugt@canonical.com>
+
+ Don't bind the FBO if it's possible it won't get painted and unbound. That
+ could lead the the screen freezing while fullscreen windows are open.
+ (LP: #1024911)
+
+2012-07-15 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Use std::function instead of sigc::slot. Fixes: . Approved by jenkins, Tim Penhey.
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibDBusProxy: always return on error
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibDBusProxy: use std::shared_ptr with deleter to unref the variant
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ ShortcutView: pass values to lambda by value instead of using sigc::bind
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Fix various code depending on sigc::slot
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ TextureCache: replace sigc::slot with std::function
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ UBusWrapper: replace sigc::slot with std::function
+
+ Also make UBusConnection struct private and remove the unneeded manager field
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ IconLoader: replace sigc::slot with std::function
+
+ Also don't accept requests from invalid slots
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibDBusProxy: replace sigc::slot with std::function
+
+ Also remove the NoReplyCallback and use default nullptr value
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibSignal: replace sigc::slot with std::function
+
+2012-07-16 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibSource: replace sigc::slot with std::function
+
+2012-07-13 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add test for bug 1020891.. Fixes: https://bugs.launchpad.net/bugs/1020891. Approved by Gord Allott, jenkins.
+
+2012-07-12 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add unit test for branch lp:~andyrock/unity/fix-1020891
+
+2012-07-12 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Scale mode now does not skip the first super to open the dash.. Fixes: https://bugs.launchpad.net/bugs/1023811. Approved by Thomi Richards.
+
+2012-07-12 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Merged trunk, and fixed ap test
+
+2012-07-12 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Dont set scale_just_active if super was not pressed to start scale.
+
+2012-07-12 Thomi Richards <thomi.richards@canonical.com>
+
+ Fix up panel autopilot tests.. Fixes: . Approved by Christopher Lee, jenkins, Brandon Schaefer.
+
+2012-07-13 Thomi Richards <thomi.richards@canonical.com>
+
+ Well behaved checks now use assertProperty, thereby giving us some grace time.
+
+2012-07-13 Thomi Richards <thomi.richards@canonical.com>
+
+ Merged branch that fixes regressions.
+
+2012-07-12 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed failing show desktop test.
+
+2012-07-12 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed failing autopilot test.
+
+2012-07-12 Thomi Richards <thomi.richards@canonical.com>
+
+ Converted a hud test that failed to use the Eventually matcher.
+
+2012-07-12 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed an error waiting for the Bamf model to update.
+
+2012-07-12 Thomi Richards <thomi.richards@canonical.com>
+
+ Hud now closes correctly.
+
+2012-07-12 Thomi Richards <thomi.richards@canonical.com>
+
+ Made the panel menu entry tests more reliable.
+
+2012-07-13 Thomi Richards <thomi.richards@canonical.com>
+
+ Merged parent.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed erroring panel test.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ FIxed an issue in the hud emulator.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Merged trunk.
+
+2012-07-09 Thomi Richards <thomi.richards@canonical.com>
+
+ Merged prerequisite branch.
+
+2012-07-09 Thomi Richards <thomi.richards@canonical.com>
+
+ Undo the workaround for the panel tests that was needed to avoid a bug in Unity.
+
+2012-07-09 Thomi Richards <thomi.richards@canonical.com>
+
+ Change panel tests to use the new assertProperty method available in autopilot.
+
+2012-07-09 Thomi Richards <thomi.richards@canonical.com>
+
+ Changed case of custom assert methods to be camelCase.
+
+2012-07-12 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Default Icon used if one isn't found by bamf.. Fixes: https://bugs.launchpad.net/bugs/886778. Approved by Tim Penhey, Thomi Richards.
+
+2012-07-11 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * removed debugging
+
+2012-07-11 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Added gtest for blank icon
+
+2012-07-10 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * test was bad...
+
+2012-07-10 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Adds a gtest
+
+2012-07-10 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * If no icon is found, then use a default one.
+
+2012-07-12 smspillaz <sam.spilsbury@canonical.com>
+
+ Scale the generated fbo tex by the screen dimentions as its screen size
+ and ensure nux sets the reference viewport back to output size.
+
+ (LP: #1016789). Fixes: https://bugs.launchpad.net/bugs/1016789. Approved by Daniel van Vugt, jenkins.
+
+2012-06-23 smspillaz <sam.spilsbury@canonical.com>
+
+ Scale the generated fbo tex by the screen dimentions as its screen size
+ and ensure nux sets the reference viewport back to output size.
+
+ (LP: #1016789)
+
+2012-07-11 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Quicklist closes when opening the Dash.. Fixes: https://bugs.launchpad.net/bugs/913994. Approved by Thomi Richards.
+
+2012-07-11 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * small fixes
+
+2012-07-11 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Merged trunk, fixed conflicts
+
+2012-07-03 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * mistakes in the ap test
+
+2012-07-02 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Quickilist closes when dash is activated
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Fix up switcher test suite to use new assert methods available in the latest autopilot.. Fixes: . Approved by jenkins, Brandon Schaefer.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Made new start_applications() method that starts test apps for the switcher tests. Fixed the rest of the switcher tests to not sleep so much, use new style asserts instead.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed more switcher tests.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Converted the switcher window management tests to use the assertProperty method in favour of the lambda-based Eventually matcher.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Several cleanups to the basic switcher tests.
+
+2012-07-11 Andrea Azzarone <azzaronea@gmail.com>
+
+ Tint the launcher icons that are *not* valid drop receptacles.. Fixes: https://bugs.launchpad.net/bugs/1020891. Approved by Andrea Azzarone.
+
+2012-07-11 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-07-04 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix bug 1020891.
+
+2012-07-11 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix padding issues in quicklist view.. Fixes: https://bugs.launchpad.net/bugs/955158. Approved by Andrea Azzarone.
+
+2012-06-27 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor changes.
+
+2012-06-26 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix padding issues in QuicklistView.cpp
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Autopilot launcher model cleanup.. Fixes: . Approved by Christopher Lee.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Merged trunk, fixed conflicts.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed docstring.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed a spot where we were using filter(...) and we didn't need to.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Removed a bunch of methods that weren't being used in the launcher model, and updated lots of places in the code where we were using get_icon_by_desktop_id and replaced it with get_icon(...) calls, as this is safer.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ A couple of quicklist test changes, and added the new get_icon method to the launcher mode.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ PEP8 fixes in test_shortcut_hint.py
+
+2012-07-11 Christopher Lee <chris.lee@canonical.com>
+
+ Removed references to files that have been removed. Fixes: . Approved by Tim Penhey.
+
+2012-07-11 Christopher Lee <chris.lee@canonical.com>
+
+ Removed references to files that where removed (revno: 2414)
+
+2012-07-10 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ Hud closes when a Quicklist is open.. Fixes: https://bugs.launchpad.net/bugs/1020246. Approved by Thomi Richards.
+
+2012-07-09 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Merged with trunk, fixed conflicts
+
+2012-07-05 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Merged with trunk and fix confict.
+
+2012-07-05 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * Fixed ap test
+
+2012-07-02 Brandon Schaefer <brandontschaefer@gmail.com>
+
+ * The hud will now open if a quicklist is open
+
+2012-07-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Unfold valid drop icons.. Fixes: https://bugs.launchpad.net/bugs/839717. Approved by jenkins, Marco Trevisan (Treviño).
+
+2012-07-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Merge trunk.
+
+2012-07-04 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor changes to the manual test.
+
+2012-07-04 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add manual test.
+
+2012-07-04 Andrea Azzarone <azzaronea@gmail.com>
+
+ Minor changes.
+
+2012-07-04 Andrea Azzarone <azzaronea@gmail.com>
+
+ Don't link QUIRK_DROP_PRELIGHT and QUIRK_PRESENTED.
+
+2012-07-04 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix bug #839717.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Show desktop autopilot tests now use new-style autopilot assertions.. Fixes: . Approved by Christopher Lee.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Merged trunk.
+
+2012-07-11 Thomi Richards <thomi.richards@canonical.com>
+
+ Pushed switcher icon selection code into the switcher emulator.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Fixed errors.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ No commit message
+2012-07-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Revert revision 2398.. Fixes: . Approved by Tim Penhey.
+
+2012-07-04 Andrea Azzarone <azzaronea@gmail.com>
+
+ Revert revision 2398.
+
+2012-07-10 Michal Hruby <michal.mhr@gmail.com>
+
+ Added Object::IsType method. Fixes: . Approved by Marco Trevisan (Treviño).
+
+2012-07-04 Michal Hruby <michal.mhr@gmail.com>
+
+ Added Object::IsType method
+
+2012-07-10 Tim Penhey <tim.penhey@canonical.com>
+
+ Reduce the amount of logging spam from bamf by checking for null first.. Fixes: . Approved by Thomi Richards.
+
+2012-07-05 Tim Penhey <tim.penhey@canonical.com>
+
+ Bamf logging changes.
+
+2012-07-10 Christopher Lee <chris.lee@canonical.com>
+
+ Removed 2 fast-switching tests, made them manual tests instead.. Fixes: . Approved by Thomi Richards.
+
+2012-07-09 Christopher Lee <chris.lee@canonical.com>
+
+ Made instructions a little more explicit
+
+2012-07-09 Christopher Lee <chris.lee@canonical.com>
+
+ Removed fast-switching tests, made them manual tests
+
+2012-07-10 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibSource, SourceManager: add utility functions to add timeouts and idles
+
+ Update the code to use them.. Fixes: . Approved by Marco Trevisan (Treviño).
+
+2012-07-09 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ LauncherController: use AddIdle
+
+2012-07-09 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merge with trunk
+
+2012-06-09 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ tests, glib::SourceManager: added tests for adding timeouts and idles
+
+2012-06-09 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Use glib::SourceManager Add utility functions to add Idles and Timeouts
+
+2012-06-09 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ GLibSource, SourceManager: add utility functions to add timeouts and idles
+
+2012-06-09 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ glib::Source, rename Source::SourceCallback to Source::Callback
+
+2012-07-10 Andrea Azzarone <azzaronea@gmail.com>
+
+ Fix freezes during dnd.. Fixes: https://bugs.launchpad.net/bugs/772445. Approved by Gord Allott.
+
+2012-07-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Add manual test.
+
+2012-07-09 Andrea Azzarone <azzaronea@gmail.com>
+
+ Replace g_file_info_get_content_type with g_content_type_guess.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Dash and hud now close on Alt+F4 even when the caps lock or num lock keys are active.. Fixes: https://bugs.launchpad.net/bugs/1022801. Approved by Tim Penhey.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Dash test passes now too.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Hud test passes.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Have failing dash test too.
+
+2012-07-10 Thomi Richards <thomi.richards@canonical.com>
+
+ Have failing test.
+
+2012-07-09 Łukasz 'sil2100' Zemczak <lukasz.zemczak@canonical.com>
+
+ Release\ 6.0.0
+
2012-07-09 Thomi Richards <thomi.richards@canonical.com>
Fix several intermittently failing tests.. Fixes: . Approved by Tim Penhey.
diff --git a/HACKING b/HACKING
index f01837ed5..a2ac75320 100644
--- a/HACKING
+++ b/HACKING
@@ -7,7 +7,6 @@ If you want to hack on unity you need the following packages
- gthread-2.0
- indicator
- atk
- - libutouch-geis
Or if you are on ubuntu run the command, apt-get build-dep unity
diff --git a/UnityCore/CMakeLists.txt b/UnityCore/CMakeLists.txt
index 5393f2c8c..0ae006c41 100644
--- a/UnityCore/CMakeLists.txt
+++ b/UnityCore/CMakeLists.txt
@@ -1,5 +1,6 @@
find_package (PkgConfig)
pkg_check_modules (CORE_DEPS REQUIRED glib-2.0 gio-2.0 dee-1.0 sigc++-2.0 nux-core-3.0 gdk-pixbuf-2.0 unity-protocol-private)
+pkg_check_modules (PRIVATE_CORE_DEPS REQUIRED unity-protocol-private)
execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} unity --variable lensesdir OUTPUT_VARIABLE _lensesdir OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -124,7 +125,8 @@ set (CORE_LIB_NAME "unity-core-${UNITY_API_VERSION}")
add_library (${CORE_LIB_NAME} SHARED ${CORE_SOURCES})
set_target_properties(${CORE_LIB_NAME} PROPERTIES
VERSION ${CORE_LIB_LT_CURRENT}.${CORE_LIB_LT_REV}.${CORE_LIB_LT_AGE}
- SOVERSION ${CORE_LIB_LT_CURRENT})
+ SOVERSION ${CORE_LIB_LT_CURRENT}
+ INSTALL_RPATH "${PRIVATE_CORE_DEPS_LIBRARY_DIRS}")
install (TARGETS ${CORE_LIB_NAME}
RUNTIME DESTINATION bin
diff --git a/UnityCore/HomeLens.cpp b/UnityCore/HomeLens.cpp
index 54cb14746..ee73a2775 100644
--- a/UnityCore/HomeLens.cpp
+++ b/UnityCore/HomeLens.cpp
@@ -105,7 +105,7 @@ public:
/* Any existing categories with offsets >= target_cat_offset must be
* pushed up. Update both maps by id and display name */
std::map<std::string,unsigned int>::iterator end = reg_by_id_.end();
- for (i = reg_by_id_.begin(); i != end; i++)
+ for (i = reg_by_id_.begin(); i != end; ++i)
{
if (i->second >= target_cat_offset)
{
@@ -114,7 +114,7 @@ public:
}
}
- for (i = reg_by_display_name_.begin(), end = reg_by_display_name_.end(); i != end; i++)
+ for (i = reg_by_display_name_.begin(), end = reg_by_display_name_.end(); i != end; ++i)
{
if (i->second >= target_cat_offset)
{
@@ -637,7 +637,7 @@ void HomeLens::ResultsMerger::CheckCategoryRegistryDirty()
* the category offset in the corresponding rows in the target model
*/
for (i = source_to_target_tags_.begin(), end = source_to_target_tags_.end();
- i != end; i++)
+ i != end; ++i)
{
source = i->first;
target_tag = i->second;
diff --git a/dash/ResultView.cpp b/dash/ResultView.cpp
index 5350fc579..c25c9810f 100644
--- a/dash/ResultView.cpp
+++ b/dash/ResultView.cpp
@@ -97,7 +97,7 @@ void ResultView::RemoveResult(Result& result)
ResultList::iterator it;
std::string uri = result.uri;
- for (it = results_.begin(); it != results_.end(); it++)
+ for (it = results_.begin(); it != results_.end(); ++it)
{
if (result.uri == (*it).uri)
{
diff --git a/dash/ResultViewGrid.cpp b/dash/ResultViewGrid.cpp
index 173c26c3c..a322c8126 100644
--- a/dash/ResultViewGrid.cpp
+++ b/dash/ResultViewGrid.cpp
@@ -354,7 +354,7 @@ void ResultViewGrid::OnKeyDown (unsigned long event_type, unsigned long event_ke
total_rows = (expanded) ? total_rows : 1; // restrict to one row if not expanded
// find the currently focused item
- for (it = results_.begin(); it != results_.end(); it++)
+ for (it = results_.begin(); it != results_.end(); ++it)
{
std::string result_uri = (*it).uri;
if (result_uri == focused_uri_)
diff --git a/launcher/AbstractLauncherIcon.h b/launcher/AbstractLauncherIcon.h
index 1f4341536..73f0395af 100644
--- a/launcher/AbstractLauncherIcon.h
+++ b/launcher/AbstractLauncherIcon.h
@@ -80,41 +80,41 @@ public:
typedef nux::ObjectPtr<AbstractLauncherIcon> Ptr;
typedef std::vector<nux::Vector4> TransformVector;
- typedef enum
+ enum class IconType
{
- TYPE_NONE,
- TYPE_BEGIN,
- TYPE_HOME,
- TYPE_HUD,
- TYPE_FAVORITE,
- TYPE_APPLICATION,
- TYPE_EXPO,
- TYPE_DESKTOP,
- TYPE_PLACE,
- TYPE_DEVICE,
- TYPE_TRASH,
- TYPE_END,
- } IconType;
-
- typedef enum
+ NONE,
+ BEGIN,
+ HOME,
+ HUD,
+ FAVORITE,
+ APPLICATION,
+ EXPO,
+ DESKTOP,
+ PLACE,
+ DEVICE,
+ TRASH,
+ END
+ };
+
+ enum class Quirk
{
- QUIRK_VISIBLE,
- QUIRK_ACTIVE,
- QUIRK_RUNNING,
- QUIRK_URGENT,
- QUIRK_PRESENTED,
- QUIRK_STARTING,
- QUIRK_SHIMMER,
- QUIRK_CENTER_SAVED,
- QUIRK_PROGRESS,
- QUIRK_DROP_PRELIGHT,
- QUIRK_DROP_DIM,
- QUIRK_DESAT,
- QUIRK_PULSE_ONCE,
- QUIRK_LAST_ACTION,
-
- QUIRK_LAST,
- } Quirk;
+ VISIBLE = 0,
+ ACTIVE,
+ RUNNING,
+ URGENT,
+ PRESENTED,
+ STARTING,
+ SHIMMER,
+ CENTER_SAVED,
+ PROGRESS,
+ DROP_PRELIGHT,
+ DROP_DIM,
+ DESAT,
+ PULSE_ONCE,
+ LAST_ACTION,
+
+ LAST
+ };
virtual ~AbstractLauncherIcon() {}
@@ -205,9 +205,9 @@ public:
virtual void SetVisibleOnMonitor(int monitor, bool visible) = 0;
virtual void AboutToRemove() = 0;
-
+
virtual void Stick(bool save = true) = 0;
-
+
virtual void UnStick() = 0;
sigc::signal<void, int, int, unsigned long> mouse_down;
diff --git a/launcher/BFBLauncherIcon.cpp b/launcher/BFBLauncherIcon.cpp
index cdcc4f0e2..d66f2deaa 100644
--- a/launcher/BFBLauncherIcon.cpp
+++ b/launcher/BFBLauncherIcon.cpp
@@ -39,9 +39,9 @@ BFBLauncherIcon::BFBLauncherIcon(LauncherHideMode hide_mode)
{
tooltip_text = _("Dash Home");
icon_name = PKGDATADIR"/launcher_bfb.png";
- SetQuirk(QUIRK_VISIBLE, true);
- SetQuirk(QUIRK_RUNNING, false);
- SetIconType(TYPE_HOME);
+ SetQuirk(Quirk::VISIBLE, true);
+ SetQuirk(Quirk::RUNNING, false);
+ SetIconType(IconType::HOME);
background_color_ = nux::color::White;
@@ -66,7 +66,7 @@ void BFBLauncherIcon::OnOverlayShown(GVariant *data, bool visible)
if (overlay_identity.Str() == "dash" && IsVisibleOnMonitor(overlay_monitor))
{
tooltip_enabled = !visible;
- SetQuirk(QUIRK_ACTIVE, visible);
+ SetQuirk(Quirk::ACTIVE, visible);
EmitNeedsRedraw();
}
// If the hud is open, we hide the BFB if we have a locked launcher
diff --git a/launcher/BamfLauncherIcon.cpp b/launcher/BamfLauncherIcon.cpp
index 699a6b0f1..62f70dbdb 100644
--- a/launcher/BamfLauncherIcon.cpp
+++ b/launcher/BamfLauncherIcon.cpp
@@ -71,15 +71,15 @@ BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)
tooltip_text = BamfName();
icon_name = (icon ? icon.Str() : DEFAULT_ICON);
- SetIconType(TYPE_APPLICATION);
+ SetIconType(IconType::APPLICATION);
if (IsSticky())
- SetQuirk(QUIRK_VISIBLE, true);
+ SetQuirk(Quirk::VISIBLE, true);
else
- SetQuirk(QUIRK_VISIBLE, bamf_view_user_visible(bamf_view));
+ 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));
+ SetQuirk(Quirk::ACTIVE, bamf_view_is_active(bamf_view));
+ SetQuirk(Quirk::RUNNING, bamf_view_is_running(bamf_view));
glib::SignalBase* sig;
@@ -97,19 +97,19 @@ BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)
sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "urgent-changed",
[&] (BamfView*, gboolean urgent) {
- SetQuirk(QUIRK_URGENT, 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);
+ 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);
+ SetQuirk(Quirk::RUNNING, running);
if (running)
{
@@ -123,7 +123,7 @@ BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)
sig = new glib::Signal<void, BamfView*, gboolean>(bamf_view, "user-visible-changed",
[&] (BamfView*, gboolean visible) {
if (!IsSticky())
- SetQuirk(QUIRK_VISIBLE, visible);
+ SetQuirk(Quirk::VISIBLE, visible);
});
_gsignals.Add(sig);
@@ -131,7 +131,7 @@ BamfLauncherIcon::BamfLauncherIcon(BamfApplication* app)
[&] (BamfView*) {
if (!IsSticky())
{
- SetQuirk(QUIRK_VISIBLE, false);
+ SetQuirk(Quirk::VISIBLE, false);
/* Use a timeout to remove the icon, this avoids
* that we remove an application that is going
@@ -196,22 +196,22 @@ bool BamfLauncherIcon::IsSticky() const
bool BamfLauncherIcon::IsVisible() const
{
- return GetQuirk(QUIRK_VISIBLE);
+ return GetQuirk(Quirk::VISIBLE);
}
bool BamfLauncherIcon::IsActive() const
{
- return GetQuirk(QUIRK_ACTIVE);
+ return GetQuirk(Quirk::ACTIVE);
}
bool BamfLauncherIcon::IsRunning() const
{
- return GetQuirk(QUIRK_RUNNING);
+ return GetQuirk(Quirk::RUNNING);
}
bool BamfLauncherIcon::IsUrgent() const
{
- return GetQuirk(QUIRK_URGENT);
+ return GetQuirk(Quirk::URGENT);
}
void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
@@ -303,7 +303,7 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
if (!IsRunning() || (IsRunning() && !user_visible)) // #1 above
{
- if (GetQuirk(QUIRK_STARTING))
+ if (GetQuirk(Quirk::STARTING))
return;
if (scaleWasActive)
@@ -311,7 +311,7 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
wm->TerminateScale();
}
- SetQuirk(QUIRK_STARTING, true);
+ SetQuirk(Quirk::STARTING, true);
OpenInstanceLauncherIcon(ActionArg());
}
else // app is running
@@ -455,7 +455,7 @@ void BamfLauncherIcon::OnWindowMinimized(guint32 xid)
return;
Present(0.5f, 600);
- UpdateQuirkTimeDelayed(300, QUIRK_SHIMMER);
+ UpdateQuirkTimeDelayed(300, Quirk::SHIMMER);
}
void BamfLauncherIcon::OnWindowMoved(guint32 moved_win)
@@ -610,7 +610,7 @@ void BamfLauncherIcon::OpenInstanceWithUris(std::set<std::string> uris)
if (error)
g_warning("%s\n", error.Message().c_str());
- UpdateQuirkTime(QUIRK_STARTING);
+ UpdateQuirkTime(Quirk::STARTING);
}
void BamfLauncherIcon::OpenInstanceLauncherIcon(ActionArg arg)
diff --git a/launcher/BamfLauncherIcon.h b/launcher/BamfLauncherIcon.h
index 75097012b..5c00d3b52 100644
--- a/launcher/BamfLauncherIcon.h
+++ b/launcher/BamfLauncherIcon.h
@@ -53,9 +53,9 @@ public:
bool IsRunning() const;
bool IsUrgent() const;
- void Quit();
- void Stick(bool save = true);
- void UnStick();
+ virtual void Quit();
+ virtual void Stick(bool save = true);
+ virtual void UnStick();
virtual bool ShowInSwitcher(bool current);
virtual unsigned long long SwitcherPriority();
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index ceefbdb0e..3ac9e8db8 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -45,7 +45,6 @@ set (LAUNCHER_SOURCES
FavoriteStore.cpp
FavoriteStoreGSettings.cpp
FavoriteStorePrivate.cpp
- GeisAdapter.cpp
HudLauncherIcon.cpp
Launcher.cpp
LauncherController.cpp
diff --git a/launcher/DesktopLauncherIcon.cpp b/launcher/DesktopLauncherIcon.cpp
index ca1587357..715fd9ac8 100644
--- a/launcher/DesktopLauncherIcon.cpp
+++ b/launcher/DesktopLauncherIcon.cpp
@@ -33,9 +33,9 @@ DesktopLauncherIcon::DesktopLauncherIcon()
{
tooltip_text = _("Show Desktop");
icon_name = "desktop";
- SetQuirk(QUIRK_VISIBLE, true);
- SetQuirk(QUIRK_RUNNING, false);
- SetIconType(TYPE_DESKTOP);
+ SetQuirk(Quirk::VISIBLE, true);
+ SetQuirk(Quirk::RUNNING, false);
+ SetIconType(IconType::DESKTOP);
}
DesktopLauncherIcon::~DesktopLauncherIcon()
diff --git a/launcher/DeviceLauncherIcon.cpp b/launcher/DeviceLauncherIcon.cpp
index fe5b46d8f..017f5aacb 100644
--- a/launcher/DeviceLauncherIcon.cpp
+++ b/launcher/DeviceLauncherIcon.cpp
@@ -80,21 +80,21 @@ void DeviceLauncherIcon::UpdateVisibility()
switch (DevicesSettings::GetDefault().GetDevicesOption())
{
case DevicesSettings::NEVER:
- SetQuirk(QUIRK_VISIBLE, false);
+ SetQuirk(Quirk::VISIBLE, false);
break;
case DevicesSettings::ONLY_MOUNTED:
if (keep_in_launcher_)
{
- SetQuirk(QUIRK_VISIBLE, true);
+ SetQuirk(Quirk::VISIBLE, true);
}
else
{
glib::Object<GMount> mount(g_volume_get_mount(volume_));
- SetQuirk(QUIRK_VISIBLE, mount);
+ SetQuirk(Quirk::VISIBLE, mount);
}
break;
case DevicesSettings::ALWAYS:
- SetQuirk(QUIRK_VISIBLE, true);
+ SetQuirk(Quirk::VISIBLE, true);
break;
}
}
@@ -109,8 +109,8 @@ void DeviceLauncherIcon::UpdateDeviceIcon()
tooltip_text = name_;
icon_name = icon_string.Str();
- SetIconType(TYPE_DEVICE);
- SetQuirk(QUIRK_RUNNING, false);
+ SetIconType(IconType::DEVICE);
+ SetQuirk(Quirk::RUNNING, false);
}
bool
@@ -262,7 +262,7 @@ void DeviceLauncherIcon::ShowMount(GMount* mount)
void DeviceLauncherIcon::ActivateLauncherIcon(ActionArg arg)
{
SimpleLauncherIcon::ActivateLauncherIcon(arg);
- SetQuirk(QUIRK_STARTING, true);
+ SetQuirk(Quirk::STARTING, true);
glib::Object<GMount> mount(g_volume_get_mount(volume_));
@@ -351,7 +351,7 @@ void DeviceLauncherIcon::OnTogglePin(DbusmenuMenuitem* item,
glib::Object<GMount> mount(g_volume_get_mount(self->volume_));
if (!mount)
- self->SetQuirk(QUIRK_VISIBLE, false);
+ self->SetQuirk(Quirk::VISIBLE, false);
// Remove from favorites
if (!uuid.Str().empty())
diff --git a/launcher/FavoriteStoreGSettings.cpp b/launcher/FavoriteStoreGSettings.cpp
index fe900099b..30ba42287 100644
--- a/launcher/FavoriteStoreGSettings.cpp
+++ b/launcher/FavoriteStoreGSettings.cpp
@@ -42,8 +42,8 @@ namespace
{
nux::logging::Logger logger("unity.favorites");
-
-const char* SETTINGS_NAME = "com.canonical.Unity.Launcher";
+const std::string SETTINGS_NAME = "com.canonical.Unity.Launcher";
+const std::string SETTINGS_KEY = "favorites";
void on_settings_updated(GSettings* settings,
const gchar* key,
@@ -52,26 +52,17 @@ void on_settings_updated(GSettings* settings,
}
FavoriteStoreGSettings::FavoriteStoreGSettings()
- : settings_(g_settings_new(SETTINGS_NAME))
- , ignore_signals_(false)
+ : ignore_signals_(false)
+ , settings_(g_settings_new(SETTINGS_NAME.c_str()))
{
- Init();
-}
-
-FavoriteStoreGSettings::FavoriteStoreGSettings(GSettingsBackend* backend)
- : settings_(g_settings_new_with_backend(SETTINGS_NAME, backend))
- , ignore_signals_(false)
-{
- Init();
-}
+ favorites_changed_.Connect(settings_, "changed::"+SETTINGS_KEY, [&] (GSettings*, gchar*)
+ {
+ Changed();
+ });
-void FavoriteStoreGSettings::Init()
-{
- g_signal_connect(settings_, "changed", G_CALLBACK(on_settings_updated), this);
Refresh();
}
-
void FavoriteStoreGSettings::Refresh()
{
FillList(favorites_);
@@ -81,7 +72,7 @@ void FavoriteStoreGSettings::FillList(FavoriteList& list)
{
list.clear();
- gchar** favs = g_settings_get_strv(settings_, "favorites");
+ gchar** favs = g_settings_get_strv(settings_, SETTINGS_KEY.c_str());
for (int i = 0; favs[i] != NULL; ++i)
{
@@ -222,16 +213,16 @@ void FavoriteStoreGSettings::SaveFavorites(FavoriteList const& favorites, bool i
}
ignore_signals_ = ignore;
- if (!g_settings_set_strv(settings_, "favorites", favs))
+ if (!g_settings_set_strv(settings_, SETTINGS_KEY.c_str(), favs))
{
LOG_WARNING(logger) << "Saving favorites failed.";
}
ignore_signals_ = false;
}
-void FavoriteStoreGSettings::Changed(std::string const& key)
+void FavoriteStoreGSettings::Changed()
{
- if (ignore_signals_ or key != "favorites")
+ if (ignore_signals_)
return;
FavoriteList old(favorites_);
@@ -261,20 +252,5 @@ void FavoriteStoreGSettings::Changed(std::string const& key)
}
-namespace
-{
-
-void on_settings_updated(GSettings* settings,
- const gchar* key,
- FavoriteStoreGSettings* self)
-{
- if (settings and key)
- {
- self->Changed(key);
- }
-}
-
-} // anonymous namespace
-
} // namespace internal
} // namespace unity
diff --git a/launcher/FavoriteStoreGSettings.h b/launcher/FavoriteStoreGSettings.h
index 600b6162c..5fd084b90 100644
--- a/launcher/FavoriteStoreGSettings.h
+++ b/launcher/FavoriteStoreGSettings.h
@@ -24,6 +24,7 @@
#include "FavoriteStore.h"
#include <UnityCore/GLibWrapper.h>
+#include <UnityCore/GLibSignal.h>
// An abstract object that facilitates getting and modifying the list of favorites
// Use GetDefault () to get the correct store for the session
@@ -36,7 +37,6 @@ class FavoriteStoreGSettings : public FavoriteStore
{
public:
FavoriteStoreGSettings();
- FavoriteStoreGSettings(GSettingsBackend* backend);
virtual FavoriteList const& GetFavorites();
virtual void AddFavorite(std::string const& desktop_path, int position);
@@ -45,17 +45,15 @@ public:
void SaveFavorites(FavoriteList const& favorites, bool ignore = true);
virtual void SetFavorites(FavoriteList const& desktop_paths);
- //Methods
- void Changed(std::string const& key);
-
private:
- void Init();
void Refresh();
+ void Changed();
void FillList(FavoriteList& list);
FavoriteList favorites_;
- glib::Object<GSettings> settings_;
bool ignore_signals_;
+ glib::Object<GSettings> settings_;
+ glib::Signal<void, GSettings*, gchar*> favorites_changed_;
};
}
diff --git a/launcher/GeisAdapter.cpp b/launcher/GeisAdapter.cpp
deleted file mode 100644
index d9fe220af..000000000
--- a/launcher/GeisAdapter.cpp
+++ /dev/null
@@ -1,521 +0,0 @@
-// -*- 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 <glib.h>
-#include <gdk/gdkx.h>
-#include <NuxCore/Logger.h>
-#include "GeisAdapter.h"
-
-namespace
-{
- GeisAdapter* adaptor_instance = nullptr;
- nux::logging::Logger logger("unity.geisadapter");
-}
-
-/* static */
-GeisAdapter& GeisAdapter::Instance()
-{
- if (!adaptor_instance)
- {
- LOG_ERROR(logger) << "No GeisAdapter created yet.";
- }
-
- return *adaptor_instance;
-}
-
-GeisAdapter::GeisAdapter() : _root_instance(nullptr)
-{
- if (adaptor_instance)
- {
- LOG_ERROR(logger) << "More than one GeisAdapter created.";
- }
- else
- {
- adaptor_instance = this;
- }
- RegisterRootInstance();
-}
-
-GeisAdapter::~GeisAdapter()
-{
- if (_root_instance != nullptr)
- geis_finish(_root_instance);
- if (adaptor_instance == this)
- {
- adaptor_instance = nullptr;
- }
-}
-
-void
-GeisAdapter::Run()
-{
- int fd = -1;
- GeisStatus status = GEIS_STATUS_NOT_SUPPORTED;
-
- if (_root_instance != nullptr)
- status = geis_configuration_get_value(_root_instance, GEIS_CONFIG_UNIX_FD, &fd);
-
- if (status != GEIS_STATUS_SUCCESS)
- return;
-
- _watch_id = g_io_add_watch(g_io_channel_unix_new(fd),
- G_IO_IN,
- &GeisAdapter::OnWatchIn,
- this);
-}
-
-gboolean
-GeisAdapter::OnWatchIn(GIOChannel* source, GIOCondition condition, gpointer data)
-{
- GeisAdapter* self = static_cast<GeisAdapter*>(data);
- geis_event_dispatch(self->_root_instance);
- return true;
-}
-
-void
-GeisAdapter::InputDeviceAdded(void* cookie, GeisInputDeviceId device_id, void* attrs)
-{
-}
-
-
-void
-GeisAdapter::InputDeviceChanged(void* cookie, GeisInputDeviceId device_id, void* attrs)
-{
-}
-
-
-void
-GeisAdapter::InputDeviceRemoved(void* cookie, GeisInputDeviceId device_id, void* attrs)
-{
-}
-
-void
-GeisAdapter::GestureAdded(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
-{
-}
-
-void
-GeisAdapter::GestureRemoved(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
-{
-}
-
-void
-GeisAdapter::GestureStart(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
-{
- GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
-
- if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
- {
- GeisDragData* data = self->ProcessDragGesture(count, attrs);
- data->id = gesture_id;
- self->drag_start.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
- {
- GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
- data->id = gesture_id;
- self->rotate_start.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
- {
- GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
- data->id = gesture_id;
- self->pinch_start.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
- {
- GeisTapData* data = self->ProcessTapGesture(count, attrs);
- data->id = gesture_id;
- self->tap.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
- {
- GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
- data->id = gesture_id;
- self->touch_start.emit(data);
- g_free(data);
- }
-}
-
-void
-GeisAdapter::GestureUpdate(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
-{
- GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
-
- if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
- {
- GeisDragData* data = self->ProcessDragGesture(count, attrs);
- data->id = gesture_id;
- self->drag_update.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
- {
- GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
- data->id = gesture_id;
- self->rotate_update.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
- {
- GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
- data->id = gesture_id;
- self->pinch_update.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
- {
- GeisTapData* data = self->ProcessTapGesture(count, attrs);
- data->id = gesture_id;
- self->tap.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
- {
- GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
- data->id = gesture_id;
- self->touch_update.emit(data);
- g_free(data);
- }
-}
-
-void
-GeisAdapter::GestureFinish(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize count, GeisGestureAttr* attrs)
-{
- GeisAdapter* self = static_cast<GeisAdapter*>(cookie);
-
- if (gesture_type == GEIS_GESTURE_PRIMITIVE_DRAG)
- {
- GeisDragData* data = self->ProcessDragGesture(count, attrs);
- data->id = gesture_id;
- self->drag_finish.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_ROTATE)
- {
- GeisRotateData* data = self->ProcessRotateGesture(count, attrs);
- data->id = gesture_id;
- self->rotate_finish.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_PINCH)
- {
- GeisPinchData* data = self->ProcessPinchGesture(count, attrs);
- data->id = gesture_id;
- self->pinch_finish.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TAP)
- {
- GeisTapData* data = self->ProcessTapGesture(count, attrs);
- data->id = gesture_id;
- self->tap.emit(data);
- g_free(data);
- }
- else if (gesture_type == GEIS_GESTURE_PRIMITIVE_TOUCH)
- {
- GeisTouchData* data = self->ProcessTouchGesture(count, attrs);
- data->id = gesture_id;
- self->touch_finish.emit(data);
- g_free(data);
- }
-}
-
-GeisAdapter::GeisTapData* GeisAdapter::ProcessTapGesture(GeisSize count, GeisGestureAttr* attrs)
-{
- GeisTapData* result = (GeisTapData*) g_malloc0(sizeof(GeisTapData));
-
- int i;
- for (i = 0; i < (int) count; i++)
- {
- GeisGestureAttr attr = attrs[i];
- if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
- result->device_id = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
- result->window = (Window) attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
- result->timestamp = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
- result->focus_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
- result->focus_y = attr.float_val;
- else if (g_str_equal (attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
- result->touches = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME))
- {
- if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP1))
- result->touches = 1;
- else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP2))
- result->touches = 2;
- else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP3))
- result->touches = 3;
- else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP4))
- result->touches = 4;
- else if (!g_strcmp0(attr.string_val, GEIS_GESTURE_TYPE_TAP5))
- result->touches = 5;
- }
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TAP_TIME))
- result->tap_length_ms = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_X))
- result->position_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_Y))
- result->position_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
- result->bound_x1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
- result->bound_y1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
- result->bound_x2 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
- result->bound_y2 = attr.float_val;
- }
-
- return result;
-}
-
-GeisAdapter::GeisTouchData* GeisAdapter::ProcessTouchGesture(GeisSize count, GeisGestureAttr* attrs)
-{
- GeisTouchData* result = (GeisTouchData*) g_malloc0(sizeof(GeisTouchData));
-
- int i;
- for (i = 0; i < (int) count; i++)
- {
- GeisGestureAttr attr = attrs[i];
- if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
- result->device_id = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
- result->window = (Window) attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
- result->timestamp = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
- result->focus_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
- result->focus_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
- result->touches = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
- result->bound_x1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
- result->bound_y1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
- result->bound_x2 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
- result->bound_y2 = attr.float_val;
- }
-
- return result;
-}
-
-GeisAdapter::GeisDragData* GeisAdapter::ProcessDragGesture(GeisSize count, GeisGestureAttr* attrs)
-{
- GeisDragData* result = (GeisDragData*) g_malloc0(sizeof(GeisDragData));
-
- int i;
- for (i = 0; i < (int) count; i++)
- {
- GeisGestureAttr attr = attrs[i];
- if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
- result->device_id = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
- result->window = (Window) attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
- result->timestamp = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
- result->focus_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
- result->focus_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
- result->touches = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_X))
- result->position_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_POSITION_Y))
- result->position_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_X))
- result->velocity_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_VELOCITY_Y))
- result->velocity_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DELTA_X))
- result->delta_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DELTA_Y))
- result->delta_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
- result->bound_x1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
- result->bound_y1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
- result->bound_x2 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
- result->bound_y2 = attr.float_val;
- }
-
- return result;
-}
-
-GeisAdapter::GeisPinchData* GeisAdapter::ProcessPinchGesture(GeisSize count, GeisGestureAttr* attrs)
-{
- GeisPinchData* result = (GeisPinchData*) g_malloc0(sizeof(GeisPinchData));
-
- int i;
- for (i = 0; i < (int) count; i++)
- {
- GeisGestureAttr attr = attrs[i];
- if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
- result->device_id = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
- result->window = (Window) attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
- result->timestamp = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
- result->focus_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
- result->focus_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
- result->touches = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIUS))
- result->radius = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIUS_DELTA))
- result->radius_delta = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_RADIAL_VELOCITY))
- result->radius_velocity = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
- result->bound_x1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
- result->bound_y1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
- result->bound_x2 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
- result->bound_y2 = attr.float_val;
- }
-
- return result;
-}
-
-GeisAdapter::GeisRotateData* GeisAdapter::ProcessRotateGesture(GeisSize count, GeisGestureAttr* attrs)
-{
- GeisRotateData* result = (GeisRotateData*) g_malloc0(sizeof(GeisRotateData));
-
- int i;
- for (i = 0; i < (int) count; i++)
- {
- GeisGestureAttr attr = attrs[i];
- if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_DEVICE_ID))
- result->device_id = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_CHILD_WINDOW_ID))
- result->window = (Window) attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TIMESTAMP))
- result->timestamp = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_X))
- result->focus_x = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_FOCUS_Y))
- result->focus_y = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_TOUCHES))
- result->touches = attr.integer_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGLE))
- result->angle = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGLE_DELTA))
- result->angle_delta = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_ANGULAR_VELOCITY))
- result->angle_velocity = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X1))
- result->bound_x1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y1))
- result->bound_y1 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_X2))
- result->bound_x2 = attr.float_val;
- else if (g_str_equal(attr.name, GEIS_GESTURE_ATTRIBUTE_BOUNDINGBOX_Y2))
- result->bound_y2 = attr.float_val;
- }
-
- return result;
-}
-
-static const char* s_gestures[] =
-{
- GEIS_GESTURE_TYPE_DRAG3, GEIS_GESTURE_TYPE_TAP3, GEIS_GESTURE_TYPE_ROTATE3, GEIS_GESTURE_TYPE_PINCH3, GEIS_GESTURE_TYPE_TOUCH3,
- GEIS_GESTURE_TYPE_DRAG4, GEIS_GESTURE_TYPE_TAP4, GEIS_GESTURE_TYPE_ROTATE4, GEIS_GESTURE_TYPE_PINCH4, GEIS_GESTURE_TYPE_TOUCH4,
- GEIS_GESTURE_TYPE_SYSTEM,
- NULL
-};
-
-void
-GeisAdapter::RegisterRootInstance()
-{
- static GeisInputFuncs input_funcs =
- {
- &GeisAdapter::InputDeviceAdded,
- &GeisAdapter::InputDeviceChanged,
- &GeisAdapter::InputDeviceRemoved
- };
-
- static GeisGestureFuncs gesture_funcs =
- {
- &GeisAdapter::GestureAdded,
- &GeisAdapter::GestureRemoved,
- &GeisAdapter::GestureStart,
- &GeisAdapter::GestureUpdate,
- &GeisAdapter::GestureFinish
- };
-
- GeisStatus status = GEIS_UNKNOWN_ERROR;
-
- GeisXcbWinInfo xcb_win_info;
- xcb_win_info.display_name = NULL,
- xcb_win_info.screenp = NULL,
- xcb_win_info.window_id = gdk_x11_get_default_root_xwindow();
-
- GeisWinInfo win_info =
- {
- GEIS_XCB_FULL_WINDOW,
- &xcb_win_info
- };
- GeisInstance instance;
-
- status = geis_init(&win_info, &instance);
- if (status != GEIS_STATUS_SUCCESS)
- {
- fprintf(stderr, "error in geis_init\n");
- return;
- }
-
- status = geis_input_devices(instance, &input_funcs, this);
- if (status != GEIS_STATUS_SUCCESS)
- {
- fprintf(stderr, "error subscribing to input devices\n");
- geis_finish(instance);
- return;
- }
-
- status = geis_subscribe(instance,
- GEIS_ALL_INPUT_DEVICES,
- s_gestures,
- &gesture_funcs,
- this);
- if (status != GEIS_STATUS_SUCCESS)
- {
- fprintf(stderr, "error subscribing to gestures\n");
- geis_finish(instance);
- return;
- }
-
- _root_instance = instance;
-}
diff --git a/launcher/GeisAdapter.h b/launcher/GeisAdapter.h
deleted file mode 100644
index f68923bed..000000000
--- a/launcher/GeisAdapter.h
+++ /dev/null
@@ -1,172 +0,0 @@
-// -*- 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
- * aint with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by: Jason Smith <jason.smith@canonical.com>
- */
-
-#ifndef GEISADAPTER_H
-#define GEISADAPTER_H
-
-/* Compiz */
-#include <sigc++/sigc++.h>
-#include <geis/geis.h>
-#include <Nux/Nux.h>
-
-class GeisAdapter : public sigc::trackable
-{
-public:
- static GeisAdapter& Instance();
-
- GeisAdapter();
- ~GeisAdapter();
-
- void Run();
-
- typedef struct _GeisTapData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- int tap_length_ms;
- float position_x;
- float position_y;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisTapData;
-
- typedef struct _GeisDragData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float delta_x;
- float delta_y;
- float velocity_x;
- float velocity_y;
- float position_x;
- float position_y;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisDragData;
-
- typedef struct _GeisRotateData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float angle;
- float angle_delta;
- float angle_velocity;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisRotateData;
-
- typedef struct _GeisPinchData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float radius;
- float radius_delta;
- float radius_velocity;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisPinchData;
-
- typedef struct _GeisTouchData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisTouchData;
-
- sigc::signal<void, GeisTapData*> tap;
-
- sigc::signal<void, GeisDragData*> drag_start;
- sigc::signal<void, GeisDragData*> drag_update;
- sigc::signal<void, GeisDragData*> drag_finish;
-
- sigc::signal<void, GeisRotateData*> rotate_start;
- sigc::signal<void, GeisRotateData*> rotate_update;
- sigc::signal<void, GeisRotateData*> rotate_finish;
-
- sigc::signal<void, GeisPinchData*> pinch_start;
- sigc::signal<void, GeisPinchData*> pinch_update;
- sigc::signal<void, GeisPinchData*> pinch_finish;
-
- sigc::signal<void, GeisTouchData*> touch_start;
- sigc::signal<void, GeisTouchData*> touch_update;
- sigc::signal<void, GeisTouchData*> touch_finish;
-protected:
- static gboolean OnWatchIn(GIOChannel* source, GIOCondition condition, gpointer data);
-
- static void InputDeviceAdded(void* cookie, GeisInputDeviceId device_id, void* attrs);
- static void InputDeviceChanged(void* cookie, GeisInputDeviceId device_id, void* attrs);
- static void InputDeviceRemoved(void* cookie, GeisInputDeviceId device_id, void* attrs);
-
- static void GestureAdded(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
- static void GestureRemoved(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
-
- static void GestureStart(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
- static void GestureUpdate(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
- static void GestureFinish(void* cookie, GeisGestureType gesture_type, GeisGestureId gesture_id, GeisSize attr_count, GeisGestureAttr* attrs);
-
- GeisTapData* ProcessTapGesture(GeisSize attr_count, GeisGestureAttr* attrs);
- GeisDragData* ProcessDragGesture(GeisSize attr_count, GeisGestureAttr* attrs);
- GeisPinchData* ProcessPinchGesture(GeisSize attr_count, GeisGestureAttr* attrs);
- GeisRotateData* ProcessRotateGesture(GeisSize attr_count, GeisGestureAttr* attrs);
- GeisTouchData* ProcessTouchGesture(GeisSize attr_count, GeisGestureAttr* attrs);
-
-private:
- void RegisterRootInstance();
-
- GeisInstance _root_instance;
- guint _watch_id;
-};
-
-#endif
diff --git a/launcher/HudLauncherIcon.cpp b/launcher/HudLauncherIcon.cpp
index 22ada7182..3a7c64ef6 100644
--- a/launcher/HudLauncherIcon.cpp
+++ b/launcher/HudLauncherIcon.cpp
@@ -44,10 +44,10 @@ HudLauncherIcon::HudLauncherIcon(LauncherHideMode hide_mode)
{
tooltip_text = _("HUD");
icon_name = PKGDATADIR"/launcher_bfb.png";
- SetQuirk(QUIRK_VISIBLE, false);
- SetQuirk(QUIRK_RUNNING, false);
- SetQuirk(QUIRK_ACTIVE, true);
- SetIconType(TYPE_HUD);
+ SetQuirk(Quirk::VISIBLE, false);
+ SetQuirk(Quirk::RUNNING, false);
+ SetQuirk(Quirk::ACTIVE, true);
+ SetIconType(IconType::HUD);
background_color_ = nux::color::White;
@@ -82,7 +82,7 @@ void HudLauncherIcon::SetHideMode(LauncherHideMode hide_mode)
launcher_hide_mode_ = hide_mode;
if (launcher_hide_mode_ == LAUNCHER_HIDE_AUTOHIDE)
- SetQuirk(QUIRK_VISIBLE, false);
+ SetQuirk(Quirk::VISIBLE, false);
}
}
@@ -99,8 +99,8 @@ void HudLauncherIcon::OnOverlayShown(GVariant* data, bool visible)
launcher_hide_mode_ == LAUNCHER_HIDE_NEVER)
{
SetMonitor(overlay_monitor);
- SetQuirk(QUIRK_VISIBLE, visible);
- SetQuirk(QUIRK_ACTIVE, visible);
+ SetQuirk(Quirk::VISIBLE, visible);
+ SetQuirk(Quirk::ACTIVE, visible);
tooltip_enabled = !visible;
EmitNeedsRedraw();
}
@@ -118,7 +118,7 @@ nux::Color HudLauncherIcon::GlowColor()
void HudLauncherIcon::ActivateLauncherIcon(ActionArg arg)
{
- if (GetQuirk(QUIRK_VISIBLE))
+ if (GetQuirk(Quirk::VISIBLE))
{
ubus_manager_.SendMessage(UBUS_HUD_CLOSE_REQUEST);
}
diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp
index bd6ebb3c5..901d7247f 100644
--- a/launcher/Launcher.cpp
+++ b/launcher/Launcher.cpp
@@ -29,6 +29,7 @@
#include <NuxCore/Logger.h>
#include <NuxGraphics/NuxGraphics.h>
+#include <NuxGraphics/GestureEvent.h>
#include <NuxGraphics/GpuDevice.h>
#include <NuxGraphics/GLTextureResourceManager.h>
@@ -91,6 +92,7 @@ const int MOUSE_DEADZONE = 15;
const float DRAG_OUT_PIXELS = 300.0f;
const std::string DND_CHECK_TIMEOUT = "dnd-check-timeout";
+const std::string STRUT_HACK_TIMEOUT = "strut-hack-timeout";
const std::string START_DRAGICON_TIMEOUT = "start-dragicon-timeout";
const std::string SCROLL_TIMEOUT = "scroll-timeout";
const std::string ANIMATION_IDLE = "animation-idle";
@@ -136,8 +138,8 @@ Launcher::Launcher(nux::BaseWindow* parent,
, _launcher_drag_delta_min(0)
, _enter_y(0)
, _last_button_press(0)
- , _drag_out_id(0)
, _drag_out_delta_x(0.0f)
+ , _drag_gesture_ongoing(false)
, _last_reveal_progress(0.0f)
, _collection_window(collection_window)
, _selection_atom(0)
@@ -185,11 +187,6 @@ Launcher::Launcher(nux::BaseWindow* parent,
plugin_adapter.terminate_expo.connect(sigc::mem_fun(this, &Launcher::OnPluginStateChanged));
plugin_adapter.compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &Launcher::EnsureAnimation));
- GeisAdapter& adapter = GeisAdapter::Instance();
- adapter.drag_start.connect(sigc::mem_fun(this, &Launcher::OnDragStart));
- adapter.drag_update.connect(sigc::mem_fun(this, &Launcher::OnDragUpdate));
- adapter.drag_finish.connect(sigc::mem_fun(this, &Launcher::OnDragFinish));
-
display.changed.connect(sigc::mem_fun(this, &Launcher::OnDisplayChanged));
// 0 out timers to avoid wonky startups
@@ -233,45 +230,39 @@ void Launcher::OnDisplayChanged(Display* display)
_collection_window->display = display;
}
-void Launcher::OnDragStart(GeisAdapter::GeisDragData* data)
+void
+Launcher::OnDragStart(const nux::GestureEvent &event)
{
- if (_drag_out_id && _drag_out_id == data->id)
- return;
-
- if (data->touches == 4)
+ _drag_gesture_ongoing = true;
+ if (_hidden)
{
- _drag_out_id = data->id;
- if (_hidden)
- {
- _drag_out_delta_x = 0.0f;
- }
- else
- {
- _drag_out_delta_x = DRAG_OUT_PIXELS;
- _hide_machine.SetQuirk(LauncherHideMachine::MT_DRAG_OUT, false);
- }
+ _drag_out_delta_x = 0.0f;
+ }
+ else
+ {
+ _drag_out_delta_x = DRAG_OUT_PIXELS;
+ _hide_machine.SetQuirk(LauncherHideMachine::MT_DRAG_OUT, false);
}
}
-void Launcher::OnDragUpdate(GeisAdapter::GeisDragData* data)
+void
+Launcher::OnDragUpdate(const nux::GestureEvent &event)
{
- if (data->id == _drag_out_id)
- {
- _drag_out_delta_x = CLAMP(_drag_out_delta_x + data->delta_x, 0.0f, DRAG_OUT_PIXELS);
- EnsureAnimation();
- }
+ _drag_out_delta_x =
+ CLAMP(_drag_out_delta_x + event.GetDelta().x, 0.0f, DRAG_OUT_PIXELS);
+ EnsureAnimation();
}
-void Launcher::OnDragFinish(GeisAdapter::GeisDragData* data)
+void
+Launcher::OnDragFinish(const nux::GestureEvent &event)
{
- if (data->id == _drag_out_id)
- {
- if (_drag_out_delta_x >= DRAG_OUT_PIXELS - 90.0f)
- _hide_machine.SetQuirk(LauncherHideMachine::MT_DRAG_OUT, true);
- TimeUtil::SetTimeStruct(&_times[TIME_DRAG_OUT], &_times[TIME_DRAG_OUT], ANIM_DURATION_SHORT);
- _drag_out_id = 0;
- EnsureAnimation();
- }
+ if (_drag_out_delta_x >= DRAG_OUT_PIXELS - 90.0f)
+ _hide_machine.SetQuirk(LauncherHideMachine::MT_DRAG_OUT, true);
+ TimeUtil::SetTimeStruct(&_times[TIME_DRAG_OUT],
+ &_times[TIME_DRAG_OUT],
+ ANIM_DURATION_SHORT);
+ EnsureAnimation();
+ _drag_gesture_ongoing = false;
}
void Launcher::AddProperties(GVariantBuilder* builder)
@@ -341,9 +332,11 @@ 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);
- if (_drag_out_id || _hide_machine.GetQuirk(LauncherHideMachine::MT_DRAG_OUT))
+ if (_drag_gesture_ongoing
+ || _hide_machine.GetQuirk(LauncherHideMachine::MT_DRAG_OUT))
return progress;
- return progress * (1.0f - timeout);
+ else
+ return progress * (1.0f - timeout);
}
float Launcher::AutohideProgress(struct timespec const& current) const
@@ -380,51 +373,51 @@ void Launcher::EnsureAnimation()
bool Launcher::IconNeedsAnimation(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_VISIBLE);
+ struct timespec time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::VISIBLE);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_RUNNING);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::RUNNING);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::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(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_PRESENTED);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PRESENTED);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_SHIMMER);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::SHIMMER);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_LONG)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_CENTER_SAVED);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::CENTER_SAVED);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_PROGRESS);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::PROGRESS);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_DIM);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DROP_DIM);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DESAT);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DESAT);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION_SHORT_SHORT)
return true;
- time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_DROP_PRELIGHT);
+ time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::DROP_PRELIGHT);
if (unity::TimeUtil::TimeDelta(&current, &time) < ANIM_DURATION)
return true;
@@ -473,7 +466,7 @@ bool Launcher::AnimationInProgress() const
// animations happening on specific icons
LauncherModel::iterator it;
- for (it = _model->begin(); it != _model->end(); it++)
+ for (it = _model->begin(); it != _model->end(); ++it)
if (IconNeedsAnimation(*it, current))
return true;
@@ -503,20 +496,20 @@ float Launcher::IconVisibleProgress(AbstractLauncherIcon::Ptr icon, struct times
if (!icon->IsVisibleOnMonitor(monitor))
return 0.0f;
- if (icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD)
+ if (icon->GetIconType() == AbstractLauncherIcon::IconType::HUD)
{
- return (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE)) ? 1.0f : 0.0f;
+ return (icon->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE)) ? 1.0f : 0.0f;
}
- if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE))
{
- struct timespec icon_visible_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::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);
}
@@ -549,11 +542,11 @@ void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo, timespec
float Launcher::IconPresentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec icon_present_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_PRESENTED))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PRESENTED))
return result;
else
return 1.0f - result;
@@ -561,7 +554,7 @@ float Launcher::IconPresentProgress(AbstractLauncherIcon::Ptr icon, struct times
float Launcher::IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::QUIRK_URGENT);
+ struct timespec urgent_time = icon->GetQuirkTime(AbstractLauncherIcon::Quirk::URGENT);
int urgent_ms = unity::TimeUtil::TimeDelta(&current, &urgent_time);
float result;
@@ -570,7 +563,7 @@ float Launcher::IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timesp
else
result = CLAMP((float) urgent_ms / (float)(ANIM_DURATION_LONG * URGENT_BLINKS * 2), 0.0f, 1.0f);
- if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT))
return result;
else
return 1.0f - result;
@@ -578,11 +571,11 @@ float Launcher::IconUrgentProgress(AbstractLauncherIcon::Ptr icon, struct timesp
float Launcher::IconDropDimValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_DROP_DIM))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::DROP_DIM))
return 1.0f - result;
else
return result;
@@ -590,11 +583,11 @@ float Launcher::IconDropDimValue(AbstractLauncherIcon::Ptr icon, struct timespec
float Launcher::IconDesatValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec dim_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_DESAT))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::DESAT))
return 1.0f - result;
else
return result;
@@ -602,21 +595,21 @@ float Launcher::IconDesatValue(AbstractLauncherIcon::Ptr icon, struct timespec c
float Launcher::IconShimmerProgress(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec shimmer_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec save_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- if (!icon->GetQuirk(AbstractLauncherIcon::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);
@@ -625,19 +618,19 @@ float Launcher::IconUrgentPulseValue(AbstractLauncherIcon::Ptr icon, struct time
float Launcher::IconPulseOnceValue(AbstractLauncherIcon::Ptr icon, struct timespec const &current) const
{
- struct timespec pulse_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::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(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- if (!icon->GetQuirk(AbstractLauncherIcon::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);
@@ -646,7 +639,7 @@ float Launcher::IconUrgentWiggleValue(AbstractLauncherIcon::Ptr icon, struct tim
float Launcher::IconStartingBlinkValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::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;
@@ -655,14 +648,14 @@ float Launcher::IconStartingBlinkValue(AbstractLauncherIcon::Ptr icon, struct ti
float Launcher::IconStartingPulseValue(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec starting_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_RUNNING))
+ if (starting_progress == 1.0f && !icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING))
{
- icon->SetQuirk(AbstractLauncherIcon::QUIRK_STARTING, false);
- icon->ResetQuirkTime(AbstractLauncherIcon::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;
@@ -672,16 +665,16 @@ float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct t
{
float result = 0.0f;
- struct timespec running_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_RUNNING))
- icon->SetQuirk(AbstractLauncherIcon::QUIRK_STARTING, false);
+ if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING))
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::STARTING, false);
float backlight_strength;
if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON)
@@ -705,8 +698,8 @@ float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct t
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(AbstractLauncherIcon::QUIRK_RUNNING))
- icon->ResetQuirkTime(AbstractLauncherIcon::QUIRK_STARTING);
+ if (running_progress == 1.0f && icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING))
+ icon->ResetQuirkTime(AbstractLauncherIcon::Quirk::STARTING);
result = backlight_strength;
if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON)
@@ -718,7 +711,7 @@ float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct t
break;
}
- if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PULSE_ONCE))
{
if (options()->backlight_mode() == BACKLIGHT_ALWAYS_ON)
result *= CLAMP(running_progress + IconPulseOnceValue(icon, current), 0.0f, 1.0f);
@@ -729,7 +722,7 @@ float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct t
}
// urgent serves to bring the total down only
- if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT) && options()->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;
@@ -737,11 +730,11 @@ float Launcher::IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, struct t
float Launcher::IconProgressBias(AbstractLauncherIcon::Ptr icon, struct timespec const& current) const
{
- struct timespec icon_progress_time = icon->GetQuirkTime(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_PROGRESS))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PROGRESS))
return -1.0f + result;
else
return result;
@@ -765,8 +758,8 @@ void Launcher::SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec co
arg.alpha = 0.2f + 0.8f * desat_value;
arg.saturation = desat_value;
arg.colorify = nux::color::White;
- arg.running_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING);
- arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT);
+ arg.running_arrow = icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING);
+ arg.running_colored = icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT);
arg.draw_edge_only = IconDrawEdgeOnly(icon);
arg.active_colored = false;
arg.x_rotation = 0.0f;
@@ -778,14 +771,14 @@ void Launcher::SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec co
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->GetIconType() == AbstractLauncherIcon::TYPE_HOME ||
- icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD;
- arg.colorify_background = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME ||
- icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD ||
- icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH ||
- icon->GetIconType() == AbstractLauncherIcon::TYPE_DESKTOP ||
- icon->GetIconType() == AbstractLauncherIcon::TYPE_DEVICE ||
- icon->GetIconType() == AbstractLauncherIcon::TYPE_EXPO;
+ arg.system_item = icon->GetIconType() == AbstractLauncherIcon::IconType::HOME ||
+ icon->GetIconType() == AbstractLauncherIcon::IconType::HUD;
+ arg.colorify_background = icon->GetIconType() == AbstractLauncherIcon::IconType::HOME ||
+ icon->GetIconType() == AbstractLauncherIcon::IconType::HUD ||
+ icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH ||
+ icon->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP ||
+ icon->GetIconType() == AbstractLauncherIcon::IconType::DEVICE ||
+ icon->GetIconType() == AbstractLauncherIcon::IconType::EXPO;
// trying to protect against flickering when icon is dragged from dash LP: #863230
if (arg.alpha < 0.2)
@@ -794,13 +787,13 @@ void Launcher::SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec co
arg.saturation = 0.0;
}
- arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE);
+ arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::Quirk::ACTIVE);
/* BFB or HUD icons don't need the active arrow if the overaly is opened
* in another monitor */
if (arg.active_arrow && !IsOverlayOpen() &&
- (icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME ||
- icon->GetIconType() == AbstractLauncherIcon::TYPE_HUD))
+ (icon->GetIconType() == AbstractLauncherIcon::IconType::HOME ||
+ icon->GetIconType() == AbstractLauncherIcon::IconType::HUD))
{
arg.active_arrow = false;
}
@@ -817,9 +810,9 @@ void Launcher::SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec co
arg.shortcut_label = 0;
// we dont need to show strays
- if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING))
+ if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING))
{
- if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_URGENT))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT))
{
arg.running_arrow = true;
arg.window_indicators = 1;
@@ -840,13 +833,13 @@ void Launcher::SetupRenderArg(AbstractLauncherIcon::Ptr icon, struct timespec co
float urgent_progress = IconUrgentProgress(icon, current);
- if (icon->GetQuirk(AbstractLauncherIcon::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(AbstractLauncherIcon::QUIRK_URGENT) && options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::URGENT) && options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
{
arg.z_rotation = IconUrgentWiggleValue(icon, current);
}
@@ -997,7 +990,7 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
// compute required height of launcher AND folding threshold
float sum = 0.0f + center.y;
float folding_threshold = launcher_height - _icon_size / 2.5f;
- for (it = _model->begin(); it != _model->end(); it++)
+ for (it = _model->begin(); it != _model->end(); ++it)
{
float height = (_icon_size + _space_between_icons) * IconVisibleProgress(*it, current);
sum += height;
@@ -1106,7 +1099,7 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
// wont start jumping around). As a general rule ANY if () statements that modify center.y should be seen
// as bugs.
int index = 1;
- for (it = _model->main_begin(); it != _model->main_end(); it++)
+ for (it = _model->main_begin(); it != _model->main_end(); ++it)
{
RenderArg arg;
AbstractLauncherIcon::Ptr icon = *it;
@@ -1120,7 +1113,7 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
// compute maximum height of shelf
float shelf_sum = 0.0f;
- for (it = _model->shelf_begin(); it != _model->shelf_end(); it++)
+ for (it = _model->shelf_begin(); it != _model->shelf_end(); ++it)
{
float height = (_icon_size + _space_between_icons) * IconVisibleProgress(*it, current);
shelf_sum += height;
@@ -1134,7 +1127,7 @@ void Launcher::RenderArgs(std::list<RenderArg> &launcher_args,
folding_threshold += shelf_delta;
center.y += shelf_delta;
- for (it = _model->shelf_begin(); it != _model->shelf_end(); it++)
+ for (it = _model->shelf_begin(); it != _model->shelf_end(); ++it)
{
RenderArg arg;
AbstractLauncherIcon::Ptr icon = *it;
@@ -1188,10 +1181,10 @@ void Launcher::DesaturateIcons()
{
for (auto icon : *_model)
{
- if (icon->GetIconType () != AbstractLauncherIcon::TYPE_HOME &&
- icon->GetIconType () != AbstractLauncherIcon::TYPE_HUD)
+ if (icon->GetIconType () != AbstractLauncherIcon::IconType::HOME &&
+ icon->GetIconType () != AbstractLauncherIcon::IconType::HUD)
{
- icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true);
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true);
}
icon->HideTooltip();
@@ -1202,7 +1195,7 @@ void Launcher::SaturateIcons()
{
for (auto icon : *_model)
{
- icon->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, false);
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false);
}
}
@@ -1429,6 +1422,17 @@ LauncherHideMode Launcher::GetHideMode() const
/* End Launcher Show/Hide logic */
+// Hacks around compiz failing to see the struts because the window was just mapped.
+bool Launcher::StrutHack()
+{
+ _parent->InputWindowEnableStruts(false);
+
+ if (options()->hide_mode == LAUNCHER_HIDE_NEVER)
+ _parent->InputWindowEnableStruts(true);
+
+ return false;
+}
+
void Launcher::OnOptionsChanged(Options::Ptr options)
{
UpdateOptions(options);
@@ -1469,7 +1473,16 @@ void Launcher::SetHideMode(LauncherHideMode hidemode)
}
else
{
+ static bool first_time = true;
+
_parent->EnableInputWindow(true, launcher::window_title, false, false);
+
+ if (first_time && !sources_.GetSource(STRUT_HACK_TIMEOUT))
+ {
+ sources_.AddTimeout(1000, sigc::mem_fun(this, &Launcher::StrutHack), STRUT_HACK_TIMEOUT);
+ first_time = false;
+ }
+
_parent->InputWindowEnableStruts(true);
}
@@ -1702,7 +1715,7 @@ void Launcher::EnsureIconOnScreen(AbstractLauncherIcon::Ptr selection)
int natural_y = 0;
for (auto icon : *_model)
{
- if (!icon->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) || !icon->IsVisibleOnMonitor(monitor))
+ if (!icon->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) || !icon->IsVisibleOnMonitor(monitor))
continue;
if (icon == selection)
@@ -1908,7 +1921,7 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
EventLogic();
/* draw launcher */
- for (rev_it = args.rbegin(); rev_it != args.rend(); rev_it++)
+ for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it)
{
if ((*rev_it).stick_thingy)
gPainter.Paint2DQuadColor(GfxContext,
@@ -2005,7 +2018,7 @@ void Launcher::StartIconDragRequest(int x, int y)
// FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
// on an internal Launcher property then
- if (drag_icon && (_last_button_press == 1) && _model->IconHasSister(drag_icon))
+ if (drag_icon && _last_button_press == 1 && _model->IconHasSister(drag_icon))
{
SetActionState(ACTION_DRAG_ICON);
StartIconDrag(drag_icon);
@@ -2055,9 +2068,9 @@ void Launcher::EndIconDrag()
{
AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection(_mouse_position.x, _mouse_position.y);
- if (hovered_icon && hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH)
+ if (hovered_icon && hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH)
{
- hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_PULSE_ONCE, true);
+ hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::PULSE_ONCE, true);
launcher_removerequest.emit(_drag_icon);
@@ -2114,9 +2127,9 @@ void Launcher::UpdateDragWindowPosition(int x, int y)
AbstractLauncherIcon::Ptr iconBeforeHover;
LauncherModel::iterator it;
LauncherModel::iterator prevIt = _model->end();
- for (it = _model->begin(); it != _model->end(); it++)
+ for (it = _model->begin(); it != _model->end(); ++it)
{
- if (!(*it)->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor))
+ if (!(*it)->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor))
continue;
if ((*it) == hovered_icon) {
@@ -2134,6 +2147,15 @@ void Launcher::UpdateDragWindowPosition(int x, int y)
}
}
}
+
+ if (progress >= 1.0f)
+ {
+ _model->ReorderSmart(_drag_icon, hovered_icon, true);
+ }
+ else if (progress == 0.0f)
+ {
+ _model->ReorderBefore(_drag_icon, hovered_icon, false);
+ }
}
}
}
@@ -2236,9 +2258,7 @@ void Launcher::RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned
void Launcher::RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags)
{
- SetMousePosition(x, y);
SetStateMouseOverLauncher(false);
- //AbstractLauncherIcon::SetSkipTooltipDelay(false);
EventLogic();
EnsureAnimation();
@@ -2460,9 +2480,9 @@ AbstractLauncherIcon::Ptr Launcher::MouseIconIntersection(int x, int y)
nux::Point2 mouse_position(x, y);
int inside = 0;
- for (it = _model->begin(); it != _model->end(); it++)
+ for (it = _model->begin(); it != _model->end(); ++it)
{
- if (!(*it)->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor))
+ if (!(*it)->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) || !(*it)->IsVisibleOnMonitor(monitor))
continue;
nux::Point2 screen_coord [4];
@@ -2505,7 +2525,26 @@ void Launcher::RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLaun
RestoreSystemRenderTarget();
}
-void Launcher::SetOffscreenRenderTarget(nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)
+nux::GestureDeliveryRequest Launcher::GestureEvent(const nux::GestureEvent &event)
+{
+ switch(event.type)
+ {
+ case nux::EVENT_GESTURE_BEGIN:
+ OnDragStart(event);
+ break;
+ case nux::EVENT_GESTURE_UPDATE:
+ OnDragUpdate(event);
+ break;
+ default: // EVENT_GESTURE_END
+ OnDragFinish(event);
+ break;
+ }
+
+ return nux::GestureDeliveryRequest::NONE;
+}
+
+void
+Launcher::SetOffscreenRenderTarget(nux::ObjectPtr<nux::IOpenGLBaseTexture> texture)
{
int width = texture->GetWidth();
int height = texture->GetHeight();
@@ -2560,13 +2599,13 @@ void Launcher::OnDNDDataCollected(const std::list<char*>& mimes)
{
if (it->ShouldHighlightOnDrag(_dnd_data))
{
- it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, false);
- it->SetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED, true);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, true);
}
else
{
- it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true);
- it->SetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED, false);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, false);
}
}
}
@@ -2597,8 +2636,8 @@ void Launcher::DndReset()
for (auto it : *_model)
{
- it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, is_overlay_open);
- it->SetQuirk(AbstractLauncherIcon::QUIRK_PRESENTED, false);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, is_overlay_open);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::PRESENTED, false);
}
DndHoveredIconReset();
@@ -2611,7 +2650,7 @@ void Launcher::DndHoveredIconReset()
if (_steal_drag && _dnd_hovered_icon)
{
- _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false);
+ _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, false);
_dnd_hovered_icon->remove.emit(_dnd_hovered_icon);
}
@@ -2668,9 +2707,9 @@ void Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
for (auto it : *_model)
{
if (it->ShouldHighlightOnDrag(_dnd_data))
- it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, false);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, false);
else
- it->SetQuirk(AbstractLauncherIcon::QUIRK_DESAT, true);
+ it->SetQuirk(AbstractLauncherIcon::Quirk::DESAT, true);
}
}
}
@@ -2699,10 +2738,10 @@ void Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
bool hovered_icon_is_appropriate = false;
if (hovered_icon)
{
- if (hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH)
+ if (hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH)
_steal_drag = false;
- if (hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_APPLICATION || hovered_icon->GetIconType() == AbstractLauncherIcon::TYPE_EXPO)
+ if (hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::APPLICATION || hovered_icon->GetIconType() == AbstractLauncherIcon::IconType::EXPO)
hovered_icon_is_appropriate = true;
}
@@ -2726,7 +2765,7 @@ void Launcher::ProcessDndMove(int x, int y, std::list<char*> mimes)
}
else
{
- _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false);
+ _dnd_hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, false);
_dnd_hovered_icon->remove.emit(_dnd_hovered_icon);
_dnd_hovered_icon = nullptr;
}
diff --git a/launcher/Launcher.h b/launcher/Launcher.h
index 3c1c010d4..a44671a3d 100644
--- a/launcher/Launcher.h
+++ b/launcher/Launcher.h
@@ -32,7 +32,6 @@
#include "DNDCollectionWindow.h"
#include "DndData.h"
#include "EdgeBarrierController.h"
-#include "GeisAdapter.h"
#include "unity-shared/Introspectable.h"
#include "LauncherModel.h"
#include "LauncherOptions.h"
@@ -136,6 +135,7 @@ public:
void RenderIconToTexture(nux::GraphicsEngine& GfxContext, AbstractLauncherIcon::Ptr icon, nux::ObjectPtr<nux::IOpenGLBaseTexture> texture);
+ virtual nux::GestureDeliveryRequest GestureEvent(const nux::GestureEvent &event);
protected:
// Introspectable methods
std::string GetName() const;
@@ -183,9 +183,9 @@ private:
void OnWindowMapped(guint32 xid);
void OnWindowUnmapped(guint32 xid);
- void OnDragStart(GeisAdapter::GeisDragData* data);
- void OnDragUpdate(GeisAdapter::GeisDragData* data);
- void OnDragFinish(GeisAdapter::GeisDragData* data);
+ void OnDragStart(const nux::GestureEvent &event);
+ void OnDragUpdate(const nux::GestureEvent &event);
+ void OnDragFinish(const nux::GestureEvent &event);
bool HandleBarrierEvent(ui::PointerBarrierWrapper* owner, ui::BarrierEvent::Ptr event);
@@ -193,6 +193,7 @@ private:
void OnSelectionChanged(AbstractLauncherIcon::Ptr selection);
+ bool StrutHack();
bool StartIconDragTimeout();
bool OnScrollTimeout();
bool OnUpdateDragManagerTimeout();
@@ -362,8 +363,8 @@ private:
int _launcher_drag_delta_min;
int _enter_y;
int _last_button_press;
- int _drag_out_id;
float _drag_out_delta_x;
+ bool _drag_gesture_ongoing;
float _last_reveal_progress;
nux::Point2 _mouse_position;
diff --git a/launcher/LauncherController.cpp b/launcher/LauncherController.cpp
index edc8192fa..2ee6150c3 100644
--- a/launcher/LauncherController.cpp
+++ b/launcher/LauncherController.cpp
@@ -361,7 +361,7 @@ Controller::Impl::OnLauncherAddRequestSpecial(std::string const& path,
if (result)
{
- result->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, false);
+ result->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, false);
result->Animate(CurrentLauncher(), icon_x, icon_y, icon_size);
RegisterIcon(result);
Save();
@@ -370,7 +370,7 @@ Controller::Impl::OnLauncherAddRequestSpecial(std::string const& path,
void Controller::Impl::OnSCIconAnimationComplete(AbstractLauncherIcon::Ptr icon)
{
- icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, true);
launcher_->ForceReveal(false);
}
@@ -410,7 +410,7 @@ void Controller::Impl::OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon)
{
switch (icon->GetIconType())
{
- case AbstractLauncherIcon::TYPE_APPLICATION:
+ case AbstractLauncherIcon::IconType::APPLICATION:
{
BamfLauncherIcon* bamf_icon = dynamic_cast<BamfLauncherIcon*>(icon.GetPointer());
@@ -422,7 +422,7 @@ void Controller::Impl::OnLauncherRemoveRequest(AbstractLauncherIcon::Ptr icon)
break;
}
- case AbstractLauncherIcon::TYPE_DEVICE:
+ case AbstractLauncherIcon::IconType::DEVICE:
{
DeviceLauncherIcon* device_icon = dynamic_cast<DeviceLauncherIcon*>(icon.GetPointer());
@@ -469,7 +469,7 @@ void Controller::Impl::OnFavoriteStoreFavoriteAdded(std::string const& entry, st
{
for (auto it : bamf_list)
{
- if (it->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE) && pos == it->DesktopFile())
+ if (it->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE) && pos == it->DesktopFile())
other = it;
}
}
@@ -502,13 +502,13 @@ void Controller::Impl::OnFavoriteStoreFavoriteAdded(std::string const& entry, st
void Controller::Impl::OnFavoriteStoreFavoriteRemoved(std::string const& entry)
{
- for (auto it : model_->GetSublist<BamfLauncherIcon> ())
+ for (auto icon : model_->GetSublist<BamfLauncherIcon> ())
{
- if (it->DesktopFile() == entry)
+ if (icon->DesktopFile() == entry)
{
- OnLauncherRemoveRequest(it);
+ icon->UnStick();
break;
- }
+ }
}
}
@@ -570,9 +570,9 @@ void Controller::Impl::InsertExpoAction()
SimpleLauncherIcon* icon = static_cast<SimpleLauncherIcon*>(expo_icon_.GetPointer());
icon->tooltip_text = _("Workspace Switcher");
icon->icon_name = "workspace-switcher";
- icon->SetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE, true);
- icon->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false);
- icon->SetIconType(AbstractLauncherIcon::TYPE_EXPO);
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::VISIBLE, true);
+ icon->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, false);
+ icon->SetIconType(AbstractLauncherIcon::IconType::EXPO);
icon->SetShortcut('s');
on_expoicon_activate_connection_ = icon->activate.connect(sigc::mem_fun(this, &Impl::OnExpoActivated));
@@ -788,7 +788,7 @@ std::vector<AbstractLauncherIcon::Ptr> Controller::GetAltTabIcons(bool current,
if (icon->ShowInSwitcher(current))
{
//otherwise we get two desktop icons in the switcher.
- if (icon->GetIconType() != AbstractLauncherIcon::IconType::TYPE_DESKTOP)
+ if (icon->GetIconType() != AbstractLauncherIcon::IconType::DESKTOP)
{
results.push_back(icon);
}
@@ -941,12 +941,12 @@ bool Controller::HandleLauncherKeyEvent(Display *display, unsigned int key_sym,
LauncherModel::iterator it;
// Shortcut to start launcher icons. Only relies on Keycode, ignore modifier
- for (it = pimpl->model_->begin(); it != pimpl->model_->end(); it++)
+ 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 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)
@@ -1052,7 +1052,7 @@ void Controller::KeyNavTerminate(bool activate)
{
/* If the selected icon is running, we must not restore the input to the old */
AbstractLauncherIcon::Ptr const& icon = pimpl->model_->Selection();
- pimpl->keynav_restore_window_ = !icon->GetQuirk(AbstractLauncherIcon::QUIRK_RUNNING);
+ pimpl->keynav_restore_window_ = !icon->GetQuirk(AbstractLauncherIcon::Quirk::RUNNING);
}
pimpl->keyboard_launcher_->ExitKeyNavMode();
diff --git a/launcher/LauncherIcon.cpp b/launcher/LauncherIcon.cpp
index 2bdc6bcee..236e3a38e 100644
--- a/launcher/LauncherIcon.cpp
+++ b/launcher/LauncherIcon.cpp
@@ -81,7 +81,7 @@ LauncherIcon::LauncherIcon()
, _background_color(nux::color::White)
, _glow_color(nux::color::White)
, _shortcut(0)
- , _icon_type(TYPE_NONE)
+ , _icon_type(IconType::NONE)
, _center(max_num_monitors)
, _has_visible_window(max_num_monitors)
, _last_stable(max_num_monitors)
@@ -89,7 +89,7 @@ LauncherIcon::LauncherIcon()
, _saved_center(max_num_monitors)
, _allow_quicklist_to_show(true)
{
- for (int i = 0; i < QUIRK_LAST; i++)
+ for (unsigned i = 0; i < unsigned(Quirk::LAST); i++)
{
_quirks[i] = false;
_quirk_times[i].tv_sec = 0;
@@ -120,7 +120,7 @@ LauncherIcon::LauncherIcon()
LauncherIcon::~LauncherIcon()
{
- SetQuirk(QUIRK_URGENT, false);
+ SetQuirk(Quirk::URGENT, false);
// clean up the whole signal-callback mess
if (needs_redraw_connection.connected())
@@ -196,19 +196,19 @@ LauncherIcon::AddProperties(GVariantBuilder* builder)
.add("center_x", _center[0].x)
.add("center_y", _center[0].y)
.add("center_z", _center[0].z)
- .add("related_windows", static_cast<unsigned int>(Windows().size()))
- .add("icon_type", _icon_type)
+ .add("related_windows", Windows().size())
+ .add("icon_type", unsigned(_icon_type))
.add("tooltip_text", tooltip_text())
.add("sort_priority", _sort_priority)
.add("shortcut", _shortcut)
.add("monitors_visibility", g_variant_builder_end(&monitors_builder))
- .add("active", GetQuirk(QUIRK_ACTIVE))
- .add("visible", GetQuirk(QUIRK_VISIBLE))
- .add("urgent", GetQuirk(QUIRK_URGENT))
- .add("running", GetQuirk(QUIRK_RUNNING))
- .add("starting", GetQuirk(QUIRK_STARTING))
- .add("desaturated", GetQuirk(QUIRK_DESAT))
- .add("presented", GetQuirk(QUIRK_PRESENTED));
+ .add("active", GetQuirk(Quirk::ACTIVE))
+ .add("visible", GetQuirk(Quirk::VISIBLE))
+ .add("urgent", GetQuirk(Quirk::URGENT))
+ .add("running", GetQuirk(Quirk::RUNNING))
+ .add("starting", GetQuirk(Quirk::STARTING))
+ .add("desaturated", GetQuirk(Quirk::DESAT))
+ .add("presented", GetQuirk(Quirk::PRESENTED));
}
void
@@ -221,7 +221,7 @@ LauncherIcon::Activate(ActionArg arg)
ActivateLauncherIcon(arg);
- UpdateQuirkTime(QUIRK_LAST_ACTION);
+ UpdateQuirkTime(Quirk::LAST_ACTION);
}
void
@@ -232,7 +232,7 @@ LauncherIcon::OpenInstance(ActionArg arg)
OpenInstanceLauncherIcon(arg);
- UpdateQuirkTime(QUIRK_LAST_ACTION);
+ UpdateQuirkTime(Quirk::LAST_ACTION);
}
nux::Color LauncherIcon::BackgroundColor() const
@@ -730,7 +730,7 @@ void
LauncherIcon::SaveCenter()
{
_saved_center = _center;
- UpdateQuirkTime(QUIRK_CENTER_SAVED);
+ UpdateQuirkTime(Quirk::CENTER_SAVED);
}
void
@@ -762,7 +762,7 @@ LauncherIcon::IsVisibleOnMonitor(int monitor) const
bool
LauncherIcon::OnPresentTimeout()
{
- if (!GetQuirk(QUIRK_PRESENTED))
+ if (!GetQuirk(Quirk::PRESENTED))
return false;
Unpresent();
@@ -778,7 +778,7 @@ float LauncherIcon::PresentUrgency()
void
LauncherIcon::Present(float present_urgency, int length)
{
- if (GetQuirk(QUIRK_PRESENTED))
+ if (GetQuirk(Quirk::PRESENTED))
return;
if (length >= 0)
@@ -788,17 +788,17 @@ LauncherIcon::Present(float present_urgency, int length)
}
_present_urgency = CLAMP(present_urgency, 0.0f, 1.0f);
- SetQuirk(QUIRK_PRESENTED, true);
+ SetQuirk(Quirk::PRESENTED, true);
}
void
LauncherIcon::Unpresent()
{
- if (!GetQuirk(QUIRK_PRESENTED))
+ if (!GetQuirk(Quirk::PRESENTED))
return;
_source_manager.Remove(PRESENT_TIMEOUT);
- SetQuirk(QUIRK_PRESENTED, false);
+ SetQuirk(Quirk::PRESENTED, false);
}
void
@@ -807,7 +807,7 @@ LauncherIcon::Remove()
if (_quicklist && _quicklist->IsVisible())
_quicklist->Hide();
- SetQuirk(QUIRK_VISIBLE, false);
+ SetQuirk(Quirk::VISIBLE, false);
EmitRemove();
}
@@ -838,26 +838,26 @@ LauncherIcon::GetIconType()
bool
LauncherIcon::GetQuirk(LauncherIcon::Quirk quirk) const
{
- return _quirks[quirk];
+ return _quirks[unsigned(quirk)];
}
void
LauncherIcon::SetQuirk(LauncherIcon::Quirk quirk, bool value)
{
- if (_quirks[quirk] == value)
+ if (_quirks[unsigned(quirk)] == value)
return;
- _quirks[quirk] = value;
- if (quirk == QUIRK_VISIBLE)
- TimeUtil::SetTimeStruct(&(_quirk_times[quirk]), &(_quirk_times[quirk]), Launcher::ANIM_DURATION_SHORT);
+ _quirks[unsigned(quirk)] = value;
+ if (quirk == Quirk::VISIBLE)
+ TimeUtil::SetTimeStruct(&(_quirk_times[unsigned(quirk)]), &(_quirk_times[unsigned(quirk)]), Launcher::ANIM_DURATION_SHORT);
else
- clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));
+ clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[unsigned(quirk)]));
EmitNeedsRedraw();
// Present on urgent as a general policy
- if (quirk == QUIRK_VISIBLE && value)
+ if (quirk == Quirk::VISIBLE && value)
Present(0.5f, 1500);
- if (quirk == QUIRK_URGENT)
+ if (quirk == Quirk::URGENT)
{
if (value)
{
@@ -868,7 +868,7 @@ LauncherIcon::SetQuirk(LauncherIcon::Quirk quirk, bool value)
ubus_server_send_message(ubus, UBUS_LAUNCHER_ICON_URGENT_CHANGED, g_variant_new_boolean(value));
}
- if (quirk == QUIRK_VISIBLE)
+ if (quirk == Quirk::VISIBLE)
{
visibility_changed.emit();
}
@@ -886,21 +886,21 @@ LauncherIcon::UpdateQuirkTimeDelayed(guint ms, LauncherIcon::Quirk quirk)
void
LauncherIcon::UpdateQuirkTime(LauncherIcon::Quirk quirk)
{
- clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[quirk]));
+ clock_gettime(CLOCK_MONOTONIC, &(_quirk_times[unsigned(quirk)]));
EmitNeedsRedraw();
}
void
LauncherIcon::ResetQuirkTime(LauncherIcon::Quirk quirk)
{
- _quirk_times[quirk].tv_sec = 0;
- _quirk_times[quirk].tv_nsec = 0;
+ _quirk_times[unsigned(quirk)].tv_sec = 0;
+ _quirk_times[unsigned(quirk)].tv_nsec = 0;
}
struct timespec
LauncherIcon::GetQuirkTime(LauncherIcon::Quirk quirk)
{
- return _quirk_times[quirk];
+ return _quirk_times[unsigned(quirk)];
}
void
@@ -1087,10 +1087,10 @@ LauncherIcon::RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote)
RemoveChild(remote.get());
DeleteEmblem();
- SetQuirk(QUIRK_PROGRESS, false);
+ SetQuirk(Quirk::PROGRESS, false);
if (_remote_urgent)
- SetQuirk(QUIRK_URGENT, false);
+ SetQuirk(Quirk::URGENT, false);
_menuclient_dynamic_quicklist = nullptr;
}
@@ -1099,7 +1099,7 @@ void
LauncherIcon::OnRemoteUrgentChanged(LauncherEntryRemote* remote)
{
_remote_urgent = remote->Urgent();
- SetQuirk(QUIRK_URGENT, remote->Urgent());
+ SetQuirk(Quirk::URGENT, remote->Urgent());
}
void
@@ -1166,7 +1166,7 @@ LauncherIcon::OnRemoteCountVisibleChanged(LauncherEntryRemote* remote)
void
LauncherIcon::OnRemoteProgressVisibleChanged(LauncherEntryRemote* remote)
{
- SetQuirk(QUIRK_PROGRESS, remote->ProgressVisible());
+ SetQuirk(Quirk::PROGRESS, remote->ProgressVisible());
if (remote->ProgressVisible())
SetProgress(remote->Progress());
diff --git a/launcher/LauncherIcon.h b/launcher/LauncherIcon.h
index c341bd064..3544535ae 100644
--- a/launcher/LauncherIcon.h
+++ b/launcher/LauncherIcon.h
@@ -336,8 +336,8 @@ private:
BaseTexturePtr _emblem;
- bool _quirks[QUIRK_LAST];
- struct timespec _quirk_times[QUIRK_LAST];
+ bool _quirks[unsigned(Quirk::LAST)];
+ struct timespec _quirk_times[unsigned(Quirk::LAST)];
bool _allow_quicklist_to_show;
diff --git a/launcher/LauncherModel.cpp b/launcher/LauncherModel.cpp
index fa7bab510..15583508b 100644
--- a/launcher/LauncherModel.cpp
+++ b/launcher/LauncherModel.cpp
@@ -56,7 +56,7 @@ unity::debug::Introspectable::IntrospectableList LauncherModel::GetIntrospectabl
bool LauncherModel::IconShouldShelf(AbstractLauncherIcon::Ptr icon) const
{
- return icon->GetIconType() == AbstractLauncherIcon::TYPE_TRASH;
+ return icon->GetIconType() == AbstractLauncherIcon::IconType::TRASH;
}
bool LauncherModel::CompareIcons(AbstractLauncherIcon::Ptr first, AbstractLauncherIcon::Ptr second)
@@ -79,14 +79,14 @@ LauncherModel::Populate()
iterator it, it2;
int i = 0;
- for (it = main_begin(); it != main_end(); it++)
+ for (it = main_begin(); it != main_end(); ++it)
{
_inner.push_back(*it);
(*it)->SetSortPriority(i);
++i;
}
- for (it = shelf_begin(); it != shelf_end(); it++)
+ for (it = shelf_begin(); it != shelf_end(); ++it)
{
_inner.push_back(*it);
(*it)->SetSortPriority(i);
@@ -161,7 +161,7 @@ LauncherModel::IconHasSister(AbstractLauncherIcon::Ptr icon) const
const_iterator it;
const_iterator end;
- if (icon && icon->GetIconType() == AbstractLauncherIcon::TYPE_DEVICE)
+ if (icon && icon->GetIconType() == AbstractLauncherIcon::IconType::DEVICE)
return true;
if (IconShouldShelf(icon))
@@ -357,7 +357,7 @@ void LauncherModel::SelectNext()
if (temp >= Size())
temp = 0;
- if (_inner[temp]->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
+ if (_inner[temp]->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE))
{
selection_ = temp;
selection_changed.emit(Selection());
@@ -377,7 +377,7 @@ void LauncherModel::SelectPrevious()
if (temp < 0)
temp = Size() - 1;
- if (_inner[temp]->GetQuirk(AbstractLauncherIcon::QUIRK_VISIBLE))
+ if (_inner[temp]->GetQuirk(AbstractLauncherIcon::Quirk::VISIBLE))
{
selection_ = temp;
selection_changed.emit(Selection());
@@ -409,7 +409,7 @@ LauncherModel::at(int index)
int i;
// start currently selected icon
- for (it = _inner.begin(), i = 0; it != _inner.end(); it++, i++)
+ for (it = _inner.begin(), i = 0; it != _inner.end(); ++it, i++)
{
if (i == index)
return it;
diff --git a/launcher/MockLauncherIcon.h b/launcher/MockLauncherIcon.h
index 46b0cbf72..7bdc0fa46 100644
--- a/launcher/MockLauncherIcon.h
+++ b/launcher/MockLauncherIcon.h
@@ -49,9 +49,9 @@ public:
{
tooltip_text = "Mock Icon";
sort_priority_ = 0;
- type_ = TYPE_APPLICATION;
+ type_ = IconType::APPLICATION;
- for (int i = 0; i < QUIRK_LAST; ++i)
+ for (unsigned i = 0; i < unsigned(Quirk::LAST); ++i)
{
quirks_[i] = false;
}
@@ -206,12 +206,12 @@ public:
bool GetQuirk(Quirk quirk) const
{
- return quirks_[quirk];
+ return quirks_[unsigned(quirk)];
}
void SetQuirk(Quirk quirk, bool value)
{
- quirks_[quirk] = value;
+ quirks_[unsigned(quirk)] = value;
}
void ResetQuirkTime(Quirk quirk) {};
@@ -344,7 +344,7 @@ private:
nux::BaseTexture* icon_;
int sort_priority_;
IconType type_;
- bool quirks_[QUIRK_LAST];
+ bool quirks_[unsigned(Quirk::LAST)];
};
}
diff --git a/launcher/SoftwareCenterLauncherIcon.cpp b/launcher/SoftwareCenterLauncherIcon.cpp
index 2780457bb..e88c6462f 100644
--- a/launcher/SoftwareCenterLauncherIcon.cpp
+++ b/launcher/SoftwareCenterLauncherIcon.cpp
@@ -49,7 +49,7 @@ SoftwareCenterLauncherIcon::SoftwareCenterLauncherIcon(BamfApplication* app,
aptdaemon_trans_.Connect("PropertyChanged", sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnPropertyChanged));
aptdaemon_trans_.Connect("Finished", sigc::mem_fun(this, &SoftwareCenterLauncherIcon::OnFinished));
- SetIconType(TYPE_APPLICATION);
+ SetIconType(IconType::APPLICATION);
icon_name = icon_path;
if (!aptdaemon_trans_id_.empty()) // Application is being installed, or hasn't been installed yet
tooltip_text = _("Waiting to install");
@@ -114,13 +114,13 @@ void SoftwareCenterLauncherIcon::ActivateLauncherIcon(ActionArg arg)
{
if (needs_urgent_)
{
- SetQuirk(QUIRK_URGENT, false);
+ SetQuirk(Quirk::URGENT, false);
needs_urgent_ = false;
}
BamfLauncherIcon::ActivateLauncherIcon(arg);
}
else
- SetQuirk(QUIRK_STARTING, false);
+ SetQuirk(Quirk::STARTING, false);
}
void SoftwareCenterLauncherIcon::OnFinished(GVariant *params)
@@ -131,8 +131,8 @@ void SoftwareCenterLauncherIcon::OnFinished(GVariant *params)
if (exit_state.Str() == "exit-success")
{
tooltip_text = BamfName();
- SetQuirk(QUIRK_PROGRESS, false);
- SetQuirk(QUIRK_URGENT, true);
+ SetQuirk(Quirk::PROGRESS, false);
+ SetQuirk(Quirk::URGENT, true);
SetProgress(0.0f);
finished_ = true;
needs_urgent_ = true;
@@ -157,7 +157,7 @@ void SoftwareCenterLauncherIcon::OnPropertyChanged(GVariant* params)
if (progress < 100)
{
- SetQuirk(QUIRK_PROGRESS, true);
+ SetQuirk(Quirk::PROGRESS, true);
finished_ = false;
}
diff --git a/launcher/SpacerLauncherIcon.cpp b/launcher/SpacerLauncherIcon.cpp
index 556b13cf0..6c46b6749 100644
--- a/launcher/SpacerLauncherIcon.cpp
+++ b/launcher/SpacerLauncherIcon.cpp
@@ -30,9 +30,9 @@ namespace launcher
SpacerLauncherIcon::SpacerLauncherIcon(int monitor)
: SingleMonitorLauncherIcon(monitor)
{
- SetQuirk(QUIRK_VISIBLE, true);
- SetQuirk(QUIRK_RUNNING, false);
- SetIconType(TYPE_APPLICATION);
+ SetQuirk(Quirk::VISIBLE, true);
+ SetQuirk(Quirk::RUNNING, false);
+ SetIconType(IconType::APPLICATION);
tooltip_text = _("Drop To Add Application");
}
diff --git a/launcher/StandaloneLauncher.cpp b/launcher/StandaloneLauncher.cpp
index a3e7a7752..8dba0e4f7 100644
--- a/launcher/StandaloneLauncher.cpp
+++ b/launcher/StandaloneLauncher.cpp
@@ -59,7 +59,6 @@ int main(int argc, char** argv)
nux::NuxInitialize(0);
- GeisAdapter geis_adapter;
unity::Settings settings;
panel::Style panel_style;
internal::FavoriteStoreGSettings favorite_store;
diff --git a/launcher/SwitcherController.cpp b/launcher/SwitcherController.cpp
index cc49f8621..84b1fe095 100644
--- a/launcher/SwitcherController.cpp
+++ b/launcher/SwitcherController.cpp
@@ -73,6 +73,9 @@ void Controller::OnBackgroundUpdate(GVariant* data)
void Controller::Show(ShowMode show, SortMode sort, bool reverse,
std::vector<AbstractLauncherIcon::Ptr> results)
{
+ if (results.empty())
+ return;
+
if (sort == SortMode::FOCUS_ORDER)
{
std::sort(results.begin(), results.end(), CompareSwitcherItemsPriority);
@@ -223,7 +226,7 @@ void Controller::Hide(bool accept_state)
}
else
{
- if (selection->GetQuirk (AbstractLauncherIcon::QUIRK_ACTIVE) &&
+ if (selection->GetQuirk(AbstractLauncherIcon::Quirk::ACTIVE) &&
!model_->DetailXids().empty ())
{
selection->Activate(ActionArg (ActionArg::SWITCHER, 0, model_->DetailXids()[0]));
@@ -411,10 +414,10 @@ bool Controller::CompareSwitcherItemsPriority(AbstractLauncherIcon::Ptr first,
if (first->GetIconType() == second->GetIconType())
return first->SwitcherPriority() > second->SwitcherPriority();
- if (first->GetIconType() == AbstractLauncherIcon::IconType::TYPE_DESKTOP)
+ if (first->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP)
return true;
- if (second->GetIconType() == AbstractLauncherIcon::IconType::TYPE_DESKTOP)
+ if (second->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP)
return false;
return first->GetIconType() < second->GetIconType();
diff --git a/launcher/SwitcherModel.cpp b/launcher/SwitcherModel.cpp
index 3f94e88f9..d0fea19d7 100644
--- a/launcher/SwitcherModel.cpp
+++ b/launcher/SwitcherModel.cpp
@@ -42,7 +42,7 @@ SwitcherModel::SwitcherModel(std::vector<AbstractLauncherIcon::Ptr> icons)
for (auto icon : _inner)
{
AddChild(icon.GetPointer());
- if (icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE))
+ if (icon->GetQuirk(AbstractLauncherIcon::Quirk::ACTIVE))
_last_active_icon = icon;
}
}
diff --git a/launcher/TrashLauncherIcon.cpp b/launcher/TrashLauncherIcon.cpp
index 057af3baa..b91efd13f 100644
--- a/launcher/TrashLauncherIcon.cpp
+++ b/launcher/TrashLauncherIcon.cpp
@@ -39,23 +39,20 @@ namespace
TrashLauncherIcon::TrashLauncherIcon()
: SimpleLauncherIcon()
- , on_trash_changed_handler_id_(0)
, proxy_("org.gnome.Nautilus", "/org/gnome/Nautilus", "org.gnome.Nautilus.FileOperations")
+ , cancellable_(g_cancellable_new())
{
tooltip_text = _("Trash");
icon_name = "user-trash";
- SetQuirk(QUIRK_VISIBLE, true);
- SetQuirk(QUIRK_RUNNING, false);
- SetIconType(TYPE_TRASH);
+ SetQuirk(Quirk::VISIBLE, true);
+ SetQuirk(Quirk::RUNNING, false);
+ SetIconType(IconType::TRASH);
SetShortcut('t');
glib::Object<GFile> location(g_file_new_for_uri("trash:///"));
glib::Error err;
- trash_monitor_ = g_file_monitor_directory(location,
- G_FILE_MONITOR_NONE,
- NULL,
- &err);
+ trash_monitor_ = g_file_monitor_directory(location, G_FILE_MONITOR_NONE, nullptr, &err);
if (err)
{
@@ -63,10 +60,10 @@ TrashLauncherIcon::TrashLauncherIcon()
}
else
{
- on_trash_changed_handler_id_ = g_signal_connect(trash_monitor_,
- "changed",
- G_CALLBACK(&TrashLauncherIcon::OnTrashChanged),
- this);
+ trash_changed_signal_.Connect(trash_monitor_, "changed",
+ [this] (GFileMonitor*, GFile*, GFile*, GFileMonitorEvent) {
+ UpdateTrashIcon();
+ });
}
UpdateTrashIcon();
@@ -74,9 +71,7 @@ TrashLauncherIcon::TrashLauncherIcon()
TrashLauncherIcon::~TrashLauncherIcon()
{
- if (on_trash_changed_handler_id_ != 0)
- g_signal_handler_disconnect((gpointer) trash_monitor_,
- on_trash_changed_handler_id_);
+ g_cancellable_cancel(cancellable_);
}
std::list<DbusmenuMenuitem*> TrashLauncherIcon::GetMenus()
@@ -121,10 +116,9 @@ void TrashLauncherIcon::UpdateTrashIcon()
G_FILE_ATTRIBUTE_STANDARD_ICON,
G_FILE_QUERY_INFO_NONE,
0,
- NULL,
+ cancellable_,
&TrashLauncherIcon::UpdateTrashIconCb,
this);
-
}
void TrashLauncherIcon::UpdateTrashIconCb(GObject* source,
@@ -147,16 +141,6 @@ void TrashLauncherIcon::UpdateTrashIconCb(GObject* source,
}
}
-void TrashLauncherIcon::OnTrashChanged(GFileMonitor* monitor,
- GFile* file,
- GFile* other_file,
- GFileMonitorEvent event_type,
- gpointer data)
-{
- TrashLauncherIcon* self = (TrashLauncherIcon*) data;
- self->UpdateTrashIcon();
-}
-
nux::DndAction TrashLauncherIcon::OnQueryAcceptDrop(DndData const& dnd_data)
{
@@ -177,7 +161,7 @@ void TrashLauncherIcon::OnAcceptDrop(DndData const& dnd_data)
g_file_trash(file, NULL, NULL);
}
- SetQuirk(LauncherIcon::QUIRK_PULSE_ONCE, true);
+ SetQuirk(LauncherIcon::Quirk::PULSE_ONCE, true);
}
std::string TrashLauncherIcon::GetName() const
diff --git a/launcher/TrashLauncherIcon.h b/launcher/TrashLauncherIcon.h
index cf7e9277d..204d36ba7 100644
--- a/launcher/TrashLauncherIcon.h
+++ b/launcher/TrashLauncherIcon.h
@@ -23,6 +23,7 @@
#include <gio/gio.h>
#include <UnityCore/GLibDBusProxy.h>
#include <UnityCore/GLibWrapper.h>
+#include <UnityCore/GLibSignal.h>
#include "DndData.h"
#include "SimpleLauncherIcon.h"
@@ -49,18 +50,17 @@ protected:
std::string GetName() const;
private:
- gulong on_trash_changed_handler_id_;
- glib::Object<GFileMonitor> trash_monitor_;
- gboolean empty_;
- glib::DBusProxy proxy_;
-
void ActivateLauncherIcon(ActionArg arg);
std::list<DbusmenuMenuitem*> GetMenus();
static void UpdateTrashIconCb(GObject* source, GAsyncResult* res, gpointer data);
- static void OnTrashChanged(GFileMonitor* monitor, GFile* file, GFile* other_file,
- GFileMonitorEvent event_type, gpointer data);
static void OnEmptyTrash(DbusmenuMenuitem* item, int time, TrashLauncherIcon* self);
+
+ gboolean empty_;
+ glib::DBusProxy proxy_;
+ glib::Object<GCancellable> cancellable_;
+ glib::Object<GFileMonitor> trash_monitor_;
+ glib::Signal<void, GFileMonitor*, GFile*, GFile*, GFileMonitorEvent> trash_changed_signal_;
};
}
diff --git a/manual-tests/Launcher.txt b/manual-tests/Launcher.txt
index 082a7a24f..407f6ed14 100644
--- a/manual-tests/Launcher.txt
+++ b/manual-tests/Launcher.txt
@@ -665,14 +665,28 @@ Expected Result:
* The launcher should autoscroll so you can reach the trash icon.
+No flashing tooltips when peforming the accordion effect.
+----------------------------------------------------
+Setup:
+ * Make sure the launcher setting is to never hide.
+ * Add icons to the launcher so that some of them in the bottom are folded.
+
+Actions:
+ * Quickly move the mouse pointer to the bottom-left corner.
+ * Quickly move the mouse pointer outside the launcher area.
+
+Expected Result:
+ * No icon flickers near the top panel.
+ * See https://bugs.launchpad.net/unity/+bug/980942/+attachment/3059914/+files/launcher-accordion-effect-tooltip-bug.ogv.
+
+
No flickering when resizing the launcher
-----------------------------------------
+-----------------------------------------
Actions:
- * Open gedit.
- * Maximize it. Make sure it remains maximized during the test.
- * Open Appearance panel in System Settings.
- * Change Launcher Icon Size.
+* Open gedit.
+* Maximize it. Make sure it remains maximized during the test.
+* Open Appearance panel in System Settings.
+* Change Launcher Icon Size.
Expected Results:
- * The gedit window must not flicker behind the launcher.
-
+* The gedit window must not flicker behind the launcher.
diff --git a/panel/PanelIndicatorEntryView.cpp b/panel/PanelIndicatorEntryView.cpp
index d61d8282d..7354d6083 100644
--- a/panel/PanelIndicatorEntryView.cpp
+++ b/panel/PanelIndicatorEntryView.cpp
@@ -429,7 +429,6 @@ void PanelIndicatorEntryView::Refresh()
unsigned int width = 0;
unsigned int icon_width = 0;
unsigned int height = panel::Style::Instance().panel_height;
- unsigned int text_width = 0;
// First lets figure out our size
if (pixbuf && IsIconVisible())
@@ -484,7 +483,7 @@ void PanelIndicatorEntryView::Refresh()
pango_layout_context_changed(layout);
pango_layout_get_extents(layout, nullptr, &log_rect);
- text_width = log_rect.width / PANGO_SCALE;
+ unsigned int text_width = log_rect.width / PANGO_SCALE;
if (icon_width)
width += spacing_;
diff --git a/panel/PanelMenuView.cpp b/panel/PanelMenuView.cpp
index 0b90f67c7..3d75c0afc 100644
--- a/panel/PanelMenuView.cpp
+++ b/panel/PanelMenuView.cpp
@@ -700,7 +700,6 @@ void PanelMenuView::DrawTitle(cairo_t *cr_real, nux::Geometry const& geo, std::s
using namespace panel;
cairo_t* cr;
cairo_pattern_t* linpat;
- const int fading_pixels = 35;
int x = MAIN_LEFT_PADDING + TITLE_PADDING + geo.x;
int y = geo.y;
@@ -762,6 +761,7 @@ void PanelMenuView::DrawTitle(cairo_t *cr_real, nux::Geometry const& geo, std::s
if (text_width > text_space)
{
int out_pixels = text_width - text_space;
+ const int fading_pixels = 35;
int fading_width = out_pixels < fading_pixels ? out_pixels : fading_pixels;
cairo_push_group(cr);
diff --git a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp
index 74bd70d7c..ad840204c 100644
--- a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp
+++ b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp
@@ -292,7 +292,7 @@ UnityMTGrabHandlesScreen::handleEvent(XEvent* event)
CompWindowVector::const_iterator cit = clientListStacking.begin();
CompWindowVector::const_iterator oit = mLastClientListStacking.begin();
- for (; cit != clientListStacking.end(); cit++, oit++)
+ for (; cit != clientListStacking.end(); ++cit, oit++)
{
/* All clients from this point onwards in cit are invalidated
* so splice the list to the end of the new client list
diff --git a/plugins/unitydialog/src/unitydialog.cpp b/plugins/unitydialog/src/unitydialog.cpp
index 05b51ddc6..91f7f235e 100644
--- a/plugins/unitydialog/src/unitydialog.cpp
+++ b/plugins/unitydialog/src/unitydialog.cpp
@@ -367,7 +367,7 @@ UnityDialogScreen::donePaint()
continue;
}
- it++;
+ ++it;
}
}
@@ -1383,7 +1383,6 @@ UnityDialogWindow::place(CompPoint& pos)
CompWindow::Geometry transientGeometry;
CompRegion transientPos, outputRegion, outsideArea, outsideRegion;
pos = getChildCenteredPositionForRect(mParent->serverBorderRect());
- int hdirection, vdirection;
transientGeometry = CompWindow::Geometry(pos.x(),
pos.y(),
@@ -1406,8 +1405,8 @@ UnityDialogWindow::place(CompPoint& pos)
int width;
int height;
- hdirection = outsideArea.boundingRect().x() < 0 ? 1 : -1;
- vdirection = outsideArea.boundingRect().y() < 0 ? 1 : -1;
+ int hdirection = outsideArea.boundingRect().x() < 0 ? 1 : -1;
+ int vdirection = outsideArea.boundingRect().y() < 0 ? 1 : -1;
width = outsideArea.boundingRect().width() >=
window->serverBorderRect().width() ? 0 :
diff --git a/plugins/unityshell/CMakeLists.txt b/plugins/unityshell/CMakeLists.txt
index 2e11fb453..eaf2047a3 100644
--- a/plugins/unityshell/CMakeLists.txt
+++ b/plugins/unityshell/CMakeLists.txt
@@ -12,6 +12,9 @@ compiz_plugin (unityshell
)
add_dependencies(unityshell unity-core-${UNITY_API_VERSION} dash-lib launcher-lib switcher-lib hud-lib panel-lib shortcuts-lib unity-shared unity-shared-compiz)
target_link_libraries(unityshell unity-core-${UNITY_API_VERSION} launcher-lib dash-lib switcher-lib hud-lib panel-lib shortcuts-lib unity-shared unity-shared-compiz)
+set_target_properties(unityshell
+ PROPERTIES INSTALL_RPATH "${CACHED_UNITY_PRIVATE_DEPS_LIBRARY_DIRS}"
+ INSTALL_RPATH_USE_LINK_PATH TRUE)
#
# Data
diff --git a/plugins/unityshell/src/GestureEngine.cpp b/plugins/unityshell/src/GestureEngine.cpp
deleted file mode 100644
index 9bf825b3a..000000000
--- a/plugins/unityshell/src/GestureEngine.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * GestureEngine.cpp
- * This file is part of Unity
- *
- * Copyright (C) 2011 - Canonical Ltd.
- *
- * Unity is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Unity 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 Unity; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#include <X11/cursorfont.h>
-
-#include "ubus-server.h"
-#include "UBusMessages.h"
-#include "GestureEngine.h"
-#include "PluginAdapter.h"
-
-GestureEngine::GestureEngine(CompScreen* screen)
-{
- _screen = screen;
-
- _drag_id = 0;
- _drag_window = 0;
- _pinch_id = 0;
- _touch_id = 0;
- _drag_grab = 0;
- _pinch_grab = 0;
- _fleur_cursor = XCreateFontCursor (screen->dpy (), XC_fleur);
-
- GeisAdapter& adapter = GeisAdapter::Instance();
-
- adapter.tap.connect(sigc::mem_fun(this, &GestureEngine::OnTap));
-
- adapter.drag_start.connect(sigc::mem_fun(this, &GestureEngine::OnDragStart));
- adapter.drag_update.connect(sigc::mem_fun(this, &GestureEngine::OnDragUpdate));
- adapter.drag_finish.connect(sigc::mem_fun(this, &GestureEngine::OnDragFinish));
-
- adapter.rotate_start.connect(sigc::mem_fun(this, &GestureEngine::OnRotateStart));
- adapter.rotate_update.connect(sigc::mem_fun(this, &GestureEngine::OnRotateUpdate));
- adapter.rotate_finish.connect(sigc::mem_fun(this, &GestureEngine::OnRotateFinish));
-
- adapter.pinch_start.connect(sigc::mem_fun(this, &GestureEngine::OnPinchStart));
- adapter.pinch_update.connect(sigc::mem_fun(this, &GestureEngine::OnPinchUpdate));
- adapter.pinch_finish.connect(sigc::mem_fun(this, &GestureEngine::OnPinchFinish));
-
- adapter.touch_start.connect(sigc::mem_fun(this, &GestureEngine::OnTouchStart));
- adapter.touch_update.connect(sigc::mem_fun(this, &GestureEngine::OnTouchUpdate));
- adapter.touch_finish.connect(sigc::mem_fun(this, &GestureEngine::OnTouchFinish));
-}
-
-GestureEngine::~GestureEngine()
-{
- if (_fleur_cursor)
- XFreeCursor (screen->dpy (), _fleur_cursor);
-}
-
-void
-GestureEngine::OnTap(GeisAdapter::GeisTapData* data)
-{
- if (data->touches == 4)
- {
- UBusServer* ubus = ubus_server_get_default();
- ubus_server_send_message(ubus, UBUS_DASH_EXTERNAL_ACTIVATION, NULL);
- }
-}
-
-CompWindow* GestureEngine::FindCompWindowAtPos(float fpos_x, float fpos_y)
-{
- const CompWindowVector& client_list_stacking = _screen->clientList(true);
-
- int pos_x = fpos_x;
- int pos_y = fpos_y;
-
- for (auto iter = client_list_stacking.rbegin(),
- end = client_list_stacking.rend();
- iter != end; ++iter)
- {
- CompWindow* window = *iter;
-
- if (pos_x >= window->x() && pos_x <= (window->width() + window->x())
- &&
- pos_y >= window->y() && pos_y <= (window->height() + window->y()))
- return window;
- }
-
- return nullptr;
-}
-
-void
-GestureEngine::OnDragStart(GeisAdapter::GeisDragData* data)
-{
- if (data->touches == 3)
- {
- _drag_window = FindCompWindowAtPos(data->focus_x, data->focus_y);
-
-
- if (!_drag_window)
- return;
-
- if (!(_drag_window->actions() & CompWindowActionMoveMask))
- {
- _drag_window = 0;
- return;
- }
-
- /* Don't allow windows to be dragged if completely maximized */
- if ((_drag_window->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE)
- {
- _drag_window = 0;
- return;
- }
-
- if (_drag_grab)
- _screen->removeGrab(_drag_grab, NULL);
- _drag_id = data->id;
- _drag_grab = _screen->pushGrab(_fleur_cursor, "unity");
- _drag_window->grabNotify (_drag_window->serverGeometry ().x (),
- _drag_window->serverGeometry ().y (),
- 0, CompWindowGrabMoveMask | CompWindowGrabButtonMask);
- }
-}
-
-/* FIXME: CompScreen::warpPointer filters out motion events which
- * other plugins may need to process, but for most cases in core
- * they should be filtered out. */
-void
-GestureEngine::OnDragUpdate(GeisAdapter::GeisDragData* data)
-{
- if (_drag_id == data->id && _drag_window)
- {
- unsigned int px = std::max (std::min (pointerX + static_cast <int> (data->delta_x), screen->width ()), 0);
- unsigned int py = std::max (std::min (pointerY + static_cast <int> (data->delta_y), screen->height ()), 0);
-
- if (_drag_window->state () & CompWindowStateMaximizedVertMask)
- py = pointerY;
- if (_drag_window->state () & CompWindowStateMaximizedHorzMask)
- px = pointerX;
-
- XWarpPointer(screen->dpy (),
- None, screen->root (),
- 0, 0, 0, 0,
- px, py);
-
- XSync(screen->dpy (), false);
- _drag_window->move(px - pointerX, py - pointerY, false);
-
- pointerX = px;
- pointerY = py;
- }
-}
-
-void
-GestureEngine::OnDragFinish(GeisAdapter::GeisDragData* data)
-{
- if (_drag_id == data->id && _drag_window)
- {
- _drag_window->ungrabNotify ();
- _drag_window->syncPosition();
- EndDrag();
- }
-}
-
-void
-GestureEngine::EndDrag()
-{
- if (_drag_window)
- {
- _screen->removeGrab(_drag_grab, NULL);
- _drag_grab = 0;
- _drag_window = 0;
- _drag_id = 0;
- }
-}
-
-void
-GestureEngine::OnRotateStart(GeisAdapter::GeisRotateData* data)
-{
-
-}
-void
-GestureEngine::OnRotateUpdate(GeisAdapter::GeisRotateData* data)
-{
-
-}
-void
-GestureEngine::OnRotateFinish(GeisAdapter::GeisRotateData* data)
-{
-
-}
-
-void
-GestureEngine::OnTouchStart(GeisAdapter::GeisTouchData* data)
-{
- if (data->touches == 3 && data->window != 0)
- {
- CompWindow* result = FindCompWindowAtPos(data->focus_x, data->focus_y);
-
- if (result)
- {
- PluginAdapter::Default()->ShowGrabHandles(result, false);
- _touch_id = data->id;
- _touch_window = result;
- }
- }
-}
-
-void
-GestureEngine::OnTouchUpdate(GeisAdapter::GeisTouchData* data)
-{
-
-}
-
-void
-GestureEngine::OnTouchFinish(GeisAdapter::GeisTouchData* data)
-{
- if (_touch_id == data->id)
- {
- if (_touch_window)
- PluginAdapter::Default()->ShowGrabHandles(_touch_window, true);
- _touch_id = 0;
- _touch_window = 0;
- }
-}
-
-void
-GestureEngine::OnPinchStart(GeisAdapter::GeisPinchData* data)
-{
- if (data->touches == 3)
- {
- _pinch_window = FindCompWindowAtPos(data->focus_x, data->focus_y);
-
- if (!_pinch_window)
- return;
-
- _pinch_id = data->id;
-
- if (_pinch_grab)
- _screen->removeGrab(_pinch_grab, NULL);
- _pinch_grab = _screen->pushGrab(_screen->invisibleCursor(), "unity");
- }
-}
-void
-GestureEngine::OnPinchUpdate(GeisAdapter::GeisPinchData* data)
-{
- if (data->id != _pinch_id)
- return;
-
- if (data->radius > 1.25)
- {
- _pinch_window->maximize(MAXIMIZE_STATE);
- EndDrag();
- }
- else if (data->radius < 0.8)
- {
- _pinch_window->maximize(0);
- EndDrag();
- }
-}
-void
-GestureEngine::OnPinchFinish(GeisAdapter::GeisPinchData* data)
-{
- if (_pinch_id == data->id && _pinch_window)
- {
- _screen->removeGrab(_pinch_grab, NULL);
- _pinch_grab = 0;
- _pinch_id = 0;
- }
-}
diff --git a/plugins/unityshell/src/GestureEngine.h b/plugins/unityshell/src/GestureEngine.h
deleted file mode 100644
index bce81628d..000000000
--- a/plugins/unityshell/src/GestureEngine.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * GestureEngine.h
- * This file is part of Unity
- *
- * Copyright (C) 2011 - Canonical Ltd.
- *
- * Unity is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Unity 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 Unity; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#include <core/core.h>
-
-#include <sigc++/sigc++.h>
-#include "GeisAdapter.h"
-
-class GestureEngine : public sigc::trackable
-{
-public:
- GestureEngine(CompScreen* screen);
- virtual ~GestureEngine();
-
- void OnTap(GeisAdapter::GeisTapData* data);
-
- void OnDragStart(GeisAdapter::GeisDragData* data);
- void OnDragUpdate(GeisAdapter::GeisDragData* data);
- void OnDragFinish(GeisAdapter::GeisDragData* data);
-
- void OnRotateStart(GeisAdapter::GeisRotateData* data);
- void OnRotateUpdate(GeisAdapter::GeisRotateData* data);
- void OnRotateFinish(GeisAdapter::GeisRotateData* data);
-
- void OnPinchStart(GeisAdapter::GeisPinchData* data);
- void OnPinchUpdate(GeisAdapter::GeisPinchData* data);
- void OnPinchFinish(GeisAdapter::GeisPinchData* data);
-
- void OnTouchStart(GeisAdapter::GeisTouchData* data);
- void OnTouchUpdate(GeisAdapter::GeisTouchData* data);
- void OnTouchFinish(GeisAdapter::GeisTouchData* data);
-
- void EndDrag();
-private:
- CompWindow* FindCompWindowAtPos(float pos_x, float pos_y);
-
- CompScreen* _screen;
- CompWindow* _drag_window;
- CompWindow* _pinch_window;
- CompWindow* _touch_window;
- CompScreen::GrabHandle _drag_grab;
- CompScreen::GrabHandle _pinch_grab;
-
- int _drag_id;
- int _pinch_id;
- int _touch_id;
-
- Cursor _fleur_cursor;
-};
diff --git a/plugins/unityshell/src/UnityGestureBroker.cpp b/plugins/unityshell/src/UnityGestureBroker.cpp
new file mode 100644
index 000000000..c05237f22
--- /dev/null
+++ b/plugins/unityshell/src/UnityGestureBroker.cpp
@@ -0,0 +1,129 @@
+/*
+ * UnityGestureBroker.cpp
+ * This file is part of Unity
+ *
+ * Copyright (C) 2012 - Canonical Ltd.
+ *
+ * Unity is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Unity 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 Unity; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "UnityGestureBroker.h"
+#include "UnityGestureTarget.h"
+#include "WindowGestureTarget.h"
+
+#include <X11/cursorfont.h>
+
+UnityGestureBroker::UnityGestureBroker()
+ : nux::GestureBroker()
+{
+ g_assert(WindowGestureTarget::fleur_cursor == 0);
+ WindowGestureTarget::fleur_cursor = XCreateFontCursor (screen->dpy (), XC_fleur);
+
+ unity_target.reset(new UnityGestureTarget);
+}
+
+UnityGestureBroker::~UnityGestureBroker()
+{
+ if (WindowGestureTarget::fleur_cursor)
+ {
+ XFreeCursor (screen->dpy (), WindowGestureTarget::fleur_cursor);
+ WindowGestureTarget::fleur_cursor = 0;
+ }
+}
+
+std::vector<nux::ShPtGestureTarget>
+UnityGestureBroker::FindGestureTargets(const nux::GestureEvent &event)
+{
+ std::vector<nux::ShPtGestureTarget> targets;
+ const std::vector<nux::TouchPoint> &touches = event.GetTouches();
+
+ if (touches.size() == 4)
+ {
+ targets.push_back(unity_target);
+ }
+ else if (touches.size() == 3)
+ {
+ CompWindow *window = FindWindowHitByGesture(event);
+ if (window)
+ {
+ targets.push_back(nux::ShPtGestureTarget(new WindowGestureTarget(window)));
+ }
+ }
+
+ return targets;
+}
+
+CompWindow *UnityGestureBroker::FindWindowHitByGesture(const nux::GestureEvent &event)
+{
+ if (event.IsDirectTouch())
+ {
+ /* If a direct device is being used (e.g., a touchscreen), all touch
+ points must hit the same window */
+ CompWindow *last_window = nullptr;
+ const std::vector<nux::TouchPoint> &touches = event.GetTouches();
+ for (auto touch : touches)
+ {
+ CompWindow *window = FindCompWindowAtPos(touch.x, touch.y);
+ if (last_window)
+ {
+ if (window != last_window)
+ {
+ return nullptr;
+ }
+ }
+ else
+ {
+ last_window = window;
+ }
+ }
+
+ return last_window;
+ }
+ else
+ {
+ /* If a indirect device is being used (e.g., a trackpad), the individual
+ touch points are not in screen coordinates and therefore it doesn't make
+ sense to hit-test them individually against the window tree. Instead,
+ we use just the focus point, which is the same as the cursor
+ position in this case (which is in screen coordinates). */
+ return FindCompWindowAtPos(event.GetFocus().x, event.GetFocus().y);
+ }
+}
+
+CompWindow* UnityGestureBroker::FindCompWindowAtPos(int pos_x, int pos_y)
+{
+ const CompWindowVector& client_list_stacking = screen->clientList(true);
+
+ for (auto iter = client_list_stacking.rbegin(),
+ end = client_list_stacking.rend();
+ iter != end; ++iter)
+ {
+ CompWindow* window = *iter;
+
+ if (window->minimized())
+ continue;
+
+ if (window->state() & CompWindowStateHiddenMask)
+ continue;
+
+ if (pos_x >= window->x() && pos_x <= (window->width() + window->x())
+ &&
+ pos_y >= window->y() && pos_y <= (window->height() + window->y()))
+ return window;
+ }
+
+ return nullptr;
+}
diff --git a/plugins/unityshell/src/UnityGestureBroker.h b/plugins/unityshell/src/UnityGestureBroker.h
new file mode 100644
index 000000000..d859f49a1
--- /dev/null
+++ b/plugins/unityshell/src/UnityGestureBroker.h
@@ -0,0 +1,45 @@
+/*
+ * UnityGestureBroker.h
+ * This file is part of Unity
+ *
+ * Copyright (C) 2011 - Canonical Ltd.
+ *
+ * Unity is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Unity 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 Unity; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include <core/core.h>
+
+#include <Nux/GestureBroker.h>
+
+class UnityGestureBroker : public nux::GestureBroker
+{
+public:
+ UnityGestureBroker();
+ virtual ~UnityGestureBroker();
+
+private:
+ std::vector<nux::ShPtGestureTarget>
+ virtual FindGestureTargets(const nux::GestureEvent &event);
+
+ CompWindow *FindWindowHitByGesture(const nux::GestureEvent &event);
+
+ /*!
+ Returns the top-most CompWindow at the given position, if any.
+ */
+ CompWindow* FindCompWindowAtPos(int pos_x, int pos_y);
+
+ nux::ShPtGestureTarget unity_target;
+};
diff --git a/plugins/unityshell/src/UnityGestureTarget.cpp b/plugins/unityshell/src/UnityGestureTarget.cpp
new file mode 100644
index 000000000..3afe2ce26
--- /dev/null
+++ b/plugins/unityshell/src/UnityGestureTarget.cpp
@@ -0,0 +1,54 @@
+/*
+ * UnityGestureTarget.cpp
+ * This file is part of Unity
+ *
+ * Copyright (C) 2012 - Canonical Ltd.
+ *
+ * Unity is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Unity 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 Unity; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "UnityGestureTarget.h"
+
+#include <Nux/Nux.h> // otherwise unityshell.h inclusion will cause failures
+#include "unityshell.h"
+
+#include "UBusMessages.h"
+#include "ubus-server.h"
+
+using namespace nux;
+
+UnityGestureTarget::UnityGestureTarget()
+{
+ launcher = unity::UnityScreen::get(screen)->LauncherView();
+}
+
+GestureDeliveryRequest UnityGestureTarget::GestureEvent(const nux::GestureEvent &event)
+{
+ if (event.GetGestureClasses() & DRAG_GESTURE)
+ {
+ if (launcher.IsValid())
+ launcher->GestureEvent(event);
+ }
+ else if (event.GetGestureClasses() == TAP_GESTURE
+ && event.type == EVENT_GESTURE_END)
+ {
+ ubus_server_send_message(ubus_server_get_default(),
+ UBUS_DASH_EXTERNAL_ACTIVATION,
+ NULL);
+ }
+
+ return GestureDeliveryRequest::NONE;
+}
diff --git a/plugins/unityshell/src/UnityGestureTarget.h b/plugins/unityshell/src/UnityGestureTarget.h
new file mode 100644
index 000000000..f47996e63
--- /dev/null
+++ b/plugins/unityshell/src/UnityGestureTarget.h
@@ -0,0 +1,44 @@
+/*
+ * UnityGestureTarget.h
+ * This file is part of Unity
+ *
+ * Copyright (C) 2012 - Canonical Ltd.
+ *
+ * Unity is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Unity 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 Unity; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef UNITY_GESTURE_TARGET_H
+#define UNITY_GESTURE_TARGET_H
+
+#include <Nux/Gesture.h>
+
+/*
+ Target for Unity-level gestures.
+ I.e., for gestures that act on Unity elements, such as
+ the dash or launcher.
+ */
+class UnityGestureTarget : public nux::GestureTarget
+{
+ public:
+ UnityGestureTarget();
+
+ virtual nux::GestureDeliveryRequest GestureEvent(const nux::GestureEvent &event);
+
+ private:
+ nux::ObjectWeakPtr<nux::InputArea> launcher;
+};
+
+#endif // UNITY_GESTURE_TARGET_H
diff --git a/plugins/unityshell/src/WindowGestureTarget.cpp b/plugins/unityshell/src/WindowGestureTarget.cpp
new file mode 100644
index 000000000..37e947deb
--- /dev/null
+++ b/plugins/unityshell/src/WindowGestureTarget.cpp
@@ -0,0 +1,215 @@
+/*
+ * WindowGestureTarget.cpp
+ * This file is part of Unity
+ *
+ * Copyright (C) 2012 - Canonical Ltd.
+ *
+ * Unity is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Unity 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 Unity; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "WindowGestureTarget.h"
+
+#include <Nux/Nux.h> // otherwise unityshell.h inclusion will cause failures
+#include "unityshell.h"
+
+#include "PluginAdapter.h"
+
+using namespace nux;
+
+Cursor WindowGestureTarget::fleur_cursor = 0;
+
+WindowGestureTarget::WindowGestureTarget(CompWindow *window)
+ : window_(window), drag_grab_(0), started_window_move_(false),
+ window_restored_by_pinch_(false)
+{
+ // A workaround for the lack of weak pointers.
+ unity::UnityWindow *unity_window = unity::UnityWindow::get(window);
+
+ connection_window_destruction =
+ unity_window->being_destroyed.connect(
+ sigc::mem_fun(this, &WindowGestureTarget::NullifyWindowPointer));
+}
+
+WindowGestureTarget::~WindowGestureTarget()
+{
+ connection_window_destruction.disconnect();
+ if (drag_grab_)
+ {
+ if (window_)
+ window_->ungrabNotify();
+ screen->removeGrab(drag_grab_, NULL);
+ }
+}
+
+void WindowGestureTarget::NullifyWindowPointer()
+{
+ window_ = nullptr;
+}
+
+GestureDeliveryRequest WindowGestureTarget::GestureEvent(const nux::GestureEvent &event)
+{
+ if (!window_)
+ return GestureDeliveryRequest::NONE;
+
+ switch (event.type)
+ {
+ case nux::EVENT_GESTURE_BEGIN:
+ PluginAdapter::Default()->ShowGrabHandles(window_, false);
+ break;
+ case EVENT_GESTURE_UPDATE:
+ if (event.GetGestureClasses() & PINCH_GESTURE)
+ MaximizeOrRestoreWindowDueToPinch(event);
+ if (event.GetGestureClasses() & DRAG_GESTURE)
+ {
+ if (WindowCanMove())
+ {
+ if (!started_window_move_)
+ {
+ StartWindowMove(event);
+ started_window_move_ = true;
+ }
+ MoveWindow(event);
+ }
+ }
+ break;
+ default: // EVENT_GESTURE_END
+ if (event.GetGestureClasses() & DRAG_GESTURE)
+ {
+ EndWindowMove(event);
+ started_window_move_ = false;
+ }
+ PluginAdapter::Default()->ShowGrabHandles(window_, true);
+ break;
+ };
+
+ return GestureDeliveryRequest::NONE;
+}
+
+bool WindowGestureTarget::WindowCanMove()
+{
+ if (!(window_->actions() & CompWindowActionMoveMask))
+ return false;
+
+ /* Don't allow windows to be dragged if completely maximized */
+ if ((window_->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE)
+ return false;
+
+ /* Don't start moving a window that has just been restored. The user is likely
+ still performing the pinch and not expecting the window to start moving */
+ if (window_restored_by_pinch_)
+ return false;
+
+ return true;
+}
+
+void WindowGestureTarget::MaximizeOrRestoreWindowDueToPinch(const nux::GestureEvent &event)
+{
+ if (event.GetRadius() > 1.25f)
+ {
+ window_->maximize(MAXIMIZE_STATE);
+ RemoveDragGrab();
+ window_restored_by_pinch_ = false;
+ }
+ else if (event.GetRadius() < 0.8f)
+ {
+ if (window_->state() & MAXIMIZE_STATE)
+ {
+ window_->maximize(0);
+ RemoveDragGrab();
+ window_restored_by_pinch_ = true;
+ }
+ }
+}
+
+void WindowGestureTarget::StartWindowMove(const nux::GestureEvent &event)
+{
+ if (!event.IsDirectTouch())
+ {
+ drag_grab_ = screen->pushGrab(fleur_cursor, "unity");
+ window_->grabNotify(window_->serverGeometry().x(),
+ window_->serverGeometry().y(),
+ 0,
+ CompWindowGrabMoveMask | CompWindowGrabButtonMask);
+ }
+}
+
+void WindowGestureTarget::MoveWindow(const nux::GestureEvent &event)
+{
+ const nux::Point2D<float> &delta = event.GetDelta();
+
+ unsigned int px = std::max(std::min(pointerX + static_cast<int>(delta.x),
+ screen->width()),
+ 0);
+
+ unsigned int py = std::max(std::min(pointerY + static_cast<int>(delta.y),
+ screen->height()),
+ 0);
+
+ if (window_->state() & CompWindowStateMaximizedVertMask)
+ py = pointerY;
+ if (window_->state() & CompWindowStateMaximizedHorzMask)
+ px = pointerX;
+
+ if (!event.IsDirectTouch())
+ {
+ /* FIXME: CompScreen::warpPointer filters out motion events which
+ other plugins may need to process, but for most cases in core
+ they should be filtered out. */
+ XWarpPointer(screen->dpy (),
+ None, screen->root (),
+ 0, 0, 0, 0,
+ px, py);
+ }
+
+ XSync(screen->dpy (), false);
+ window_->move(px - pointerX, py - pointerY, false);
+
+ pointerX = px;
+ pointerY = py;
+}
+
+void WindowGestureTarget::EndWindowMove(const nux::GestureEvent &event)
+{
+ window_->ungrabNotify();
+ RemoveDragGrab();
+ window_->syncPosition();
+}
+
+void WindowGestureTarget::RemoveDragGrab()
+{
+ if (drag_grab_)
+ {
+ screen->removeGrab(drag_grab_, NULL);
+ drag_grab_ = 0;
+ }
+}
+
+bool WindowGestureTarget::Equals(const nux::GestureTarget& other) const
+{
+ const WindowGestureTarget *window_target = dynamic_cast<const WindowGestureTarget *>(&other);
+
+ if (window_target)
+ {
+ if (window_ && window_target->window_)
+ return window_->id() == window_target->window_->id();
+ else
+ return window_ == window_target->window_;
+ }
+ else
+ {
+ return false;
+ }
+}
diff --git a/plugins/unityshell/src/WindowGestureTarget.h b/plugins/unityshell/src/WindowGestureTarget.h
new file mode 100644
index 000000000..e805e3948
--- /dev/null
+++ b/plugins/unityshell/src/WindowGestureTarget.h
@@ -0,0 +1,57 @@
+/*
+ * WindowGestureTarget.h
+ * This file is part of Unity
+ *
+ * Copyright (C) 2012 - Canonical Ltd.
+ *
+ * Unity is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Unity 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 Unity; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef WINDOW_GESTURE_TARGET_H
+#define WINDOW_GESTURE_TARGET_H
+
+#include <Nux/Gesture.h>
+
+#include <core/core.h> // compiz stuff
+
+class WindowGestureTarget : public nux::GestureTarget
+{
+ public:
+ WindowGestureTarget(CompWindow *window);
+ virtual ~WindowGestureTarget();
+
+ virtual nux::GestureDeliveryRequest GestureEvent(const nux::GestureEvent &event);
+
+ static Cursor fleur_cursor;
+
+ CompWindow *window() {return window_;}
+ private:
+ virtual bool Equals(const nux::GestureTarget& other) const;
+ void StartWindowMove(const nux::GestureEvent &event);
+ void MoveWindow(const nux::GestureEvent &event);
+ void EndWindowMove(const nux::GestureEvent &event);
+ void MaximizeOrRestoreWindowDueToPinch(const nux::GestureEvent &event);
+ bool WindowCanMove();
+ void NullifyWindowPointer();
+ void RemoveDragGrab();
+ CompWindow *window_;
+ CompScreen::GrabHandle drag_grab_;
+ bool started_window_move_;
+ bool window_restored_by_pinch_;
+ sigc::connection connection_window_destruction;
+};
+
+#endif // WINDOW_GESTURE_TARGET_H
diff --git a/plugins/unityshell/src/nux-layout-accessible.cpp b/plugins/unityshell/src/nux-layout-accessible.cpp
index 8bec1d9e2..d692c696e 100644
--- a/plugins/unityshell/src/nux-layout-accessible.cpp
+++ b/plugins/unityshell/src/nux-layout-accessible.cpp
@@ -203,7 +203,7 @@ search_for_child(AtkObject* accessible,
element_list = layout->GetChildren();
- for (it = element_list.begin(); it != element_list.end(); it++, result++)
+ for (it = element_list.begin(); it != element_list.end(); ++it, result++)
{
current_area = *it;
if (current_area == area)
diff --git a/plugins/unityshell/src/unity-launcher-accessible.cpp b/plugins/unityshell/src/unity-launcher-accessible.cpp
index d20deed28..4cb4301ae 100644
--- a/plugins/unityshell/src/unity-launcher-accessible.cpp
+++ b/plugins/unityshell/src/unity-launcher-accessible.cpp
@@ -441,7 +441,7 @@ update_children_index(UnityLauncherAccessible* self)
if (launcher_model == NULL)
return;
- for (it = launcher_model->begin(); it != launcher_model->end(); it++)
+ for (it = launcher_model->begin(); it != launcher_model->end(); ++it)
{
child = dynamic_cast<nux::Object*>((*it).GetPointer());
child_accessible = unity_a11y_get_accessible(child);
diff --git a/plugins/unityshell/src/unity-launcher-icon-accessible.cpp b/plugins/unityshell/src/unity-launcher-icon-accessible.cpp
index 44b5051a7..b0331eb00 100644
--- a/plugins/unityshell/src/unity-launcher-icon-accessible.cpp
+++ b/plugins/unityshell/src/unity-launcher-icon-accessible.cpp
@@ -281,7 +281,7 @@ unity_launcher_icon_accessible_ref_state_set(AtkObject* obj)
icon = dynamic_cast<LauncherIcon*>(nux_object);
- if (icon->GetQuirk(LauncherIcon::QUIRK_VISIBLE))
+ if (icon->GetQuirk(LauncherIcon::Quirk::VISIBLE))
{
atk_state_set_add_state(state_set, ATK_STATE_VISIBLE);
atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
diff --git a/plugins/unityshell/src/unity-switcher-accessible.cpp b/plugins/unityshell/src/unity-switcher-accessible.cpp
index e4e2a968f..189e7d703 100644
--- a/plugins/unityshell/src/unity-switcher-accessible.cpp
+++ b/plugins/unityshell/src/unity-switcher-accessible.cpp
@@ -404,7 +404,7 @@ create_children(UnitySwitcherAccessible* self)
if (switcher_model == NULL)
return;
- for (it = switcher_model->begin(); it != switcher_model->end(); it++)
+ for (it = switcher_model->begin(); it != switcher_model->end(); ++it)
{
child = *it;
child_accessible = unity_launcher_icon_accessible_new(child.GetPointer());
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 30c94c76f..99871940a 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -29,7 +29,6 @@
#include "Launcher.h"
#include "LauncherIcon.h"
#include "LauncherController.h"
-#include "GeisAdapter.h"
#include "DevicesSettings.h"
#include "PluginAdapter.h"
#include "QuicklistManager.h"
@@ -38,6 +37,7 @@
#include "KeyboardUtil.h"
#include "unityshell.h"
#include "BackgroundEffectHelper.h"
+#include "UnityGestureBroker.h"
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
@@ -111,7 +111,6 @@ UnityScreen::UnityScreen(CompScreen* screen)
, gScreen(GLScreen::get(screen))
, debugger_(this)
, enable_shortcut_overlay_(true)
- , gesture_engine_(screen)
, needsRelayout(false)
, _in_paint(false)
, super_keypressed_(false)
@@ -364,7 +363,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::initPluginActions);
sources_.Add(std::make_shared<glib::Idle>(init_plugins_cb, glib::Source::Priority::DEFAULT));
- geis_adapter_.Run();
+ InitGesturesSupport();
CompString name(PKGDATADIR"/panel-shadow.png");
CompString pname("unityshell");
@@ -501,6 +500,15 @@ void UnityScreen::nuxPrologue()
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
+
+ /* This is needed to Fix a crash in glDrawArrays with the NVIDIA driver
+ * see bugs #1031554 and #982626.
+ * The NVIDIA driver looks to see if the legacy GL_VERTEX_ARRAY,
+ * GL_TEXTURE_COORDINATES_ARRAY and other such client states are enabled
+ * first before checking if a vertex buffer is bound and will prefer the
+ * client buffers over the the vertex buffer object. */
+ glDisableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
glGetError();
@@ -530,6 +538,11 @@ void UnityScreen::nuxEpilogue()
glReadBuffer(GL_BACK);
glPopAttrib();
+
+ /* Re-enable the client states that have been disabled in nuxPrologue, for
+ * NVIDIA compatibility reasons */
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
#else
#ifdef USE_GLES
glDepthRangef(0, 1);
@@ -1212,7 +1225,7 @@ bool UnityScreen::shellCouldBeHidden(CompOutput const& output)
CompWindowList const& wins = screen->windows();
for ( CompWindowList::const_reverse_iterator r = wins.rbegin()
; r != wins.rend()
- ; r++
+ ; ++r
)
{
CompWindow* w = *r;
@@ -1310,10 +1323,9 @@ void UnityScreen::glPaintCompositedOutput (const CompRegion &region,
::GLFramebufferObject *fbo,
unsigned int mask)
{
- bool useFbo = false;
-
if (doShellRepaint)
{
+ bool useFbo = false;
oldFbo = fbo->bind ();
useFbo = fbo->checkStatus () && fbo->tex ();
if (!useFbo) {
@@ -1883,7 +1895,7 @@ bool UnityScreen::altTabInitiateCommon(CompAction* action, switcher::ShowMode sh
auto results = launcher_controller_->GetAltTabIcons(show_mode == switcher::ShowMode::CURRENT_VIEWPORT,
switcher_controller_->IsShowDesktopDisabled());
- if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::TYPE_DESKTOP))
+ if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP) && !results.empty())
switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results);
return true;
@@ -2168,10 +2180,9 @@ bool UnityScreen::ShowHudInitiate(CompAction* action,
{
// Look to see if there is a keycode. If there is, then this isn't a
// modifier only keybinding.
- int key_code = 0;
if (options[6].type() != CompOption::TypeUnset)
{
- key_code = options[6].value().i();
+ int key_code = options[6].value().i();
LOG_DEBUG(logger) << "HUD initiate key code: " << key_code;
// show it now, no timings or terminate needed.
return ShowHud();
@@ -2598,6 +2609,9 @@ void UnityWindow::windowNotify(CompWindowNotify n)
window->minimizedSetEnabled (this, false);
}
break;
+ case CompWindowNotifyBeforeDestroy:
+ being_destroyed.emit();
+ break;
default:
break;
}
@@ -3047,6 +3061,18 @@ void UnityScreen::initLauncher()
ScheduleRelayout(0);
}
+nux::View *UnityScreen::LauncherView()
+{
+ nux::View *result = nullptr;
+
+ if (launcher_controller_)
+ {
+ result = &launcher_controller_->launcher();
+ }
+
+ return result;
+}
+
void UnityScreen::InitHints()
{
// TODO move category text into a vector...
@@ -3068,6 +3094,7 @@ void UnityScreen::InitHints()
hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + A", _("Open the Dash App Lens."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher"));
hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + F", _("Open the Dash Files Lens."), shortcut::COMPIZ_KEY_OPTION,"unityshell", "show_launcher"));
hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + M", _("Open the Dash Music Lens."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher"));
+ hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", " + V", _("Open the Dash Video Lens."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher"));
hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", "", _("Switches between Lenses."), shortcut::HARDCODED_OPTION, _("Ctrl + Tab")));
hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", "", _("Moves the focus."), shortcut::HARDCODED_OPTION, _("Cursor Keys")));
hints_.push_back(std::make_shared<shortcut::Hint>(dash, "", "", _("Open currently focused item."), shortcut::HARDCODED_OPTION, _("Enter & Return")));
@@ -3108,6 +3135,32 @@ void UnityScreen::InitHints()
hints_.push_back(std::make_shared<shortcut::Hint>(windows, "", _(" Drag"), _("Resize window."), shortcut::COMPIZ_MOUSE_OPTION, "resize", "initiate_button"));
}
+void UnityScreen::InitGesturesSupport()
+{
+ std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);
+ wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));
+
+ gestures_sub_launcher_.reset(new nux::GesturesSubscription);
+ gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);
+ gestures_sub_launcher_->SetNumTouches(4);
+ gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());
+ gestures_sub_launcher_->Activate();
+
+ gestures_sub_dash_.reset(new nux::GesturesSubscription);
+ gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);
+ gestures_sub_dash_->SetNumTouches(4);
+ gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());
+ gestures_sub_dash_->Activate();
+
+ gestures_sub_windows_.reset(new nux::GesturesSubscription);
+ gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE
+ | nux::DRAG_GESTURE
+ | nux::PINCH_GESTURE);
+ gestures_sub_windows_->SetNumTouches(3);
+ gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());
+ gestures_sub_windows_->Activate();
+}
+
/* Window init */
UnityWindow::UnityWindow(CompWindow* window)
: BaseSwitchWindow (dynamic_cast<BaseSwitchScreen *> (UnityScreen::get (screen)), window)
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index 34e29975e..765ad980b 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -22,6 +22,7 @@
#ifndef UNITYSHELL_H
#define UNITYSHELL_H
+#include <Nux/GesturesSubscription.h>
#include <Nux/WindowThread.h>
#include <NuxCore/Property.h>
#include <sigc++/sigc++.h>
@@ -46,7 +47,6 @@
#include "PanelController.h"
#include "PanelStyle.h"
#include "UScreen.h"
-#include "GestureEngine.h"
#include "DebugDBusInterface.h"
#include "SwitcherController.h"
#include "UBusWrapper.h"
@@ -190,6 +190,8 @@ public:
bool forcePaintOnTop ();
+ nux::View *LauncherView();
+
protected:
std::string GetName() const;
void AddProperties(GVariantBuilder* builder);
@@ -239,11 +241,12 @@ private:
void OnPanelStyleChanged();
+ void InitGesturesSupport();
+
Settings dash_settings_;
dash::Style dash_style_;
panel::Style panel_style_;
FontSettings font_settings_;
- GeisAdapter geis_adapter_;
internal::FavoriteStoreGSettings favorite_store_;
/* The window thread should be the last thing removed, as c++ does it in reverse order */
@@ -261,7 +264,15 @@ private:
std::list<shortcut::AbstractHint::Ptr> hints_;
bool enable_shortcut_overlay_;
- GestureEngine gesture_engine_;
+ /* Subscription for gestures that manipulate Unity launcher */
+ std::unique_ptr<nux::GesturesSubscription> gestures_sub_launcher_;
+
+ /* Subscription for gestures that manipulate Unity dash */
+ std::unique_ptr<nux::GesturesSubscription> gestures_sub_dash_;
+
+ /* Subscription for gestures that manipulate windows. */
+ std::unique_ptr<nux::GesturesSubscription> gestures_sub_windows_;
+
bool needsRelayout;
bool _in_paint;
bool super_keypressed_;
@@ -398,6 +409,8 @@ public:
ShowdesktopHandler *mShowdesktopHandler;
+ //! Emited when CompWindowNotifyBeforeDestroy is received
+ sigc::signal<void> being_destroyed;
private:
void DoEnableFocus ();
void DoDisableFocus ();
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7fa32987e..33ce23678 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,11 +8,13 @@ dash/LensView.cpp
dash/PlacesGroup.cpp
hud/HudController.cpp
hud/HudView.cpp
+hud/StandaloneHud.cpp
launcher/BFBLauncherIcon.cpp
launcher/BamfLauncherIcon.cpp
launcher/DesktopLauncherIcon.cpp
launcher/DeviceLauncherIcon.cpp
launcher/LauncherController.cpp
+launcher/HudLauncherIcon.cpp
launcher/SoftwareCenterLauncherIcon.cpp
launcher/SpacerLauncherIcon.cpp
launcher/TrashLauncherIcon.cpp
@@ -29,6 +31,8 @@ plugins/unityshell/src/unityshell.cpp
plugins/unityshell/unityshell.xml.in
shortcuts/ShortcutHintPrivate.cpp
shortcuts/ShortcutView.cpp
+shortcuts/StandaloneShortcuts.cpp
unity-shared/DashStyle.cpp
unity-shared/SearchBar.cpp
+unity-shared/UScreen.cpp
diff --git a/services/panel-main.c b/services/panel-main.c
index e48f2b993..4bc5a5160 100644
--- a/services/panel-main.c
+++ b/services/panel-main.c
@@ -235,7 +235,7 @@ on_service_resync (PanelService *service, const gchar *indicator_id, GDBusConnec
{
GError *error = NULL;
g_dbus_connection_emit_signal (connection,
- S_NAME,
+ NULL,
S_PATH,
S_IFACE,
"ReSync",
@@ -256,7 +256,7 @@ on_service_entry_activated (PanelService *service,
{
GError *error = NULL;
g_dbus_connection_emit_signal (connection,
- S_NAME,
+ NULL,
S_PATH,
S_IFACE,
"EntryActivated",
@@ -278,7 +278,7 @@ on_service_entry_activate_request (PanelService *service,
GError *error = NULL;
g_warning ("%s, entry_id:%s", G_STRFUNC, entry_id);
g_dbus_connection_emit_signal (connection,
- S_NAME,
+ NULL,
S_PATH,
S_IFACE,
"EntryActivateRequest",
@@ -300,7 +300,7 @@ on_service_entry_show_now_changed (PanelService *service,
{
GError *error = NULL;
g_dbus_connection_emit_signal (connection,
- S_NAME,
+ NULL,
S_PATH,
S_IFACE,
"EntryShowNowChanged",
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 01fe6993d..7eb276781 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -39,7 +39,7 @@ set (LIBS ${TEST_UNIT_DEPS_LIBRARIES} "-lunity-core-${UNITY_API_VERSION} -lcompi
link_libraries (${LIBS})
set (LIB_PATHS ${TEST_UNIT_DEPS_LIBRARY_DIRS})
-link_directories (${CMAKE_BINARY_DIR}/UnityCore ${LIB_PATHS})
+link_directories (${CMAKE_BINARY_DIR}/UnityCore ${LIB_PATHS} ${COMPIZ_LIBDIR})
include_directories (. .. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_DIR})
include_directories (${CMAKE_SOURCE_DIR}/plugins/unity-mt-grab-handles/src)
@@ -219,6 +219,7 @@ if (GTEST_SRC_DIR AND
test_im_text_entry.cpp
test_launcher_controller.cpp
test_keyboard_util.cpp
+ test_panel_style.cpp
test_resultviewgrid.cpp
test_single_monitor_launcher_icon.cpp
test_switcher_controller.cpp
@@ -253,7 +254,6 @@ if (GTEST_SRC_DIR AND
${CMAKE_SOURCE_DIR}/launcher/FavoriteStore.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStoreGSettings.cpp
${CMAKE_SOURCE_DIR}/launcher/FavoriteStorePrivate.cpp
- ${CMAKE_SOURCE_DIR}/launcher/GeisAdapter.cpp
${CMAKE_SOURCE_DIR}/launcher/HudLauncherIcon.cpp
${CMAKE_SOURCE_DIR}/launcher/Launcher.cpp
${CMAKE_SOURCE_DIR}/launcher/LauncherController.cpp
@@ -321,7 +321,7 @@ endif (GTEST_SRC_DIR AND
GMOCK_LIB AND
GMOCK_MAIN_LIB)
-add_subdirectory (test-gesture-engine)
+add_subdirectory (test-gestures)
#
# check target
@@ -332,25 +332,25 @@ set (TEST_RESULT_HTML ${TEST_RESULT_DIR}/test-results.html)
set (GTEST_TEST_COMMAND ./test-gtest)
set (GTEST_TEST_COMMAND_XLESS ./test-gtest-xless)
set (GTEST_TEST_COMMAND_DBUS dbus-test-runner --task ./test-gtest-service --task ./test-gtest-dbus)
-set (GTEST_TEST_COMMAND_GESTURE_ENGINE ./test-gesture-engine/test-gesture-engine)
+set (GTEST_TEST_COMMAND_GESTURES ./test-gestures/test-gestures)
set (TEST_COMMAND
gtester --verbose -k --g-fatal-warnings -o=${TEST_RESULT_XML} ./test-unit
&& ${GTEST_TEST_COMMAND} --gtest_output=xml:./
&& ${GTEST_TEST_COMMAND_XLESS} --gtest_output=xml:./
- && ${GTEST_TEST_COMMAND_GESTURE_ENGINE} --gtest_output=xml:./
+ && ${GTEST_TEST_COMMAND_GESTURES} --gtest_output=xml:./
&& ${GTEST_TEST_COMMAND_DBUS} --gtest_output=xml:./
)
set (TEST_COMMAND_HEADLESS
${GTEST_TEST_COMMAND_XLESS} --gtest_output=xml:./
- && ${GTEST_TEST_COMMAND_GESTURE_ENGINE} --gtest_output=xml:./
+ && ${GTEST_TEST_COMMAND_GESTURES} --gtest_output=xml:./
#&& ${GTEST_TEST_COMMAND_DBUS} --gtest_output=xml:./
&& echo "Warning, DBus test cases are disabled!!")
if (GTEST_SRC_DIR)
- add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit test-gtest test-gtest-xless test-gtest-dbus test-gesture-engine)
- add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest-xless test-gtest-dbus test-gesture-engine)
+ add_custom_target (check COMMAND ${TEST_COMMAND} DEPENDS test-unit test-gtest test-gtest-xless test-gtest-dbus test-gestures)
+ add_custom_target (check-headless COMMAND ${TEST_COMMAND_HEADLESS} DEPENDS test-gtest-xless test-gtest-dbus test-gestures)
add_custom_target (check-report COMMAND ${TEST_UNIT_COMMAND} && gtester-report ${TEST_RESULT_XML} > ${TEST_RESULT_HTML})
add_custom_target (gcheck COMMAND ${DBUS_TEST_COMMAND} DEPENDS test-gtest test-gtest-xless)
else (GTEST_SRC_DIR)
diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
index bd6eab38c..798283d21 100644
--- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
+++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py
@@ -66,50 +66,50 @@ class LauncherIconsTests(LauncherTestCase):
of that application.
"""
- mah_win1 = self.start_app_window("Mahjongg")
+ char_win1 = self.start_app_window("Character Map")
calc_win = self.start_app_window("Calculator")
- mah_win2 = self.start_app_window("Mahjongg")
+ char_win2 = self.start_app_window("Character Map")
- self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
+ self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
- mahj_icon = self.launcher.model.get_icon(
- desktop_id=mah_win2.application.desktop_file)
+ char_icon = self.launcher.model.get_icon(
+ desktop_id=char_win2.application.desktop_file)
calc_icon = self.launcher.model.get_icon(
desktop_id=calc_win.application.desktop_file)
self.launcher_instance.click_launcher_icon(calc_icon)
self.assertProperty(calc_win, is_focused=True)
- self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1])
+ self.assertVisibleWindowStack([calc_win, char_win2, char_win1])
- self.launcher_instance.click_launcher_icon(mahj_icon)
- self.assertProperty(mah_win2, is_focused=True)
- self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
+ self.launcher_instance.click_launcher_icon(char_icon)
+ self.assertProperty(char_win2, is_focused=True)
+ self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
self.keybinding("window/minimize")
- self.assertThat(lambda: mah_win2.is_hidden, Eventually(Equals(True)))
+ self.assertThat(lambda: char_win2.is_hidden, Eventually(Equals(True)))
self.assertProperty(calc_win, is_focused=True)
- self.assertVisibleWindowStack([calc_win, mah_win1])
+ self.assertVisibleWindowStack([calc_win, char_win1])
- self.launcher_instance.click_launcher_icon(mahj_icon)
- self.assertProperty(mah_win1, is_focused=True)
- self.assertThat(lambda: mah_win2.is_hidden, Eventually(Equals(True)))
- self.assertVisibleWindowStack([mah_win1, calc_win])
+ self.launcher_instance.click_launcher_icon(char_icon)
+ self.assertProperty(char_win1, is_focused=True)
+ self.assertThat(lambda: char_win2.is_hidden, Eventually(Equals(True)))
+ self.assertVisibleWindowStack([char_win1, calc_win])
def test_clicking_icon_twice_initiates_spread(self):
"""This tests shows that when you click on a launcher icon twice,
when an application window is focused, the spread is initiated.
"""
- calc_win1 = self.start_app_window("Calculator")
- calc_win2 = self.start_app_window("Calculator")
- calc_app = calc_win1.application
+ char_win1 = self.start_app_window("Character Map")
+ char_win2 = self.start_app_window("Character Map")
+ char_app = char_win1.application
- self.assertVisibleWindowStack([calc_win2, calc_win1])
- self.assertProperty(calc_win2, is_focused=True)
+ self.assertVisibleWindowStack([char_win2, char_win1])
+ self.assertProperty(char_win2, is_focused=True)
- calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file)
+ char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file)
self.addCleanup(self.keybinding, "spread/cancel")
- self.launcher_instance.click_launcher_icon(calc_icon)
+ self.launcher_instance.click_launcher_icon(char_icon)
self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
self.assertThat(self.window_manager.scale_active_for_group, Eventually(Equals(True)))
@@ -118,15 +118,15 @@ class LauncherIconsTests(LauncherTestCase):
"""If scale is initiated through the laucher pressing super must close
scale and open the dash.
"""
- calc_win1 = self.start_app_window("Calculator")
- calc_win2 = self.start_app_window("Calculator")
- calc_app = calc_win1.application
+ char_win1 = self.start_app_window("Character Map")
+ char_win2 = self.start_app_window("Character Map")
+ char_app = char_win1.application
- self.assertVisibleWindowStack([calc_win2, calc_win1])
- self.assertProperty(calc_win2, is_focused=True)
+ self.assertVisibleWindowStack([char_win2, char_win1])
+ self.assertProperty(char_win2, is_focused=True)
- calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file)
- self.launcher_instance.click_launcher_icon(calc_icon)
+ char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file)
+ self.launcher_instance.click_launcher_icon(char_icon)
self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
self.dash.ensure_visible()
diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py
index 18190cb16..7f932c102 100644
--- a/tests/autopilot/unity/tests/test_dash.py
+++ b/tests/autopilot/unity/tests/test_dash.py
@@ -8,11 +8,10 @@
from __future__ import absolute_import
-from time import sleep
-
+from autopilot.emulators.clipboard import get_clipboard_contents
from autopilot.matchers import Eventually
-from gtk import Clipboard
from testtools.matchers import Equals, NotEquals
+from time import sleep
from unity.tests import UnityTestCase
@@ -305,8 +304,7 @@ class DashClipboardTests(DashTestCase):
self.keyboard.press_and_release("Ctrl+a")
self.keyboard.press_and_release("Ctrl+c")
- cb = Clipboard(selection="CLIPBOARD")
- self.assertThat(self.dash.search_string, Eventually(Equals(cb.wait_for_text())))
+ self.assertThat(get_clipboard_contents, Eventually(Equals("Copy")))
def test_ctrl_x(self):
""" This test if ctrl+x deletes all text and copys it """
@@ -319,8 +317,7 @@ class DashClipboardTests(DashTestCase):
self.keyboard.press_and_release("Ctrl+x")
self.assertThat(self.dash.search_string, Eventually(Equals("")))
- cb = Clipboard(selection="CLIPBOARD")
- self.assertEqual(cb.wait_for_text(), u'Cut')
+ self.assertThat(get_clipboard_contents, Eventually(Equals('Cut')))
def test_ctrl_c_v(self):
""" This test if ctrl+c and ctrl+v copies and pastes text"""
diff --git a/tests/autopilot/unity/tests/test_panel.py b/tests/autopilot/unity/tests/test_panel.py
index d17e52f5c..74a9504a0 100644
--- a/tests/autopilot/unity/tests/test_panel.py
+++ b/tests/autopilot/unity/tests/test_panel.py
@@ -807,10 +807,10 @@ class PanelMenuTests(PanelTestsBase):
def test_menus_dont_show_if_a_new_application_window_is_opened(self):
"""This tests the menu discovery feature on new window for a know application."""
- self.open_new_application_window("Calculator")
+ self.open_new_application_window("Character Map")
self.sleep_menu_settle_period()
- self.start_app("Calculator")
+ self.start_app("Character Map")
sleep(self.panel.menus.fadein_duration / 1000.0)
# Not using Eventually here since this is time-critical. Need to work
# out a better way to do this.
diff --git a/tests/autopilot/unity/tests/test_quicklist.py b/tests/autopilot/unity/tests/test_quicklist.py
index bcd3ae328..b253fa071 100644
--- a/tests/autopilot/unity/tests/test_quicklist.py
+++ b/tests/autopilot/unity/tests/test_quicklist.py
@@ -72,14 +72,14 @@ class QuicklistActionTests(UnityTestCase):
Then we activate the Calculator quicklist item.
Then we actiavte the Mahjongg launcher icon.
"""
- mah_win1 = self.start_app_window("Mahjongg")
+ char_win1 = self.start_app_window("Character Map")
calc_win = self.start_app_window("Calculator")
- mah_win2 = self.start_app_window("Mahjongg")
+ char_win2 = self.start_app_window("Character Map")
- self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
+ self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
- mahj_icon = self.launcher.model.get_icon(
- desktop_id=mah_win1.application.desktop_file)
+ char_icon = self.launcher.model.get_icon(
+ desktop_id=char_win1.application.desktop_file)
calc_icon = self.launcher.model.get_icon(
desktop_id=calc_win.application.desktop_file)
@@ -87,29 +87,29 @@ class QuicklistActionTests(UnityTestCase):
calc_ql.get_quicklist_application_item(calc_win.application.name).mouse_click()
self.assertProperty(calc_win, is_focused=True)
- self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1])
+ self.assertVisibleWindowStack([calc_win, char_win2, char_win1])
- mahj_ql = self.open_quicklist_for_icon(mahj_icon)
- mahj_ql.get_quicklist_application_item(mah_win1.application.name).mouse_click()
+ char_ql = self.open_quicklist_for_icon(char_icon)
+ char_ql.get_quicklist_application_item(char_win1.application.name).mouse_click()
- self.assertProperty(mah_win2, is_focused=True)
- self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
+ self.assertProperty(char_win2, is_focused=True)
+ self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
def test_quicklist_application_item_initiate_spread(self):
"""This tests shows that when you activate a quicklist application item
when an application window is focused, the spread is initiated.
"""
- calc_win1 = self.start_app_window("Calculator")
- calc_win2 = self.start_app_window("Calculator")
- calc_app = calc_win1.application
+ char_win1 = self.start_app_window("Character Map")
+ char_win2 = self.start_app_window("Character Map")
+ char_app = char_win1.application
- self.assertVisibleWindowStack([calc_win2, calc_win1])
- self.assertProperty(calc_win2, is_focused=True)
+ self.assertVisibleWindowStack([char_win2, char_win1])
+ self.assertProperty(char_win2, is_focused=True)
- calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file)
+ char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file)
- calc_ql = self.open_quicklist_for_icon(calc_icon)
- app_item = calc_ql.get_quicklist_application_item(calc_app.name)
+ char_ql = self.open_quicklist_for_icon(char_icon)
+ app_item = char_ql.get_quicklist_application_item(char_app.name)
self.addCleanup(self.keybinding, "spread/cancel")
app_item.mouse_click()
diff --git a/tests/autopilot/unity/tests/test_switcher.py b/tests/autopilot/unity/tests/test_switcher.py
index 4b33b4ff4..8e7704e91 100644
--- a/tests/autopilot/unity/tests/test_switcher.py
+++ b/tests/autopilot/unity/tests/test_switcher.py
@@ -46,9 +46,9 @@ class SwitcherTestCase(UnityTestCase):
"""Start some applications, returning their windows.
If no applications are specified, the following will be started:
- * Character Map
- * Calculator
* Calculator
+ * Character Map
+ * Character Map
Windows are always started in the order that they are specified (which
means the last specified application will *probably* be at the top of the
@@ -57,7 +57,7 @@ class SwitcherTestCase(UnityTestCase):
"""
if len(args) == 0:
- args = ('Character Map', 'Calculator', 'Calculator')
+ args = ('Calculator', 'Character Map', 'Character Map')
windows = []
for app in args:
windows.append(self.start_app_window(app))
@@ -231,20 +231,20 @@ class SwitcherWindowsManagementTests(SwitcherTestCase):
Then we close the currently focused window.
"""
- mah_win1, calc_win, mah_win2 = self.start_applications("Mahjongg", "Calculator", "Mahjongg")
- self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
+ char_win1, calc_win, char_win2 = self.start_applications("Character Map", "Calculator", "Character Map")
+ self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
self.keybinding("switcher/reveal_normal")
self.assertProperty(calc_win, is_focused=True)
- self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1])
+ self.assertVisibleWindowStack([calc_win, char_win2, char_win1])
self.keybinding("switcher/reveal_normal")
- self.assertProperty(mah_win2, is_focused=True)
- self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
+ self.assertProperty(char_win2, is_focused=True)
+ self.assertVisibleWindowStack([char_win2, calc_win, char_win1])
self.keybinding("window/close")
self.assertProperty(calc_win, is_focused=True)
- self.assertVisibleWindowStack([calc_win, mah_win1])
+ self.assertVisibleWindowStack([calc_win, char_win1])
class SwitcherDetailsTests(SwitcherTestCase):
@@ -338,17 +338,17 @@ class SwitcherDetailsModeTests(SwitcherTestCase):
"""The active selection in detail mode must be the last focused window.
If it was the currently active application type.
"""
- calc_win1, calc_win2 = self.start_applications("Calculator", "Calculator")
- self.assertVisibleWindowStack([calc_win2, calc_win1])
+ char_win1, char_win2 = self.start_applications("Character Map", "Character Map")
+ self.assertVisibleWindowStack([char_win2, char_win1])
self.switcher.initiate()
- while self.switcher.current_icon.tooltip_text != calc_win2.application.name:
+ while self.switcher.current_icon.tooltip_text != char_win2.application.name:
self.switcher.next_icon()
self.keyboard.press_and_release(self.initiate_keycode)
sleep(0.5)
self.switcher.select()
- self.assertProperty(calc_win1, is_focused=True)
+ self.assertProperty(char_win1, is_focused=True)
class SwitcherWorkspaceTests(SwitcherTestCase):
@@ -402,18 +402,18 @@ class SwitcherWorkspaceTests(SwitcherTestCase):
self.set_unity_option("alt_tab_timeout", False)
self.workspace.switch_to(1)
- self.start_app("Mahjongg")
+ self.start_app("Character Map")
self.workspace.switch_to(3)
- mah_win2 = self.start_app_window("Mahjongg")
+ char_win2 = self.start_app_window("Character Map")
self.keybinding("window/minimize")
- self.assertProperty(mah_win2, is_hidden=True)
+ self.assertProperty(char_win2, is_hidden=True)
self.start_app("Calculator")
self.switcher.initiate()
- while self.switcher.current_icon.tooltip_text != mah_win2.application.name:
+ while self.switcher.current_icon.tooltip_text != char_win2.application.name:
self.switcher.next_icon()
self.switcher.select()
- self.assertProperty(mah_win2, is_hidden=False)
+ self.assertProperty(char_win2, is_hidden=False)
diff --git a/tests/test-gesture-engine/CMakeLists.txt b/tests/test-gesture-engine/CMakeLists.txt
deleted file mode 100644
index 49596e152..000000000
--- a/tests/test-gesture-engine/CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-if (GTEST_SRC_DIR)
- set(UNITY_SRC ${CMAKE_SOURCE_DIR}/plugins/unityshell/src)
-
- add_custom_command(OUTPUT GestureEngine.cpp GestureEngine.h UBusMessages.h
- COMMAND cp ${UNITY_SRC}/GestureEngine.cpp ${UNITY_SRC}/GestureEngine.h ${CMAKE_SOURCE_DIR}/unity-shared//UBusMessages.h ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script ${UNITY_SRC}/GestureEngine.cpp > ${CMAKE_CURRENT_BINARY_DIR}/GestureEngine.cpp
- COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script ${UNITY_SRC}/GestureEngine.h > ${CMAKE_CURRENT_BINARY_DIR}/GestureEngine.h
- DEPENDS ${UNITY_SRC}/GestureEngine.cpp ${UNITY_SRC}/GestureEngine.h ${CMAKE_SOURCE_DIR}/unity-shared/UBusMessages.h
- COMMENT "Copying GestureEngine source.")
-
- # Clean-up includes and definitions made in ../CmakeLists.txt
- remove_definitions(${CFLAGS})
- set_directory_properties(PROPERTY INCLUDE_DIRECTORIES "")
- # And make our own
- pkg_check_modules (TEST_GESTURE_ENGINE_DEPS REQUIRED QUIET "${UNITY_PLUGIN_DEPS}")
- set(TEST_GESTURE_ENGINE_CFLAGS
- "-g"
- "-I${CMAKE_CURRENT_SOURCE_DIR}"
- "-I${CMAKE_CURRENT_BINARY_DIR}"
- ${TEST_GESTURE_ENGINE_DEPS_CFLAGS}
- )
- add_definitions(${TEST_GESTURE_ENGINE_CFLAGS})
-
- pkg_check_modules (COMPIZ REQUIRED QUIET compiz)
- link_directories (${COMPIZ_LIBDIR})
-
- add_executable(test-gesture-engine
- test_gesture_engine.cpp
- X11_mock.cpp
- GestureEngine.cpp
- PluginAdapterMock.cpp
- GeisAdapterMock.cpp
- ubus-server-mock.cpp
- )
- target_link_libraries(test-gesture-engine gtest ${TEST_GESTURE_ENGINE_DEPS_LIBRARIES} -lcompiz_core)
- add_test(UnityGTestGestureEngine test-gesture-engine)
- add_dependencies(test-gesture-engine gtest unity-core-${UNITY_API_VERSION})
-
- add_custom_target (check-gesture-engine COMMAND ./test-gesture-engine DEPENDS test-gesture-engine)
-endif (GTEST_SRC_DIR)
diff --git a/tests/test-gesture-engine/GeisAdapterMock.cpp b/tests/test-gesture-engine/GeisAdapterMock.cpp
deleted file mode 100644
index 2d4355a21..000000000
--- a/tests/test-gesture-engine/GeisAdapterMock.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 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 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: Daniel d'Andrada <daniel.dandrada@canonical.com>
- *
- */
-
-#include "GeisAdapterMock.h"
-
-GeisAdapterMock *GeisAdapterMock::_default = nullptr;
-
-GeisAdapterMock& GeisAdapterMock::Instance() {
- if (!_default)
- {
- _default = new GeisAdapterMock;
- }
- return *_default;
-}
diff --git a/tests/test-gesture-engine/GeisAdapterMock.h b/tests/test-gesture-engine/GeisAdapterMock.h
deleted file mode 100644
index c4237a0a8..000000000
--- a/tests/test-gesture-engine/GeisAdapterMock.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright 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 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: Daniel d'Andrada <daniel.dandrada@canonical.com>
- *
- */
-
-#ifndef GEISADAPTER_MOCK_H
-#define GEISADAPTER_MOCK_H
-
-#include <sigc++/sigc++.h>
-#include <X11/Xlib.h>
-
-class GeisAdapterMock : public sigc::trackable
-{
-public:
- static GeisAdapterMock& Instance();
-
- ~GeisAdapterMock() {}
-
- typedef struct _GeisTapData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- int tap_length_ms;
- float position_x;
- float position_y;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisTapData;
-
- typedef struct _GeisDragData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float delta_x;
- float delta_y;
- float velocity_x;
- float velocity_y;
- float position_x;
- float position_y;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisDragData;
-
- typedef struct _GeisRotateData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float angle;
- float angle_delta;
- float angle_velocity;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisRotateData;
-
- typedef struct _GeisPinchData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float radius;
- float radius_delta;
- float radius_velocity;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisPinchData;
-
- typedef struct _GeisTouchData
- {
- int id;
- int device_id;
- Window window;
- int touches;
- int timestamp;
- float focus_x;
- float focus_y;
- float bound_x1;
- float bound_y1;
- float bound_x2;
- float bound_y2;
- } GeisTouchData;
-
- sigc::signal<void, GeisTapData*> tap;
-
- sigc::signal<void, GeisDragData*> drag_start;
- sigc::signal<void, GeisDragData*> drag_update;
- sigc::signal<void, GeisDragData*> drag_finish;
-
- sigc::signal<void, GeisRotateData*> rotate_start;
- sigc::signal<void, GeisRotateData*> rotate_update;
- sigc::signal<void, GeisRotateData*> rotate_finish;
-
- sigc::signal<void, GeisPinchData*> pinch_start;
- sigc::signal<void, GeisPinchData*> pinch_update;
- sigc::signal<void, GeisPinchData*> pinch_finish;
-
- sigc::signal<void, GeisTouchData*> touch_start;
- sigc::signal<void, GeisTouchData*> touch_update;
- sigc::signal<void, GeisTouchData*> touch_finish;
-
-private:
- GeisAdapterMock() {}
-
- static GeisAdapterMock* _default;
-
-};
-#endif
diff --git a/tests/test-gesture-engine/test_gesture_engine.cpp b/tests/test-gesture-engine/test_gesture_engine.cpp
deleted file mode 100644
index 1c009bd55..000000000
--- a/tests/test-gesture-engine/test_gesture_engine.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright 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 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: Daniel d'Andrada <daniel.dandrada@canonical.com>
- *
- */
-
-#include <gtest/gtest.h>
-#include <compiz_mock/core/core.h>
-#include "GestureEngine.h"
-
-CompScreenMock concrete_screen_mock;
-CompScreenMock *screen_mock = &concrete_screen_mock;
-int pointerX_mock = 0;
-int pointerY_mock = 0;
-
-class GestureEngineTest : public ::testing::Test {
- protected:
- virtual void SetUp() {
- screen_mock->_width = 1280;
- screen_mock->_height = 1024;
-
- GenerateWindows();
- }
-
- void PerformPinch(GestureEngine &gesture_engine, float peak_radius) {
- CompWindowMock *middle_window = screen_mock->_client_list_stacking[1];
-
- GeisAdapterMock::GeisTouchData touch_data;
- touch_data.id = 1;
- touch_data.touches = 3;
- touch_data.window = 123;
- touch_data.focus_x = 100; /* hits the middle window */
- touch_data.focus_y = 100;
- gesture_engine.OnTouchStart(&touch_data);
-
- GeisAdapterMock::GeisPinchData pinch_data;
- pinch_data.id = 1;
- pinch_data.touches = 3;
- pinch_data.window = 123;
- pinch_data.focus_x = 100; /* hits the middle window */
- pinch_data.focus_y = 100;
- pinch_data.radius = 1.0;
- gesture_engine.OnPinchStart(&pinch_data);
-
- touch_data.focus_x += 10;
- touch_data.focus_y += 20;
- gesture_engine.OnTouchUpdate(&touch_data);
-
- pinch_data.focus_x += 10;
- pinch_data.focus_y += 20;
- pinch_data.radius = peak_radius;
- gesture_engine.OnPinchUpdate(&pinch_data);
-
- gesture_engine.OnTouchFinish(&touch_data);
- gesture_engine.OnPinchFinish(&pinch_data);
- }
-
- private:
- void GenerateWindows() {
- /* remove windows from previous test */
- for (auto window : screen_mock->_client_list_stacking) {
- delete window;
- }
- screen_mock->_client_list_stacking.clear();
-
- /* and generate new ones */
- CompWindowMock *window;
-
- /* the root window */
- window = new CompWindowMock;
- /* x, y, width, height, border */
- window->_geometry.set(0, 0, screen_mock->width(), screen_mock->height(), 0);
- window->_serverGeometry = window->_geometry;
- window->_actions = 0;
- window->_state = 0;
- screen_mock->_client_list_stacking.push_back(window);
-
- /* middle window */
- window = new CompWindowMock;
- window->_geometry.set(10, 10, 400, 400, 0);
- window->_serverGeometry = window->_geometry;
- window->_actions = CompWindowActionMoveMask;
- window->_state = 0;
- screen_mock->_client_list_stacking.push_back(window);
-
- /* top-level window */
- window = new CompWindowMock;
- window->_geometry.set(500, 500, 410, 410, 0);
- window->_serverGeometry = window->_geometry;
- window->_actions = CompWindowActionMoveMask;
- window->_state = 0;
- screen_mock->_client_list_stacking.push_back(window);
-
- screen_mock->_client_list = screen_mock->_client_list_stacking;
- std::reverse(screen_mock->_client_list.begin(),
- screen_mock->_client_list.end());
- }
-};
-
-TEST_F(GestureEngineTest, ThreeFingersDragMovesWindow)
-{
- GestureEngine gestureEngine(screen_mock);
- CompWindowMock *middle_window = screen_mock->_client_list_stacking[1];
-
- GeisAdapterMock::GeisTouchData touch_data;
- touch_data.id = 1;
- touch_data.touches = 3;
- touch_data.window = 123;
- touch_data.focus_x = 100; /* hits the middle window */
- touch_data.focus_y = 100;
- gestureEngine.OnTouchStart(&touch_data);
-
- GeisAdapterMock::GeisDragData drag_data;
- drag_data.id = 1;
- drag_data.touches = 3;
- drag_data.window = 123;
- drag_data.focus_x = 100; /* hits the middle window */
- drag_data.focus_y = 100;
- gestureEngine.OnDragStart(&drag_data);
-
- ASSERT_FALSE(middle_window->_moved);
-
- touch_data.focus_x += 10;
- touch_data.focus_y += 20;
- gestureEngine.OnTouchUpdate(&touch_data);
-
- drag_data.delta_x = 10;
- drag_data.delta_y = 20;
- drag_data.focus_x += drag_data.delta_x;
- drag_data.focus_y += drag_data.delta_x;
- gestureEngine.OnDragUpdate(&drag_data);
-
- ASSERT_TRUE(middle_window->_moved);
- ASSERT_EQ(drag_data.delta_x, middle_window->_movement_x);
- ASSERT_EQ(drag_data.delta_y, middle_window->_movement_y);
-}
-
-TEST_F(GestureEngineTest, ThreeFingersDragDoesntMoveStaticWindow)
-{
- GestureEngine gestureEngine(screen_mock);
- CompWindowMock *middle_window = screen_mock->_client_list_stacking[1];
-
- /* can't be moved */
- middle_window->_actions = 0;
-
- GeisAdapterMock::GeisTouchData touch_data;
- touch_data.id = 1;
- touch_data.touches = 3;
- touch_data.window = 123;
- touch_data.focus_x = 100; /* hits the middle window */
- touch_data.focus_y = 100;
- gestureEngine.OnTouchStart(&touch_data);
-
- GeisAdapterMock::GeisDragData drag_data;
- drag_data.id = 1;
- drag_data.touches = 3;
- drag_data.window = 123;
- drag_data.focus_x = 100; /* hits the middle window */
- drag_data.focus_y = 100;
- gestureEngine.OnDragStart(&drag_data);
-
- ASSERT_FALSE(middle_window->_moved);
-
- touch_data.focus_x += 10;
- touch_data.focus_y += 20;
- gestureEngine.OnTouchUpdate(&touch_data);
-
- drag_data.delta_x = 10;
- drag_data.delta_y = 20;
- drag_data.focus_x += drag_data.delta_x;
- drag_data.focus_y += drag_data.delta_x;
- gestureEngine.OnDragUpdate(&drag_data);
-
- ASSERT_FALSE(middle_window->_moved);
-}
-
-TEST_F(GestureEngineTest, ThreeFingersPinchMaximizesWindow)
-{
- GestureEngine gesture_engine(screen_mock);
- CompWindowMock *middle_window = screen_mock->_client_list_stacking[1];
-
- PerformPinch(gesture_engine, 2.0);
-
- ASSERT_EQ(1, middle_window->_maximize_count);
- ASSERT_EQ(MAXIMIZE_STATE, middle_window->_maximize_state);
-}
-
-TEST_F(GestureEngineTest, ThreeFingersPinchRestoresWindow)
-{
- GestureEngine gesture_engine(screen_mock);
- CompWindowMock *middle_window = screen_mock->_client_list_stacking[1];
-
- PerformPinch(gesture_engine, 0.3);
-
- ASSERT_EQ(1, middle_window->_maximize_count);
- ASSERT_EQ(0, middle_window->_maximize_state);
-}
-
-TEST_F(GestureEngineTest, MinimalThreeFingersPinchDoesNothing)
-{
- GestureEngine gesture_engine(screen_mock);
- CompWindowMock *middle_window = screen_mock->_client_list_stacking[1];
-
- PerformPinch(gesture_engine, 1.1);
-
- ASSERT_EQ(0, middle_window->_maximize_count);
-}
-
-/* Regression test for lp:979418, where the grab is not removed if the gesture
- * id is 0. */
-TEST_F(GestureEngineTest, DragGrabCheck)
-{
- screen_mock->_grab_count = 0;
-
- GestureEngine gesture_engine(screen_mock);
-
- GeisAdapterMock::GeisDragData drag_data;
- drag_data.id = 0;
- drag_data.touches = 3;
- drag_data.window = 123;
- drag_data.focus_x = 100; /* hits the middle window */
- drag_data.focus_y = 100;
- gesture_engine.OnDragStart(&drag_data);
-
- gesture_engine.OnDragFinish(&drag_data);
-
- ASSERT_EQ(0, screen_mock->_grab_count);
-}
-
-int main(int argc, char** argv)
-{
- ::testing::InitGoogleTest(&argc, argv);
-
- int ret = RUN_ALL_TESTS();
-
- return ret;
-}
diff --git a/tests/test-gestures/CMakeLists.txt b/tests/test-gestures/CMakeLists.txt
new file mode 100644
index 000000000..8d85541f7
--- /dev/null
+++ b/tests/test-gestures/CMakeLists.txt
@@ -0,0 +1,71 @@
+if (GTEST_SRC_DIR)
+ set(UNITY_SRC ${CMAKE_SOURCE_DIR}/plugins/unityshell/src)
+
+ add_custom_command(OUTPUT UnityGestureBroker.cpp
+ UnityGestureBroker.h
+ UBusMessages.h
+ WindowGestureTarget.h
+ WindowGestureTarget.cpp
+
+ COMMAND cp ${UNITY_SRC}/UnityGestureBroker.cpp
+ ${UNITY_SRC}/UnityGestureBroker.h
+ ${CMAKE_SOURCE_DIR}/unity-shared//UBusMessages.h
+ ${UNITY_SRC}/WindowGestureTarget.h
+ ${UNITY_SRC}/WindowGestureTarget.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}
+
+ COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script_broker
+ ${UNITY_SRC}/UnityGestureBroker.cpp > ${CMAKE_CURRENT_BINARY_DIR}/UnityGestureBroker.cpp
+
+ COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script_broker
+ ${UNITY_SRC}/UnityGestureBroker.h > ${CMAKE_CURRENT_BINARY_DIR}/UnityGestureBroker.h
+
+ COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script_gesture
+ ${UNITY_SRC}/WindowGestureTarget.h > ${CMAKE_CURRENT_BINARY_DIR}/WindowGestureTarget.h
+
+ COMMAND sed -f ${CMAKE_CURRENT_SOURCE_DIR}/sed_script_gesture
+ ${UNITY_SRC}/WindowGestureTarget.cpp > ${CMAKE_CURRENT_BINARY_DIR}/WindowGestureTarget.cpp
+
+ DEPENDS ${UNITY_SRC}/UnityGestureBroker.cpp
+ ${UNITY_SRC}/UnityGestureBroker.h
+ ${CMAKE_SOURCE_DIR}/unity-shared/UBusMessages.h
+ ${UNITY_SRC}/WindowGestureTarget.h
+ ${UNITY_SRC}/WindowGestureTarget.cpp
+ sed_script_broker
+ sed_script_gesture
+
+ COMMENT "Copying and modifying sources under test.")
+
+ # Clean-up includes and definitions made in ../CmakeLists.txt
+ remove_definitions(${CFLAGS})
+ set_directory_properties(PROPERTY INCLUDE_DIRECTORIES "")
+ # And make our own
+ pkg_check_modules (TEST_GESTURES_DEPS REQUIRED QUIET "${UNITY_PLUGIN_DEPS}")
+ set(TEST_GESTURES_CFLAGS
+ "-g"
+ "-I${CMAKE_CURRENT_SOURCE_DIR}"
+ "-I${CMAKE_CURRENT_BINARY_DIR}"
+ ${TEST_GESTURES_DEPS_CFLAGS}
+ )
+ add_definitions(${TEST_GESTURES_CFLAGS})
+
+ pkg_check_modules (COMPIZ REQUIRED QUIET compiz)
+ link_directories (${COMPIZ_LIBDIR})
+
+ add_executable(test-gestures
+ test_gestures_main.cpp
+ test_gesture_broker.cpp
+ test_window_gesture_target.cpp
+ X11_mock.cpp
+ UnityGestureBroker.cpp
+ WindowGestureTarget.cpp
+ PluginAdapterMock.cpp
+ ubus-server-mock.cpp
+ UnityGestureTargetMock.h
+ )
+ target_link_libraries(test-gestures gtest ${TEST_GESTURES_DEPS_LIBRARIES} -lcompiz_core)
+ add_test(UnityGTestGestures test-gestures)
+ add_dependencies(test-gestures gtest unity-core-${UNITY_API_VERSION})
+
+ add_custom_target (check-gestures COMMAND ./test-gestures DEPENDS test-gestures)
+endif (GTEST_SRC_DIR)
diff --git a/tests/test-gestures/FakeGestureEvent.h b/tests/test-gestures/FakeGestureEvent.h
new file mode 100644
index 000000000..9cc13aa76
--- /dev/null
+++ b/tests/test-gestures/FakeGestureEvent.h
@@ -0,0 +1,63 @@
+#ifndef FAKE_GESTURE_EVENT_H
+#define FAKE_GESTURE_EVENT_H
+
+#include <NuxGraphics/GestureEvent.h>
+#include <map>
+
+namespace nux {
+class FakeGestureEvent
+{
+ public:
+ nux::EventType type;
+
+ int gesture_id;
+ int gesture_classes;
+ bool is_direct_touch;
+ int timestamp;
+ nux::Point2D<float> focus;
+ nux::Point2D<float> delta;
+ float angle;
+ float angle_delta;
+ float angular_velocity;
+ int tap_duration;
+ nux::Point2D<float> velocity;
+ float radius;
+ float radius_delta;
+ float radial_velocity;
+ std::vector<nux::TouchPoint> touches;
+ bool is_construction_finished;
+
+ nux::GestureEvent &ToGestureEvent()
+ {
+ event_.type = type;
+
+ event_.gesture_id_ = gesture_id;
+ event_.gesture_classes_ = gesture_classes;
+ event_.is_direct_touch_ = is_direct_touch;
+ event_.timestamp_ = timestamp;
+ event_.focus_ = focus;
+ event_.delta_ = delta;
+ event_.angle_ = angle;
+ event_.angle_delta_ = angle_delta;
+ event_.angular_velocity_ = angular_velocity;
+ event_.tap_duration_ = tap_duration;
+ event_.velocity_ = velocity;
+ event_.radius_ = radius;
+ event_.radius_delta_ = radius_delta;
+ event_.radial_velocity_ = radial_velocity;
+ event_.touches_ = touches;
+ event_.is_construction_finished_ = is_construction_finished;
+
+ return event_;
+ }
+
+ private:
+ nux::GestureEvent event_;
+};
+} // namespace nux
+
+// maps a gesture id to its acceptance
+extern std::map<int, int> g_gesture_event_accept_count;
+extern std::map<int, int> g_gesture_event_reject_count;
+
+#endif // FAKE_GESTURE_EVENT_H
diff --git a/tests/test-gestures/NuxMock.h b/tests/test-gestures/NuxMock.h
new file mode 100644
index 000000000..28dfe7bf8
--- /dev/null
+++ b/tests/test-gestures/NuxMock.h
@@ -0,0 +1,19 @@
+#ifndef NUX_MOCK_H
+#define NUX_MOCK_H
+
+#include <Nux/Nux.h>
+
+namespace nux
+{
+
+class InputAreaMock : public Object
+{
+ public:
+ void GestureEvent(const GestureEvent &event)
+ {
+ }
+};
+
+} // namespace nux
+
+#endif // NUX_MOCK_H
diff --git a/tests/test-gesture-engine/PluginAdapterMock.cpp b/tests/test-gestures/PluginAdapterMock.cpp
index a71af2421..a71af2421 100644
--- a/tests/test-gesture-engine/PluginAdapterMock.cpp
+++ b/tests/test-gestures/PluginAdapterMock.cpp
diff --git a/tests/test-gesture-engine/PluginAdapterMock.h b/tests/test-gestures/PluginAdapterMock.h
index 2b111a68b..2b111a68b 100644
--- a/tests/test-gesture-engine/PluginAdapterMock.h
+++ b/tests/test-gestures/PluginAdapterMock.h
diff --git a/tests/test-gestures/UnityGestureTargetMock.h b/tests/test-gestures/UnityGestureTargetMock.h
new file mode 100644
index 000000000..9fd621fb8
--- /dev/null
+++ b/tests/test-gestures/UnityGestureTargetMock.h
@@ -0,0 +1,15 @@
+#ifndef UNITY_GESTURE_TARGET_MOCK_H
+#define UNITY_GESTURE_TARGET_MOCK_H
+
+#include <Nux/Gesture.h>
+
+class UnityGestureTargetMock : public nux::GestureTarget
+{
+ public:
+ virtual nux::GestureDeliveryRequest GestureEvent(const nux::GestureEvent &event)
+ {
+ return nux::GestureDeliveryRequest::NONE;
+ }
+};
+
+#endif // UNITY_GESTURE_TARGET_MOCK_H
diff --git a/tests/test-gestures/WindowGestureTargetMock.h b/tests/test-gestures/WindowGestureTargetMock.h
new file mode 100644
index 000000000..e43bad80c
--- /dev/null
+++ b/tests/test-gestures/WindowGestureTargetMock.h
@@ -0,0 +1,55 @@
+#ifndef WINDOW_GESTURE_TARGET_MOCK_H
+#define WINDOW_GESTURE_TARGET_MOCK_H
+
+#include <Nux/Gesture.h>
+
+#include <set>
+
+class CompWindowMock;
+class WindowGestureTargetMock;
+
+extern std::set<WindowGestureTargetMock*> g_window_target_mocks;
+
+class WindowGestureTargetMock : public nux::GestureTarget
+{
+ public:
+ WindowGestureTargetMock(CompWindowMock *window) : window(window)
+ {
+ g_window_target_mocks.insert(this);
+ }
+
+ virtual ~WindowGestureTargetMock()
+ {
+ g_window_target_mocks.erase(this);
+ }
+
+ virtual nux::GestureDeliveryRequest GestureEvent(const nux::GestureEvent &event)
+ {
+ events_received.push_back(event);
+ return nux::GestureDeliveryRequest::NONE;
+ }
+
+ CompWindowMock *window;
+ std::list<nux::GestureEvent> events_received;
+
+ static Cursor fleur_cursor;
+ private:
+ virtual bool Equals(const nux::GestureTarget& other) const
+ {
+ const WindowGestureTargetMock *window_target = dynamic_cast<const WindowGestureTargetMock *>(&other);
+
+ if (window_target)
+ {
+ if (window && window_target->window)
+ return window->id() == window_target->window->id();
+ else
+ return window == window_target->window;
+ }
+ else
+ {
+ return false;
+ }
+ }
+};
+
+#endif // WINDOW_GESTURE_TARGET_MOCK_H
diff --git a/tests/test-gesture-engine/X11_mock.cpp b/tests/test-gestures/X11_mock.cpp
index 5560aa9ac..5560aa9ac 100644
--- a/tests/test-gesture-engine/X11_mock.cpp
+++ b/tests/test-gestures/X11_mock.cpp
diff --git a/tests/test-gesture-engine/X11_mock.h b/tests/test-gestures/X11_mock.h
index f98e028be..f98e028be 100644
--- a/tests/test-gesture-engine/X11_mock.h
+++ b/tests/test-gestures/X11_mock.h
diff --git a/tests/test-gesture-engine/compiz_mock/core/core.h b/tests/test-gestures/compiz_mock/core/core.h
index f1c358fbf..f1c358fbf 100644
--- a/tests/test-gesture-engine/compiz_mock/core/core.h
+++ b/tests/test-gestures/compiz_mock/core/core.h
diff --git a/tests/test-gesture-engine/compiz_mock/core/screen.h b/tests/test-gestures/compiz_mock/core/screen.h
index 38795db15..225d41c65 100644
--- a/tests/test-gesture-engine/compiz_mock/core/screen.h
+++ b/tests/test-gestures/compiz_mock/core/screen.h
@@ -31,41 +31,42 @@ typedef std::vector<CompWindowMock*> CompWindowMockVector;
class CompScreenMock {
public:
- CompScreenMock() : _grab_count(0) {}
+ CompScreenMock() : grab_count_(0), next_grab_handle_(1) {}
typedef int GrabHandle;
- int width() const {return _width;}
- int height() const {return _height;}
+ int width() const {return width_;}
+ int height() const {return height_;}
- Display *dpy() {return _dpy;}
+ Display *dpy() {return dpy_;}
const CompWindowMockVector & clientList(bool stackingOrder = true) {
if (stackingOrder)
- return _client_list_stacking;
+ return client_list_stacking_;
else
- return _client_list;
+ return client_list_;
}
- Window root() {return _root;}
+ Window root() {return root_;}
GrabHandle pushGrab(Cursor cursor, const char *name) {
- _grab_count++;
- return 0;
+ grab_count_++;
+ return next_grab_handle_++;
}
void removeGrab(GrabHandle handle, CompPoint *restorePointer) {
- _grab_count--;
+ grab_count_--;
}
Cursor invisibleCursor() {return 1;}
- int _width;
- int _height;
- Display *_dpy;
- CompWindowMockVector _client_list;
- CompWindowMockVector _client_list_stacking;
- Window _root;
- int _grab_count;
+ int width_;
+ int height_;
+ Display *dpy_;
+ CompWindowMockVector client_list_;
+ CompWindowMockVector client_list_stacking_;
+ Window root_;
+ int grab_count_;
+ int next_grab_handle_;
};
extern CompScreenMock *screen_mock;
diff --git a/tests/test-gesture-engine/compiz_mock/core/window.h b/tests/test-gestures/compiz_mock/core/window.h
index d65524b7d..f5e930107 100644
--- a/tests/test-gesture-engine/compiz_mock/core/window.h
+++ b/tests/test-gestures/compiz_mock/core/window.h
@@ -24,46 +24,56 @@
/* The real CompWindow */
#include <core/window.h>
-class CompWindowMock {
+class CompWindowMock
+{
public:
- CompWindowMock() : _moved(false), _maximize_count(0), _maximize_state(0) {}
+ CompWindowMock() : moved_(false), maximize_count_(0), maximize_state_(0),
+ minimized_(false) {}
- int x() const {return _geometry.x();}
- int y() const {return _geometry.y();}
- int width() const {return _geometry.width() + (_geometry.border()*2);}
- int height() const {return _geometry.height() + (_geometry.border()*2);}
+ int x() const {return geometry_.x();}
+ int y() const {return geometry_.y();}
+ int width() const {return geometry_.width() + (geometry_.border()*2);}
+ int height() const {return geometry_.height() + (geometry_.border()*2);}
+ int id() { return id_; }
- void move(int dx, int dy, bool immediate = true) {
- _moved = true;
- _movement_x = dx;
- _movement_y = dy;
+ void move(int dx, int dy, bool immediate = true)
+ {
+ moved_ = true;
+ movement_x_ = dx;
+ movement_y_ = dy;
}
- unsigned int actions () {return _actions;}
+ unsigned int actions () {return actions_;}
- void maximize(int state) {++_maximize_count; _maximize_state = state;}
+ bool minimized() { return minimized_; }
+
+ void maximize(int state) {++maximize_count_; maximize_state_ = state;}
/* OBS: I wonder why it returns a reference */
- unsigned int &state() {return _state;}
+ unsigned int &state() {return state_;}
void grabNotify(int x, int y, unsigned int state, unsigned int mask) {}
void ungrabNotify() {}
void syncPosition() {}
- compiz::window::Geometry &serverGeometry() {return _serverGeometry;}
+ compiz::window::Geometry &serverGeometry() {return server_geometry_;}
+
+ unsigned int actions_;
+ unsigned int state_;
+ compiz::window::Geometry server_geometry_;
+ compiz::window::Geometry geometry_;
+
+ bool moved_;
+ int movement_x_;
+ int movement_y_;
- unsigned int _actions;
- unsigned int _state;
- compiz::window::Geometry _serverGeometry;
- compiz::window::Geometry _geometry;
+ int maximize_count_;
+ int maximize_state_;
- bool _moved;
- int _movement_x;
- int _movement_y;
+ int id_;
- int _maximize_count;
- int _maximize_state;
+ bool minimized_;
};
#endif
diff --git a/tests/test-gestures/sed_script_broker b/tests/test-gestures/sed_script_broker
new file mode 100644
index 000000000..3f256b0f6
--- /dev/null
+++ b/tests/test-gestures/sed_script_broker
@@ -0,0 +1,11 @@
+s|<core/core.h>|<compiz_mock/core/core.h>|
+s|\<CompScreen\>|CompScreenMock|g
+s|\<CompWindow\>|CompWindowMock|g
+s|\<CompWindowVector\>|CompWindowMockVector|g
+s|\<screen\>|screen_mock|g
+s|\<pointerX\>|pointerX_mock|g
+s|\<pointerY\>|pointerY_mock|g
+s|\<XFreeCursor\>|XFreeCursorMock|g
+s|\<XCreateFontCursor\>|XCreateFontCursorMock|g
+s|\<WindowGestureTarget\>|WindowGestureTargetMock|g
+s|\<UnityGestureTarget\>|UnityGestureTargetMock|g
diff --git a/tests/test-gesture-engine/sed_script b/tests/test-gestures/sed_script_gesture
index 94fb691f6..c2e3ffa48 100644
--- a/tests/test-gesture-engine/sed_script
+++ b/tests/test-gestures/sed_script_gesture
@@ -9,6 +9,10 @@ s|\<XSync\>|XSyncMock|g
s|\<XWarpPointer\>|XWarpPointerMock|g
s|\<XFreeCursor\>|XFreeCursorMock|g
s|\<XCreateFontCursor\>|XCreateFontCursorMock|g
-s|\<GeisAdapter\>|GeisAdapterMock|g
-s|\<PluginAdapter\>|PluginAdapterMock|g
s|\<ubus-server.h\>|ubus-server-mock.h|g
+s|\<unityshell.h\>|unityshell_mock.h|g
+s|\<PluginAdapter\>|PluginAdapterMock|g
+s|\<UnityWindow\>|UnityWindowMock|g
+s|\<UnityScreen\>|UnityScreenMock|g
+s|\<InputArea\>|InputAreaMock|g
+s|\<Nux/Nux\.h\>|NuxMock.h|g
diff --git a/tests/test-gestures/test_gesture_broker.cpp b/tests/test-gestures/test_gesture_broker.cpp
new file mode 100644
index 000000000..b7f30ec04
--- /dev/null
+++ b/tests/test-gestures/test_gesture_broker.cpp
@@ -0,0 +1,137 @@
+/*
+ * Copyright 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 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: Daniel d'Andrada <daniel.dandrada@canonical.com>
+ *
+ */
+
+#include <gtest/gtest.h>
+#include <compiz_mock/core/core.h>
+#include "UnityGestureBroker.h"
+#include "FakeGestureEvent.h"
+#include "unityshell_mock.h"
+#include "WindowGestureTargetMock.h"
+
+class GestureBrokerTest : public ::testing::Test
+{
+ protected:
+ virtual void SetUp()
+ {
+ screen_mock->width_ = 1280;
+ screen_mock->height_ = 1024;
+
+ GenerateWindows();
+ }
+
+ private:
+ void GenerateWindows()
+ {
+ /* remove windows from previous test */
+ for (auto window : screen_mock->client_list_stacking_) {
+ delete window;
+ }
+ screen_mock->client_list_stacking_.clear();
+
+ /* and generate new ones */
+ CompWindowMock *window;
+
+ /* the root window */
+ window = new unity::UnityWindowMock;
+ window->id_ = 0;
+ /* x, y, width, height, border */
+ window->geometry_.set(0, 0, screen_mock->width(), screen_mock->height(), 0);
+ window->server_geometry_ = window->geometry_;
+ window->actions_ = 0;
+ window->state_ = 0;
+ screen_mock->client_list_stacking_.push_back(window);
+
+ /* middle window */
+ window = new unity::UnityWindowMock;
+ window->id_ = 1;
+ window->geometry_.set(10, 10, 400, 400, 0);
+ window->server_geometry_ = window->geometry_;
+ window->actions_ = CompWindowActionMoveMask;
+ window->state_ = 0;
+ screen_mock->client_list_stacking_.push_back(window);
+
+ /* top-level window */
+ window = new unity::UnityWindowMock;
+ window->id_ = 2;
+ window->geometry_.set(500, 500, 410, 410, 0);
+ window->server_geometry_ = window->geometry_;
+ window->actions_ = CompWindowActionMoveMask;
+ window->state_ = 0;
+ screen_mock->client_list_stacking_.push_back(window);
+
+ screen_mock->client_list_ = screen_mock->client_list_stacking_;
+ std::reverse(screen_mock->client_list_.begin(),
+ screen_mock->client_list_.end());
+ }
+};
+
+/*
+ Tests that events from a three-fingers' Touch gesture goes to the
+ correct window. I.e., to the window that lies where the gesture starts.
+ */
+TEST_F(GestureBrokerTest, ThreeFingersTouchHitsCorrectWindow)
+{
+ UnityGestureBroker gesture_broker;
+ CompWindowMock *middle_window = screen_mock->client_list_stacking_[1];
+ nux::FakeGestureEvent fake_event;
+
+ // init counters
+ g_gesture_event_accept_count[0] = 0;
+ g_gesture_event_reject_count[0] = 0;
+
+ /* prepare and send the fake event */
+ fake_event.type = nux::EVENT_GESTURE_BEGIN;
+ fake_event.gesture_id = 0;
+ fake_event.is_direct_touch = false;
+ fake_event.focus.x = 100.0f; // hits the middle window
+ fake_event.focus.y = 100.0f;
+ // in touch device's coordinate system (because it's not a direct device).
+ // Thus not used by WindowCompositor
+ fake_event.touches.push_back(nux::TouchPoint(0, 10.0f, 10.0f));
+ fake_event.touches.push_back(nux::TouchPoint(1, 20.0f, 20.0f));
+ fake_event.touches.push_back(nux::TouchPoint(2, 22.0f, 22.0f));
+ fake_event.is_construction_finished = false;
+ gesture_broker.ProcessGestureBegin(fake_event.ToGestureEvent());
+
+ // Gesture shouldn't be accepted as constructions hasn't finished
+ ASSERT_EQ(0, g_gesture_event_accept_count[0]);
+ ASSERT_EQ(0, g_gesture_event_reject_count[0]);
+ ASSERT_EQ(1, g_window_target_mocks.size());
+ WindowGestureTargetMock *target_mock = *g_window_target_mocks.begin();
+ ASSERT_TRUE(target_mock->window == middle_window);
+ // No events yet as the broker didn't accept the gesture yet
+ ASSERT_EQ(0, target_mock->events_received.size());
+
+ fake_event.type = nux::EVENT_GESTURE_UPDATE;
+ fake_event.delta.x += 10.0f;
+ fake_event.delta.y += 20.0f;
+ fake_event.focus.x += fake_event.delta.x;
+ fake_event.focus.y += fake_event.delta.y;
+ fake_event.is_construction_finished = true;
+ gesture_broker.ProcessGestureUpdate(fake_event.ToGestureEvent());
+
+ // Gesture should have been accepted now since the construction has finished.
+ ASSERT_EQ(1, g_gesture_event_accept_count[0]);
+ ASSERT_EQ(0, g_gesture_event_reject_count[0]);
+ // Check that this gesture target is still valid
+ ASSERT_EQ(1, g_window_target_mocks.count(target_mock));
+ // Gesture events should have been sent to the target by now
+ ASSERT_EQ(2, target_mock->events_received.size());
+}
diff --git a/tests/test-gestures/test_gestures_main.cpp b/tests/test-gestures/test_gestures_main.cpp
new file mode 100644
index 000000000..d362b5746
--- /dev/null
+++ b/tests/test-gestures/test_gestures_main.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright 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 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: Daniel d'Andrada <daniel.dandrada@canonical.com>
+ *
+ */
+
+#include <gtest/gtest.h>
+#include <compiz_mock/core/core.h>
+#include <NuxGraphics/GestureEvent.h>
+#include "WindowGestureTargetMock.h"
+#include "unityshell_mock.h"
+
+unity::UnityScreenMock concrete_screen_mock;
+CompScreenMock *screen_mock = &concrete_screen_mock;
+int pointerX_mock = 0;
+int pointerY_mock = 0;
+
+std::map<int, int> g_gesture_event_accept_count;
+void nux::GestureEvent::Accept()
+{
+ g_gesture_event_accept_count[gesture_id_] =
+ g_gesture_event_accept_count[gesture_id_] + 1;
+}
+
+std::map<int, int> g_gesture_event_reject_count;
+void nux::GestureEvent::Reject()
+{
+ g_gesture_event_reject_count[gesture_id_] =
+ g_gesture_event_reject_count[gesture_id_] + 1;
+}
+
+Cursor WindowGestureTargetMock::fleur_cursor = 0;
+std::set<WindowGestureTargetMock*> g_window_target_mocks;
+
+int main(int argc, char** argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+
+ int ret = RUN_ALL_TESTS();
+
+ return ret;
+}
diff --git a/tests/test-gestures/test_window_gesture_target.cpp b/tests/test-gestures/test_window_gesture_target.cpp
new file mode 100644
index 000000000..4491a9ca3
--- /dev/null
+++ b/tests/test-gestures/test_window_gesture_target.cpp
@@ -0,0 +1,235 @@
+/*
+ * Copyright 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 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: Daniel d'Andrada <daniel.dandrada@canonical.com>
+ *
+ */
+
+#include <gtest/gtest.h>
+#include <compiz_mock/core/core.h>
+#include "FakeGestureEvent.h"
+#include "unityshell_mock.h"
+#include <WindowGestureTarget.h>
+
+class WindowGestureTargetTest : public ::testing::Test
+{
+ protected:
+ virtual void SetUp()
+ {
+ screen_mock->width_ = 1280;
+ screen_mock->height_ = 1024;
+ }
+
+ void PerformPinch(WindowGestureTarget &gesture_target, float peak_radius)
+ {
+ nux::FakeGestureEvent fake_event;
+
+ fake_event.type = nux::EVENT_GESTURE_BEGIN;
+ fake_event.gesture_id = 0;
+ fake_event.gesture_classes = nux::PINCH_GESTURE;
+ fake_event.is_direct_touch = false;
+ // in touch device's coordinate system (because it's not a direct device).
+ // Thus not used by WindowCompositor
+ fake_event.touches.push_back(nux::TouchPoint(0, 10.0f, 10.0f));
+ fake_event.touches.push_back(nux::TouchPoint(1, 20.0f, 20.0f));
+ fake_event.touches.push_back(nux::TouchPoint(2, 22.0f, 22.0f));
+ fake_event.focus.x = gesture_target.window()->geometry_.centerX();
+ fake_event.focus.y = gesture_target.window()->geometry_.centerY();;
+ fake_event.radius = 1.0;
+ fake_event.is_construction_finished = false;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ fake_event.type = nux::EVENT_GESTURE_UPDATE;
+ fake_event.radius = peak_radius;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ fake_event.type = nux::EVENT_GESTURE_END;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+ }
+};
+
+TEST_F(WindowGestureTargetTest, ThreeFingersDragMovesWindow)
+{
+ unity::UnityWindowMock window;
+ window.geometry_.set(10, 10, 400, 400, 0);
+ window.server_geometry_ = window.geometry_;
+ window.actions_ = CompWindowActionMoveMask;
+ window.state_ = 0;
+ window.id_ = 1;
+
+ WindowGestureTarget gesture_target(&window);
+
+ nux::FakeGestureEvent fake_event;
+
+ /* prepare and send the fake event */
+ fake_event.type = nux::EVENT_GESTURE_BEGIN;
+ fake_event.gesture_id = 0;
+ fake_event.gesture_classes = nux::TOUCH_GESTURE;
+ fake_event.is_direct_touch = false;
+ fake_event.focus.x = 100.0f; // hits the middle window
+ fake_event.focus.y = 100.0f;
+ // in touch device's coordinate system (because it's not a direct device).
+ // Thus not used by WindowCompositor
+ fake_event.touches.push_back(nux::TouchPoint(0, 10.0f, 10.0f));
+ fake_event.touches.push_back(nux::TouchPoint(1, 20.0f, 20.0f));
+ fake_event.touches.push_back(nux::TouchPoint(2, 22.0f, 22.0f));
+ fake_event.is_construction_finished = false;
+ fake_event.radius = 1.0f;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ ASSERT_FALSE(window.moved_);
+
+ fake_event.type = nux::EVENT_GESTURE_UPDATE;
+ fake_event.gesture_classes = nux::TOUCH_GESTURE | nux::DRAG_GESTURE;
+ fake_event.delta.x = 10.0f;
+ fake_event.delta.y = 20.0f;
+ fake_event.focus.x += fake_event.delta.x;
+ fake_event.focus.y += fake_event.delta.y;
+ fake_event.is_construction_finished = true;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ ASSERT_TRUE(window.moved_);
+ ASSERT_EQ(fake_event.delta.x, window.movement_x_);
+ ASSERT_EQ(fake_event.delta.y, window.movement_y_);
+}
+
+TEST_F(WindowGestureTargetTest, ThreeFingersDragDoesntMoveStaticWindow)
+{
+
+ unity::UnityWindowMock window;
+ window.geometry_.set(10, 10, 400, 400, 0);
+ window.server_geometry_ = window.geometry_;
+ window.actions_ = 0; /* can't be moved */
+ window.state_ = 0;
+ window.id_ = 1;
+
+ WindowGestureTarget gesture_target(&window);
+
+ nux::FakeGestureEvent fake_event;
+
+ /* prepare and send the fake event */
+ fake_event.type = nux::EVENT_GESTURE_BEGIN;
+ fake_event.gesture_id = 0;
+ fake_event.is_direct_touch = false;
+ fake_event.focus.x = 100.0f; // hits the middle window
+ fake_event.focus.y = 100.0f;
+ // in touch device's coordinate system (because it's not a direct device).
+ // Thus not used by WindowCompositor
+ fake_event.touches.push_back(nux::TouchPoint(0, 10.0f, 10.0f));
+ fake_event.touches.push_back(nux::TouchPoint(1, 20.0f, 20.0f));
+ fake_event.touches.push_back(nux::TouchPoint(2, 22.0f, 22.0f));
+ fake_event.is_construction_finished = false;
+ fake_event.radius = 1.0f;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ ASSERT_FALSE(window.moved_);
+
+ fake_event.type = nux::EVENT_GESTURE_UPDATE;
+ fake_event.delta.x += 10.0f;
+ fake_event.delta.y += 20.0f;
+ fake_event.focus.x += fake_event.delta.x;
+ fake_event.focus.y += fake_event.delta.y;
+ fake_event.is_construction_finished = true;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ ASSERT_FALSE(window.moved_);
+}
+
+TEST_F(WindowGestureTargetTest, ThreeFingersPinchMaximizesWindow)
+{
+ unity::UnityWindowMock window;
+ window.geometry_.set(10, 10, 400, 400, 0);
+ window.server_geometry_ = window.geometry_;
+ window.actions_ = CompWindowActionMoveMask;
+ window.state_ = 0;
+ window.id_ = 1;
+
+ WindowGestureTarget gesture_target(&window);
+
+ PerformPinch(gesture_target, 2.0);
+
+ ASSERT_EQ(1, window.maximize_count_);
+ ASSERT_EQ(MAXIMIZE_STATE, window.maximize_state_);
+}
+
+TEST_F(WindowGestureTargetTest, ThreeFingersPinchRestoresWindow)
+{
+ unity::UnityWindowMock window;
+ window.geometry_.set(10, 10, 400, 400, 0);
+ window.server_geometry_ = window.geometry_;
+ window.actions_ = CompWindowActionMoveMask;
+ window.state_ = MAXIMIZE_STATE;
+ window.id_ = 1;
+
+ WindowGestureTarget gesture_target(&window);
+
+ PerformPinch(gesture_target, 0.3);
+
+ ASSERT_EQ(1, window.maximize_count_);
+ ASSERT_EQ(0, window.maximize_state_);
+}
+
+TEST_F(WindowGestureTargetTest, MinimalThreeFingersPinchDoesNothing)
+{
+ unity::UnityWindowMock window;
+ window.geometry_.set(10, 10, 400, 400, 0);
+ window.server_geometry_ = window.geometry_;
+ window.actions_ = CompWindowActionMoveMask;
+ window.state_ = 0;
+ window.id_ = 1;
+
+ WindowGestureTarget gesture_target(&window);
+
+ PerformPinch(gesture_target, 1.1);
+
+ ASSERT_EQ(0, window.maximize_count_);
+}
+
+/* Regression test for lp:979418, where the grab is not removed if the gesture
+ * id is 0. */
+TEST_F(WindowGestureTargetTest, DragGrabCheck)
+{
+ screen_mock->grab_count_ = 0;
+
+ unity::UnityWindowMock window;
+ window.geometry_.set(10, 10, 400, 400, 0);
+ window.server_geometry_ = window.geometry_;
+ window.actions_ = CompWindowActionMoveMask;
+ window.state_ = 0;
+ window.id_ = 1;
+
+ WindowGestureTarget gesture_target(&window);
+
+ /* prepare and send the fake event */
+ nux::FakeGestureEvent fake_event;
+ fake_event.type = nux::EVENT_GESTURE_BEGIN;
+ fake_event.gesture_id = 0;
+ fake_event.is_direct_touch = false;
+ fake_event.focus.x = 100.0f; // hits the middle window
+ fake_event.focus.y = 100.0f;
+ // in touch device's coordinate system (because it's not a direct device).
+ // Thus not used by WindowCompositor
+ fake_event.touches.push_back(nux::TouchPoint(0, 10.0f, 10.0f));
+ fake_event.touches.push_back(nux::TouchPoint(1, 20.0f, 20.0f));
+ fake_event.touches.push_back(nux::TouchPoint(2, 22.0f, 22.0f));
+ fake_event.is_construction_finished = false;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ fake_event.type = nux::EVENT_GESTURE_END;
+ gesture_target.GestureEvent(fake_event.ToGestureEvent());
+
+ ASSERT_EQ(0, screen_mock->grab_count_);
+}
diff --git a/tests/test-gesture-engine/ubus-server-mock.cpp b/tests/test-gestures/ubus-server-mock.cpp
index 8305aedff..8305aedff 100644
--- a/tests/test-gesture-engine/ubus-server-mock.cpp
+++ b/tests/test-gestures/ubus-server-mock.cpp
diff --git a/tests/test-gesture-engine/ubus-server-mock.h b/tests/test-gestures/ubus-server-mock.h
index 21a642253..21a642253 100644
--- a/tests/test-gesture-engine/ubus-server-mock.h
+++ b/tests/test-gestures/ubus-server-mock.h
diff --git a/tests/test-gestures/unityshell_mock.h b/tests/test-gestures/unityshell_mock.h
new file mode 100644
index 000000000..dd054abf4
--- /dev/null
+++ b/tests/test-gestures/unityshell_mock.h
@@ -0,0 +1,52 @@
+#ifndef UNITYSHELL_MOCK_H
+#define UNITYSHELL_MOCK_H
+
+#include <compiz_mock/core/core.h>
+#include <sigc++/sigc++.h>
+#include <NuxMock.h>
+
+namespace unity
+{
+
+class UnityWindowMock : public CompWindowMock
+{
+ public:
+ static UnityWindowMock *get(CompWindowMock *window)
+ {
+ return static_cast<UnityWindowMock*>(window);
+
+ }
+
+ sigc::signal<void> being_destroyed;
+};
+
+class UnityScreenMock : public CompScreenMock
+{
+ public:
+ UnityScreenMock()
+ : launcher_(new nux::InputAreaMock)
+ {
+ }
+
+ virtual ~UnityScreenMock()
+ {
+ launcher_->Dispose();
+ }
+
+ static UnityScreenMock *get(CompScreenMock *screen)
+ {
+ return static_cast<UnityScreenMock*>(screen);
+
+ }
+
+ nux::InputAreaMock *LauncherView()
+ {
+ return launcher_;
+ }
+
+ nux::InputAreaMock *launcher_;
+};
+
+} // namespace unity
+
+#endif // UNITYSHELL_MOCK_H
diff --git a/tests/test_favorite_store_gsettings.cpp b/tests/test_favorite_store_gsettings.cpp
index 9604dc712..245fcd001 100644
--- a/tests/test_favorite_store_gsettings.cpp
+++ b/tests/test_favorite_store_gsettings.cpp
@@ -41,10 +41,9 @@ using testing::Eq;
namespace {
// Constant
+const gchar* SETTINGS_NAME = "com.canonical.Unity.Launcher";
+const gchar* SETTINGS_KEY = "favorites";
const gchar* SCHEMA_DIRECTORY = BUILDDIR"/settings";
-const gchar* BASE_STORE_FILE = BUILDDIR"/settings/test-favorite-store-gsettings.store";
-const gchar* BASE_STORE_CONTENTS = "[com/canonical/unity/launcher]\n" \
- "favorites=['%s', '%s', '%s']";
const char* base_store_favs[] = { BUILDDIR"/tests/data/ubuntuone-installer.desktop",
BUILDDIR"/tests/data/ubuntu-software-center.desktop",
@@ -76,41 +75,33 @@ bool ends_with(std::string const& value, std::string const& suffix)
class TestFavoriteStoreGSettings : public testing::Test
{
public:
- glib::Object<GSettingsBackend> backend;
- std::unique_ptr<internal::FavoriteStoreGSettings> setting_singleton_instance;
+ std::unique_ptr<internal::FavoriteStoreGSettings> favorite_store;
+ glib::Object<GSettings> gsettings_client;
virtual void SetUp()
{
// set the data directory so gsettings can find the schema
- g_setenv("GSETTINGS_SCHEMA_DIR", SCHEMA_DIRECTORY, false);
+ g_setenv("GSETTINGS_SCHEMA_DIR", SCHEMA_DIRECTORY, true);
+ g_setenv("GSETTINGS_BACKEND", "memory", true);
- glib::Error error;
- glib::String contents(g_strdup_printf(BASE_STORE_CONTENTS,
- base_store_favs[0],
- base_store_favs[1],
- base_store_favs[2]
- ));
+ favorite_store.reset(new internal::FavoriteStoreGSettings());
- g_file_set_contents(BASE_STORE_FILE,
- contents.Value(),
- -1,
- error.AsOutParam());
-
- ASSERT_FALSE(error);
-
- backend = g_keyfile_settings_backend_new(BASE_STORE_FILE, "/", "root");
- setting_singleton_instance.reset(new internal::FavoriteStoreGSettings(backend.RawPtr()));
+ // Setting the test values
+ gsettings_client = g_settings_new(SETTINGS_NAME);
+ g_settings_set_strv(gsettings_client, SETTINGS_KEY, base_store_favs);
}
virtual void TearDown()
{
+ g_setenv("GSETTINGS_SCHEMA_DIR", "", true);
+ g_setenv("GSETTINGS_BACKEND", "", true);
}
-
};
TEST_F(TestFavoriteStoreGSettings, TestAllocation)
{
- EXPECT_TRUE(G_IS_SETTINGS_BACKEND(backend.RawPtr()));
+ FavoriteStore &settings = FavoriteStore::Instance();
+ EXPECT_EQ(&settings, favorite_store.get());
}
TEST_F(TestFavoriteStoreGSettings, TestGetFavorites)
@@ -245,9 +236,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteAddedSignalFirst)
favs.push_back(base_store_favs[0]);
favs.push_back(base_store_favs[1]);
favs.push_back(base_store_favs[2]);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
ASSERT_TRUE(signal_received);
EXPECT_EQ(position, base_store_favs[0]);
@@ -273,9 +262,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteAddedSignalMiddle)
favs.push_back(base_store_favs[1]);
favs.push_back(other_desktop);
favs.push_back(base_store_favs[2]);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
ASSERT_TRUE(signal_received);
EXPECT_EQ(position, base_store_favs[1]);
@@ -301,9 +288,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteAddedSignalEnd)
favs.push_back(base_store_favs[1]);
favs.push_back(base_store_favs[2]);
favs.push_back(other_desktop);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
ASSERT_TRUE(signal_received);
EXPECT_EQ(position, base_store_favs[2]);
@@ -326,9 +311,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteAddedSignalEmpty)
FavoriteList favs;
favs.push_back(other_desktop);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
ASSERT_TRUE(signal_received);
EXPECT_EQ(position, "");
@@ -350,9 +333,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteRemoved)
FavoriteList favs;
favs.push_back(base_store_favs[0]);
favs.push_back(base_store_favs[2]);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
ASSERT_TRUE(signal_received);
EXPECT_EQ(path_removed, base_store_favs[1]);
@@ -372,9 +353,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteReordered)
favs.push_back(base_store_favs[0]);
favs.push_back(base_store_favs[2]);
favs.push_back(base_store_favs[1]);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
ASSERT_TRUE(signal_received);
@@ -382,9 +361,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteReordered)
favs.push_back(base_store_favs[0]);
favs.push_back(base_store_favs[2]);
favs.push_back(base_store_favs[1]);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
ASSERT_FALSE(signal_received);
}
@@ -415,9 +392,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteSignalsMixed1)
favs.push_back(base_store_favs[0]);
favs.push_back(base_store_favs[1]);
favs.push_back(other_desktop);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
EXPECT_TRUE(added_received);
EXPECT_TRUE(removed_received);
@@ -450,9 +425,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteSignalsMixed2)
favs.push_back(base_store_favs[1]);
favs.push_back(other_desktop);
favs.push_back(base_store_favs[0]);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
EXPECT_TRUE(added_received);
EXPECT_TRUE(removed_received);
@@ -484,9 +457,7 @@ TEST_F(TestFavoriteStoreGSettings, TestFavoriteSignalsMixed3)
FavoriteList favs;
favs.push_back(base_store_favs[1]);
favs.push_back(base_store_favs[0]);
- setting_singleton_instance->SaveFavorites(favs, false);
-
- sleep(1);
+ favorite_store->SaveFavorites(favs, false);
EXPECT_FALSE(added_received);
EXPECT_TRUE(removed_received);
diff --git a/tests/test_launcher.cpp b/tests/test_launcher.cpp
index 21fbe131e..634a97ea4 100644
--- a/tests/test_launcher.cpp
+++ b/tests/test_launcher.cpp
@@ -84,9 +84,9 @@ TEST_F(TestLauncher, TestQuirksDuringDnd)
Utils::WaitForTimeout(1);
- EXPECT_FALSE(first->GetQuirk(launcher::AbstractLauncherIcon::QUIRK_DESAT));
- EXPECT_FALSE(second->GetQuirk(launcher::AbstractLauncherIcon::QUIRK_DESAT));
- EXPECT_TRUE(third->GetQuirk(launcher::AbstractLauncherIcon::QUIRK_DESAT));
+ EXPECT_FALSE(first->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT));
+ EXPECT_FALSE(second->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT));
+ EXPECT_TRUE(third->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT));
}
}
diff --git a/tests/test_launcher_controller.cpp b/tests/test_launcher_controller.cpp
index bbc461de2..16fbbf5ee 100644
--- a/tests/test_launcher_controller.cpp
+++ b/tests/test_launcher_controller.cpp
@@ -49,6 +49,17 @@ private:
FavoriteList fav_list_;
};
+class MockBamfLauncherIcon : public BamfLauncherIcon
+{
+public:
+ //typedef nux::ObjectPtr<MockMockLauncherIcon> Ptr;
+ MockBamfLauncherIcon(BamfApplication* app)
+ : BamfLauncherIcon(app) {}
+
+ MOCK_METHOD0(UnStick, void());
+ MOCK_METHOD0(Quit, void());
+};
+
namespace launcher
{
class TestLauncherController : public testing::Test
@@ -70,11 +81,15 @@ protected:
return lc.pimpl->edge_barriers_;
}
+ LauncherModel::Ptr GetLauncherModel()
+ {
+ return lc.pimpl->model_;
+ }
+
MockUScreen uscreen;
Settings settings;
panel::Style panel_style;
MockFavoriteStore favorite_store;
- GeisAdapter geis_adapter;
Controller lc;
};
}
@@ -199,4 +214,20 @@ TEST_F(TestLauncherController, SingleMonitorEdgeBarrierSubscriptionsUpdates)
}
}
+TEST_F(TestLauncherController, OnlyUnstickIconOnFavoriteRemoval)
+{
+ const std::string USC_DESKTOP = BUILDDIR"/tests/data/ubuntu-software-center.desktop";
+
+ glib::Object<BamfMatcher> matcher(bamf_matcher_get_default());
+
+ auto bamf_app = bamf_matcher_get_application_for_desktop_file(matcher, USC_DESKTOP.c_str(), TRUE);
+ MockBamfLauncherIcon *bamf_icon = new MockBamfLauncherIcon(bamf_app);
+ GetLauncherModel()->AddIcon(AbstractLauncherIcon::Ptr(bamf_icon));
+
+ EXPECT_CALL(*bamf_icon, UnStick());
+ EXPECT_CALL(*bamf_icon, Quit()).Times(0);
+
+ favorite_store.favorite_removed.emit(USC_DESKTOP);
+}
+
}
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index e2c6a9116..a92978dab 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -4,7 +4,6 @@
#include <NuxCore/Logger.h>
#include <Nux/Nux.h>
-#include "GestureEngine.h"
#include "unity-shared/PluginAdapter.h"
#include "unity-shared/WindowManager.h"
@@ -27,7 +26,6 @@ int main(int argc, char** argv)
// Setting the PluginAdapter to null, using the Standalone version at link time.
PluginAdapter::Initialize(NULL);
WindowManager::SetDefault(PluginAdapter::Default());
- GeisAdapter geis_adapter;
int ret = RUN_ALL_TESTS();
diff --git a/tests/test_panel_style.cpp b/tests/test_panel_style.cpp
new file mode 100644
index 000000000..3e795c3d4
--- /dev/null
+++ b/tests/test_panel_style.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright 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 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: Andrea Azzarone <andrea.azzarone@canonical.com>
+ *
+ */
+
+#include <config.h>
+
+#include <gio/gio.h>
+#include <gtest/gtest.h>
+
+#include "unity-shared/PanelStyle.h"
+#include "unity-shared/UnitySettings.h"
+
+using namespace unity;
+using namespace testing;
+
+namespace
+{
+
+const std::string TITLEBAR_FONT = "Ubuntu Bold 11";
+
+class TestPanelStyle : public Test
+{
+public:
+ glib::Object<GSettings> gsettings;
+ Settings unity_settings;
+ std::unique_ptr<panel::Style> panel_style_instance;
+
+ /* override */ void SetUp()
+ {
+ g_setenv("GSETTINGS_BACKEND", "memory", TRUE);
+
+ gsettings = g_settings_new("org.gnome.desktop.wm.preferences");
+ g_settings_set_string(gsettings, "titlebar-font", TITLEBAR_FONT.c_str());
+
+ panel_style_instance.reset(new panel::Style());
+ }
+
+ /* override */ void TearDown()
+ {
+ g_setenv("GSETTINGS_BACKEND", "", TRUE);
+ }
+};
+
+TEST_F(TestPanelStyle, TestGetFontDescription)
+{
+ ASSERT_EQ(panel_style_instance->GetFontDescription(panel::PanelItem::TITLE), TITLEBAR_FONT);
+}
+
+TEST_F(TestPanelStyle, TestChangedSignal)
+{
+ bool signal_received = false;
+
+ panel_style_instance->changed.connect([&](){
+ signal_received = true;
+ });
+
+ g_settings_set_string(gsettings, "titlebar-font", "Ubuntu Italic 11");
+
+ sleep(1);
+
+ ASSERT_TRUE(signal_received);
+ ASSERT_EQ(panel_style_instance->GetFontDescription(panel::PanelItem::TITLE), "Ubuntu Italic 11");
+}
+
+}
diff --git a/tests/test_switcher_controller.cpp b/tests/test_switcher_controller.cpp
index 9f15f000e..70bda5fd0 100644
--- a/tests/test_switcher_controller.cpp
+++ b/tests/test_switcher_controller.cpp
@@ -24,6 +24,7 @@
#include "test_utils.h"
#include "SwitcherController.h"
+#include "DesktopLauncherIcon.h"
#include "TimeUtil.h"
@@ -127,6 +128,7 @@ TEST(TestSwitcherController, InitialDetailTimeout)
{
MockSwitcherController controller;
std::vector<unity::launcher::AbstractLauncherIcon::Ptr> results;
+ results.push_back(unity::launcher::AbstractLauncherIcon::Ptr(new unity::launcher::DesktopLauncherIcon()));
struct timespec current;
controller.initial_detail_timeout_length = 2000;
@@ -160,6 +162,7 @@ TEST(TestSwitcherController, ShowSwitcher)
{
MockSwitcherController controller;
std::vector<unity::launcher::AbstractLauncherIcon::Ptr> results;
+ results.push_back(unity::launcher::AbstractLauncherIcon::Ptr(new unity::launcher::DesktopLauncherIcon()));
controller.Show(ShowMode::ALL, SortMode::LAUNCHER_ORDER, false, results);
@@ -176,4 +179,15 @@ TEST(TestSwitcherController, ShowSwitcherNoShowDeskop)
ASSERT_TRUE(controller.StartIndex() == 0);
}
+TEST(TestSwitcherController, ShowSwitcherNoResults)
+{
+ MockSwitcherController controller;
+ controller.SetShowDesktopDisabled(true);
+ std::vector<unity::launcher::AbstractLauncherIcon::Ptr> results;
+
+ controller.Show(ShowMode::CURRENT_VIEWPORT, SortMode::FOCUS_ORDER, false, results);
+
+ ASSERT_FALSE(controller.Visible());
+}
+
}
diff --git a/unity-shared/BGHash.cpp b/unity-shared/BGHash.cpp
index 3ccd92e2f..767c8f377 100644
--- a/unity-shared/BGHash.cpp
+++ b/unity-shared/BGHash.cpp
@@ -155,7 +155,6 @@ nux::Color BGHash::MatchColor(nux::Color const& base_color) const
colors[10] = nux::Color (0x1b134c);
colors[11] = nux::Color (0x2c0d46);
- float closest_diff = 200.0f;
nux::Color chosen_color;
nux::color::HueSaturationValue base_hsv (base_color);
@@ -168,6 +167,7 @@ nux::Color BGHash::MatchColor(nux::Color const& base_color) const
}
else
{
+ float closest_diff = 200.0f;
LOG_DEBUG (logger) << "got a colour image";
// full colour image
for (int i = 0; i < 11; i++)
diff --git a/unity-shared/DashStyle.cpp b/unity-shared/DashStyle.cpp
index 789659139..31d997f0f 100644
--- a/unity-shared/DashStyle.cpp
+++ b/unity-shared/DashStyle.cpp
@@ -1648,7 +1648,6 @@ bool Style::SquareButton(cairo_t* cr, nux::ButtonVisualState state,
double height = h - (2.0 * garnish) - 1.0;
bool odd = true;
- double radius = 7.0;
// draw the grid background
{
@@ -1656,6 +1655,7 @@ bool Style::SquareButton(cairo_t* cr, nux::ButtonVisualState state,
cairo_move_to(cr, _align(x + width, odd), y);
if (curve_bottom)
{
+ double radius = 7.0;
LOG_DEBUG(logger) << "curve: " << _align(x + width, odd) << " - " << _align(y + height - radius, odd);
// line to bottom-right corner
cairo_line_to(cr, _align(x + width, odd), _align(y + height - radius, odd));
diff --git a/unity-shared/IconRenderer.cpp b/unity-shared/IconRenderer.cpp
index f8bbbba66..ed1fa65e6 100644
--- a/unity-shared/IconRenderer.cpp
+++ b/unity-shared/IconRenderer.cpp
@@ -250,7 +250,7 @@ void IconRenderer::PreprocessIcons(std::list<RenderArg>& args, nux::Geometry con
std::list<RenderArg>::iterator it;
int i;
- for (it = args.begin(), i = 0; it != args.end(); it++, i++)
+ for (it = args.begin(), i = 0; it != args.end(); ++it, i++)
{
IconTextureSource* launcher_icon = it->icon;
@@ -757,7 +757,6 @@ void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0));
CHECKGL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));
- int TextureObjectLocation;
int VertexLocation;
int TextureCoord0Location;
int FragmentColor = 0;
@@ -768,7 +767,7 @@ void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext,
{
local::shader_program_uv_persp_correction->Begin();
- TextureObjectLocation = local::shader_program_uv_persp_correction->GetUniformLocationARB("TextureObject0");
+ int TextureObjectLocation = local::shader_program_uv_persp_correction->GetUniformLocationARB("TextureObject0");
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");
diff --git a/unity-shared/PanelStyle.cpp b/unity-shared/PanelStyle.cpp
index 2fce4eacf..142095396 100644
--- a/unity-shared/PanelStyle.cpp
+++ b/unity-shared/PanelStyle.cpp
@@ -22,7 +22,6 @@
#include <math.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
#include <boost/algorithm/string/predicate.hpp>
#include <Nux/Nux.h>
@@ -46,8 +45,8 @@ Style* style_instance = nullptr;
nux::logging::Logger logger("unity.panel.style");
-const std::string METACITY_SETTINGS_PATH("/apps/metacity/general/");
-const std::string PANEL_TITLE_FONT_KEY("/apps/metacity/general/titlebar_font");
+const std::string SETTINGS_NAME("org.gnome.desktop.wm.preferences");
+const std::string PANEL_TITLE_FONT_KEY("titlebar-font");
const std::string HIGH_CONTRAST_THEME_PREFIX("HighContrast");
nux::Color ColorFromGdkRGBA(GdkRGBA const& color)
@@ -63,6 +62,7 @@ nux::Color ColorFromGdkRGBA(GdkRGBA const& color)
Style::Style()
: panel_height(24)
, _style_context(gtk_style_context_new())
+ , _gsettings(g_settings_new(SETTINGS_NAME.c_str()))
{
if (style_instance)
{
@@ -109,14 +109,10 @@ Style::Style()
changed.emit();
});
- GConfClient* client = gconf_client_get_default();
- gconf_client_add_dir(client, METACITY_SETTINGS_PATH.c_str(), GCONF_CLIENT_PRELOAD_NONE, nullptr);
- _gconf_notify_id = gconf_client_notify_add(client, PANEL_TITLE_FONT_KEY.c_str(),
- [] (GConfClient*,guint,GConfEntry*, gpointer data)
- {
- auto self = static_cast<Style*>(data);
- self->changed.emit();
- }, this, nullptr, nullptr);
+ _settings_changed_signal.Connect(_gsettings, "changed::" + PANEL_TITLE_FONT_KEY,
+ [&] (GSettings*, gchar*) {
+ changed.emit();
+ });
Refresh();
}
@@ -125,9 +121,6 @@ Style::~Style()
{
if (style_instance == this)
style_instance = nullptr;
-
- if (_gconf_notify_id)
- gconf_client_notify_remove(gconf_client_get_default(), _gconf_notify_id);
}
Style& Style::Instance()
@@ -371,8 +364,7 @@ std::string Style::GetFontDescription(PanelItem item)
}
case PanelItem::TITLE:
{
- GConfClient* client = gconf_client_get_default();
- glib::String font_name(gconf_client_get_string(client, PANEL_TITLE_FONT_KEY.c_str(), nullptr));
+ glib::String font_name(g_settings_get_string(_gsettings, PANEL_TITLE_FONT_KEY.c_str()));
return font_name.Str();
}
}
@@ -390,3 +382,4 @@ int Style::GetTextDPI()
} // namespace panel
} // namespace unity
+
diff --git a/unity-shared/PanelStyle.h b/unity-shared/PanelStyle.h
index ef86d9800..b5640c18e 100644
--- a/unity-shared/PanelStyle.h
+++ b/unity-shared/PanelStyle.h
@@ -84,12 +84,14 @@ private:
void Refresh();
glib::Object<GtkStyleContext> _style_context;
+ glib::Object<GSettings> _gsettings;
+ std::string _theme_name;
+ nux::Color _text_color;
+
glib::Signal<void, GtkSettings*, GParamSpec*> _style_changed_signal;
glib::Signal<void, GtkSettings*, GParamSpec*> _font_changed_signal;
glib::Signal<void, GtkSettings*, GParamSpec*> _dpi_changed_signal;
- guint _gconf_notify_id;
- std::string _theme_name;
- nux::Color _text_color;
+ glib::Signal<void, GSettings*, gchar*> _settings_changed_signal;
};
}
diff --git a/unity-shared/PluginAdapterCompiz.cpp b/unity-shared/PluginAdapterCompiz.cpp
index 567d37f49..057ccea0c 100644
--- a/unity-shared/PluginAdapterCompiz.cpp
+++ b/unity-shared/PluginAdapterCompiz.cpp
@@ -1010,7 +1010,7 @@ PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &acti
}
else
{
- for (it = window_list.begin(); it != window_list.end(); it++)
+ for (it = window_list.begin(); it != window_list.end(); ++it)
{
if (CheckWindowIntersection(region, *it))
{
diff --git a/unity-standalone/StandaloneUnity.cpp b/unity-standalone/StandaloneUnity.cpp
index 80638c7a7..fa0662bed 100644
--- a/unity-standalone/StandaloneUnity.cpp
+++ b/unity-standalone/StandaloneUnity.cpp
@@ -164,7 +164,6 @@ int main(int argc, char **argv)
dash::Style dash_style;
panel::Style panel_style;
- GeisAdapter geis_adapter;
internal::FavoriteStoreGSettings favorite_store;
BackgroundEffectHelper::blur_type = BLUR_NONE;