diff -Nru unity-5.4.0/AUTHORS unity-5.6.0/AUTHORS --- unity-5.4.0/AUTHORS 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/AUTHORS 2012-03-12 09:16:36.000000000 +0000 @@ -1,5 +1,6 @@ 3v1n0 , Marco Trevisan (Treviño) agateau + alanbell@ubuntu.com Alejandro Piñeiro Alexandros Frantzis , Marc Ordinas i Llopis , Jay Taoko Alex Launi @@ -10,16 +11,20 @@ Andrey Logvinov Bilal Akhtar + Brandon Schaefer + Brandon Schaefer Brandon Schaefer Chase Douglas Chris Coulson Christopher James Halse Rogers + Daniel d'Andrada Daniel van Vugt David Barth David Gomes David Planella Didier Roche + Gabor Kelemen Gordon Allott Henri De Veene Jani Monoses @@ -29,9 +34,12 @@ Jason Smith , Andrea Cimitan Jason Smith , Marco Trevisan (Treviño) , Thomi Richards Jason Smith , smspillaz + Jason Smith , Tim Penhey jassmith@gmail.com Jay Ó Broin Jay Taoko + Jeremy Bicha + Lars Uebernickel Loïc Molinari Luke Yelavich Marco Biscaro @@ -41,6 +49,7 @@ Marco Trevisan (Treviño) Marco Trevisan (Treviño) , 3v1n0 Marco Trevisan (Treviño) , Andrea Cimitan + Marco Trevisan (Treviño) , Thomi Richards Marius Gedminas Martin Albisetti Michael Terry @@ -53,6 +62,7 @@ Nico van der Walt Oliver Sauder Omer Akram + Paul Sladen Rafał Cieślak Ricardo Mendoza Robert Carr @@ -73,9 +83,12 @@ Thomi Richards , Thomi Richards Thomi Richards Thomi Richards , Jason Smith + Thomi Richards , Ted Gould Thomi Richards , Thomi Richards Tim Penhey Tim Penhey , Gordon Allott + Tim Penhey , Jason Smith + Tim Penhey , Jay Taoko Ubuntu Unity Merger Victor Eduardo diff -Nru unity-5.4.0/ChangeLog unity-5.6.0/ChangeLog --- unity-5.4.0/ChangeLog 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/ChangeLog 2012-03-12 09:16:36.000000000 +0000 @@ -1,3 +1,1960 @@ +2012-03-12 Thomi Richards + + Fixed the CommandLensSearchTests.test_run_before_refresh test so it passes, and refactored the bamf emulator.. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + Cleaned up command lens, which required removing large quantities of code from the bamf emulator. + +2012-03-12 Thomi Richards + + Updated show desktop autopilot test to use new launcher API.. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + Fixed show_desktop test. + +2012-03-11 Thomi Richards + + Poll for visibility to avoid system differences in tests.. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + Dash emulator ensure_hidden and ensure_visible now poll the dash visibility state to make sure that the dash is visible before they return. After 10 seconds an exception is raised. + +2012-03-11 Thomi Richards + + The problem: + + The Autopilot test case class didn't log anything when calling set_unity_option, which made it hard to diagnose certain failing autopilot tests. + + The solution: + + The log message is now produced both when a compiz option is set, and when it is unset (as part of cleanup). + + Tests: + + Log messages from set_unity_option and set_compiz_option will appear in jenkins test logs. + + UNBLOCK. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + Removed debugging code. + +2012-03-12 Thomi Richards + + Fixed an issue with the autopilot logging infrastructure which meant we were missing some important log messages in certain AP tests. + +2012-03-11 Thomi Richards + + Fix the DashKeyboardFocusTests.test_filterbar_expansion_leaves_kb_focus autopilot test.. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + FilterBar class can now get the correct searchbar. + +2012-03-11 Thomi Richards + + Fixed a timing issue with the dash reveal behavior.. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + Fixed a timing issue with the dash reveal behavior. This was causing the dash to appear and dissapear quickly when hitting Super+a (or any other lens shortcut). Also fixed a memory leak in the DashController. + +2012-03-11 Thomi Richards + + Only attach video capture log to failing tests if the video capture process returned non-0. Video capture logs aren't useful unless the capture process failed for some reason. + + UNBLOCK. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + Only attach video capture log if the capture process returned non-0 exit code. Capture logs aren't that useful anyway. + +2012-03-11 Thomi Richards + + This branch slows down the show desktop tests. + + As far as I can see, they're failing on the jenkins instance due to timing issues. This branch should help resolve that (or at least eliminate that possibility). + + UNBLOCK. Fixes: . Approved by Tim Penhey. + +2012-03-12 Thomi Richards + + Wait a bit longer after initiating show desktop mode. This should help these tests pass on the jenkins instance. + +2012-03-09 Gord Allott + + Fixes the hud not returning focus on return + + UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/934061. Approved by . + +2012-03-09 Gord Allott + + fixes issue with focus on return not being returned to the application + +2012-03-09 Thomi Richards + + This branch adds autopilot tests to verify the fix for bug lp:942042. + + UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/942042. Approved by Tim Penhey. + +2012-03-07 Thomi Richards + + Cleanups. + +2012-03-07 Thomi Richards + + added quicklist test file. + +2012-03-07 Thomi Richards + + added python-xdg to the dependancy list for autopilot. + +2012-03-07 Thomi Richards + + Merged branch with bugfix, test passes. + +2012-02-28 Ted Gould + + Removing a free'ing of the keyfile that was removed + +2012-02-27 Ted Gould + + Drop unused variables + +2012-02-27 Ted Gould + + Attaching Bug + +2012-02-27 Ted Gould + + Libindicator handles the case where we don't find shortcuts without warning now, don't need this if statement. This brings Unity up to compliance with the name changes in the desktop spec + +2012-03-07 Thomi Richards + + Have a failing test. + +2012-03-09 Gord Allott + + fixes issue with hud not returning focus correctly, hack was bad. + + UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/934061. Approved by Gord Allott, Mirco Müller. + +2012-03-05 Gord Allott + + resolved conflict + +2012-03-05 Gord Allott + + remove debugs + +2012-03-02 Gord Allott + + fixed up the bamf wrapper to use desktop files for matching rather than application names, should work on non english locales now + +2012-03-02 Gord Allott + + merged trunk and added ap tests + +2012-02-23 Gord Allott + + remove stupid po changes i hate that + +2012-02-23 Gord Allott + + fixes the hud not giving focus back if you open close the hud fast, no tests + +2012-03-09 Gord Allott + + UNBLOCK + + dummy merge to bump abi. Fixes: . Approved by Didier Roche, Gord Allott. + +2012-03-08 Gord Allott + + corrected HACKING file + +2012-03-08 Jeremy Bicha + + UNBLOCK: set title case for Lock to Launcher/Unlock from Launcher. Fixes: https://bugs.launchpad.net/bugs/949636. Approved by Didier Roche. + +2012-03-07 Jeremy Bicha + + Use title case for "Lock to Launcher"/"Unlock from Launcher" (LP: #949636) + +2012-03-08 Gord Allott + + Includes the google test library in our build system, could use some slimming down after some investigation + + UNBLOCK. Fixes: . Approved by . + +2012-03-08 Gord Allott + + more graceful handling of no gtest + +2012-03-08 Gord Allott + + builds cmake locally using distro supplied cmake - hardcoded to /usr/src/gtest right now + +2012-03-08 Gord Allott + + adds the entire gtest library to our build system as per googles preference + +2012-03-07 Thomi Richards + + Autopilot now logs when it sets a compiz plugin option as part of a test run. Fixed a bug in a log message inside the Mouse class. + + UNBLOCK. Fixes: . Approved by Alex Launi. + +2012-03-08 Thomi Richards + + Fixed a bug in the Mouse class log message. + +2012-03-08 Thomi Richards + + Added logging to code that alters unity settings. + +2012-03-07 Jay Taoko + + * Revert composition character support in Unity. It introduced a regression in Unity. + + UNBLOCK. Fixes: . Approved by Alex Launi. + +2012-03-07 Jay Taoko + + * Revert composition character support in Unity. It introduced a regression in Unity. + +2012-03-06 Marco Trevisan (Treviño) + + UnityScreen: don't ungrab the keyboard on Alt press if switcher is active + + When the Alt+Tab switcher is active is the keyboard must not be ungrabbed or the Alt+Tab cancel action won't work (i.e. escaping from switcher by Escape key). + This fixes a regression introduced recently. I've also included AP tests to check if the cancel action works. + + UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/948227. Approved by Tim Penhey, Thomi Richards. + +2012-03-06 Marco Trevisan (Treviño) + + autopilot, test_switcher.py: added tests for switcher escaping, and lazy invocation + +2012-03-06 Marco Trevisan (Treviño) + + UnityScreen: don't ungrab the keyboard on Alt press if switcher is active + + When the Alt+Tab switcher is active is the keyboard must not be + ungrabbed or the Alt+Tab cancel action won't work (i.e. escaping + from switcher by Escape key). + +2012-03-06 Thomi Richards + + Adds an option to the autopilot script that allows users to pick which folder to store videos of failed tests. This is needed by the jenkins infrastructure. + + UNBLOCK. Fixes: . Approved by Alex Launi. + +2012-03-07 Thomi Richards + + Adds an option to the autopilot script so we can pick where to store videos of failed tests. + +2012-03-06 Thomi Richards + + Add the ability to video capture failing autopilot tests. This feature is enabled with the '-r' switch to the 'autopilot run' command. + + Videos are stored in /tmp/autopilot. This feature is intended for use on the jenkins slave machines. + + UNBLOCK. Fixes: . Approved by Marco Trevisan (Treviño), Tim Penhey. + +2012-03-07 Thomi Richards + + Merged trunk, fixed conflicts. + +2012-03-06 Thomi Richards + + Whitespace fixes. + +2012-03-06 Thomi Richards + + Prevent passing tests from encoding the video file, so we don't suffer the encoding overhead. Removed the dummy test I was using to test this feature. + +2012-03-06 Thomi Richards + + Recording is disabled if the recording app is not present. + +2012-03-06 Thomi Richards + + Video capture works. + +2012-03-06 Jay Taoko + + UNBLOCK + + * Use Gtk im for composition characters. + + Fix bug #944674. Fixes: https://bugs.launchpad.net/bugs/944674. Approved by Neil J. Patel. + +2012-03-06 Jay Taoko + + * Simulate 'ô' in a test. + +2012-03-05 Jay Taoko + + * Merged with trunk. + +2012-03-05 Jay Taoko + + * Fixed errors in tests + +2012-03-05 Jay Taoko + + * Adding Autopilot test for composition characters (â,ô,ĩ,î,ã) typing in the dash. + +2012-03-05 Jay Taoko + + * Fix + +2012-03-05 Jay Taoko + + * Cleanup + +2012-03-05 Jay Taoko + + * Fix: removed bad conditional. + +2012-03-02 Jay Taoko + + * Use Gtk im for composition characters. + +2012-03-02 Jay Taoko + + * Adding support for dead keys. + +2012-03-06 Gord Allott + + UNBLOCK resolves a silly glib issue, glib is C not C++ ;). Fixes: . Approved by Michał Sawicz. + +2012-03-06 Gord Allott + + resolves a 2d build issue + +2012-03-04 Thomi Richards + + Refactor the autopilot launcher emulator to use the new UnityIntrospectableObject class. Launcher tests will now run once per configured monitor.. Fixes: . Approved by Tim Penhey. + +2012-03-05 Thomi Richards + + Fixed typo, made show desktop tests even nicer to read. + +2012-03-05 Thomi Richards + + Added a TODO comment before switcher emulator prompting me to refactor it in another branch. + +2012-03-05 Thomi Richards + + Fixed filtering in get_children_by_type. + +2012-03-05 Thomi Richards + + Imports should be system first, then local, and in alphabetical order. + +2012-03-05 Thomi Richards + + Removed debug logging that was flooding the test logs, fixed showdesktop tests. + +2012-03-05 Thomi Richards + + Fixed a breakage in the hud tests, and fixed a bug in the UnityIntrospectableObject class, where children would be filtered if no filter was applied. + +2012-03-05 Thomi Richards + + Launcher emulator is now split into separate classes: LauncherController, LauncherModel, and Launcher. Updated tests. Launcher tests are now scenario'd depending on the number of monitors configured on the machine. All new-style emulators automatically update their state when someone requests an attribute from unity. + +2012-03-05 Thomi Richards + + Renamed Launcher to LauncherHelper, added LauncherController and Launcher classes. Tests still pass. + +2012-03-04 Thomi Richards + + Modifies the tools/autopilot script to print the total number of tests found. + + UNBLOCK. Fixes: . Approved by Tim Penhey. + +2012-03-03 Thomi Richards + + autopilot script prints total number of tests after listing them. + +2012-03-04 Gord Allott + + Check pixbuf before dereferencing.. Fixes: https://bugs.launchpad.net/bugs/937421. Approved by Tim Penhey. + +2012-02-28 Gord Allott + + add safety check on gdk pixbuf + +2012-03-04 smspillaz + + Fix the Alt+F1 or Alt+F2 sending a ";3P" or ";3Q" to the active windows issue, and also fixes some alt holding showing menus. Compiz-core fix needed for complete fix.. Fixes: https://bugs.launchpad.net/bugs/943194, https://bugs.launchpad.net/bugs/943239, https://bugs.launchpad.net/bugs/943456. Approved by Tim Penhey, Sam Spilsbury, Daniel van Vugt. + +2012-03-02 smspillaz + + Added a small work-a-round for bug 943194 + +2012-03-02 smspillaz + + Always return true whenever an action was handled + +2012-03-04 Jason Smith + + Don't show the switcher when alt+right is pressed. Fixes: https://bugs.launchpad.net/bugs/943902. Approved by Tim Penhey. + +2012-03-04 Jason Smith + + add test + +2012-03-04 Jason Smith + + Fix alt-arrow causing switcher to pop up + +2012-03-02 Daniel d'Andrada + + Fixes lp:942625 + + GestureEngine::FindCompWindow() would enter in an infinite loop if the window passed to it is the root window since its break condition (parent == root) would never be reached as parent would be zero. + + Also includes some other safeguards around the same issue. + + UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/942625. Approved by Marco Trevisan (Treviño). + +2012-03-01 Daniel d'Andrada + + Fixes infinite loop in GestureEngine. lp:942625 + + GestureEngine::FindCompWindow() would enter in an infinite loop + if the window passed to it is the root window since its break condition + (parent == root) would never be reached as parent would be zero. + +2012-03-02 Tim Penhey + + * Fixes the key navigation in the hud. Implemented an "ok" behaviour when navigationg with the key. This will have to be refined with input from design. + + * This branch relies on this nux branch: https://code.launchpad.net/~unity-team/nux/nux.hud-fixes/+merge/95399 + + UNBLOCK + . Fixes: . Approved by Tim Penhey, Gord Allott. + +2012-03-02 Tim Penhey + + Merge trunk. + +2012-03-02 Tim Penhey + + Make the base autopilot test case use the glib runner, and add more hud tests. + +2012-03-02 Tim Penhey + + Expose the HudView through the controller. + +2012-03-02 Tim Penhey + + Remember the selected button, and expose over debug interface. + +2012-03-02 Tim Penhey + + Initialize the view member, and add the view as an introspectable child. + +2012-03-02 Tim Penhey + + Add an unsigned type to the variant wrapper. + +2012-03-01 Jay Taoko + + * Fix: properly updated the app icons when navigating through the Hud buttons + * Fix left and right navigation keys in the text entry + * Cleanup + +2012-03-01 Jay Taoko + + * Cleanup and comments. + +2012-03-01 Jay Taoko + + * Fixes the key navigation in the hud. Implemented an "ok" behaviour when navigationg with the key. This will have to be refined with input from design. + +2012-03-02 Thomi Richards + + Two changes to the key the Keyboard emulator handles multi-key combos: We insert a delay between pressing and releasing individual keys, and always release keys in the reverse order they were pressed. + + UNBLOCK. Fixes: . Approved by Marco Trevisan (Treviño), Alex Launi. + +2012-03-02 Thomi Richards + + Keyboard emulator now inserts a delay between each key in a multi-key press or release action. + +2012-02-29 Marco Trevisan (Treviño) + + The launcher icons can be shown during the Super Tab Launcher switcher. + + For both the shortcut hints and the icons shortcut overlays we use the same policy: + - If they were shown before starting the Super+Tab session, we still show them + - If they were not shown before starting the Super+Tab session, they won't be ever shown + + Plus, if we're pressing a valid unity shortcut key when the Launcher Switcher is active, we should terminate the switcher without doing anything. + + UNBLOCK. Fixes: https://bugs.launchpad.net/bugs/943372, https://bugs.launchpad.net/bugs/943377. Approved by Thomi Richards. + +2012-03-01 Marco Trevisan (Treviño) + + autopilot, more test_launcher.py fixes + +2012-03-01 Marco Trevisan (Treviño) + + Merging with lp:~thomir/unity/fix-ap-test-stability + +2012-03-01 Marco Trevisan (Treviño) + + test_launcher.py: fixed some errors in tests + +2012-02-29 Marco Trevisan (Treviño) + + Merging with lp:~thomir/unity/super+tab-shortcut-fixes-bettertests + +2012-03-01 Thomi Richards + + Split apart launcher tests into many smaller tests. + +2012-02-29 Marco Trevisan (Treviño) + + autopilot, test_launcher.py: Added the switcher starts on zero test + +2012-02-29 Marco Trevisan (Treviño) + + autopilot, test_launcher.py: Fixing the docstrings + + Plus use self.keyboard. + +2012-02-29 Marco Trevisan (Treviño) + + Merging with trunk. + +2012-02-29 Marco Trevisan (Treviño) + + manual-tests: SuperTab, removed the tests now covered by autopilot + +2012-02-29 Marco Trevisan (Treviño) + + autopilot, test_launcher: added Super+Tab cycling tests + +2012-02-29 Marco Trevisan (Treviño) + + autopilot, test_launcher: added tests for bug #943372 and bug #943372 + + We both check the interaction with the launcher icon shortcuts, both + from a visual and logical point of view. + +2012-02-29 Marco Trevisan (Treviño) + + autopilot, launcher emulator: add getters for shortcuts status and keyboard target launcher + +2012-02-29 Marco Trevisan (Treviño) + + LauncherController: add introspection to get the keyboard target launcher + +2012-02-29 Marco Trevisan (Treviño) + + Launcher: add introspect to check if the shortcuts overlays are showing + +2012-02-29 Marco Trevisan (Treviño) + + Merging with trunk + +2012-02-02 Marco Trevisan (Treviño) + + No need to terminate the Key navigation releasing super. + +2012-02-02 Marco Trevisan (Treviño) + + manual-tests: SuperTab, one more test to check the interaction with the unity shortcuts + +2012-02-02 Marco Trevisan (Treviño) + + manual-test: added missing manual test for SuperTab and launcher icons shortcuts interaction + +2012-02-02 Marco Trevisan (Treviño) + + UnityScreen: if a valid shortcut key is pressed and the keynavigation is active, terminate it + +2012-02-02 Marco Trevisan (Treviño) + + LauncherController: don't hide the icon shortcuts on KeyNavigation + + They should be shown if they've been already there when starting the navigation. + +2012-02-29 Thomi Richards + + Two tests are now skipped. These need to be rewritten, but this is a non-trivial test to write. The current tests try and do something that's not supported by unity. + + UNBLOCK. Fixes: . Approved by Tim Penhey. + +2012-03-01 Thomi Richards + + Skipping tests that modify _NET_WM_STATE property after a window has been mapped, since unity doesn't support that. + +2012-02-29 Thomi Richards + + Fixed several stability issues with autopilot tests. + + Specifically: + + * hud tests now make sure the hud is hidden after each test. + * Keyboard and mouse cleanup happens after test tearDown methods are called, so tests can do things like hide the dash and the keyboard cleanup will still work as expected. + * Keyboard cleanup now removes pressed keys from the global list after releasing them (oops!) + * Mouse cleanup now releases pressed mouse buttons as well as moving mouse to a safe position. + * Keyboard and mouse release methods will log a warning when asked to release a key that wasn't pressed, rather than crashing. This shouldn't normally happen, but crashing is never the right thing to do. + * Revealing the dash, or any lens will now clear the old search text by default. + + UNBLOCK. Fixes: . Approved by Marco Trevisan (Treviño). + +2012-03-01 Thomi Richards + + Fixed typo. + +2012-03-01 Thomi Richards + + Remove mouse and keyboard cleanup methods from LoggedTestCase tearDown method. + +2012-03-01 Thomi Richards + + Mouse and keyboard clenup must happen after test tearDown, so add them as a cleanup method. + +2012-03-01 Thomi Richards + + Launcher can have 0 active icons. + +2012-03-01 Thomi Richards + + Fixed type. + +2012-03-01 Thomi Richards + + Log when we start an application. + +2012-03-01 Thomi Richards + + Only count visible launcher icons as potentially active. + +2012-03-01 Thomi Richards + + Hud tests now ensure hud is hidden after each test. + +2012-03-01 Thomi Richards + + Keyboard and Mouse emulators now warn if asked to generate a release even for a key/button that was not pressed, rather than throwing an exception. + +2012-03-01 Thomi Richards + + By default, revealing the dash (or any lens) clears the last search string. + +2012-03-01 Thomi Richards + + Keyboard cleanup method only releases keys once. Mouse cleanup method now releases buttons that were previously pushed. Keyboard and mouse cleanup happens AFTER test cleanup. + +2012-02-29 Tim Penhey + + Uses the new modifier-tap ability in compiz to only show the HUD if someone hasn't used another key with alt (or the associated key).. Fixes: https://bugs.launchpad.net/bugs/923410. Approved by Thomi Richards, Mirco Müller. + +2012-02-29 Tim Penhey + + Oops, an extra } + +2012-02-29 Tim Penhey + + More autopilot tests for the hud. + +2012-02-29 Tim Penhey + + Merge trunk + +2012-02-29 Tim Penhey + + A few more tests. + +2012-02-29 Tim Penhey + + Make the dash only show on tap, and move the 250 into a constant. + +2012-02-29 Tim Penhey + + Bring back the timer. + +2012-02-29 Tim Penhey + + Merge trunk + +2012-02-16 Tim Penhey + + Use the new tap behaviour in compiz to only respond to taps to show the hud. + +2012-02-29 Thomi Richards + + Fix the autopilot setup.py script, so jenkins will run again. + + The run_autopilot script is no longer managed by python distutils. + + UNBLOCK. Fixes: . Approved by . + +2012-02-29 Thomi Richards + + remove scripts from setup.py since we don't need to install that anymore. + +2012-02-28 Thomi Richards + + Fixed a bug in the new autopilot keybindings API which would fail to hold down single-key keybindings.. Fixes: . Approved by Marco Trevisan (Treviño). + +2012-02-29 Thomi Richards + + Fixed bug where single-key keybindings couldn't be held with the new keybindings system. + +2012-02-28 Jason Smith + + Fix the details mode in alt-tab over multiple workspaces and monitors.. Fixes: https://bugs.launchpad.net/bugs/925484, https://bugs.launchpad.net/bugs/933406. Approved by Jason Smith, Thomi Richards. + +2012-02-29 Tim Penhey + + Clean up tests. + +2012-02-29 Tim Penhey + + Add test for bug: 933406 + +2012-02-29 Tim Penhey + + Merge trunk. + +2012-02-22 Jason Smith + + merge fix-alt-tab-progression branch + +2012-02-22 Jason Smith + + dont leak implementation details in switcher controller from switcher model + +2012-02-22 Jason Smith + + merge workspaces fix + +2012-02-28 Thomi Richards + + run_autopilot script now warns sensibly about missing dependancies, allows users to list all tests, and run specific test(s) as well as run the entire suite. Script is now in /tools/autopilot + + UNBLOCK. Fixes: . Approved by Marco Trevisan (Treviño). + +2012-02-29 Thomi Richards + + Renamed run_autopilot to just 'autopilot'. This avoids the situation where we type 'run_autopilot run'. + +2012-02-29 Thomi Richards + + Can now run specific tests. + +2012-02-29 Thomi Richards + + run_autopilot can now list tests as well as run the entire suite. + +2012-02-29 Thomi Richards + + Moved run_autopilot script, made it report missing dependancies, and made it patch sys.path if needed. + +2012-02-28 Tim Penhey + + Fix logic determining icons for alt-tab.. Fixes: . Approved by Thomi Richards. + +2012-02-29 Tim Penhey + + Use the compiz keybinding to minimise. + +2012-02-29 Tim Penhey + + Fix the AP test. + +2012-02-29 Tim Penhey + + The method for determining whether to show only current workspace had the logic wrong. + +2012-02-28 Thomi Richards + + Adds autopilot tests for jason's branch that fixes a bug regarding switching to minimised apps.. Fixes: . Approved by Tim Penhey. + +2012-02-28 Thomi Richards + + Removed print debugging statement. + +2012-02-28 Thomi Richards + + Merged Jason's branch with the fix. Tests now pass. + +2012-02-22 Jason Smith + + fix issue where windows wouldn't unminimize with alt-tab + +2012-02-28 Thomi Richards + + Failing test. + +2012-02-28 Thomi Richards + + Merged multi-monitor alt+tab tests, as I need some of the infrastructure here. + +2012-02-28 Thomi Richards + + Can now launch gedit easily from within tests, and can see if a BamfWindow is focused or not. + +2012-02-28 Thomi Richards + + Added autopilot tests for the switcher "show apps from all workspaces" mode.. Fixes: . Approved by Tim Penhey. + +2012-02-28 Thomi Richards + + Fixed typo in comment. + +2012-02-28 Thomi Richards + + Fixed an error in the swticher tests, and relaxed the keybindings module WRT getting hold and tap parts of a single-key binding. + +2012-02-28 Thomi Richards + + Merged trunk. + +2012-02-28 Thomi Richards + + Updated keybindings for switcher in 'all' mode. + +2012-02-28 Thomi Richards + + Merged branch that stops trunk from crashing. This has been approved, but not merged yet. + +2012-02-28 Thomi Richards + + Merged Jason's branch with the alt-tab-on-all-workspaces fix. + +2012-02-22 Jason Smith + + merge trunk + +2012-02-07 Thomi Richards + + Added small timeout to launcher tests to get them to pass. + +2012-02-06 Jason Smith + + better scaling + +2012-02-06 Jason Smith + + scale reveal pressure by screen size + +2012-02-06 Jason Smith + + re-enable and fix launcher reveal tests + +2012-02-06 Jason Smith + + merge trunk + +2012-02-01 Jason Smith + + implement ctrl+alt+tab to show apps on all viewports + +2012-02-28 Thomi Richards + + Failing AP test - switcher does not show apps from all workspaces. + +2012-02-28 Thomi Richards + + Added test to ensure that switcher only shows icons from current workspace. + +2012-02-28 Thomi Richards + + We now have a basic workspace manager - we can switch between workspaces at will. + +2012-02-28 Thomi Richards + + Added keybindings from the wall plugin. + +2012-02-28 Thomi Richards + + Merged trunk. + +2012-02-28 Thomi Richards + + Added file for workspace manager. + +2012-02-27 Thomi Richards + + Added a manual test to describe how to test bug lp:932365. + + The code has already been merged for this, but it's currently pretty hard to test with autopilot.. Fixes: . Approved by Tim Penhey. + +2012-02-28 Thomi Richards + + Updated manual test - it works with a device icon too. + +2012-02-28 Thomi Richards + + Added manual test for dragging an icon over the trash in the launcher. + +2012-02-27 Tim Penhey + + Code correctness fix. + Fixes potential multi-monitor issue with alt-tab getting settings confused. + + = Problem description = + + We passed an int into a function expecting a bool. This caused the switcher to confuse its settings and act weirdly. + + = The fix = + + We pass a bool now. + + = Test coverage = + + Existing tests cover a degree of this behavior. Currently testing does not cover multi-monitor behavior however (which is where this bug showed up). The fix is obvious and the current code is clearly and demonstrably wrong, to the point of passing the wrong type into a function. + + A manual test was added for the multi-monitor work.. Fixes: . Approved by Thomi Richards. + +2012-02-28 Tim Penhey + + Tweak the test. + +2012-02-28 Tim Penhey + + Add a manual multi-monitor test. + +2012-02-22 Jason Smith + + dont pass an int as a bool, this is obviously wrong (and buggy) + +2012-02-27 Thomi Richards + + Don't call std::list::remove while iterating over the list. + + This bug was found while running a soon-to-be-landed autopilot test.. Fixes: . Approved by Tim Penhey, Jason Smith. + +2012-02-28 Thomi Richards + + Revert rev 2018, since it causes crashes in the switcher. + +2012-02-27 Thomi Richards + + Re-added the switcher tests after they were accidentally lost in a recent merge.. Fixes: . Approved by Jason Smith. + +2012-02-28 Thomi Richards + + Re-added switcher tests that got lost in a merge. + +2012-02-27 Thomi Richards + + Launcher does not reveal if mouse button 1 is held down while pushing against screen edge. Fixes lp:928805.. Fixes: . Approved by Jason Smith. + +2012-02-28 Thomi Richards + + Fixed test name and docstring to match test contents. + +2012-02-28 Thomi Richards + + Merged fix branch. Test passes. + +2012-02-21 Jason Smith + + dont reveal when mouse is down + +2012-02-28 Thomi Richards + + Have a failing test. + +2012-02-28 Thomi Richards + + Moved launcher reveal tests to separate test case class. + +2012-02-27 Thomi Richards + + Change autopilot so instead of hardcoding keybindings, we get them from compiz.. Fixes: . Approved by Tim Penhey. + +2012-02-28 Thomi Richards + + Improved error handling for optional paramter. + +2012-02-28 Thomi Richards + + Added an optional delay parameter to KeybindingsHelper.keybinding so the hud emulator can use it as well. + +2012-02-28 Thomi Richards + + Dash emulator uses KeybindingsHelper class. + +2012-02-28 Thomi Richards + + Launcher emulator uses keybindingsHelper class. + +2012-02-28 Thomi Richards + + Switcher emulator uses KeybindingsHelper class. + +2012-02-28 Thomi Richards + + Switcher emulator changed to use new keybindings system. + +2012-02-28 Thomi Richards + + Hud emulator converted to new keybindings system. + +2012-02-28 Thomi Richards + + Dash emulator converted to use new keybindings system. + +2012-02-28 Thomi Richards + + Finished switching launcher to new keybindings system. Refactored keybindings internals to use a single dictionary. Made it easier to get the hold part and the tap part of a multi-key keybindings (like Alt+Tab) + +2012-02-27 Thomi Richards + + Seems to work... + +2012-02-27 Thomi Richards + + Added keybindings module. About to start adding it to the emulators. + +2012-02-27 Thomi Richards + + Renamed function, changed test to use an import alias so this is easier in the future. + +2012-02-27 Thomi Richards + + Moved to keybindings module. + +2012-02-27 Thomi Richards + + Fixed some whitespace and added one more test, for good luck. + +2012-02-27 Thomi Richards + + All tests pass. + +2012-02-27 Thomi Richards + + Test passes. + +2012-02-27 Thomi Richards + + Failing test: identical keys must not be duplicated in output. + +2012-02-27 Thomi Richards + + TEst Passes. + +2012-02-27 Thomi Richards + + Failing test: -> Ctrl + +2012-02-27 Thomi Richards + + Test passes. + +2012-02-27 Thomi Richards + + Failing test: must strip trailing whitespace from imput string. + +2012-02-27 Thomi Richards + + Test now passes. + +2012-02-27 Thomi Richards + + Failing test - single letter translation. + +2012-02-27 Thomi Richards + + Refactored - translation function should take strings, and return strings. + +2012-02-27 Thomi Richards + + Test now passes. + +2012-02-27 Thomi Richards + + Failing test: only setting instances with type=Key should be allowed. + +2012-02-27 Thomi Richards + + Test passes. + +2012-02-27 Thomi Richards + + Failing test case: must raise TypeError if something other than a compizconfig.Setting is passed in. + +2012-02-27 Thomi Richards + + Added tests for the command lens. + + Specifically: + * Empty string query should hide the results category. + * Non-empty string should show the results category. + * Non-empty string should show results within the results category. + * Hitting enter before the view has had time to refresh should run the correct result. + * Ensure that expanding or collapsing the filter bar does not remove keyboard focus from the searchbar.. Fixes: . Approved by Tim Penhey. + +2012-02-27 Thomi Richards + + Merged trunk. + +2012-02-27 Thomi Richards + + Removed whitespace + +2012-02-24 Thomi Richards + + Removed manual test specs that are now tested automatically. + +2012-02-24 Thomi Richards + + Added test to ensure that keyboard focus is not lost when expanding or collapsing the filter bar. + +2012-02-24 Thomi Richards + + Merged trunk. + +2012-02-24 Thomi Richards + + Added x,y,widtha nd height properties to FilterBar. + +2012-02-23 Thomi Richards + + Merged trunk. + +2012-02-23 Thomi Richards + + Removed unused import. + +2012-02-23 Thomi Richards + + Added test that verifies correct app is run when Enter is pressed before the view can update. + +2012-02-23 Thomi Richards + + Forgot to add the file previously. Added test file with 3 new tests for the command lens. + +2012-02-23 Thomi Richards + + Added ResultsView to introspection tree. + +2012-02-23 Thomi Richards + + Basic results test. + +2012-02-27 Thomi Richards + + Re-enabled launcher reveal tests, and set launcher mode to "autohide" for these tests. + Made it significantly easier to set any compiz/unity option for a single test. These options get automatically un-set when the test finishes.. Fixes: . Approved by Jason Smith. + +2012-02-27 Thomi Richards + + Removed stray pdb statement. + +2012-02-27 Thomi Richards + + Merged trunk. + +2012-02-27 Thomi Richards + + Re-enabled launcher tests. Made it easier to set any unity /compiz option for a single test. + +2012-02-26 Thomi Richards + + Added autopilot tests to verify that the switcher moves to the next switcher icon when Tab is pressed while in details mode. + + Switcher tests for details mode are "scenario"'d so we cover details mode initiated by both '`' and 'Down' keys.. Fixes: . Approved by Tim Penhey. + +2012-02-27 Thomi Richards + + Merged Jason's branch, verified that switcher tests passed. + +2012-02-21 Jason Smith + + make pressing the down arrow not result in window looping + +2012-02-27 Thomi Richards + + Have a failing test case - pressing tab after initiating details mode with the 'Down' arrow does not select next item in the switcher model. + +2012-02-27 Thomi Richards + + Added tests to verify that the switcher starts in normal mode, and that pressing '`' starts details mode. + +2012-02-27 Thomi Richards + + Added test to ensure that hitting down arrow puts switcher into details mode. + +2012-02-26 Tim Penhey + + This branch just refactors some autopilot code. + + Extracts the log handling code for the test into a different base class. + + Also makes bamf and keyboard an attribute of all autopilot tests. + + Adds a helper method to start an app.. Fixes: . Approved by Thomi Richards. + +2012-02-27 Tim Penhey + + Make a Bamf instance a member of they base test case. + +2012-02-27 Tim Penhey + + Extract the logger setup into a base class. + +2012-02-26 Thomi Richards + + Autopilot ibus tests now use new autopilot API for getting dash searchbar object.. Fixes: . Approved by Tim Penhey. + +2012-02-27 Thomi Richards + + Updated ibus tests to match new autopilot API. + +2012-02-26 Thomi Richards + + IBus test suites that don't have the required engine installed will no longer fail with an error on tearDown. Instead, the test will be skipped with a helpful message (as originally intended). + + Also updated the scenario names for the Anthy engine tests.. Fixes: . Approved by Robert Carr. + +2012-02-26 Thomi Richards + + IBus tests suites no longer fail if the ibus engine is missing. The tests will be skipped instead. + +2012-02-26 Thomi Richards + + Forgot to change scenario names in Anthy tests. + +2012-02-25 Jeremy Bicha + + . Fixes: https://bugs.launchpad.net/bugs/926213. Approved by Marco Trevisan (Treviño), Matthew Paul Thomas, Sam Spilsbury. + +2012-02-03 Jeremy Bicha + + Overlay should say "Menu Bar" not "Top Bar" (LP: #926213) + +2012-02-25 Jason Smith + + = The Problem = + Alt-Tab timeouts are too long + + = The Fix = + Make the timeout 75ms instead of 150ms + + = Testing = + The existing switcher autopilot tests cover the expected behaviour alt-tab behaviour.. Fixes: https://bugs.launchpad.net/bugs/888636. Approved by David Barth. + +2012-02-22 Jason Smith + + update alt-tab timeout time to match design requirements + +2012-02-24 Paul Sladen + + No glow updates and associate code/asset removal (LP: #933578). Fixes: https://bugs.launchpad.net/bugs/933578. Approved by Gord Allott, Andrea Cimitan. + +2012-02-24 Paul Sladen + + Remove unused glow assets + +2012-02-24 Paul Sladen + + ABI break: remove now unused Glow variables and helper functions + +2012-02-24 Paul Sladen + + No glow: Dash search: remove Glow texture drawing + (leave functions themselves in order not to break ABI) + +2012-02-24 Alex Launi + + Overrides the Add and RemoveChild methods of Introspectable for more readable code in the ResultView.. Fixes: . Approved by Gord Allott. + +2012-02-24 Alex Launi + + Add IntrospectableWrapper to standalone dash CMakeList + +2012-02-24 Alex Launi + + refactor dash result introspection to use standard introspection api + +2012-02-23 Brandon Schaefer + + Added tests for ibus strings being entered into the dash. Engines tested include Pinyin (Chinese), Anthy (Japanese), and Hangul (Korean).. Fixes: . Approved by Alex Launi. + +2012-02-23 Thomi Richards + + Wait a bit after restarting the ibus bus. + +2012-02-22 Thomi Richards + + Restart ibus bus after setting a new input method engine. + +2012-02-22 Thomi Richards + + Get the engine name right.. again. + +2012-02-22 Thomi Richards + + Japanese engine doesn't put spaces in... + +2012-02-22 Thomi Richards + + Get the engine name right\! + +2012-02-22 Thomi Richards + + Now with tests for the anthi input engine. + +2012-02-22 Thomi Richards + + Hangul input strings append a space to the expected result. Updated tests. + +2012-02-22 Thomi Richards + + Better class docstrings, and encode all unicode in u'\uXXXX' format. + +2012-02-22 Thomi Richards + + Added tests for hangul input engine. + +2012-02-22 Thomi Richards + + I'm an idiot + +2012-02-22 Thomi Richards + + AP tests now use testscenarios. + +2012-02-21 Thomi Richards + + Now activate ibus after loading dash. + +2012-02-21 Thomi Richards + + CLeaned up ibus dash tests. + +2012-02-21 Thomi Richards + + No longer use the global ibus engine. Instead, install engines into the active engine list. + +2012-02-17 Thomi Richards + + Updated ibus tests from Martin's branch. + +2012-02-16 Thomi Richards + + Fixed ibus tests. + +2012-02-16 Thomi Richards + + Remember to add new files. + +2012-02-16 Thomi Richards + + Added ibus tests. + +2012-02-23 Andrea Cimitan + + New asses from design, looks nicer!. Fixes: . Approved by Marco Trevisan (Treviño), Andrea Cimitan. + +2012-02-23 Andrea Cimitan + + New BFB shine + +2012-02-23 Lars Uebernickel + + = Problem description = + + In precise, print status is shown via an indicator instead of using system-config-printer's applet (which is whitelisted in Unity right now). + + = The fix = + + This patch makes sure the print indicator is shown at the correct position in the panel and removes the whitelist entry for 'scp-dbus-service'. + + = Test coverage = + + None, trivial change. + . Fixes: . Approved by Gord Allott. + +2012-02-22 Lars Uebernickel + + Add indicator-printers support and remove whitelist entry of old printer applet + +2012-02-23 Jason Smith + + = The Problem = + + Slide animation wasn't smooth when dragging icons around ont he launcher + + = The Fix = + + Make the animation take into account the parents geometry offset when calculating the animation + + = Testing = + + None. Fixes: . Approved by Gord Allott. + +2012-02-22 Jason Smith + + Fix calculation of slide animation to account for parent geometry + +2012-02-23 Didier Roche + + Change F10 to open the first menu of top panel to Alt + F10 as per design (LP: #878492). Fixes: https://bugs.launchpad.net/bugs/878492. Approved by Tim Penhey. + +2012-02-23 Didier Roche + + Change F10 to open the first menu of top panel to Alt + F10 as per design (LP: #878492) + +2012-02-23 Brandon Schaefer + + + * Using signal TextEntryIM::text_changed. + +2012-02-22 Brandon Schaefer + + = Problem description = + + Failed to compile with the new nux as the signal for text_changed had changed. + + = The fix = + + Rename the signal + + = Test coverage = + + Clean compile.. Fixes: . Approved by Mirco Müller. + +2012-02-23 Tim Penhey + + New signals. + +2012-02-22 Thomi Richards + + Split the dash keynav test into several smaller tests that test one specific thing. + + Also removed an unused import from the dash emulator.. Fixes: . Approved by Tim Penhey. + +2012-02-23 Thomi Richards + + Split several dash tests into multiple, smaller tests. + +2012-02-22 Thomi Richards + + Refactored the autopilot dash emulator to use multiple classes instead of one massive one. + + Also removed several instances where XPath queries were being hard-coded. Updated tests to use new class structure.. Fixes: . Approved by . + +2012-02-23 Thomi Richards + + Refactoring finished. + +2012-02-23 Thomi Richards + + Refactor finished, all tests pass. + +2012-02-23 Thomi Richards + + Refactor half done. All tests pass. + +2012-02-22 Gord Allott + + Makes bghash only change the gsettings key once per wallpaper change, instead of on every frame it transitions to the next wallpaper. + + No test as gsettings is not sandboxable and this change is *only* gsettings key change related.. Fixes: . Approved by Mirco Müller. + +2012-02-22 Gord Allott + + makes bghash only change the gsettings setting where it makes sense instead of clobbering it every frame of animation + +2012-02-22 Gord Allott + + Enables -Werror. Fixes: . Approved by Michal Hruby. + +2012-02-22 Gord Allott + + re-enables -Werror - should never have been turned off + +2012-02-22 Michal Hruby + + Splits out the .lens file reading out of FilesystemLenses class and exposes it in LensDirectoryReader, this allows the BFB to directly check the lens files from the disk and we don't start up the lenses as soon as unity starts. + + Un-reverts the revert done in r2001. + + The extremely complex part for unity-2d is @ https://code.launchpad.net/~mhr3/unity-2d/default-filesystemlenses-constructor/+merge/94102 + + Covered by existing tests.. Fixes: https://bugs.launchpad.net/bugs/929506. Approved by Gord Allott. + +2012-02-22 Michal Hruby + + Unrevert the revert of r2001 + +2012-02-21 Jason Smith + + Restores accidentally commented code. This should have been uncommented before merge previously, but was missed. Fixes bug where launcher didn't properly reflect window states on initial startup. Fixes: . Approved by Tim Penhey. + +2012-02-21 Jason Smith + + Check launcher icon state on creation again. Was accidentally left commented when porting to AbstractLauncherIcon::Ptr in rev 1948.8.1 + +2012-02-21 Thomi Richards + + Clean up result wrappers when resultview exits.. Fixes: . Approved by Tim Penhey. + +2012-02-22 Thomi Richards + + Clean up wrappers on destruction of ResultsView. + +2012-02-22 Thomi Richards + + Clean up wrappers on destruction of ResultsView. + +2012-02-21 Thomi Richards + + Make results from dash searches introspectable in autopilot.. Fixes: . Approved by Alex Launi. + +2012-02-22 Thomi Richards + + Don't take comment from Result. + +2012-02-22 Thomi Richards + + Merged trunk. + +2012-02-22 Thomi Richards + + Don't need '.c_str()' when adding std::strings to the variant::BuilderWrapper class. + +2012-02-21 Thomi Richards + + Merged trunk. + +2012-02-21 Thomi Richards + + Committing before merging trunk to get NString removal code. + +2012-02-21 Thomi Richards + + Merged trunk. + +2012-02-21 Thomi Richards + + Unity now wraps dash results during introspection. + +2012-02-21 Thomi Richards + + LensView now adds a couple of useful properties. + +2012-02-21 Thomi Richards + + ResultView added to introspection tree. + +2012-02-21 Thomi Richards + + Added ResultView class. + +2012-02-21 Thomi Richards + + Revert revision 1999 since it breaks unity2d.. Fixes: . Approved by Jay Taoko. + +2012-02-22 Thomi Richards + + Revert revision 1999 since it breaks unity2d. + +2012-02-21 Gord Allott + + Adds a gdbus proxy test suite. Fixes: . Approved by Michal Hruby. + +2012-02-21 Gord Allott + + and the other sources + +2012-02-21 Gord Allott + + remove the source, oops + +2012-02-21 Gord Allott + + fix up the tests so they pass + +2012-02-21 Gord Allott + + adds a gdbus test and service + +2012-02-21 Michal Hruby + + Splits out the .lens file reading out of FilesystemLenses class and exposes it in LensDirectoryReader, this allows the BFB to directly check the lens files from the disk and we don't start up the lenses as soon as unity starts.. Fixes: https://bugs.launchpad.net/bugs/929506. Approved by Gord Allott. + +2012-02-21 Michal Hruby + + Default setting for Visible key is true + +2012-02-21 Michal Hruby + + Move LensFileData struct into LensDirectoryReader + +2012-02-21 Michal Hruby + + Merge trunk + +2012-02-21 Michal Hruby + + Refactor FilesystemLenses class + +2012-02-21 Andrea Azzarone + + Depends on https://code.launchpad.net/~andyrock/nux/focus-on-enter + + Implements dash key navigation. + + known issues: + - shift + tab doesn't work well because of this: bug 931393. Fixes: https://bugs.launchpad.net/bugs/817436, https://bugs.launchpad.net/bugs/844033, https://bugs.launchpad.net/bugs/891648. Approved by John Lea, Tim Penhey. + +2012-02-21 Andrea Azzarone + + Focus on enter for rating filter too. + +2012-02-21 Andrea Azzarone + + Merge trunk. + +2012-02-21 Andrea Azzarone + + Implement rating filter key navigation. + +2012-02-21 Andrea Azzarone + + Fix AP test. + +2012-02-21 Andrea Azzarone + + Add an AP test for Tab. + +2012-02-20 Andrea Azzarone + + Add a partial test for Tab. Need to commit to merge a branch. + +2012-02-20 Andrea Azzarone + + Add an autopilot test for the ctlr + tab. + +2012-02-20 Andrea Azzarone + + Merge trunk. + +2012-02-20 Andrea Azzarone + + Merge trunk + +2012-02-17 Andrea Azzarone + + Fix focus on enter. + +2012-02-17 Andrea Azzarone + + Merge trunk. + +2012-02-17 Andrea Azzarone + + Focus on mouse enter. + +2012-02-14 Andrea Azzarone + + Don't focus on mouse down. + +2012-02-14 Andrea Azzarone + + Merge trunk. + +2012-02-14 Andrea Azzarone + + Ops. + +2012-02-14 Andrea Azzarone + + Fix backward key navigation. + +2012-02-13 Andrea Azzarone + + Fix. + +2012-02-13 Andrea Azzarone + + Merge trunk. + +2012-02-13 Andrea Azzarone + + Fix. + +2012-02-13 Andrea Azzarone + + Cltr+tab and tab key navigation. + +2012-02-13 Andrea Azzarone + + Merge trunk. + +2012-02-13 Andrea Azzarone + + Implements filters key navigation. + +2012-02-13 Andrea Azzarone + + Merge trunk. + +2012-02-13 Andrea Azzarone + + Merge trunk. Make "Filter results focusable". Fix ResultGridView key navigation. + +2012-02-21 Jason Smith + + fix bug where icons would jump around when resorting over an icon not in their own group + + Launcher still lacks any significant method of being tested for these kinds of changes. Significant refactoring is still required.. Fixes: https://bugs.launchpad.net/bugs/932365. Approved by Thomi Richards. + +2012-02-21 Jason Smith + + make sure we dont re-sort icons that are of different types as they wont be allowed to mingle anyhow + +2012-02-21 Jason Smith + + Fixes an issue where the launcher icons would seem to "dance" back and forth when re-ordering by dragging. Fixes: . Approved by Sam Spilsbury. + +2012-02-21 Jason Smith + + fix re-order thrashing + +2012-02-21 Thomi Richards + + Removed calls to g_variant_builder_add in favor of using the variant::BuilderWrapper class in UnityCore.. Fixes: . Approved by Jason Smith. + +2012-02-21 Thomi Richards + + Forgot to add #include. + +2012-02-21 Thomi Richards + + Merged trunk, fixed one place with g_variant calls. + +2012-02-21 Thomi Richards + + Removed a bunch of g_variant_builder_add calls. + +2012-02-20 Jason Smith + + Ensures that icons start from the proper location when dragging. Fixes: . Approved by Tim Penhey. + +2012-02-20 Jason Smith + + make drag icons start from the pointer location properly + +2012-02-20 Thomi Richards + + LauncherIcon, StaticCairoText and Tooltip classes now use std::string rather than nux::NString.. Fixes: . Approved by Tim Penhey, Jason Smith. + +2012-02-21 Thomi Richards + + Const keyword reordering. + +2012-02-21 Thomi Richards + + Cleanups. + +2012-02-21 Thomi Richards + + SCT takes a std::string in it's ctor now. + +2012-02-21 Thomi Richards + + Removed NString from StaticCairoText, Tooltip and LauncherIcon classes. + +2012-02-21 Thomi Richards + + Removed NString from QuicklistView. + +2012-02-20 Thomi Richards + + Fixed a warning about member variable order in initialiser list in PanelMenuView class.. Fixes: . Approved by Tim Penhey. + +2012-02-21 Thomi Richards + + Fix a warning about bad order in initialiser list in PanelMenuView class. + +2012-02-20 Gabor Kelemen + + . Fixes: https://bugs.launchpad.net/bugs/930510. Approved by Tim Penhey. + +2012-02-18 Gabor Kelemen + + Mark some forgotten strings for translation. LP: 930510 + +2012-02-20 Thomi Richards + + Update the unity introspection tree debug script to use the new autopilot API.. Fixes: . Approved by Tim Penhey, Andrea Azzarone. + +2012-02-20 Thomi Richards + + Updated unity introspection tree display script to use new autopilot API. + +2012-02-20 Mirco Müller + + Fixed artwork-assets to be correctly cropped to intended size. Replaced procedural vector drawing methods with newly added artwork-textures. Updated sizes and margins to adapt to new artwork. Added FIXME-hint for keyboard-navigation highlight implementation. + + Also see size/gap verification in gimp for screenshot of newly implemented rating-stars: + http://people.canonical.com/~mmueller/fix-924884.png. Fixes: https://bugs.launchpad.net/bugs/924884. Approved by Andrea Azzarone, Andrea Cimitan. + +2012-02-20 Mirco Müller + + Added new artwork-assets for rating-stars. Replace old procedural vector-drawing with new textures. Adjusted sizes and gaps/margins. Added fixme-hint for later keyboard-navigation highlight implementation. + +2012-02-20 Andrea Azzarone + + Update the design for the lensbar focus highlight. + + Mockup: https://chinstrap.canonical.com/~sabdfl/12_04/desktop_and_netbook/dash/tweaks_dash.png + Branch: http://ubuntuone.com/4Y6KetbWzMYcofmTbftCih. Fixes: . Approved by Andrea Cimitan, John Lea, Xi Zhu. + +2012-02-09 Andrea Azzarone + + Fixes. + +2012-02-08 Andrea Azzarone + + Update AGAIN the design for the lensbar focus highlight. + Reintroduce the triangle that indicates the active lens too. + +2012-02-20 Michal Hruby + + Makes sure we properly emit the connected signal.. Fixes: . Approved by Gord Allott. + +2012-02-20 Michal Hruby + + Fix incorrect proxy state + +2012-02-20 alanbell@ubuntu.com + + the dependency on the largedesktop feature which can be provided by wall or cube is a nice idea, but in practice this means that when changing from one to the other the unity plugin gets unloaded half way through which breaks peoples desktops. Without the dependency the transition works fine.. Fixes: . Approved by Didier Roche. + +2012-02-18 alanbell@ubuntu.com + + dropped dependency on largedesktop feature, it doesn't need it except for the switcher and users changing to cube from wall end up deselecting unity, this makes it safer. + +2012-02-20 Thomi Richards + + Add an autopilot test to verify that multiple Hud reveals don't leave the launcher in a bad state.. Fixes: . Approved by Tim Penhey. + +2012-02-20 Thomi Richards + + Removed unused import. + +2012-02-20 Thomi Richards + + Wrote failing test for hud multiple-reveals. + +2012-02-19 Jay Taoko + + * Triggers Unity build following Nux abi changes.. Fixes: . Approved by Jay Taoko. + +2012-02-19 Jay Taoko + + + * Triggers Unity build following Nux abi changes. + +2012-02-17 Didier Roche + + Release\ 5.4.0 + 2012-02-17 Marco Trevisan (Treviño) Fix crash on missing dash WindowButton files diff -Nru unity-5.4.0/CMakeLists.txt unity-5.6.0/CMakeLists.txt --- unity-5.4.0/CMakeLists.txt 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/CMakeLists.txt 2012-03-12 09:16:36.000000000 +0000 @@ -8,7 +8,7 @@ # set (PROJECT_NAME "unity") set (UNITY_MAJOR 5) -set (UNITY_MINOR 4) +set (UNITY_MINOR 6) set (UNITY_MICRO 0) set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}") set (UNITY_API_VERSION "5.0") @@ -113,7 +113,7 @@ SET (BOOT_LOGGER_FLAG "-DENABLE_LOGGER") endif (BOOT_LOGGER) -SET (MAINTAINER_CFLAGS "-Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self -Warray-bounds") +SET (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self -Warray-bounds") option (DISABLE_MAINTAINER_CFLAGS "Disable maintainer CFlags" OFF) if (DISABLE_MAINTAINER_CFLAGS) SET (MAINTAINER_CFLAGS "") @@ -132,6 +132,13 @@ # subdirs add_subdirectory(doc) + +find_path(GTEST_INCLUDE_DIR gtest/gtest.h) +if (GTEST_INCLUDE_DIR) + #FIXME - hardcoded is bad! + add_subdirectory(/usr/src/gtest gtest) +endif(GTEST_INCLUDE_DIR) + add_subdirectory(services) add_subdirectory(tests) add_subdirectory(tools) diff -Nru unity-5.4.0/com.canonical.Unity.gschema.xml unity-5.6.0/com.canonical.Unity.gschema.xml --- unity-5.4.0/com.canonical.Unity.gschema.xml 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/com.canonical.Unity.gschema.xml 2012-03-12 09:16:36.000000000 +0000 @@ -40,7 +40,7 @@ - [ 'JavaEmbeddedFrame', 'Wine', 'scp-dbus-service', 'Update-notifier' ] + [ 'JavaEmbeddedFrame', 'Wine', 'Update-notifier' ] List of client names, resource classes or wm classes to allow in the Panel's systray implementation. "" (empty) will not allow any tray icons, "all" will allow all tray icons, otherwise there will be an attempt to match each icon to a value here. diff -Nru unity-5.4.0/debian/changelog unity-5.6.0/debian/changelog --- unity-5.4.0/debian/changelog 2012-03-12 12:48:29.000000000 +0000 +++ unity-5.6.0/debian/changelog 2012-03-12 12:48:30.000000000 +0000 @@ -1,3 +1,80 @@ +unity (5.6.0-0ubuntu1) precise; urgency=low + + * New upstream release. + - compiz crashed with SIGSEGV in g_type_check_instance_cast() + (LP: #862972) + - compiz crashed with SIGABRT in __gnu_cxx::__verbose_terminate_handler() + (LP: #926793) + - compiz crashed with SIGSEGV in gdk_pixbuf_get_width() (LP: #937421) + - Unity causes ibus to not work correctly (spaces incorrectly placed) + (LP: #880876) + - Dash - update Dash keyboard shortcuts so the 'CTRL + TAB' switches + between Lenses and 'TAB' by itself moves the focus between categories + (LP: #891648) + - HUD - closing a window with + opens the hud (LP: #923410) + - unity-applications-daemon crashed with SIGSEGV in + dee_sequence_model_free_row() (LP: #916356) + - Launcher, Window Management - Launcher reveal should not be triggered + when dragging a window (LP: #928805) + - lenses are loaded on start, should be lazy loaded (LP: #929506) + - Trash icon jumps about when trying to drag an icon onto it (LP: #932365) + - HUD loses keypresses for the first second after opening (LP: #932906) + - HUD doesn't give the focus back to the active application after dash/hud + use (LP: #934061) + - Launcher - unpinned apps show with empty pips in the launcher as if they + exist on another workspace (LP: #937898) + - Unity Dash should support Keywords parameter in .desktop (formerly X + -GNOME-Keywords or X-AppInstall-Keywords) (LP: #941231) + - Support FD.o Desktop Actions spec (LP: #942042) + - Unity hangs when touching my touchpad/trackpad (LP: #942625) + - [regression] Pressing alt doesn't show the menu title bar in top panel + (LP: #943194) + - Alt + F (or other mnemonic) doesn't work in gnome-terminal (LP: #943239) + - [unity 5.6] Using Alt+F1 or Alt+F2 sends a ";3P" or ";3Q" to the active + windows (LP: #943456) + - [unity 5.6] holding alt and pressing a direction opens the alt-tab list + in a buggy way (LP: #943902) + - [unity-5.6] can't enter accents (^o->) in the dash since recent updates + (LP: #944674) + - Dash - Keyboard navigation for search filters is broken (LP: #844033) + - Dash - If mouse highlights one icon in grid, keyboard navigation + highlights another, so there are 2 highlighted icons (LP: #817436) + - Alt+Tab default delay of 150ms is too long (LP: #888636) + - Keyboard shortcut - F10 shortcut is used to show menu and this is wrong + (LP: #878492) + - Dash - Currently the app lens doesn't show applications that are + available for purchase (LP: #916121) + - Chromium is running, but not showing in launcher or alt-tab. + (LP: #918474) + - Dash - Different states of rating stars, and dimensions (LP: #924884) + - alt-tab confused by a multiple instances of an application on different + workspaces (LP: #925484) + - Launcher - Icons are not colorized properly (LP: #930949) + - Remove glow from Alt-tab edge and Search Field image assets + (LP: #933578) + - "Left Mouse Drag" and "Middle Mouse Drag" should be translatable + (LP: #930510) + - Launcher switcher should be terminated if a launcher icon keybinding is + pressed (LP: #943377) + - dash home lens does not include recent files... (LP: #946980) + - Alt-tab switcher can't be terminated by Escape key (LP: #948227) + - Overlay should refer to "Menu Bar" not "Top Bar" (LP: #926213) + - alt-tab is showing preview even if you have just one instance + (LP: #933406) + - When "Bias alt-tab (...)" is switched on, alt+tab and ctrl+alt+tab are + swapped (LP: #942677) + - Numbers on Launcher icons sticking (LP: #942359) + - The launcher icons shortcuts can be shown during the Super Tab Launcher + switcher. (LP: #943372) + - Use title case capitalization "Lock to Launcher" & "Unlock from + Launcher" (LP: #949636) + * debian/control: + - bump compiz-dev and libcompizconfig0-dev build-dep for ABI break + - bump libnux-2.0-dev build-dep for ABI break + - bump libbamf req. for new API + + -- Didier Roche Mon, 12 Mar 2012 12:14:28 +0100 + unity (5.4.0-0ubuntu2) precise; urgency=low * 01_hardcode_new_default_in_hardcoded_values.patch: diff -Nru unity-5.4.0/debian/control unity-5.6.0/debian/control --- unity-5.4.0/debian/control 2012-03-12 12:48:29.000000000 +0000 +++ unity-5.6.0/debian/control 2012-03-12 12:48:30.000000000 +0000 @@ -11,7 +11,7 @@ libsigc++-2.0-dev, libgee-dev (>= 0.5.0), libunique-dev, - libbamf3-dev (>= 0.2.106), + libbamf3-dev (>= 0.2.112), gsettings-desktop-schemas-dev, libgconf2-dev, libglib2.0-dev (>= 2.22.2-0ubuntu1wncksync3), @@ -25,9 +25,9 @@ libunity-misc-dev (>= 4.0.4), libutouch-grail-dev (>= 1.0.20), libxcb-icccm4-dev, - libnux-2.0-dev (>= 2.4.0), - compiz-dev (>= 1:0.9.7.0~bzr2995-0ubuntu2), - libcompizconfig0-dev (>= 0.9.5.94-0ubuntu3~), + libnux-2.0-dev (>= 2.6.0), + compiz-dev (>= 1:0.9.7.0+bzr3035), + libcompizconfig0-dev (>= 0.9.7.0~bzr428-0ubuntu4~), xsltproc, libboost1.46-dev, libboost-serialization1.46-dev, diff -Nru unity-5.4.0/HACKING unity-5.6.0/HACKING --- unity-5.4.0/HACKING 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/HACKING 2012-03-12 09:16:36.000000000 +0000 @@ -1,5 +1,5 @@ If you want to hack on unity you need the following packages - - nux + - libnux-2.0 - libbamf - libdee - gio-2.0 diff -Nru unity-5.4.0/manual-tests/Dash.txt unity-5.6.0/manual-tests/Dash.txt --- unity-5.4.0/manual-tests/Dash.txt 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/manual-tests/Dash.txt 2012-03-12 09:16:36.000000000 +0000 @@ -1,32 +1,16 @@ -Dash search ------------ -This test makes sure that the right command is run when you search -using the dash. (see lp:856205) - -#. Press Alt+F2 -#. Press 'g'. Make sure you see some command name (like gcc) -#. Quickly type 'edit' - so you'd run 'gedit'. - -Outcome - The dash disappears, and gedit is run. If nothing happens or the first - command is run (in this case gcc), this test failed. - - Mouse down and search bar focus ------------------------------- This test makes sure that the search bar doesn't lose the focus clicking into am emtpy area (or into a filter button). - + #. Open the app lens #. Expand the filter bar -#. Make sure the dash has the focus -#. The cursor should blink #. Click between a filter expander and the All Button (for example between Type > and All) or into a filter button. Outcome The cursor is still blinking. - + Category headers focus ---------------------- @@ -38,8 +22,8 @@ Outcome The category should expand/collaspe and the search bar still has the focus. - - + + Drag and drop dash icons ---------------------------- This test makes sure that. @@ -67,15 +51,3 @@ The text previously selected is pasted on the search bar at mouse pointer position, if the operation is repeated the text is inserted where the mouse pointer is. - -Dash SearchBar IBus Focus ------------------------------- -This test shows that the IBus is getting focus when it gets keyboard focus. - -#. Open the Dash -#. Press Ctrl + Space to activate ibus -#. Type "abc1" - -Outcome - Typing "abc1" while ibus is focused will produce 阿布从 . If the ibus is not focused - then "abc1" will be the outcome (This is incorrect behavior). diff -Nru unity-5.4.0/manual-tests/Launcher.txt unity-5.6.0/manual-tests/Launcher.txt --- unity-5.4.0/manual-tests/Launcher.txt 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/manual-tests/Launcher.txt 2012-03-12 09:16:36.000000000 +0000 @@ -84,3 +84,19 @@ Outcome No matter what option you click will exit keynav mode. +Drag Icons to Trash +------------------- + +This test verifies that dragging icons to the trash removes them from the +launcher, and that the animation is smooth. + +#. Move mouse pointer over an application or device icon (not BFB, Workspace switcher or trash) +#. Hold mouse button down until icon attached to moue pointer (1 Second or so) +#. With the mouse button held down, drag the icon over the trash icon. +#. Release the mouse pointer. + +Outcome: + * The icon should be removed from the launcher. + * The trash can icon should remain stationary during the entire operation. + * The operation should NOT LOOK LIKE THIS: https://bugs.launchpad.net/unity/+bug/932365/+attachment/2739868/+files/out-2.ogv + diff -Nru unity-5.4.0/manual-tests/SuperTab.txt unity-5.6.0/manual-tests/SuperTab.txt --- unity-5.4.0/manual-tests/SuperTab.txt 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/manual-tests/SuperTab.txt 2012-03-12 09:16:36.000000000 +0000 @@ -21,6 +21,7 @@ when the Super+Tab is activated and the icons should be expanded when neeeded. + Super Tab switcher interaction with Shortcut Hint ------------------------------------------------- This test shows the interaction between the shortcut hint overlay and the @@ -43,26 +44,6 @@ Super+Tab switcher is initialized and the shortcut hint overlay is not shown even keeping only super pressed until releasing it and pressing it again. -Super Tab switcher cycling over launcher applications ------------------------------------------------------ -This test shows how the Super+Tab switcher should use a circular selection. - -#. Start with a clean screen -#. Press Super+Tab multiple times to make the selection to reach the bottom - launcher icon -#. Press Tab again - -Outcome: - The selection should go from the last launcher icon, to the first one. - The launcher view should be expanded/moved if needed to show the highlighted item. - -#. Start with a clean screen -#. Press Super+Tab once to make the first launcher icon to highlight -#. Press Shift+Tab while keeping Super pressed - -Outcome: - The selection should go from the first launcher icon to the last one. - The launcher view should be expanded/moved if needed to show the highlighted item. Escaping from Super Tab switcher -------------------------------- diff -Nru unity-5.4.0/manual-tests/Switcher.txt unity-5.6.0/manual-tests/Switcher.txt --- unity-5.4.0/manual-tests/Switcher.txt 1970-01-01 00:00:00.000000000 +0000 +++ unity-5.6.0/manual-tests/Switcher.txt 2012-03-12 09:16:36.000000000 +0000 @@ -0,0 +1,18 @@ +Multi-monitor Alt-Tab +--------------------- +This test only applies for multiple monitor. +App names here are an example, any apps will do. + +#. Start with no apps open (or at least remember what is open where) +#. Start terminal on workspace 1 +#. Start firefox on workspace 2 +#. Move to workspace 2 + +Now do the following on both monitors + +#. Hold Alt, and press Tab, hold and observe +#. Release Alt. + +Outcomes + While alt is held, Firefox should appear in the tab list, and + terminal should not Binary files /tmp/zoEaEE7dkq/unity-5.4.0/plugins/unityshell/resources/search_close_glow.png and /tmp/bIYs6KiZDh/unity-5.6.0/plugins/unityshell/resources/search_close_glow.png differ Binary files /tmp/zoEaEE7dkq/unity-5.4.0/plugins/unityshell/resources/search_spin_glow.png and /tmp/bIYs6KiZDh/unity-5.6.0/plugins/unityshell/resources/search_spin_glow.png differ Binary files /tmp/zoEaEE7dkq/unity-5.4.0/plugins/unityshell/resources/squircle_shine_54.png and /tmp/bIYs6KiZDh/unity-5.6.0/plugins/unityshell/resources/squircle_shine_54.png differ Binary files /tmp/zoEaEE7dkq/unity-5.4.0/plugins/unityshell/resources/star_deselected.png and /tmp/bIYs6KiZDh/unity-5.6.0/plugins/unityshell/resources/star_deselected.png differ Binary files /tmp/zoEaEE7dkq/unity-5.4.0/plugins/unityshell/resources/star_highlight.png and /tmp/bIYs6KiZDh/unity-5.6.0/plugins/unityshell/resources/star_highlight.png differ Binary files /tmp/zoEaEE7dkq/unity-5.4.0/plugins/unityshell/resources/star_selected.png and /tmp/bIYs6KiZDh/unity-5.6.0/plugins/unityshell/resources/star_selected.png differ diff -Nru unity-5.4.0/plugins/unityshell/src/AggregateMonitor.cpp unity-5.6.0/plugins/unityshell/src/AggregateMonitor.cpp --- unity-5.4.0/plugins/unityshell/src/AggregateMonitor.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/AggregateMonitor.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -19,6 +19,7 @@ #include "AggregateMonitor.h" #include "ElapsedTimeMonitor.h" +#include namespace unity { namespace performance { @@ -49,11 +50,12 @@ void AggregateMonitor::StopMonitor(GVariantBuilder* builder) { + variant::BuilderWrapper wrapper(builder); for (std::list::iterator iter = _monitors.begin(), end = _monitors.end(); iter != end; ++iter) { Monitor* monitor = *iter; - g_variant_builder_add(builder, "{sv}", monitor->GetName().c_str(), monitor->Stop()); + wrapper.add(monitor->GetName().c_str(), monitor->Stop()); } } diff -Nru unity-5.4.0/plugins/unityshell/src/BamfLauncherIcon.cpp unity-5.6.0/plugins/unityshell/src/BamfLauncherIcon.cpp --- unity-5.4.0/plugins/unityshell/src/BamfLauncherIcon.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/BamfLauncherIcon.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -20,6 +20,7 @@ #include #include +#include #include "BamfLauncherIcon.h" #include "FavoriteStore.h" @@ -122,7 +123,7 @@ WindowManager::Default()->compiz_screen_viewport_switch_ended.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState)); WindowManager::Default()->terminate_expo.connect(sigc::mem_fun(this, &BamfLauncherIcon::EnsureWindowState)); - //EnsureWindowState(); + EnsureWindowState(); UpdateMenus(); UpdateDesktopFile(); @@ -440,10 +441,7 @@ { LauncherIcon::AddProperties(builder); - g_variant_builder_add(builder, "{sv}", "desktop-file", g_variant_new_string(DesktopFile().c_str())); - GList* children, *l; - children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr())); GVariant* xids[(int) g_list_length(children)]; @@ -457,8 +455,11 @@ xids[i++] = g_variant_new_uint32(xid); } g_list_free(children); - g_variant_builder_add(builder, "{sv}", "xids", g_variant_new_array(G_VARIANT_TYPE_UINT32, xids, i)); - g_variant_builder_add(builder, "{sv}", "sticky", g_variant_new_boolean(IsSticky())); + + variant::BuilderWrapper(builder) + .add("desktop-file", DesktopFile()) + .add("xids", g_variant_new_array(G_VARIANT_TYPE_UINT32, xids, i)) + .add("sticky", IsSticky()); } bool BamfLauncherIcon::OwnsWindow(Window xid) const @@ -662,64 +663,50 @@ void BamfLauncherIcon::UpdateDesktopQuickList() { - GKeyFile* keyfile; - glib::Error error; std::string const& desktop_file = DesktopFile(); if (desktop_file.empty()) return; - // check that we have the X-Ayatana-Desktop-Shortcuts flag - // not sure if we should do this or if libindicator should shut up - // and not report errors when it can't find the key. - // so FIXME when ted is around - keyfile = g_key_file_new(); - g_key_file_load_from_file(keyfile, desktop_file.c_str(), G_KEY_FILE_NONE, &error); - - if (error) - { - g_warning("Could not load desktop file for: %s", desktop_file.c_str()); - g_key_file_free(keyfile); - return; - } - - if (g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, - "X-Ayatana-Desktop-Shortcuts", nullptr)) - { - for (GList *l = dbusmenu_menuitem_get_children(_menu_desktop_shortcuts); l; l = l->next) - _gsignals.Disconnect(l->data, "item-activated"); - - _menu_desktop_shortcuts = dbusmenu_menuitem_new(); - dbusmenu_menuitem_set_root(_menu_desktop_shortcuts, TRUE); + for (GList *l = dbusmenu_menuitem_get_children(_menu_desktop_shortcuts); l; l = l->next) + _gsignals.Disconnect(l->data, "item-activated"); - _desktop_shortcuts = indicator_desktop_shortcuts_new(desktop_file.c_str(), "Unity"); - const gchar** nicks = indicator_desktop_shortcuts_get_nicks(_desktop_shortcuts); - - int index = 0; - while (nicks[index]) - { - glib::String name(indicator_desktop_shortcuts_nick_get_name(_desktop_shortcuts, - nicks[index])); - glib::Object item(dbusmenu_menuitem_new()); - dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, name); - dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); - dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - dbusmenu_menuitem_property_set(item, "shortcut-nick", nicks[index]); + _menu_desktop_shortcuts = dbusmenu_menuitem_new(); + dbusmenu_menuitem_set_root(_menu_desktop_shortcuts, TRUE); - auto sig = new glib::Signal(item, "item-activated", - [&] (DbusmenuMenuitem* item, gint) { - const gchar *nick; - nick = dbusmenu_menuitem_property_get(item, "shortcut-nick"); - indicator_desktop_shortcuts_nick_exec(_desktop_shortcuts, nick); - }); - _gsignals.Add(sig); + // Build a desktop shortcuts object and tell it that our + // environment is Unity to handle the filtering + _desktop_shortcuts = indicator_desktop_shortcuts_new(desktop_file.c_str(), "Unity"); + // This will get us a list of the nicks available, it should + // always be at least one entry of NULL if there either aren't + // any or they're filtered for the environment we're in + const gchar** nicks = indicator_desktop_shortcuts_get_nicks(_desktop_shortcuts); + + int index = 0; + while (nicks[index]) { + + // Build a dbusmenu item for each nick that is the desktop + // file that is built from it's name and includes a callback + // to the desktop shortcuts object to execute the nick + glib::String name(indicator_desktop_shortcuts_nick_get_name(_desktop_shortcuts, + nicks[index])); + glib::Object item(dbusmenu_menuitem_new()); + dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, name); + dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); + dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + dbusmenu_menuitem_property_set(item, "shortcut-nick", nicks[index]); + + auto sig = new glib::Signal(item, "item-activated", + [&] (DbusmenuMenuitem* item, gint) { + const gchar *nick; + nick = dbusmenu_menuitem_property_get(item, "shortcut-nick"); + indicator_desktop_shortcuts_nick_exec(_desktop_shortcuts, nick); + }); + _gsignals.Add(sig); - dbusmenu_menuitem_child_append(_menu_desktop_shortcuts, item); - index++; - } + dbusmenu_menuitem_child_append(_menu_desktop_shortcuts, item); + index++; } - - g_key_file_free(keyfile); } void BamfLauncherIcon::UpdateMenus() @@ -844,7 +831,7 @@ _menu_items["Pin"] = glib::Object(menu_item); } - const char* label = !IsSticky() ? _("Lock to launcher") : _("Unlock from launcher"); + const char* label = !IsSticky() ? _("Lock to Launcher") : _("Unlock from Launcher"); dbusmenu_menuitem_property_set(_menu_items["Pin"], DBUSMENU_MENUITEM_PROP_LABEL, label); @@ -1134,7 +1121,8 @@ if (IsRunning() && IsVisible()) { - if (current) + // If current is true, we only want to show the current workspace. + if (!current) { result = true; } diff -Nru unity-5.4.0/plugins/unityshell/src/BFBLauncherIcon.cpp unity-5.6.0/plugins/unityshell/src/BFBLauncherIcon.cpp --- unity-5.4.0/plugins/unityshell/src/BFBLauncherIcon.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/BFBLauncherIcon.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -34,6 +34,7 @@ BFBLauncherIcon::BFBLauncherIcon() : SimpleLauncherIcon() + , reader_(dash::LensDirectoryReader::GetDefault()) { tooltip_text = _("Dash home"); icon_name = PKGDATADIR"/launcher_bfb.png"; @@ -94,21 +95,21 @@ result.push_back(menu_item); // Other lenses.. - for (auto lens : lenses_.GetLenses()) + for (auto lens : reader_->GetLensData()) { - if (!lens->visible()) + if (!lens->visible) continue; menu_item = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, lens->name().c_str()); + dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, lens->name); dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, true); dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true); g_signal_connect(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, (GCallback)&BFBLauncherIcon::OnMenuitemActivated, - g_strdup(lens->id().c_str())); + g_strdup(lens->id)); result.push_back(menu_item); } diff -Nru unity-5.4.0/plugins/unityshell/src/BFBLauncherIcon.h unity-5.6.0/plugins/unityshell/src/BFBLauncherIcon.h --- unity-5.4.0/plugins/unityshell/src/BFBLauncherIcon.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/BFBLauncherIcon.h 2012-03-12 09:16:36.000000000 +0000 @@ -51,7 +51,7 @@ static unity::UBusManager ubus_manager_; nux::Color background_color_; - dash::FilesystemLenses lenses_; + dash::LensDirectoryReader::Ptr reader_; }; } diff -Nru unity-5.4.0/plugins/unityshell/src/BGHash.cpp unity-5.6.0/plugins/unityshell/src/BGHash.cpp --- unity-5.4.0/plugins/unityshell/src/BGHash.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/BGHash.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -344,6 +344,22 @@ _hires_time_end = 500 * 1000; // 500 milliseconds _transition_handler = g_timeout_add (1000/60, (GSourceFunc)BGHash::OnTransitionCallback, this); + // export to gsettings + GSettings* settings = NULL; + GdkColor color = {0, + (guint16) (_new_color.red * 65535.0 * 0.7f), + (guint16) (_new_color.green * 65535.0 * 0.7f), + (guint16) (_new_color.blue * 65535.0 * 0.7f)}; + + settings = g_settings_new (UNITY_SCHEMA.c_str()); + if (settings) + { + unity::glib::String color_string(gdk_color_to_string(&color)); + LOG_DEBUG(logger) << "Setting gsettings key to: " << color_string; + g_settings_set_string(settings, AVG_BG_COLOR.c_str(), color_string); + g_object_unref (settings); + } + } gboolean BGHash::OnTransitionCallback(BGHash *self) @@ -384,19 +400,6 @@ _current_color.blue * 0.7f, 0.5) ); - GSettings* settings = NULL; - GdkColor color = {0, - (guint16) (_current_color.red * 65535.0 * 0.7f), - (guint16) (_current_color.green * 65535.0 * 0.7f), - (guint16) (_current_color.blue * 65535.0 * 0.7f)}; - - settings = g_settings_new (UNITY_SCHEMA.c_str()); - if (settings) - { - unity::glib::String color_string(gdk_color_to_string(&color)); - g_settings_set_string(settings, AVG_BG_COLOR.c_str(), color_string); - g_object_unref (settings); - } } GdkPixbuf *BGHash::GetPixbufFromBG () diff -Nru unity-5.4.0/plugins/unityshell/src/DashController.cpp unity-5.6.0/plugins/unityshell/src/DashController.cpp --- unity-5.4.0/plugins/unityshell/src/DashController.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/DashController.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -95,6 +95,7 @@ layout->SetHorizontalExternalMargin(0); window_->SetLayout(layout); + ubus_manager_.UnregisterInterest(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST); } void Controller::SetupRelayoutCallbacks() @@ -278,6 +279,8 @@ window_->EnableInputWindow(false, "Dash", true, false); visible_ = false; + nux::GetWindowCompositor().SetKeyFocusArea(NULL,nux::KEY_NAV_NONE); + if (restore) PluginAdapter::Default ()->restoreInputFocus (); @@ -336,9 +339,7 @@ void Controller::OnActivateRequest(GVariant* variant) { EnsureDash(); - ubus_manager_.UnregisterInterest(UBUS_PLACE_ENTRY_ACTIVATE_REQUEST); view_->OnActivateRequest(variant); - ShowDash(); } gboolean Controller::CheckShortcutActivation(const char* key_string) @@ -347,7 +348,9 @@ std::string lens_id = view_->GetIdForShortcutActivation(std::string(key_string)); if (lens_id != "") { - OnActivateRequest(g_variant_new("(sus)", lens_id.c_str(), 0, "")); + GVariant* args = g_variant_new("(sus)", lens_id.c_str(), 0, ""); + OnActivateRequest(args); + g_variant_unref(args); return true; } return false; diff -Nru unity-5.4.0/plugins/unityshell/src/DashStyle.cpp unity-5.6.0/plugins/unityshell/src/DashStyle.cpp --- unity-5.4.0/plugins/unityshell/src/DashStyle.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/DashStyle.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -110,8 +110,6 @@ void SetDefaultValues(); - void Star(cairo_t* cr, double size); - void GetTextExtents(int& width, int& height, int maxWidth, @@ -208,13 +206,14 @@ LazyLoadTexture search_magnify_texture_; LazyLoadTexture search_close_texture_; - LazyLoadTexture search_close_glow_texture_; LazyLoadTexture search_spin_texture_; - LazyLoadTexture search_spin_glow_texture_; LazyLoadTexture group_unexpand_texture_; LazyLoadTexture group_expand_texture_; + LazyLoadTexture star_deselected_texture_; + LazyLoadTexture star_selected_texture_; + LazyLoadTexture star_highlight_texture_; }; Style::Impl::Impl(Style* owner) @@ -242,11 +241,12 @@ , dash_shine_("/dash_sheen.png") , search_magnify_texture_("/search_magnify.png") , search_close_texture_("/search_close.png") - , search_close_glow_texture_("/search_close_glow.png") , search_spin_texture_("/search_spin.png") - , search_spin_glow_texture_("/search_spin_glow.png") , group_unexpand_texture_("/dash_group_unexpand.png") , group_expand_texture_("/dash_group_expand.png") + , star_deselected_texture_("/star_deselected.png") + , star_selected_texture_("/star_selected.png") + , star_highlight_texture_("/star_highlight.png") { signal_manager_.Add(new glib::Signal (gtk_settings_get_default(), @@ -669,43 +669,6 @@ cairo_surface_mark_dirty(surface); } -void Style::Impl::Star(cairo_t* cr, double size) -{ - double outter[5][2] = {{0.0, 0.0}, - {0.0, 0.0}, - {0.0, 0.0}, - {0.0, 0.0}, - {0.0, 0.0}}; - double inner[5][2] = {{0.0, 0.0}, - {0.0, 0.0}, - {0.0, 0.0}, - {0.0, 0.0}, - {0.0, 0.0}}; - double angle[5] = {-90.0, -18.0, 54.0, 126.0, 198.0}; - double outterRadius = size; - double innerRadius = size/1.75; - - for (int i = 0; i < 5; i++) - { - outter[i][0] = outterRadius * cos(angle[i] * M_PI / 180.0); - outter[i][1] = outterRadius * sin(angle[i] * M_PI / 180.0); - inner[i][0] = innerRadius * cos((angle[i] + 36.0) * M_PI / 180.0); - inner[i][1] = innerRadius * sin((angle[i] + 36.0) * M_PI / 180.0); - } - - cairo_move_to(cr, outter[0][0], outter[0][1]); - cairo_line_to(cr, inner[0][0], inner[0][1]); - cairo_line_to(cr, outter[1][0], outter[1][1]); - cairo_line_to(cr, inner[1][0], inner[1][1]); - cairo_line_to(cr, outter[2][0], outter[2][1]); - cairo_line_to(cr, inner[2][0], inner[2][1]); - cairo_line_to(cr, outter[3][0], outter[3][1]); - cairo_line_to(cr, inner[3][0], inner[3][1]); - cairo_line_to(cr, outter[4][0], outter[4][1]); - cairo_line_to(cr, inner[4][0], inner[4][1]); - cairo_close_path(cr); -} - void Style::Impl::SetDefaultValues() { // button-label @@ -1786,90 +1749,6 @@ return true; } -bool Style::StarEmpty(cairo_t* cr, nux::ButtonVisualState state) -{ - // sanity checks - if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) - return false; - - if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE) - return false; - - double w = cairo_image_surface_get_width(cairo_get_target(cr)); - double h = cairo_image_surface_get_height(cairo_get_target(cr)); - double radius = .85 * h / 2.0; - - cairo_save(cr); - cairo_translate(cr, w / 2.0, h / 2.0); - pimpl->Star(cr, radius); - cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.2); - cairo_fill_preserve(cr); - cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.5); - cairo_set_line_width(cr, 0.75); - cairo_stroke(cr); - cairo_restore(cr); - - return true; -} - -bool Style::StarHalf(cairo_t* cr, nux::ButtonVisualState state) -{ - // sanity checks - if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) - return false; - - if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE) - return false; - - double w = cairo_image_surface_get_width(cairo_get_target(cr)); - double h = cairo_image_surface_get_height(cairo_get_target(cr)); - double radius = .85 * h / 2.0; - - cairo_pattern_t* pattern = NULL; - pattern = cairo_pattern_create_linear(0.0, 0.0, w, 0.0); - cairo_pattern_add_color_stop_rgba(pattern, 0.0, 1.0, 1.0, 1.0, 1.0); - cairo_pattern_add_color_stop_rgba(pattern, .5, 1.0, 1.0, 1.0, 1.0); - cairo_pattern_add_color_stop_rgba(pattern, .5 + 0.01, 1.0, 1.0, 1.0, 0.2); - cairo_pattern_add_color_stop_rgba(pattern, 1.0, 1.0, 1.0, 1.0, 0.2); - cairo_set_source(cr, pattern); - - cairo_save(cr); - cairo_translate(cr, w / 2.0, h / 2.0); - pimpl->Star(cr, radius); - cairo_fill_preserve(cr); - cairo_pattern_destroy(pattern); - cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 0.5); - cairo_set_line_width(cr, 0.75); - cairo_stroke(cr); - cairo_restore(cr); - - return true; -} - -bool Style::StarFull(cairo_t* cr, nux::ButtonVisualState state) -{ - // sanity checks - if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) - return false; - - if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE) - return false; - - double w = cairo_image_surface_get_width(cairo_get_target(cr)); - double h = cairo_image_surface_get_height(cairo_get_target(cr)); - double radius = .85 * h / 2.0; - - cairo_save(cr); - cairo_translate(cr, w / 2.0, h / 2.0); - pimpl->Star(cr, radius); - cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0); - cairo_fill_preserve(cr); - cairo_stroke(cr); // to make sure it's as "large" as the empty and half ones - cairo_restore(cr); - - return true; -} - bool Style::MultiRangeSegment(cairo_t* cr, nux::ButtonVisualState state, std::string const& label, @@ -2231,21 +2110,11 @@ return pimpl->search_close_texture_.texture(); } -nux::BaseTexture* Style::GetSearchCloseGlowIcon() -{ - return pimpl->search_close_glow_texture_.texture(); -} - nux::BaseTexture* Style::GetSearchSpinIcon() { return pimpl->search_spin_texture_.texture(); } -nux::BaseTexture* Style::GetSearchSpinGlowIcon() -{ - return pimpl->search_spin_glow_texture_.texture(); -} - nux::BaseTexture* Style::GetGroupUnexpandIcon() { return pimpl->group_unexpand_texture_.texture(); @@ -2256,6 +2125,21 @@ return pimpl->group_expand_texture_.texture(); } +nux::BaseTexture* Style::GetStarDeselectedIcon() +{ + return pimpl->star_deselected_texture_.texture(); +} + +nux::BaseTexture* Style::GetStarSelectedIcon() +{ + return pimpl->star_selected_texture_.texture(); +} + +nux::BaseTexture* Style::GetStarHighlightIcon() +{ + return pimpl->star_highlight_texture_.texture(); +} + nux::BaseTexture* Style::GetDashShine() { return pimpl->dash_shine_.texture(); diff -Nru unity-5.4.0/plugins/unityshell/src/DashStyle.h unity-5.6.0/plugins/unityshell/src/DashStyle.h --- unity-5.4.0/plugins/unityshell/src/DashStyle.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/DashStyle.h 2012-03-12 09:16:36.000000000 +0000 @@ -106,12 +106,6 @@ virtual bool ButtonFocusOverlay(cairo_t* cr); - virtual bool StarEmpty(cairo_t* cr, nux::ButtonVisualState state); - - virtual bool StarHalf(cairo_t* cr, nux::ButtonVisualState state); - - virtual bool StarFull(cairo_t* cr, nux::ButtonVisualState state); - virtual bool MultiRangeSegment(cairo_t* cr, nux::ButtonVisualState state, std::string const& label, @@ -185,13 +179,15 @@ nux::BaseTexture* GetSearchMagnifyIcon(); nux::BaseTexture* GetSearchCloseIcon(); - nux::BaseTexture* GetSearchCloseGlowIcon(); nux::BaseTexture* GetSearchSpinIcon(); - nux::BaseTexture* GetSearchSpinGlowIcon(); nux::BaseTexture* GetGroupUnexpandIcon(); nux::BaseTexture* GetGroupExpandIcon(); + nux::BaseTexture* GetStarDeselectedIcon(); + nux::BaseTexture* GetStarSelectedIcon(); + nux::BaseTexture* GetStarHighlightIcon(); + sigc::signal changed; private: diff -Nru unity-5.4.0/plugins/unityshell/src/DashView.cpp unity-5.6.0/plugins/unityshell/src/DashView.cpp --- unity-5.4.0/plugins/unityshell/src/DashView.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/DashView.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -37,13 +37,41 @@ { namespace dash { - namespace { + nux::logging::Logger logger("unity.dash.view"); } +// This is so we can access some protected members in nux::VLayout and +// break the natural key navigation path. +class DashLayout: public nux::VLayout +{ +public: + DashLayout(NUX_FILE_LINE_DECL) + : nux::VLayout(NUX_FILE_LINE_PARAM) + , area_(nullptr) + {} + + void SetSpecialArea(nux::Area* area) + { + area_ = area; + } + +protected: + nux::Area* KeyNavIteration(nux::KeyNavDirection direction) + { + if (direction == nux::KEY_NAV_DOWN && area_ && area_->HasKeyFocus()) + return nullptr; + else + return nux::VLayout::KeyNavIteration(direction); + } + +private: + nux::Area* area_; +}; + NUX_IMPLEMENT_OBJECT_TYPE(DashView); DashView::DashView() @@ -133,7 +161,7 @@ layout_ = new nux::VLayout(); SetLayout(layout_); - content_layout_ = new nux::VLayout(); + content_layout_ = new DashLayout(NUX_TRACKER_LOCATION); content_layout_->SetHorizontalExternalMargin(0); content_layout_->SetVerticalExternalMargin(0); @@ -145,11 +173,12 @@ search_bar_->live_search_reached.connect(sigc::mem_fun(this, &DashView::OnLiveSearchReached)); search_bar_->showing_filters.changed.connect([&] (bool showing) { if (active_lens_view_) active_lens_view_->filters_expanded = showing; QueueDraw(); }); content_layout_->AddView(search_bar_, 0, nux::MINOR_POSITION_LEFT); + content_layout_->SetSpecialArea(search_bar_->show_filters()); lenses_layout_ = new nux::VLayout(); content_layout_->AddView(lenses_layout_, 1, nux::MINOR_POSITION_LEFT); - home_view_ = new LensView(home_lens_); + home_view_ = new LensView(home_lens_, nullptr); AddChild(home_view_); active_lens_view_ = home_view_; lens_views_[home_lens_->id] = home_view_; @@ -376,7 +405,7 @@ std::string id = lens->id; lens_bar_->AddLens(lens); - LensView* view = new LensView(lens); + LensView* view = new LensView(lens, search_bar_->show_filters()); AddChild(view); view->SetVisible(false); view->uri_activated.connect(sigc::mem_fun(this, &DashView::OnUriActivated)); @@ -624,15 +653,20 @@ wrapper.add("num-rows", num_rows); } -nux::Area * DashView::KeyNavIteration(nux::KeyNavDirection direction) +nux::Area* DashView::KeyNavIteration(nux::KeyNavDirection direction) { - // We don't want to eat the tab as it's used for IM stuff - if (!search_bar_->im_active()) + if (direction == nux::KEY_NAV_DOWN && search_bar_ && active_lens_view_) { - if (direction == KEY_NAV_TAB_NEXT) - lens_bar_->ActivateNext(); - else if (direction == KEY_NAV_TAB_PREVIOUS) - lens_bar_->ActivatePrevious(); + auto show_filters = search_bar_->show_filters(); + auto fscroll_view = active_lens_view_->fscroll_view(); + + if (show_filters && show_filters->HasKeyFocus()) + { + if (fscroll_view->IsVisible() && fscroll_view) + return fscroll_view->KeyNavIteration(direction); + else + return active_lens_view_->KeyNavIteration(direction); + } } return this; } @@ -649,6 +683,8 @@ // Do what nux::View does, but if the event isn't a key navigation, // designate the text entry to process it. + bool ctrl = (special_keys_state & NUX_STATE_CTRL); + nux::KeyNavDirection direction = KEY_NAV_NONE; switch (x11_key_code) { @@ -665,9 +701,11 @@ direction = KEY_NAV_RIGHT; break; case NUX_VK_LEFT_TAB: + case NUX_VK_PAGE_UP: direction = KEY_NAV_TAB_PREVIOUS; break; case NUX_VK_TAB: + case NUX_VK_PAGE_DOWN: direction = KEY_NAV_TAB_NEXT; break; case NUX_VK_ENTER: @@ -680,11 +718,87 @@ break; } - if (has_key_focus_) + // We should not do it here, but I really don't want to make DashView + // focusable and I'm not able to know if ctrl is pressed in + // DashView::KeyNavIteration. + nux::InputArea* focus_area = nux::GetWindowCompositor().GetKeyFocusArea(); + + if (key_symbol == nux::NUX_KEYDOWN) { - return this; + std::list tabs; + for (auto category : active_lens_view_->categories()) + { + if (category->IsVisible()) + tabs.push_back(category); + } + + if (search_bar_ && search_bar_->show_filters() && + search_bar_->show_filters()->IsVisible()) + { + tabs.push_back(search_bar_->show_filters()); + } + + if (active_lens_view_->filter_bar() && active_lens_view_->fscroll_view() && + active_lens_view_->fscroll_view()->IsVisible()) + { + for (auto filter : active_lens_view_->filter_bar()->GetLayout()->GetChildren()) + { + tabs.push_back(filter); + } + } + + if (direction == KEY_NAV_TAB_PREVIOUS) + { + if (ctrl) + { + lens_bar_->ActivatePrevious(); + } + else + { + auto rbegin = tabs.rbegin(); + auto rend = tabs.rend(); + + bool use_the_prev = false; + for (auto tab = rbegin; tab != rend; ++tab) + { + const auto& tab_ptr = *tab; + + if (use_the_prev) + return tab_ptr; + + if (focus_area) + use_the_prev = focus_area->IsChildOf(tab_ptr); + } + + for (auto tab = rbegin; tab != rend; ++tab) + return *tab; + } + } + else if (direction == KEY_NAV_TAB_NEXT) + { + if (ctrl) + { + lens_bar_->ActivateNext(); + } + else + { + bool use_the_next = false; + for (auto tab : tabs) + { + if (use_the_next) + return tab; + + if (focus_area) + use_the_next = focus_area->IsChildOf(tab); + } + + for (auto tab : tabs) + return tab; + } + } } - else if (direction == KEY_NAV_NONE || search_bar_->im_active) + + if (direction == KEY_NAV_NONE || search_bar_->im_active) { // then send the event to the search entry return search_bar_->text_entry(); diff -Nru unity-5.4.0/plugins/unityshell/src/DashView.h unity-5.6.0/plugins/unityshell/src/DashView.h --- unity-5.4.0/plugins/unityshell/src/DashView.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/DashView.h 2012-03-12 09:16:36.000000000 +0000 @@ -42,6 +42,8 @@ namespace dash { +class DashLayout; + class DashView : public nux::View, public unity::debug::Introspectable { NUX_DECLARE_OBJECT_TYPE(DashView, nux::View); @@ -116,7 +118,7 @@ // View related nux::VLayout* layout_; - nux::VLayout* content_layout_; + DashLayout* content_layout_; SearchBar* search_bar_; nux::VLayout* lenses_layout_; LensBar* lens_bar_; diff -Nru unity-5.4.0/plugins/unityshell/src/DeviceLauncherIcon.cpp unity-5.6.0/plugins/unityshell/src/DeviceLauncherIcon.cpp --- unity-5.4.0/plugins/unityshell/src/DeviceLauncherIcon.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/DeviceLauncherIcon.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -87,13 +87,13 @@ DbusmenuMenuitem* menu_item; glib::Object drive(g_volume_get_drive(volume_)); - // "Lock to launcher"/"Unlock from launcher" item + // "Lock to Launcher"/"Unlock from Launcher" item if (DevicesSettings::GetDefault().GetDevicesOption() == DevicesSettings::ONLY_MOUNTED && drive && !g_drive_is_media_removable (drive)) { menu_item = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, !keep_in_launcher_ ? _("Lock to launcher") : _("Unlock from launcher")); + dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, !keep_in_launcher_ ? _("Lock to Launcher") : _("Unlock from Launcher")); dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, true); dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true); diff -Nru unity-5.4.0/plugins/unityshell/src/ElapsedTimeMonitor.cpp unity-5.6.0/plugins/unityshell/src/ElapsedTimeMonitor.cpp --- unity-5.4.0/plugins/unityshell/src/ElapsedTimeMonitor.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/ElapsedTimeMonitor.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -17,6 +17,8 @@ * Authored by: Alex Launi */ +#include + #include "ElapsedTimeMonitor.h" #include "TimeUtil.h" @@ -39,7 +41,8 @@ clock_gettime(CLOCK_MONOTONIC, ¤t); int diff = TimeUtil::TimeDelta(¤t, &_start); - g_variant_builder_add(builder, "{sv}", "elapsed-time", g_variant_new_uint32(diff)); + variant::BuilderWrapper(builder) + .add("elapsed-time", diff); } } diff -Nru unity-5.4.0/plugins/unityshell/src/FilterAllButton.h unity-5.6.0/plugins/unityshell/src/FilterAllButton.h --- unity-5.4.0/plugins/unityshell/src/FilterAllButton.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterAllButton.h 2012-03-12 09:16:36.000000000 +0000 @@ -24,6 +24,7 @@ #define UNITYSHELL_FILTERALLBUTTON_H #include +#include #include "FilterBasicButton.h" diff -Nru unity-5.4.0/plugins/unityshell/src/FilterBar.cpp unity-5.6.0/plugins/unityshell/src/FilterBar.cpp --- unity-5.4.0/plugins/unityshell/src/FilterBar.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterBar.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -24,6 +24,7 @@ #include #include "FilterBar.h" +#include "FilterExpanderLabel.h" #include "FilterFactory.h" namespace unity @@ -76,7 +77,8 @@ return; } - nux::View* filter_view = factory_.WidgetForFilter(filter); + FilterExpanderLabel* filter_view = factory_.WidgetForFilter(filter); + AddChild(filter_view); filter_map_[filter] = filter_view; GetLayout()->AddView(filter_view, 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); } @@ -87,7 +89,8 @@ { if (iter.first->id == filter->id) { - nux::View* filter_view = iter.second; + FilterExpanderLabel* filter_view = iter.second; + RemoveChild(filter_view); filter_map_.erase(filter_map_.find(iter.first)); GetLayout()->RemoveChildObject(filter_view); break; @@ -112,15 +115,14 @@ nux::Color col(0.13f, 0.13f, 0.13f, 0.13f); std::list& layout_list = GetLayout()->GetChildren(); - std::list::iterator iter; int i = 0; int num_separators = layout_list.size() - 1; - for (iter = layout_list.begin(); iter != layout_list.end(); iter++) + for (auto iter : layout_list) { if (i != num_separators) { - nux::Area* filter_view = (*iter); + nux::Area* filter_view = iter; nux::Geometry const& geom = filter_view->GetGeometry(); unsigned int alpha = 0, src = 0, dest = 0; @@ -134,11 +136,33 @@ col); GfxContext.GetRenderStates().SetBlend(alpha, src, dest); } - i++; + ++i; } GfxContext.PopClippingRectangle(); } +bool FilterBar::AcceptKeyNavFocus() +{ + return false; +} + +// +// Introspection +// +std::string FilterBar::GetName() const +{ + return "FilterBar"; +} + +void FilterBar::AddProperties(GVariantBuilder* builder) +{ + variant::BuilderWrapper(builder) + .add("x", GetAbsoluteX()) + .add("y", GetAbsoluteY()) + .add("width", GetAbsoluteWidth()) + .add("height", GetAbsoluteHeight()); +} + } // namespace dash } // namespace unity diff -Nru unity-5.4.0/plugins/unityshell/src/FilterBar.h unity-5.6.0/plugins/unityshell/src/FilterBar.h --- unity-5.4.0/plugins/unityshell/src/FilterBar.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterBar.h 2012-03-12 09:16:36.000000000 +0000 @@ -28,13 +28,16 @@ #include #include "FilterFactory.h" +#include "Introspectable.h" namespace unity { namespace dash { -class FilterBar : public nux::View +class FilterExpanderLabel; + +class FilterBar : public nux::View, public debug::Introspectable { NUX_DECLARE_OBJECT_TYPE(FilterBar, nux::View); public: @@ -47,15 +50,20 @@ void RemoveFilter(Filter::Ptr const& filter); protected: + virtual bool AcceptKeyNavFocus(); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); + // Introspection + virtual std::string GetName() const; + virtual void AddProperties(GVariantBuilder* builder); + private: void Init(); FilterFactory factory_; Filters::Ptr filters_; - std::map filter_map_; + std::map filter_map_; }; } // namespace dash diff -Nru unity-5.4.0/plugins/unityshell/src/FilterBasicButton.cpp unity-5.6.0/plugins/unityshell/src/FilterBasicButton.cpp --- unity-5.4.0/plugins/unityshell/src/FilterBasicButton.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterBasicButton.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -68,6 +68,18 @@ InitTheme(); SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(true); + + key_nav_focus_change.connect([&] (nux::Area*, bool, nux::KeyNavDirection) + { + QueueDraw(); + }); + + key_nav_focus_activate.connect([&](nux::Area*) + { + if (GetInputEventSensitivity()) + Active() ? Deactivate() : Activate(); + }); } void FilterBasicButton::InitTheme() diff -Nru unity-5.4.0/plugins/unityshell/src/FilterBasicButton.h unity-5.6.0/plugins/unityshell/src/FilterBasicButton.h --- unity-5.4.0/plugins/unityshell/src/FilterBasicButton.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterBasicButton.h 2012-03-12 09:16:36.000000000 +0000 @@ -26,8 +26,6 @@ #include #include -#include "FilterWidget.h" - namespace unity { namespace dash diff -Nru unity-5.4.0/plugins/unityshell/src/FilterExpanderLabel.cpp unity-5.6.0/plugins/unityshell/src/FilterExpanderLabel.cpp --- unity-5.4.0/plugins/unityshell/src/FilterExpanderLabel.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterExpanderLabel.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -21,7 +21,6 @@ */ #include "DashStyle.h" -#include "FilterBasicButton.h" #include "FilterExpanderLabel.h" namespace @@ -54,12 +53,13 @@ ExpanderView(NUX_FILE_LINE_DECL) : nux::View(NUX_FILE_LINE_PARAM) { + SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(true); } protected: void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) - { - }; + {}; void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) { @@ -69,7 +69,17 @@ bool AcceptKeyNavFocus() { - return false; + return true; + } + + nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) + { + bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type); + + if (mouse_inside == false) + return nullptr; + + return this; } }; @@ -83,7 +93,7 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel); FilterExpanderLabel::FilterExpanderLabel(std::string const& label, NUX_FILE_LINE_DECL) - : FilterWidget(NUX_FILE_LINE_PARAM) + : nux::View(NUX_FILE_LINE_PARAM) , expanded(true) , layout_(nullptr) , top_bar_layout_(nullptr) @@ -96,6 +106,8 @@ { expanded.changed.connect(sigc::mem_fun(this, &FilterExpanderLabel::DoExpandChange)); BuildLayout(); + + SetAcceptKeyNavFocusOnMouseDown(false); } FilterExpanderLabel::~FilterExpanderLabel() @@ -179,26 +191,32 @@ SetLayout(layout_); // Lambda functions - auto mouse_redraw = [&](int x, int y, unsigned long b, unsigned long k) + auto mouse_expand = [&](int x, int y, unsigned long b, unsigned long k) + { + expanded = !expanded; + }; + + auto key_redraw = [&](nux::Area*, bool, nux::KeyNavDirection) { QueueDraw(); }; - auto mouse_expand = [&](int x, int y, unsigned long b, unsigned long k) + auto key_expand = [&](nux::Area*) { expanded = !expanded; }; // Signals expander_view_->mouse_click.connect(mouse_expand); - expander_view_->mouse_enter.connect(mouse_redraw); - expander_view_->mouse_leave.connect(mouse_redraw); + expander_view_->key_nav_focus_change.connect(key_redraw); + expander_view_->key_nav_focus_activate.connect(key_expand); cairo_label_->mouse_click.connect(mouse_expand); - cairo_label_->mouse_enter.connect(mouse_redraw); - cairo_label_->mouse_leave.connect(mouse_redraw); expand_icon_->mouse_click.connect(mouse_expand); - expand_icon_->mouse_enter.connect(mouse_redraw); - expand_icon_->mouse_leave.connect(mouse_redraw); + key_nav_focus_change.connect([&](nux::Area* area, bool has_focus, nux::KeyNavDirection direction) + { + if(has_focus) + nux::GetWindowCompositor().SetKeyFocusArea(expander_view_); + }); QueueRelayout(); NeedRedraw(); @@ -229,9 +247,7 @@ bool FilterExpanderLabel::ShouldBeHighlighted() { - return ((expander_view_ && expander_view_->IsMouseInside()) || - (cairo_label_ && cairo_label_->IsMouseInside()) || - (expand_icon_ && expand_icon_->IsMouseInside())); + return ((expander_view_ && expander_view_->HasKeyFocus())); } void FilterExpanderLabel::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) @@ -271,5 +287,28 @@ GfxContext.PopClippingRectangle(); } +// +// Key navigation +// +bool FilterExpanderLabel::AcceptKeyNavFocus() +{ + return true; +} + +// +// Introspection +// +std::string FilterExpanderLabel::GetName() const +{ + return "FilterExpanderLabel"; +} + +void FilterExpanderLabel::AddProperties(GVariantBuilder* builder) +{ + unity::variant::BuilderWrapper wrapper(builder); + + wrapper.add("expander-has-focus", expander_view_->HasKeyFocus()); +} + } // namespace dash } // namespace unity diff -Nru unity-5.4.0/plugins/unityshell/src/FilterExpanderLabel.h unity-5.6.0/plugins/unityshell/src/FilterExpanderLabel.h --- unity-5.4.0/plugins/unityshell/src/FilterExpanderLabel.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterExpanderLabel.h 2012-03-12 09:16:36.000000000 +0000 @@ -28,11 +28,13 @@ #include #include #include +#include #include #include +#include -#include "FilterWidget.h" #include "IconTexture.h" +#include "Introspectable.h" namespace nux { @@ -44,9 +46,9 @@ namespace dash { -class FilterExpanderLabel : public FilterWidget +class FilterExpanderLabel : public nux::View, public debug::Introspectable { - NUX_DECLARE_OBJECT_TYPE(FilterExpanderLabel, FilterWidget); + NUX_DECLARE_OBJECT_TYPE(FilterExpanderLabel, nux::View); public: FilterExpanderLabel(std::string const& label, NUX_FILE_LINE_PROTO); virtual ~FilterExpanderLabel(); @@ -55,12 +57,20 @@ void SetLabel(std::string const& label); void SetContents(nux::Layout* layout); + virtual void SetFilter(Filter::Ptr const& filter) = 0; + virtual std::string GetFilterType() = 0; + nux::Property expanded; protected: + virtual bool AcceptKeyNavFocus(); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); + // Introspection + virtual std::string GetName() const; + virtual void AddProperties(GVariantBuilder* builder); + private: void BuildLayout(); void DoExpandChange(bool change); diff -Nru unity-5.4.0/plugins/unityshell/src/FilterFactory.cpp unity-5.6.0/plugins/unityshell/src/FilterFactory.cpp --- unity-5.4.0/plugins/unityshell/src/FilterFactory.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterFactory.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -44,12 +44,12 @@ namespace dash { -nux::View* FilterFactory::WidgetForFilter(Filter::Ptr const& filter) +FilterExpanderLabel* FilterFactory::WidgetForFilter(Filter::Ptr const& filter) { std::string filter_type(filter->renderer_name); LOG_DEBUG(logger) << "building filter of type, " << filter_type; - FilterWidget* widget = nullptr; + FilterExpanderLabel* widget = nullptr; if (filter_type == renderer_type_check_options) { widget = new FilterGenre(2, NUX_TRACKER_LOCATION); diff -Nru unity-5.4.0/plugins/unityshell/src/FilterFactory.h unity-5.6.0/plugins/unityshell/src/FilterFactory.h --- unity-5.4.0/plugins/unityshell/src/FilterFactory.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterFactory.h 2012-03-12 09:16:36.000000000 +0000 @@ -30,10 +30,12 @@ namespace dash { +class FilterExpanderLabel; + class FilterFactory { public: - nux::View* WidgetForFilter(Filter::Ptr const& filter); + FilterExpanderLabel* WidgetForFilter(Filter::Ptr const& filter); }; } // namespace dash diff -Nru unity-5.4.0/plugins/unityshell/src/FilterGenreButton.h unity-5.6.0/plugins/unityshell/src/FilterGenreButton.h --- unity-5.4.0/plugins/unityshell/src/FilterGenreButton.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterGenreButton.h 2012-03-12 09:16:36.000000000 +0000 @@ -24,8 +24,8 @@ #include #include +#include -#include "FilterWidget.h" #include "FilterBasicButton.h" namespace unity diff -Nru unity-5.4.0/plugins/unityshell/src/FilterMultiRangeButton.cpp unity-5.6.0/plugins/unityshell/src/FilterMultiRangeButton.cpp --- unity-5.4.0/plugins/unityshell/src/FilterMultiRangeButton.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterMultiRangeButton.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -54,9 +54,11 @@ { InitTheme(); SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(true); state_change.connect(sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated)); key_nav_focus_change.connect([&](nux::Area*, bool, nux::KeyNavDirection) { QueueDraw(); }); + key_nav_focus_activate.connect([&](nux::Area* area) { Active() ? Deactivate() : Activate(); }); } void FilterMultiRangeButton::OnActivated(nux::Area* area) @@ -237,7 +239,6 @@ col); nux::BaseTexture* texture = normal_[MapKey(has_arrow_, side_)]->GetTexture(); - //FIXME - dashstyle does not give us a focused state yet, so ignore if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) { texture = prelight_[MapKey(has_arrow_, side_)]->GetTexture(); diff -Nru unity-5.4.0/plugins/unityshell/src/FilterMultiRangeButton.h unity-5.6.0/plugins/unityshell/src/FilterMultiRangeButton.h --- unity-5.4.0/plugins/unityshell/src/FilterMultiRangeButton.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterMultiRangeButton.h 2012-03-12 09:16:36.000000000 +0000 @@ -28,8 +28,7 @@ #include #include #include - -#include "FilterWidget.h" +#include namespace unity { diff -Nru unity-5.4.0/plugins/unityshell/src/FilterMultiRangeWidget.cpp unity-5.6.0/plugins/unityshell/src/FilterMultiRangeWidget.cpp --- unity-5.4.0/plugins/unityshell/src/FilterMultiRangeWidget.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterMultiRangeWidget.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -113,7 +113,7 @@ button->SetHasArrow(MultiRangeArrow::BOTH); else if (index == start) button->SetHasArrow(MultiRangeArrow::LEFT); - else if (index == end) + else if (index == end && index != 0) button->SetHasArrow(MultiRangeArrow::RIGHT); else button->SetHasArrow(MultiRangeArrow::NONE); diff -Nru unity-5.4.0/plugins/unityshell/src/FilterRatingsButton.cpp unity-5.6.0/plugins/unityshell/src/FilterRatingsButton.cpp --- unity-5.4.0/plugins/unityshell/src/FilterRatingsButton.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterRatingsButton.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -27,19 +27,39 @@ #include "DashStyle.h" #include "FilterRatingsButton.h" +namespace +{ +const int star_size = 28; +const int star_gap = 10; +const int num_stars = 5; +} + namespace unity { namespace dash { - FilterRatingsButton::FilterRatingsButton(NUX_FILE_LINE_DECL) : nux::ToggleButton(NUX_FILE_LINE_PARAM) + , focused_star_(-1) { - InitTheme(); SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(true); mouse_up.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseUp)); + mouse_move.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseMove)); mouse_drag.connect(sigc::mem_fun(this, &FilterRatingsButton::RecvMouseDrag)); + + key_nav_focus_change.connect([&](nux::Area* area, bool has_focus, nux::KeyNavDirection direction) + { + if (has_focus && direction != nux::KEY_NAV_NONE) + focused_star_ = 0; + else if (!has_focus) + focused_star_ = -1; + + QueueDraw(); + }); + key_nav_focus_activate.connect([&](nux::Area*) { filter_->rating = static_cast(focused_star_+1)/num_stars; }); + key_down.connect(sigc::mem_fun(this, &FilterRatingsButton::OnKeyDown)); } FilterRatingsButton::~FilterRatingsButton() @@ -58,78 +78,11 @@ return "FilterRatingsButton"; } -void FilterRatingsButton::InitTheme() -{ - if (!active_empty_) - { - nux::Geometry geometry(GetGeometry()); - geometry.width /= 5; - - active_empty_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_PRESSED))); - normal_empty_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_NORMAL))); - prelight_empty_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT))); - - active_half_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_PRESSED))); - normal_half_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_NORMAL))); - prelight_half_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT))); - - active_full_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_PRESSED))); - normal_full_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_NORMAL))); - prelight_full_.reset(new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT))); - } -} - -void FilterRatingsButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, int type, nux::ButtonVisualState faked_state) -{ - Style& dash_style = Style::Instance(); - if (type == 0) - { - // empty - dash_style.StarEmpty(cr, faked_state); - } - else if (type == 1) - { - // half - dash_style.StarHalf(cr, faked_state); - } - else - { - // full - dash_style.StarFull(cr, faked_state); - } -} - -long FilterRatingsButton::ComputeContentSize() -{ - long ret = nux::Button::ComputeContentSize(); - nux::Geometry geo(GetGeometry()); - - if (cached_geometry_ != geo) - { - geo.width = 27; - active_empty_->Invalidate(geo); - normal_empty_->Invalidate(geo); - prelight_empty_->Invalidate(geo); - - active_half_->Invalidate(geo); - normal_half_->Invalidate(geo); - prelight_half_->Invalidate(geo); - - active_full_->Invalidate(geo); - normal_full_->Invalidate(geo); - prelight_full_->Invalidate(geo); - - cached_geometry_ = geo; - } - - return ret; -} - void FilterRatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { int rating = 0; if (filter_ && filter_->filtering) - rating = static_cast(filter_->rating * 5); + rating = static_cast(filter_->rating * num_stars); // FIXME: 9/26/2011 // We should probably support an API for saying whether the ratings // should or shouldn't support half stars...but our only consumer at @@ -138,11 +91,10 @@ // int total_half_stars = rating % 2; // int total_full_stars = rating / 2; int total_full_stars = rating; - int total_half_stars = 0; nux::Geometry const& geo = GetGeometry(); nux::Geometry geo_star(geo); - geo_star.width = 27; + geo_star.width = star_size; gPainter.PaintBackground(GfxContext, geo); // set up our texture mode @@ -164,35 +116,27 @@ geo.height, col); - for (int index = 0; index < 5; index++) + for (int index = 0; index < num_stars; ++index) { - nux::BaseTexture* texture = normal_empty_->GetTexture(); + Style& style = Style::Instance(); + nux::BaseTexture* texture = style.GetStarSelectedIcon(); if (index < total_full_stars) { if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL) - texture = normal_full_->GetTexture(); + texture = style.GetStarSelectedIcon(); else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) - texture = prelight_full_->GetTexture(); + texture = style.GetStarSelectedIcon(); else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) - texture = active_full_->GetTexture(); - } - else if (index < total_full_stars + total_half_stars) - { - if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL) - texture = normal_half_->GetTexture(); - else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) - texture = prelight_half_->GetTexture(); - else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) - texture = active_half_->GetTexture(); + texture = style.GetStarSelectedIcon(); } else { if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL) - texture = normal_empty_->GetTexture(); + texture = style.GetStarDeselectedIcon(); else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT) - texture = prelight_empty_->GetTexture(); + texture = style.GetStarDeselectedIcon(); else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED) - texture = active_empty_->GetTexture(); + texture = style.GetStarDeselectedIcon(); } GfxContext.QRP_1Tex(geo_star.x, @@ -203,7 +147,18 @@ texxform, nux::Color(1.0f, 1.0f, 1.0f, 1.0f)); - geo_star.x += geo_star.width + 10; + if (focused_star_ == index) + { + GfxContext.QRP_1Tex(geo_star.x, + geo_star.y, + geo_star.width, + geo_star.height, + style.GetStarHighlightIcon()->GetDeviceTexture(), + texxform, + nux::Color(1.0f, 1.0f, 1.0f, 0.5f)); + } + + geo_star.x += geo_star.width + star_gap; } @@ -216,8 +171,8 @@ int width = 180; float new_rating = (static_cast(x) / width); - // FIXME: change to 10 once we decide to support also half-stars - new_rating = ceil(5 * new_rating) / 5; + // FIXME: change to * 2 once we decide to support also half-stars + new_rating = ceil((num_stars * 1) * new_rating) / (num_stars * 1); new_rating = (new_rating > 1) ? 1 : ((new_rating < 0) ? 0 : new_rating); if (filter) @@ -241,5 +196,71 @@ NeedRedraw(); } +void FilterRatingsButton::RecvMouseMove(int x, int y, int dx, int dy, + unsigned long button_flags, + unsigned long key_flags) +{ + int width = 180; + focused_star_ = std::max(0, std::min(static_cast(ceil((static_cast(x) / width) * num_stars) - 1), num_stars - 1)); + + if (!HasKeyFocus()) + nux::GetWindowCompositor().SetKeyFocusArea(this); + + QueueDraw(); +} + + +bool FilterRatingsButton::InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character) +{ + nux::KeyNavDirection direction = nux::KEY_NAV_NONE; + + switch (keysym) + { + case NUX_VK_LEFT: + direction = nux::KeyNavDirection::KEY_NAV_LEFT; + break; + case NUX_VK_RIGHT: + direction = nux::KeyNavDirection::KEY_NAV_RIGHT; + break; + default: + direction = nux::KeyNavDirection::KEY_NAV_NONE; + break; + } + + if (direction == nux::KeyNavDirection::KEY_NAV_NONE) + return false; + else if (direction == nux::KEY_NAV_LEFT && (focused_star_ <= 0)) + return false; + else if (direction == nux::KEY_NAV_RIGHT && (focused_star_ >= num_stars - 1)) + return false; + else + return true; +} + + +void FilterRatingsButton::OnKeyDown(unsigned long event_type, unsigned long event_keysym, + unsigned long event_state, const TCHAR* character, + unsigned short key_repeat_count) +{ + switch (event_keysym) + { + case NUX_VK_LEFT: + --focused_star_; + break; + case NUX_VK_RIGHT: + ++focused_star_; + break; + default: + return; + } + + QueueDraw(); +} + +bool FilterRatingsButton::AcceptKeyNavFocus() +{ + return true; +} + } // namespace dash } // namespace unity diff -Nru unity-5.4.0/plugins/unityshell/src/FilterRatingsButton.h unity-5.6.0/plugins/unityshell/src/FilterRatingsButton.h --- unity-5.4.0/plugins/unityshell/src/FilterRatingsButton.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterRatingsButton.h 2012-03-12 09:16:36.000000000 +0000 @@ -45,30 +45,24 @@ std::string GetFilterType(); protected: - virtual long ComputeContentSize(); virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); - void InitTheme(); - void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, int type, nux::ButtonVisualState faked_state); + // Key-nav + virtual bool AcceptKeyNavFocus(); + virtual bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character); + +private: + void OnKeyDown(unsigned long event_type, unsigned long event_keysym, + unsigned long event_state, const TCHAR* character, + unsigned short key_repeat_count); void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags); void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); + void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); void OnRatingsChanged(int rating); - typedef std::unique_ptr NuxCairoPtr; - - NuxCairoPtr active_empty_; - NuxCairoPtr normal_empty_; - NuxCairoPtr prelight_empty_; - NuxCairoPtr active_half_; - NuxCairoPtr normal_half_; - NuxCairoPtr prelight_half_; - NuxCairoPtr active_full_; - NuxCairoPtr normal_full_; - NuxCairoPtr prelight_full_; - nux::Geometry cached_geometry_; - dash::RatingsFilter::Ptr filter_; + int focused_star_; }; diff -Nru unity-5.4.0/plugins/unityshell/src/FilterRatingsWidget.cpp unity-5.6.0/plugins/unityshell/src/FilterRatingsWidget.cpp --- unity-5.4.0/plugins/unityshell/src/FilterRatingsWidget.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterRatingsWidget.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -30,6 +30,13 @@ #include "FilterRatingsButton.h" #include "FilterRatingsWidget.h" +namespace +{ +const int top_padding = 11; +const int bottom_padding = 12; +const int star_size = 28; +} + namespace unity { namespace dash @@ -43,8 +50,9 @@ all_button_ = new FilterAllButton(NUX_TRACKER_LOCATION); nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); - layout->SetTopAndBottomPadding(11, 12); + layout->SetTopAndBottomPadding(top_padding, bottom_padding); ratings_ = new FilterRatingsButton(NUX_TRACKER_LOCATION); + ratings_->SetMinimumHeight(star_size); layout->AddView(ratings_); diff -Nru unity-5.4.0/plugins/unityshell/src/FilterWidget.cpp unity-5.6.0/plugins/unityshell/src/FilterWidget.cpp --- unity-5.4.0/plugins/unityshell/src/FilterWidget.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterWidget.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- -/* - * Copyright 2011 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 applicable version of the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of both the GNU Lesser General Public - * License version 3 along with this program. If not, see - * - * - * Authored by: Andrea Azzarone - * - */ - -#include "FilterWidget.h" - -namespace unity -{ -namespace dash -{ - -NUX_IMPLEMENT_OBJECT_TYPE(FilterWidget); - -FilterWidget::FilterWidget( NUX_FILE_LINE_DECL) - : nux::View(NUX_FILE_LINE_PARAM) -{ - SetAcceptKeyNavFocusOnMouseDown(false); -} - -} // namespace dash -} // namespace unity diff -Nru unity-5.4.0/plugins/unityshell/src/FilterWidget.h unity-5.6.0/plugins/unityshell/src/FilterWidget.h --- unity-5.4.0/plugins/unityshell/src/FilterWidget.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/FilterWidget.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- -/* - * Copyright 2011 Canonical Ltd. - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 applicable version of the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of both the GNU Lesser General Public - * License version 3 along with this program. If not, see - * - * - * Authored by: Gordon Allott - * - */ -#ifndef UNITYSHELL_FILTERWIDGET_H -#define UNITYSHELL_FILTERWIDGET_H - -#include -#include -#include - -namespace unity -{ -namespace dash -{ - -class FilterWidget : public nux::View -{ - NUX_DECLARE_OBJECT_TYPE(FilterWidget, nux::View); -public: - FilterWidget(NUX_FILE_LINE_PROTO); - virtual ~FilterWidget() {}; - - virtual void SetFilter(Filter::Ptr const& filter) = 0; - virtual std::string GetFilterType() = 0; -}; - -} // namespace dash -} // namespace unity - -#endif //UNITYSHELL_FILTERWIDGET_H diff -Nru unity-5.4.0/plugins/unityshell/src/GestureEngine.cpp unity-5.6.0/plugins/unityshell/src/GestureEngine.cpp --- unity-5.4.0/plugins/unityshell/src/GestureEngine.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/GestureEngine.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -85,13 +85,18 @@ Window parent, root; Window* children = NULL; unsigned int nchildren; + Status status; - XQueryTree(_screen->dpy(), window, &root, &parent, &children, &nchildren); + status = XQueryTree(_screen->dpy(), window, &root, &parent, &children, &nchildren); + if (status == 0) + break; if (children) XFree(children); - if (parent == root) + // parent will be zero when the window passed to this method is already the + // root one. + if (parent == root || parent == 0) break; window = parent; @@ -215,7 +220,7 @@ void GestureEngine::OnTouchStart(GeisAdapter::GeisTouchData* data) { - if (data->touches == 3) + if (data->touches == 3 && data->window != 0) { CompWindow* result = FindCompWindow(data->window); diff -Nru unity-5.4.0/plugins/unityshell/src/HudButton.cpp unity-5.6.0/plugins/unityshell/src/HudButton.cpp --- unity-5.4.0/plugins/unityshell/src/HudButton.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/HudButton.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -30,6 +30,8 @@ #include #include #include +#include + #include "DashStyle.h" #include "HudButton.h" @@ -39,9 +41,9 @@ nux::logging::Logger logger("unity.hud.HudButton"); } -namespace unity +namespace unity { -namespace hud +namespace hud { @@ -83,9 +85,9 @@ void HudButton::Init() { InitTheme(); - key_nav_focus_change.connect([this](nux::Area *area, bool recieving, nux::KeyNavDirection direction) - { - QueueDraw(); + key_nav_focus_change.connect([this](nux::Area *area, bool recieving, nux::KeyNavDirection direction) + { + QueueDraw(); }); fake_focused.changed.connect([this](bool change) @@ -117,15 +119,16 @@ void HudButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state) { - dash::Style::Instance().SquareButton(cr, faked_state, label_, - is_rounded, 17, + dash::Style::Instance().SquareButton(cr, faked_state, label_, + is_rounded, 17, dash::Alignment::LEFT, true); } bool HudButton::AcceptKeyNavFocus() { - // say we can't be focused if we have fake focus on - return !fake_focused; + // The button will not receive the keyboard focus. The keyboard focus is always to remain with the + // text entry in the hud. + return false; } @@ -142,11 +145,11 @@ cached_geometry_ = geo; } - + return ret; -} +} -void HudButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) +void HudButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry const& geo = GetGeometry(); gPainter.PaintBackground(GfxContext, geo); @@ -160,7 +163,7 @@ GfxContext.GetRenderStates().GetBlend(alpha, src, dest); GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); GfxContext.GetRenderStates().SetBlend(true); - + nux::Color col = nux::color::Black; col.alpha = 0; GfxContext.QRP_Color(geo.x, @@ -215,7 +218,8 @@ void HudButton::AddProperties(GVariantBuilder* builder) { - g_variant_builder_add(builder, "{sv}", "label", g_variant_new_string(label_.c_str())); + variant::BuilderWrapper(builder) + .add("label", label_); } } diff -Nru unity-5.4.0/plugins/unityshell/src/HudController.cpp unity-5.6.0/plugins/unityshell/src/HudController.cpp --- unity-5.4.0/plugins/unityshell/src/HudController.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/HudController.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -20,6 +20,7 @@ #include #include +#include #include "PluginAdapter.h" #include "PanelStyle.h" #include "UBusMessages.h" @@ -40,12 +41,13 @@ Controller::Controller() : launcher_width(66) , hud_service_("com.canonical.hud", "/com/canonical/hud") - , window_(0) + , window_(nullptr) , visible_(false) , need_show_(false) , timeline_id_(0) , last_opacity_(0.0f) , start_time_(0) + , view_(nullptr) { LOG_DEBUG(logger) << "hud startup"; SetupRelayoutCallbacks(); @@ -110,6 +112,8 @@ view_->search_activated.connect(sigc::mem_fun(this, &Controller::OnSearchActivated)); view_->query_activated.connect(sigc::mem_fun(this, &Controller::OnQueryActivated)); view_->query_selected.connect(sigc::mem_fun(this, &Controller::OnQuerySelected)); + // Add to the debug introspection. + AddChild(view_); } void Controller::SetupRelayoutCallbacks() @@ -186,7 +190,7 @@ { LOG_DEBUG(logger) << "OnScreenUngrabbed called"; if (need_show_) - { + { nux::GetWindowCompositor().SetKeyFocusArea(view_->default_focus()); window_->PushToFront(); @@ -225,10 +229,10 @@ PluginAdapter* adaptor = PluginAdapter::Default(); LOG_DEBUG(logger) << "Showing the hud"; EnsureHud(); - + if (visible_ || adaptor->IsExpoActive() || adaptor->IsScaleActive()) return; - + if (adaptor->IsScreenGrabbed()) { need_show_ = true; @@ -267,7 +271,7 @@ GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "hud", FALSE, UScreen::GetDefault()->GetMonitorWithMouse()); ubus.SendMessage(UBUS_OVERLAY_SHOWN, info); - + nux::GetWindowCompositor().SetKeyFocusArea(view_->default_focus()); window_->SetEnterFocusInputArea(view_->default_focus()); } @@ -342,15 +346,18 @@ else { // ensure the text entry is focused - g_timeout_add(500, [] (gpointer data) -> gboolean + g_timeout_add(500, [] (gpointer data) -> gboolean { //THIS IS BAD - VERY VERY BAD LOG_DEBUG(logger) << "Last attempt, forcing window focus"; Controller* self = static_cast(data); - nux::GetWindowCompositor().SetKeyFocusArea(self->view_->default_focus()); - - self->window_->PushToFront(); - self->window_->SetInputFocus(); + if (self->visible_) + { + nux::GetWindowCompositor().SetKeyFocusArea(self->view_->default_focus()); + + self->window_->PushToFront(); + self->window_->SetInputFocus(); + } return FALSE; }, self); } @@ -376,7 +383,7 @@ { unsigned int timestamp = nux::GetWindowThread()->GetGraphicsDisplay().GetCurrentEvent().x11_timestamp; hud_service_.ExecuteQueryBySearch(search_string, timestamp); - HideHud(); + ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST); } void Controller::OnQueryActivated(Query::Ptr query) @@ -384,7 +391,7 @@ LOG_DEBUG(logger) << "Activating query, " << query->formatted_text; unsigned int timestamp = nux::GetWindowThread()->GetGraphicsDisplay().GetCurrentEvent().x11_timestamp; hud_service_.ExecuteQuery(query, timestamp); - HideHud(); + ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST); } void Controller::OnQuerySelected(Query::Ptr query) @@ -419,7 +426,8 @@ void Controller::AddProperties(GVariantBuilder* builder) { - g_variant_builder_add(builder, "{sv}", "visible", g_variant_new_boolean (visible_)); + variant::BuilderWrapper(builder) + .add("visible", visible_); } diff -Nru unity-5.4.0/plugins/unityshell/src/HudIconTextureSource.cpp unity-5.6.0/plugins/unityshell/src/HudIconTextureSource.cpp --- unity-5.4.0/plugins/unityshell/src/HudIconTextureSource.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/HudIconTextureSource.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -26,6 +26,10 @@ #include #include +namespace +{ + nux::logging::Logger logger("unity.hud.HudIconTextureSource"); +} namespace unity { @@ -44,46 +48,54 @@ void HudIconTextureSource::ColorForIcon(GdkPixbuf* pixbuf) { - unsigned int width = gdk_pixbuf_get_width(pixbuf); - unsigned int height = gdk_pixbuf_get_height(pixbuf); - unsigned int row_bytes = gdk_pixbuf_get_rowstride(pixbuf); - - long int rtotal = 0, gtotal = 0, btotal = 0; - float total = 0.0f; - - guchar* img = gdk_pixbuf_get_pixels(pixbuf); - - for (unsigned int i = 0; i < width; i++) + if (GDK_IS_PIXBUF(pixbuf)) { - for (unsigned int j = 0; j < height; j++) + unsigned int width = gdk_pixbuf_get_width(pixbuf); + unsigned int height = gdk_pixbuf_get_height(pixbuf); + unsigned int row_bytes = gdk_pixbuf_get_rowstride(pixbuf); + + long int rtotal = 0, gtotal = 0, btotal = 0; + float total = 0.0f; + + guchar* img = gdk_pixbuf_get_pixels(pixbuf); + + for (unsigned int i = 0; i < width; i++) { - guchar* pixels = img + (j * row_bytes + i * 4); - guchar r = *(pixels + 0); - guchar g = *(pixels + 1); - guchar b = *(pixels + 2); - guchar a = *(pixels + 3); - - float saturation = (MAX(r, MAX(g, b)) - MIN(r, MIN(g, b))) / 255.0f; - float relevance = .1 + .9 * (a / 255.0f) * saturation; - - rtotal += (guchar)(r * relevance); - gtotal += (guchar)(g * relevance); - btotal += (guchar)(b * relevance); - - total += relevance * 255; + for (unsigned int j = 0; j < height; j++) + { + guchar* pixels = img + (j * row_bytes + i * 4); + guchar r = *(pixels + 0); + guchar g = *(pixels + 1); + guchar b = *(pixels + 2); + guchar a = *(pixels + 3); + + float saturation = (MAX(r, MAX(g, b)) - MIN(r, MIN(g, b))) / 255.0f; + float relevance = .1 + .9 * (a / 255.0f) * saturation; + + rtotal += (guchar)(r * relevance); + gtotal += (guchar)(g * relevance); + btotal += (guchar)(b * relevance); + + total += relevance * 255; + } } + + nux::color::RedGreenBlue rgb(rtotal / total, + gtotal / total, + btotal / total); + nux::color::HueSaturationValue hsv(rgb); + + if (hsv.saturation > 0.15f) + hsv.saturation = 0.65f; + + hsv.value = 0.90f; + bg_color = nux::Color(nux::color::RedGreenBlue(hsv)); + } + else + { + LOG_ERROR(logger) << "Pixbuf (" << pixbuf << ") passed is non valid"; + bg_color = nux::Color(255,255,255,255); } - - nux::color::RedGreenBlue rgb(rtotal / total, - gtotal / total, - btotal / total); - nux::color::HueSaturationValue hsv(rgb); - - if (hsv.saturation > 0.15f) - hsv.saturation = 0.65f; - - hsv.value = 0.90f; - bg_color = nux::Color(nux::color::RedGreenBlue(hsv)); } nux::Color HudIconTextureSource::BackgroundColor() @@ -107,4 +119,5 @@ } } -} \ No newline at end of file +} + diff -Nru unity-5.4.0/plugins/unityshell/src/HudView.cpp unity-5.6.0/plugins/unityshell/src/HudView.cpp --- unity-5.4.0/plugins/unityshell/src/HudView.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/HudView.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -62,7 +63,7 @@ , last_known_height_(0) , current_height_(0) , timeline_need_more_draw_(false) - + , selected_button_(0) { renderer_.SetOwner(this); renderer_.need_redraw.connect([this] () { @@ -82,31 +83,37 @@ search_activated.emit(search_bar_->search_string); }); + search_bar_->text_entry()->SetLoseKeyFocusOnKeyNavDirectionUp(false); + search_bar_->text_entry()->SetLoseKeyFocusOnKeyNavDirectionDown(false); + search_bar_->text_entry()->key_nav_focus_change.connect([&](nux::Area *area, bool receiving, nux::KeyNavDirection direction) { - if (buttons_.empty() && !receiving) - { - // we lost focus in the keynav and there are no buttons, we need to steal - // focus back - LOG_ERROR(logger) << "hud search bar lost keynav with no where else to keynav to"; - nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry()); - } + // We get here when the Hud closes. + // The TextEntry should always have the keyboard focus as long as the hud is open. if (buttons_.empty()) return;// early return on empty button list if (receiving) { - // if the search_bar gets focus, fake focus the first button if it exists if (!buttons_.empty()) { + // If the search_bar gets focus, fake focus the first button if it exists buttons_.back()->fake_focused = true; } } else { - // we are losing focus, so remove the fake focused entry - buttons_.back()->fake_focused = false; + // The hud is closing and there are HudButtons visible. Remove the fake_focus. + // There should be only one HudButton with the fake_focus set to true. + std::list::iterator it; + for(it = buttons_.begin(); it != buttons_.end(); ++it) + { + if ((*it)->fake_focused) + { + (*it)->fake_focused = false; + } + } } }); @@ -212,11 +219,12 @@ void View::SetQueries(Hud::Queries queries) { // remove the previous children - for (auto button = buttons_.begin(); button != buttons_.end(); button++) + for (auto button : buttons_) { - RemoveChild((*button).GetPointer()); + RemoveChild(button.GetPointer()); } - + + selected_button_ = 0; queries_ = queries_; buttons_.clear(); button_views_->Clear(); @@ -226,15 +234,16 @@ if (found_items > 5) break; - HudButton::Ptr button = HudButton::Ptr(new HudButton()); + HudButton::Ptr button(new HudButton()); buttons_.push_front(button); button->SetQuery(*query); + button_views_->AddView(button.GetPointer(), 0, nux::MINOR_POSITION_LEFT); button->click.connect([&](nux::View* view) { query_activated.emit(dynamic_cast(view)->GetQuery()); }); - + button->key_nav_focus_activate.connect([&](nux::Area *area) { query_activated.emit(dynamic_cast(area)->GetQuery()); }); @@ -244,13 +253,16 @@ query_selected.emit(dynamic_cast(area)->GetQuery()); }); + // You should never decrement end(). We should fix this loop. button->is_rounded = (query == --(queries.end())) ? true : false; button->fake_focused = (query == (queries.begin())) ? true : false; - + button->SetMinimumWidth(941); found_items++; } - + if (found_items) + selected_button_ = 1; + QueueRelayout(); QueueDraw(); } @@ -450,7 +462,10 @@ void View::AddProperties(GVariantBuilder* builder) { - + unsigned num_buttons = buttons_.size(); + variant::BuilderWrapper(builder) + .add("selected_button", selected_button_) + .add("num_buttons", num_buttons); } bool View::InspectKeyEvent(unsigned int eventType, @@ -473,13 +488,10 @@ return false; } -nux::Area* View::FindKeyFocusArea(unsigned int key_symbol, +nux::Area* View::FindKeyFocusArea(unsigned int event_type, unsigned long x11_key_code, unsigned long special_keys_state) { - // Do what nux::View does, but if the event isn't a key navigation, - // designate the text entry to process it. - nux::KeyNavDirection direction = nux::KEY_NAV_NONE; switch (x11_key_code) { @@ -511,18 +523,118 @@ break; } - if (has_key_focus_) + + if ((event_type == nux::NUX_KEYDOWN) && (x11_key_code == NUX_VK_ESCAPE)) + { + // Escape key! This is how it works: + // -If there is text, clear it and give the focus to the text entry view. + // -If there is no text text, then close the hud. + + if (search_bar_->search_string == "") + { + search_bar_->search_hint = default_text; + ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST); + } + else + { + search_bar_->search_string = ""; + search_bar_->search_hint = default_text; + return search_bar_->text_entry(); + } + return NULL; + } + + if (search_bar_->text_entry()->HasKeyFocus()) { - return this; + if (direction == nux::KEY_NAV_NONE || + direction == nux::KEY_NAV_UP || + direction == nux::KEY_NAV_DOWN || + direction == nux::KEY_NAV_LEFT || + direction == nux::KEY_NAV_RIGHT) + { + // We have received a key character or a keyboard arrow Up or Down (navigation keys). + // Because we have called "SetLoseKeyFocusOnKeyNavDirectionUp(false);" and "SetLoseKeyFocusOnKeyNavDirectionDown(false);" + // on the text entry, the text entry will not loose the keyboard focus. + // All that we need to do here is set the fake_focused value on the HudButton. + + if (!buttons_.empty()) + { + if (event_type == nux::NUX_KEYDOWN && direction == nux::KEY_NAV_UP) + { + std::list::iterator it; + for(it = buttons_.begin(); it != buttons_.end(); ++it) + { + if ((*it)->fake_focused) + { + std::list::iterator next = it; + ++next; + if (next != buttons_.end()) + { + // The button with the current fake_focus looses it. + (*it)->fake_focused = false; + // The next button gets the fake_focus + (*next)->fake_focused = true; + query_selected.emit((*next)->GetQuery()); + --selected_button_; + } + break; + } + } + } + + if (event_type == nux::NUX_KEYDOWN && direction == nux::KEY_NAV_DOWN) + { + std::list::reverse_iterator rit; + for(rit = buttons_.rbegin(); rit != buttons_.rend(); ++rit) + { + if ((*rit)->fake_focused) + { + std::list::reverse_iterator next = rit; + ++next; + if(next != buttons_.rend()) + { + // The button with the current fake_focus looses it. + (*rit)->fake_focused = false; + // The next button bellow gets the fake_focus. + (*next)->fake_focused = true; + query_selected.emit((*next)->GetQuery()); + ++selected_button_; + } + break; + } + } + } + } + return search_bar_->text_entry(); + } + + if (direction == nux::KEY_NAV_ENTER) + { + // The "Enter" key has been received and the text entry has the key focus. + // If one of the button has the fake_focus, we get it to emit the query_activated signal. + if (!buttons_.empty()) + { + std::list::iterator it; + for(it = buttons_.begin(); it != buttons_.end(); ++it) + { + if ((*it)->fake_focused) + { + query_activated.emit((*it)->GetQuery()); + } + } + } + + // We still choose the text_entry as the receiver of the key focus. + return search_bar_->text_entry(); + } } else if (direction == nux::KEY_NAV_NONE) { - // then send the event to the search entry return search_bar_->text_entry(); } else if (next_object_to_key_focus_area_) { - return next_object_to_key_focus_area_->FindKeyFocusArea(key_symbol, x11_key_code, special_keys_state); + return next_object_to_key_focus_area_->FindKeyFocusArea(event_type, x11_key_code, special_keys_state); } return NULL; } diff -Nru unity-5.4.0/plugins/unityshell/src/HudView.h unity-5.6.0/plugins/unityshell/src/HudView.h --- unity-5.4.0/plugins/unityshell/src/HudView.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/HudView.h 2012-03-12 09:16:36.000000000 +0000 @@ -71,7 +71,7 @@ sigc::signal query_selected; protected: - virtual Area* FindKeyFocusArea(unsigned int key_symbol, + virtual Area* FindKeyFocusArea(unsigned int event_type, unsigned long x11_key_code, unsigned long special_keys_state); @@ -117,6 +117,7 @@ int last_known_height_; int current_height_; bool timeline_need_more_draw_; + int selected_button_; }; diff -Nru unity-5.4.0/plugins/unityshell/src/IMTextEntry.cpp unity-5.6.0/plugins/unityshell/src/IMTextEntry.cpp --- unity-5.4.0/plugins/unityshell/src/IMTextEntry.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/IMTextEntry.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -21,7 +21,6 @@ #include "IMTextEntry.h" -#include #include #include @@ -36,127 +35,21 @@ NUX_IMPLEMENT_OBJECT_TYPE(IMTextEntry); IMTextEntry::IMTextEntry() - : TextEntry("", "", 80085) - , preedit_string("") - , im_enabled(false) - , im_active(false) - , focused_(false) +: TextEntry("", NUX_TRACKER_LOCATION) { - g_setenv("IBUS_ENABLE_SYNC_MODE", "1", TRUE); - CheckIMEnabled(); - im_enabled ? SetupMultiIM() : SetupSimpleIM(); - - key_nav_focus_change.connect([&](nux::Area* area, bool focus, nux::KeyNavDirection dir) - { - focus ? OnFocusIn() : OnFocusOut(); - }); mouse_up.connect(sigc::mem_fun(this, &IMTextEntry::OnMouseButtonUp)); } -void IMTextEntry::CheckIMEnabled() -{ - const char* module = g_getenv("GTK_IM_MODULE"); - if (module && - g_strcmp0(module, "") && - g_strcmp0(module, "gtk-im-context-simple")) - im_enabled = true; - - LOG_DEBUG(logger) << "Input method support is " - << (im_enabled ? "enabled" : "disabled"); -} - -void IMTextEntry::SetupSimpleIM() -{ - im_context_ = gtk_im_context_simple_new(); - - sig_manager_.Add(new Signal(im_context_, "commit", sigc::mem_fun(this, &IMTextEntry::OnCommit))); - sig_manager_.Add(new Signal(im_context_, "preedit-changed", sigc::mem_fun(this, &IMTextEntry::OnPreeditChanged))); - sig_manager_.Add(new Signal(im_context_, "preedit-start", sigc::mem_fun(this, &IMTextEntry::OnPreeditStart))); - sig_manager_.Add(new Signal(im_context_, "preedit-end", sigc::mem_fun(this, &IMTextEntry::OnPreeditEnd))); -} - -void IMTextEntry::SetupMultiIM() -{ - im_context_ = gtk_im_multicontext_new(); - - sig_manager_.Add(new Signal(im_context_, "commit", sigc::mem_fun(this, &IMTextEntry::OnCommit))); - sig_manager_.Add(new Signal(im_context_, "preedit-changed", sigc::mem_fun(this, &IMTextEntry::OnPreeditChanged))); - sig_manager_.Add(new Signal(im_context_, "preedit-start", sigc::mem_fun(this, &IMTextEntry::OnPreeditStart))); - sig_manager_.Add(new Signal(im_context_, "preedit-end", sigc::mem_fun(this, &IMTextEntry::OnPreeditEnd))); -} - bool IMTextEntry::InspectKeyEvent(unsigned int event_type, unsigned int keysym, const char* character) { - bool propagate_event = !(TryHandleEvent(event_type, keysym, character)); - - LOG_DEBUG(logger) << "Input method " - << (im_enabled ? gtk_im_multicontext_get_context_id(glib::object_cast(im_context_)) : "simple") - << " " - << (propagate_event ? "did not handle " : "handled ") - << "event (" - << (event_type == NUX_KEYDOWN ? "press" : "release") - << ") "; - - if (propagate_event) - propagate_event = !TryHandleSpecial(event_type, keysym, character); - - if (propagate_event) - { - text_input_mode_ = event_type == NUX_KEYDOWN; - propagate_event = TextEntry::InspectKeyEvent(event_type, keysym, character); - text_input_mode_ = false; - - UpdateCursorLocation(); - } - return propagate_event; -} - -bool IMTextEntry::TryHandleEvent(unsigned int eventType, - unsigned int keysym, - const char* character) -{ - nux::Event event = nux::GetWindowThread()->GetGraphicsDisplay().GetCurrentEvent(); + bool need_to_filter_event = TryHandleSpecial(event_type, keysym, character); + + if (need_to_filter_event) + need_to_filter_event = TextEntry::InspectKeyEvent(event_type, keysym, character); - CheckValidClientWindow(event.x11_window); - - GdkEventKey ev; - KeyEventToGdkEventKey(event, ev); - - return gtk_im_context_filter_keypress(im_context_, &ev); -} - -inline void IMTextEntry::CheckValidClientWindow(Window window) -{ - if (!client_window_) - { - client_window_ = gdk_x11_window_foreign_new_for_display(gdk_display_get_default(), window); - gtk_im_context_set_client_window(im_context_, client_window_); - - if (focused_) - { - gtk_im_context_focus_in(im_context_); - } - } -} - -void IMTextEntry::KeyEventToGdkEventKey(Event& event, GdkEventKey& gdk_event) -{ - gdk_event.type = event.type == nux::NUX_KEYDOWN ? GDK_KEY_PRESS : GDK_KEY_RELEASE; - gdk_event.window = client_window_; - gdk_event.send_event = FALSE; - gdk_event.time = event.x11_timestamp; - gdk_event.state = event.x11_key_state; - gdk_event.keyval = event.x11_keysym; - - gchar* txt = const_cast(event.GetText()); - gdk_event.length = strlen(txt); - gdk_event.string = txt; - - gdk_event.hardware_keycode = event.x11_keycode; - gdk_event.group = 0; - gdk_event.is_modifier = 0; + return need_to_filter_event; } bool IMTextEntry::TryHandleSpecial(unsigned int eventType, unsigned int keysym, const char* character) @@ -166,13 +59,14 @@ bool shift = (event.GetKeyState() & NUX_STATE_SHIFT); bool ctrl = (event.GetKeyState() & NUX_STATE_CTRL); + /* If there is preedit, handle the event else where, but we + want to be able to copy/paste while ibus is active */ + if (!preedit_.empty()) + return true; + if (eventType != NUX_KEYDOWN) return false; - /* If IM is active, de-activate Copy & Paste */ - if (im_active) - return true; - if (((keyval == NUX_VK_x) && ctrl && !shift) || ((keyval == NUX_VK_DELETE) && shift && !ctrl)) { @@ -194,15 +88,16 @@ } else { - return false; + return true; } - return true; + return false; } void IMTextEntry::Cut() { Copy(); DeleteSelection(); + QueueRefresh (true, true); } void IMTextEntry::Copy() @@ -210,8 +105,7 @@ int start=0, end=0; if (GetSelectionBounds(&start, &end)) { - GtkClipboard* clip = gtk_clipboard_get_for_display(gdk_display_get_default(), - GDK_SELECTION_CLIPBOARD); + GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); gtk_clipboard_set_text(clip, text_.c_str() + start, end - start); } } @@ -219,124 +113,42 @@ void IMTextEntry::Paste(bool primary) { GdkAtom origin = primary ? GDK_SELECTION_PRIMARY : GDK_SELECTION_CLIPBOARD; - glib::Object clip(gtk_clipboard_get_for_display(gdk_display_get_default(), - origin)); + GtkClipboard* clip = gtk_clipboard_get(origin); + auto callback = [](GtkClipboard* clip, const char* text, gpointer user_data) { IMTextEntry* self = static_cast(user_data); if (text) - self->InsertTextAt(self->cursor_, std::string(text)); + self->InsertText(std::string(text)); }; gtk_clipboard_request_text(clip, callback, this); } -void IMTextEntry::InsertTextAt(unsigned int position, std::string const& text) +void IMTextEntry::InsertText(std::string const& text) { DeleteSelection(); if (!text.empty()) { std::string new_text(GetText()); - new_text.insert(position, text); + new_text.insert(cursor_, text); - int cursor = position; + int cursor = cursor_; SetText(new_text.c_str()); SetCursor(cursor + text.length()); - UpdateCursorLocation(); + QueueRefresh (true, true); } } -void IMTextEntry::OnCommit(GtkIMContext* context, char* str) -{ - LOG_DEBUG(logger) << "Commit: " << str; - DeleteSelection(); - - if (str) - { - InsertTextAt(cursor_, std::string(str)); - } -} - -void IMTextEntry::OnPreeditChanged(GtkIMContext* context) -{ - glib::String preedit; - int cursor_pos = -1; - - gtk_im_context_get_preedit_string(context, &preedit, &preedit_attrs_, &cursor_pos); - - LOG_DEBUG(logger) << "Preedit changed: " << preedit; - - preedit_ = preedit.Str(); - - if (!preedit.Str().empty()) { - preedit_cursor_ = preedit.Str().length(); - QueueRefresh(true, true); - sigTextChanged.emit(this); - UpdateCursorLocation(); - } -} - -void IMTextEntry::OnPreeditStart(GtkIMContext* context) -{ - im_active = true; - - LOG_DEBUG(logger) << "Preedit start"; -} - -void IMTextEntry::OnPreeditEnd(GtkIMContext* context) -{ - im_active = false; - ResetPreedit(); - gtk_im_context_reset(im_context_); - - QueueRefresh(true, true); - sigTextChanged.emit(this); - - LOG_DEBUG(logger) << "Preedit ended"; -} - -void IMTextEntry::OnFocusIn() -{ - focused_ = true; - gtk_im_context_focus_in(im_context_); - gtk_im_context_reset(im_context_); - UpdateCursorLocation(); -} - -void IMTextEntry::OnFocusOut() -{ - focused_ = false; - gtk_im_context_focus_out(im_context_); -} - -void IMTextEntry::UpdateCursorLocation() -{ - nux::Rect strong, weak; - GetCursorRects(&strong, &weak); - nux::Geometry geo = GetGeometry(); - - GdkRectangle area = { strong.x + geo.x, strong.y + geo.y, strong.width, strong.height }; - gtk_im_context_set_cursor_location(im_context_, &area); -} - void IMTextEntry::OnMouseButtonUp(int x, int y, unsigned long bflags, unsigned long kflags) { int button = nux::GetEventButton(bflags); - if (im_enabled && button == 3) - { - GtkWidget* menu = gtk_menu_new(); - gtk_im_multicontext_append_menuitems(glib::object_cast(im_context_), - GTK_MENU_SHELL(menu)); - gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, GDK_CURRENT_TIME); - } - else if (button == 2) - { - SetCursor(XYToTextIndex(x, y)); - UpdateCursorLocation(); + if (button == 2) + { + SetCursor(XYToTextIndex(x,y)); Paste(true); - } + } } - } diff -Nru unity-5.4.0/plugins/unityshell/src/IMTextEntry.h unity-5.6.0/plugins/unityshell/src/IMTextEntry.h --- unity-5.4.0/plugins/unityshell/src/IMTextEntry.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/IMTextEntry.h 2012-03-12 09:16:36.000000000 +0000 @@ -40,42 +40,15 @@ public: IMTextEntry(); - nux::Property preedit_string; - nux::Property im_enabled; - nux::Property im_active; - private: - void CheckIMEnabled(); - void SetupSimpleIM(); - void SetupMultiIM(); - bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character); - bool TryHandleEvent(unsigned int eventType, unsigned int keysym, const char* character); - void KeyEventToGdkEventKey(Event& event, GdkEventKey& gdk_event); - inline void CheckValidClientWindow(Window window); bool TryHandleSpecial(unsigned int eventType, unsigned int keysym, const char* character); - void InsertTextAt(unsigned int position, std::string const& text); + void InsertText(std::string const& text); void Cut(); void Copy(); void Paste(bool primary = false); - void OnCommit(GtkIMContext* context, char* str); - void OnPreeditChanged(GtkIMContext* context); - void OnPreeditStart(GtkIMContext* context); - void OnPreeditEnd(GtkIMContext* context); - - void OnFocusIn(); - void OnFocusOut(); - - void UpdateCursorLocation(); - void OnMouseButtonUp(int x, int y, unsigned long bflags, unsigned long kflags); - - private: - glib::SignalManager sig_manager_; - glib::Object im_context_; - glib::Object client_window_; - bool focused_; }; } diff -Nru unity-5.4.0/plugins/unityshell/src/IntrospectableWrappers.cpp unity-5.6.0/plugins/unityshell/src/IntrospectableWrappers.cpp --- unity-5.4.0/plugins/unityshell/src/IntrospectableWrappers.cpp 1970-01-01 00:00:00.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/IntrospectableWrappers.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -0,0 +1,50 @@ +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- +/* + * Copyright (C) 2012 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authored by: Thomi Richards + */ + +#include + +#include "IntrospectableWrappers.h" + +namespace unity +{ +namespace debug +{ + ResultWrapper::ResultWrapper(const dash::Result& result) + : uri_(result.uri), + name_(result.name), + icon_hint_(result.icon_hint), + mime_type_(result.mimetype) + { + } + + std::string ResultWrapper::GetName() const + { + return "Result"; + } + + void ResultWrapper::AddProperties(GVariantBuilder* builder) + { + unity::variant::BuilderWrapper(builder) + .add("uri", uri_) + .add("name", name_) + .add("icon_hint", icon_hint_) + .add("mimetype", mime_type_); + } +} +} diff -Nru unity-5.4.0/plugins/unityshell/src/IntrospectableWrappers.h unity-5.6.0/plugins/unityshell/src/IntrospectableWrappers.h --- unity-5.4.0/plugins/unityshell/src/IntrospectableWrappers.h 1970-01-01 00:00:00.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/IntrospectableWrappers.h 2012-03-12 09:16:36.000000000 +0000 @@ -0,0 +1,51 @@ +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- +/* + * Copyright (C) 2012 Canonical Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Authored by: Thomi Richards + */ + +#ifndef _INTROSPECTABLE_WRAPPERS_H +#define _INTROSPECTABLE_WRAPPERS_H + +#include + +#include "Introspectable.h" + +namespace unity +{ +namespace debug +{ + +/** Wrap a result object from UnityCore and present it's properties + * to the introspectable tree. + */ +class ResultWrapper: public Introspectable +{ +public: + ResultWrapper(const dash::Result& result); + std::string GetName() const; + void AddProperties(GVariantBuilder* builder); +private: + std::string uri_; + std::string name_; + std::string icon_hint_; + std::string mime_type_; +}; + +} +} + +#endif diff -Nru unity-5.4.0/plugins/unityshell/src/LauncherController.cpp unity-5.6.0/plugins/unityshell/src/LauncherController.cpp --- unity-5.4.0/plugins/unityshell/src/LauncherController.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LauncherController.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -908,9 +908,9 @@ pimpl->launcher_label_show_handler_id_ = g_timeout_add(local::shortcuts_show_delay, show_shortcuts, pimpl); } -void Controller::HandleLauncherKeyRelease() +void Controller::HandleLauncherKeyRelease(bool was_tap) { - if (pimpl->TapTimeUnderLimit()) + if (pimpl->TapTimeUnderLimit() && was_tap) { pimpl->SendHomeActivationRequest(); } @@ -1022,7 +1022,6 @@ pimpl->launcher_keynav = true; pimpl->keynav_restore_window_ = true; pimpl->keyboard_launcher_ = pimpl->launchers[pimpl->MonitorWithMouse()]; - pimpl->keyboard_launcher_->ShowShortcuts(false); pimpl->keyboard_launcher_->EnterKeyNavMode(); pimpl->model_->SetSelection(0); @@ -1087,7 +1086,8 @@ .add("key_nav_is_active", KeyNavIsActive()) .add("key_nav_launcher_monitor", pimpl->keyboard_launcher_.IsValid() ? pimpl->keyboard_launcher_->monitor : -1) .add("key_nav_selection", pimpl->model_->SelectionIndex()) - .add("key_nav_is_grabbed", pimpl->launcher_grabbed); + .add("key_nav_is_grabbed", pimpl->launcher_grabbed) + .add("keyboard_launcher", pimpl->launchers[pimpl->MonitorWithMouse()]->monitor); } void Controller::Impl::ReceiveLauncherKeyPress(unsigned long eventType, diff -Nru unity-5.4.0/plugins/unityshell/src/LauncherController.h unity-5.6.0/plugins/unityshell/src/LauncherController.h --- unity-5.4.0/plugins/unityshell/src/LauncherController.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LauncherController.h 2012-03-12 09:16:36.000000000 +0000 @@ -60,7 +60,7 @@ void SetShowDesktopIcon(bool show_desktop_icon); void HandleLauncherKeyPress(); - void HandleLauncherKeyRelease(); + void HandleLauncherKeyRelease(bool was_tap); bool HandleLauncherKeyEvent(Display *display, unsigned int key_sym, unsigned long key_code, diff -Nru unity-5.4.0/plugins/unityshell/src/Launcher.cpp unity-5.6.0/plugins/unityshell/src/Launcher.cpp --- unity-5.4.0/plugins/unityshell/src/Launcher.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/Launcher.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -407,7 +407,8 @@ .add("quicklist-open", _hide_machine->GetQuirk(LauncherHideMachine::QUICKLIST_OPEN)) .add("hide-quirks", _hide_machine->DebugHideQuirks().c_str()) .add("hover-quirks", _hover_machine->DebugHoverQuirks().c_str()) - .add("icon-size", _icon_size); + .add("icon-size", _icon_size) + .add("shortcuts_shown", _shortcuts_shown); } void Launcher::SetMousePosition(int x, int y) @@ -1015,7 +1016,8 @@ float center_transit_progress = IconCenterTransitionProgress(icon, current); if (center_transit_progress <= 1.0f) { - centerOffset.y = (icon->GetSavedCenter(monitor).y - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress); + int saved_center = icon->GetSavedCenter(monitor).y - parent_abs_geo.y; + centerOffset.y = (saved_center - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress); } center.y += half_size * size_modifier; // move to center @@ -2009,7 +2011,12 @@ void Launcher::StartIconDragRequest(int x, int y) { - AbstractLauncherIcon::Ptr drag_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y); + nux::Geometry geo = GetAbsoluteGeometry(); + AbstractLauncherIcon::Ptr drag_icon = MouseIconIntersection((int)(GetGeometry().width / 2.0f), y); + + x += geo.x; + y += geo.y; + // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying // on an internal Launcher property then @@ -2020,7 +2027,7 @@ UpdateDragWindowPosition(drag_icon->GetCenter(monitor).x, drag_icon->GetCenter(monitor).y); if (_initial_drag_animation) { - _drag_window->SetAnimationTarget(x, y + _drag_window->GetGeometry().height / 2); + _drag_window->SetAnimationTarget(x, y); _drag_window->StartAnimation(); } EnsureAnimation(); @@ -2107,9 +2114,9 @@ if (_drag_window) { nux::Geometry geo = _drag_window->GetGeometry(); - _drag_window->SetBaseXY(x - geo.width / 2 + _parent->GetGeometry().x, y - geo.height / 2 + _parent->GetGeometry().y); + _drag_window->SetBaseXY(x - geo.width / 2, y - geo.height / 2); - AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection((int)(GetGeometry().x / 2.0f), y); + AbstractLauncherIcon::Ptr hovered_icon = MouseIconIntersection((int)((GetGeometry().x + GetGeometry().width) / 2.0f), y - GetAbsoluteGeometry().y); struct timespec current; clock_gettime(CLOCK_MONOTONIC, ¤t); @@ -2203,7 +2210,8 @@ } else if (GetActionState() == ACTION_DRAG_ICON) { - UpdateDragWindowPosition(x, y); + nux::Geometry geo = GetAbsoluteGeometry(); + UpdateDragWindowPosition(geo.x + x, geo.y + y); } EnsureAnimation(); @@ -2290,6 +2298,21 @@ if (apply_to_reveal) { + int root_x_return, root_y_return, win_x_return, win_y_return; + unsigned int mask_return; + Window root_return, child_return; + Display *dpy = nux::GetGraphicsDisplay()->GetX11Display(); + + if (XQueryPointer (dpy, DefaultRootWindow(dpy), &root_return, &child_return, &root_x_return, + &root_y_return, &win_x_return, &win_y_return, &mask_return)) + { + if (mask_return & (Button1Mask | Button3Mask)) + apply_to_reveal = false; + } + } + + if (apply_to_reveal) + { _hide_machine->AddRevealPressure(event->velocity); decaymulator_->value = 0; } diff -Nru unity-5.4.0/plugins/unityshell/src/LauncherIcon.cpp unity-5.6.0/plugins/unityshell/src/LauncherIcon.cpp --- unity-5.4.0/plugins/unityshell/src/LauncherIcon.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LauncherIcon.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -99,7 +99,7 @@ // FIXME: the abstraction is already broken, should be fixed for O // right now, hooking the dynamic quicklist the less ugly possible way - + mouse_enter.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseEnter)); mouse_leave.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseLeave)); @@ -149,7 +149,7 @@ _tooltip = new Tooltip(); AddChild(_tooltip.GetPointer()); - _tooltip->SetText(nux::NString(tooltip_text().c_str())); + _tooltip->SetText(tooltip_text()); } void LauncherIcon::LoadQuicklist() @@ -454,7 +454,7 @@ { target = escaped; if (_tooltip) - _tooltip->SetText(nux::NString(target.c_str())); + _tooltip->SetText(target); result = true; } diff -Nru unity-5.4.0/plugins/unityshell/src/LauncherModel.cpp unity-5.6.0/plugins/unityshell/src/LauncherModel.cpp --- unity-5.4.0/plugins/unityshell/src/LauncherModel.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LauncherModel.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -215,7 +215,10 @@ void LauncherModel::ReorderAfter(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other) { - if (icon == other) + if (icon == other || icon.IsNull() || other.IsNull()) + return; + + if (icon->GetIconType() != other->GetIconType()) return; int i = 0; @@ -245,7 +248,10 @@ void LauncherModel::ReorderBefore(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save) { - if (icon == other) + if (icon == other || icon.IsNull() || other.IsNull()) + return; + + if (icon->GetIconType() != other->GetIconType()) return; int i = 0; @@ -286,7 +292,10 @@ void LauncherModel::ReorderSmart(AbstractLauncherIcon::Ptr icon, AbstractLauncherIcon::Ptr other, bool save) { - if (icon == other) + if (icon == other || icon.IsNull() || other.IsNull()) + return; + + if (icon->GetIconType() != other->GetIconType()) return; int i = 0; diff -Nru unity-5.4.0/plugins/unityshell/src/LensBar.cpp unity-5.6.0/plugins/unityshell/src/LensBar.cpp --- unity-5.4.0/plugins/unityshell/src/LensBar.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LensBar.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -31,8 +31,9 @@ nux::logging::Logger logger("unity.dash.lensbar"); -const int FOCUS_OVERLAY_WIDTH = 56; -const int FOCUS_OVERLAY_HEIGHT = 40; +const int FOCUS_OVERLAY_WIDTH = 60; +const int FOCUS_OVERLAY_HEIGHT = 44; +const int LENSBAR_HEIGHT = 44; } @@ -52,7 +53,6 @@ if (!focus_layer_) { focus_layer_.reset(Style::Instance().FocusOverlay(FOCUS_OVERLAY_WIDTH, FOCUS_OVERLAY_HEIGHT)); - over_layer_.reset(Style::Instance().FocusOverlay(FOCUS_OVERLAY_WIDTH, FOCUS_OVERLAY_HEIGHT)); } } @@ -72,8 +72,8 @@ layout_->SetSpaceBetweenChildren(40); SetLayout(layout_); - SetMinimumHeight(46); - SetMaximumHeight(46); + SetMinimumHeight(LENSBAR_HEIGHT); + SetMaximumHeight(LENSBAR_HEIGHT); } void LensBar::SetupHomeLens() @@ -85,8 +85,6 @@ layout_->AddView(icon, 0, nux::eCenter, nux::MINOR_SIZE_FULL); icon->mouse_click.connect([&, icon] (int x, int y, unsigned long button, unsigned long keyboard) { SetActive(icon); QueueDraw(); }); - icon->mouse_enter.connect([&] (int x, int y, unsigned long button, unsigned long keyboard) { QueueDraw(); }); - icon->mouse_leave.connect([&] (int x, int y, unsigned long button, unsigned long keyboard) { QueueDraw(); }); icon->mouse_down.connect([&] (int x, int y, unsigned long button, unsigned long keyboard) { QueueDraw(); }); icon->key_nav_focus_change.connect([&](nux::Area*, bool, nux::KeyNavDirection){ QueueDraw(); }); icon->key_nav_focus_activate.connect([&, icon](nux::Area*){ SetActive(icon); }); @@ -101,8 +99,6 @@ layout_->AddView(icon, 0, nux::eCenter, nux::eFix); icon->mouse_click.connect([&, icon] (int x, int y, unsigned long button, unsigned long keyboard) { SetActive(icon); QueueDraw(); }); - icon->mouse_enter.connect([&] (int x, int y, unsigned long button, unsigned long keyboard) { QueueDraw(); }); - icon->mouse_leave.connect([&] (int x, int y, unsigned long button, unsigned long keyboard) { QueueDraw(); }); icon->mouse_down.connect([&] (int x, int y, unsigned long button, unsigned long keyboard) { QueueDraw(); }); icon->key_nav_focus_change.connect([&](nux::Area*, bool, nux::KeyNavDirection){ QueueDraw(); }); icon->key_nav_focus_activate.connect([&, icon](nux::Area*){ SetActive(icon); }); @@ -132,8 +128,7 @@ for (auto icon : icons_) { - if ((icon->HasKeyFocus() || icon->IsMouseInside()) && - focus_layer_ && over_layer_) + if (icon->HasKeyFocus() && focus_layer_) { nux::Geometry geo(icon->GetGeometry()); @@ -143,7 +138,7 @@ geo.width = FOCUS_OVERLAY_WIDTH; geo.height = FOCUS_OVERLAY_HEIGHT; - nux::AbstractPaintLayer* layer = icon->HasKeyFocus() ? focus_layer_.get() : over_layer_.get(); + nux::AbstractPaintLayer* layer = focus_layer_.get(); layer->SetGeometry(geo); layer->Renderlayer(gfx_context); @@ -155,17 +150,18 @@ void LensBar::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw) { - gfx_context.PushClippingRectangle(GetGeometry()); + nux::Geometry const& base = GetGeometry(); + + gfx_context.PushClippingRectangle(base); if (!IsFullRedraw()) nux::GetPainter().PushLayer(gfx_context, bg_layer_->GetGeometry(), bg_layer_.get()); for (auto icon: icons_) { - if ((icon->HasKeyFocus() || icon->IsMouseInside()) && !IsFullRedraw() - && focus_layer_ && over_layer_) + if (icon->HasKeyFocus() && !IsFullRedraw() && focus_layer_) { - nux::AbstractPaintLayer* layer = icon->HasKeyFocus() ? focus_layer_.get() : over_layer_.get(); + nux::AbstractPaintLayer* layer = focus_layer_.get(); nux::GetPainter().PushLayer(gfx_context, focus_layer_->GetGeometry(), layer); } @@ -176,6 +172,28 @@ if (!IsFullRedraw()) nux::GetPainter().PopBackground(); + for (auto icon: icons_) + { + if (icon->active) + { + nux::Geometry const& geo = icon->GetGeometry(); + int middle = geo.x + geo.width/2; + int size = 5; + // Nux doesn't draw too well the small triangles, so let's draw a + // bigger one and clip part of them using the "-1". + int y = base.y - 1; + + nux::GetPainter().Draw2DTriangleColor(gfx_context, + middle - size, y, + middle, y + size, + middle + size, y, + nux::color::White); + + break; + + } + } + gfx_context.PopClippingRectangle(); } diff -Nru unity-5.4.0/plugins/unityshell/src/LensBar.h unity-5.6.0/plugins/unityshell/src/LensBar.h --- unity-5.4.0/plugins/unityshell/src/LensBar.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LensBar.h 2012-03-12 09:16:36.000000000 +0000 @@ -81,7 +81,6 @@ nux::HLayout* layout_; LayerPtr bg_layer_; LayerPtr focus_layer_; - LayerPtr over_layer_; }; } // namespace dash diff -Nru unity-5.4.0/plugins/unityshell/src/LensBarIcon.cpp unity-5.6.0/plugins/unityshell/src/LensBarIcon.cpp --- unity-5.4.0/plugins/unityshell/src/LensBarIcon.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LensBarIcon.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -41,6 +41,7 @@ SetAcceptKeyNavFocus(true); SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(true); active.changed.connect(sigc::mem_fun(this, &LensBarIcon::OnActiveChanged)); } diff -Nru unity-5.4.0/plugins/unityshell/src/LensView.cpp unity-5.6.0/plugins/unityshell/src/LensView.cpp --- unity-5.4.0/plugins/unityshell/src/LensView.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LensView.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -48,6 +48,8 @@ public: LensScrollView(nux::VScrollBar* scroll_bar, NUX_FILE_LINE_DECL) : nux::ScrollView(NUX_FILE_LINE_PARAM) + , right_area_(nullptr) + , up_area_(nullptr) { SetVScrollBar(scroll_bar); } @@ -79,6 +81,35 @@ ScrollDown (1, size); } } + + void SetRightArea(nux::Area* area) + { + right_area_ = area; + } + + void SetUpArea(nux::Area* area) + { + up_area_ = area; + } + +protected: + + // This is so we can break the natural key navigation path. + nux::Area* KeyNavIteration(nux::KeyNavDirection direction) + { + nux::Area* focus_area = nux::GetWindowCompositor().GetKeyFocusArea(); + + if (direction == nux::KEY_NAV_RIGHT && focus_area && focus_area->IsChildOf(this)) + return right_area_; + else if (direction == nux::KEY_NAV_UP && focus_area && focus_area->IsChildOf(this)) + return up_area_; + else + return nux::ScrollView::KeyNavIteration(direction); + } + +private: + nux::Area* right_area_; + nux::Area* up_area_; }; @@ -92,7 +123,7 @@ , fix_renderering_id_(0) {} -LensView::LensView(Lens::Ptr lens) +LensView::LensView(Lens::Ptr lens, nux::Area* show_filters) : nux::View(NUX_TRACKER_LOCATION) , search_string("") , filters_expanded(false) @@ -101,7 +132,7 @@ , initial_activation_(true) , fix_renderering_id_(0) { - SetupViews(); + SetupViews(show_filters); SetupCategories(); SetupResults(); SetupFilters(); @@ -124,7 +155,7 @@ { if (category->GetLayout() != nullptr) { - auto expand_label = category->GetExpandLabel(); + auto expand_label = category->GetHeaderFocusableView(); auto child = category->GetChildView(); if ((child && child->HasKeyFocus()) || @@ -149,7 +180,7 @@ g_source_remove(fix_renderering_id_); } -void LensView::SetupViews() +void LensView::SetupViews(nux::Area* show_filters) { layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); @@ -161,18 +192,21 @@ scroll_layout_ = new nux::VLayout(NUX_TRACKER_LOCATION); scroll_view_->SetLayout(scroll_layout_); + scroll_view_->SetRightArea(show_filters); fscroll_view_ = new LensScrollView(new PlacesVScrollBar(NUX_TRACKER_LOCATION), NUX_TRACKER_LOCATION); fscroll_view_->EnableVerticalScrollBar(true); fscroll_view_->EnableHorizontalScrollBar(false); fscroll_view_->SetVisible(false); + fscroll_view_->SetUpArea(show_filters); layout_->AddView(fscroll_view_, 1); fscroll_layout_ = new nux::VLayout(); fscroll_view_->SetLayout(fscroll_layout_); filter_bar_ = new FilterBar(); + AddChild(filter_bar_); fscroll_layout_->AddView(filter_bar_); SetLayout(layout_); @@ -398,6 +432,11 @@ return lens_; } +nux::Area* LensView::fscroll_view() const +{ + return fscroll_view_; +} + int LensView::GetNumRows() { unsigned int columns = dash::Style::Instance().GetDefaultNColumns(); @@ -461,7 +500,11 @@ } void LensView::AddProperties(GVariantBuilder* builder) -{} +{ + unity::variant::BuilderWrapper(builder) + .add("name", lens_->id) + .add("lens-name", lens_->name); +} } diff -Nru unity-5.4.0/plugins/unityshell/src/LensView.h unity-5.6.0/plugins/unityshell/src/LensView.h --- unity-5.4.0/plugins/unityshell/src/LensView.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/LensView.h 2012-03-12 09:16:36.000000000 +0000 @@ -50,10 +50,14 @@ public: LensView(); - LensView(Lens::Ptr lens); - virtual ~LensView(); + LensView(Lens::Ptr lens, nux::Area* show_filters); + ~LensView(); + CategoryGroups& categories() { return categories_; } + FilterBar* filter_bar() const { return filter_bar_; } Lens::Ptr lens() const; + nux::Area* fscroll_view() const; + int GetNumRows(); virtual void ActivateFirst(); @@ -66,7 +70,7 @@ sigc::signal uri_activated; private: - void SetupViews(); + void SetupViews(nux::Area* show_filters); void SetupCategories(); void SetupResults(); void SetupFilters(); diff -Nru unity-5.4.0/plugins/unityshell/src/PanelController.cpp unity-5.6.0/plugins/unityshell/src/PanelController.cpp --- unity-5.4.0/plugins/unityshell/src/PanelController.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/PanelController.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -22,6 +22,7 @@ #include #include #include +#include #include "UScreen.h" #include "PanelView.h" @@ -369,7 +370,8 @@ void Controller::AddProperties(GVariantBuilder* builder) { - g_variant_builder_add(builder, "{sv}", "opacity", g_variant_new_double(pimpl->opacity())); + variant::BuilderWrapper(builder) + .add("opacity", pimpl->opacity()); } void Controller::OnScreenChanged(int primary_monitor, std::vector& monitors) diff -Nru unity-5.4.0/plugins/unityshell/src/PanelMenuView.cpp unity-5.6.0/plugins/unityshell/src/PanelMenuView.cpp --- unity-5.4.0/plugins/unityshell/src/PanelMenuView.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/PanelMenuView.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -61,9 +61,9 @@ _util_cg(CAIRO_FORMAT_ARGB32, 1, 1), _gradient_texture(nullptr), _is_inside(false), + _is_grabbed(false), _is_maximized(false), _is_own_window(false), - _is_grabbed(false), _last_active_view(nullptr), _new_application(nullptr), _last_width(0), diff -Nru unity-5.4.0/plugins/unityshell/src/PlacesGroup.cpp unity-5.6.0/plugins/unityshell/src/PlacesGroup.cpp --- unity-5.4.0/plugins/unityshell/src/PlacesGroup.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/PlacesGroup.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -43,6 +43,7 @@ #include "DashStyle.h" #include "ubus-server.h" #include "UBusMessages.h" + #include "Introspectable.h" namespace unity { @@ -69,6 +70,8 @@ HeaderView(NUX_FILE_LINE_DECL) : nux::View(NUX_FILE_LINE_PARAM) { + SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(true); } protected: @@ -84,7 +87,17 @@ bool AcceptKeyNavFocus() { - return false; + return true; + } + + nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) + { + bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type); + + if (mouse_inside == false) + return nullptr; + + return this; } }; @@ -102,6 +115,9 @@ _n_total_items(0), _draw_sep(true) { + SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(false); + nux::BaseTexture* arrow = dash::Style::Instance().GetGroupUnexpandIcon(); _cached_name = NULL; @@ -151,26 +167,24 @@ SetLayout(_group_layout); // don't need to disconnect these signals as they are disconnected when this object destroys the contents - _header_view->mouse_enter.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseEnter)); - _header_view->mouse_leave.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseLeave)); _header_view->mouse_click.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseClick)); + _header_view->key_nav_focus_change.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelFocusChanged)); + _header_view->key_nav_focus_activate.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelActivated)); _icon->mouse_click.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseClick)); - _icon->mouse_enter.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseEnter)); - _icon->mouse_leave.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseLeave)); - _icon->key_nav_focus_change.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelFocusChanged)); _name->mouse_click.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseClick)); - _name->mouse_enter.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseEnter)); - _name->mouse_leave.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseLeave)); - _name->key_nav_focus_change.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelFocusChanged)); _expand_label->mouse_click.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseClick)); - _expand_label->mouse_enter.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseEnter)); - _expand_label->mouse_leave.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseLeave)); - _expand_label->key_nav_focus_activate.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelActivated)); - _expand_label->key_nav_focus_change.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelFocusChanged)); _expand_icon->mouse_click.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseClick)); - _expand_icon->mouse_enter.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseEnter)); - _expand_icon->mouse_leave.connect(sigc::mem_fun(this, &PlacesGroup::RecvMouseLeave)); - _expand_icon->key_nav_focus_change.connect(sigc::mem_fun(this, &PlacesGroup::OnLabelFocusChanged)); + + key_nav_focus_change.connect([&](nux::Area* area, bool has_focus, nux::KeyNavDirection direction) + { + if (!has_focus) + return; + + if(direction == nux::KEY_NAV_UP) + nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction); + else + nux::GetWindowCompositor().SetKeyFocusArea(GetHeaderFocusableView(), direction); + }); } PlacesGroup::~PlacesGroup() @@ -193,8 +207,11 @@ void PlacesGroup::OnLabelFocusChanged(nux::Area* label, bool has_focus, nux::KeyNavDirection direction) { - _ubus.SendMessage(UBUS_RESULT_VIEW_KEYNAV_CHANGED, - g_variant_new("(iiii)", 0, -30, 0, -30)); + if (HeaderHasKeyFocus()) + { + _ubus.SendMessage(UBUS_RESULT_VIEW_KEYNAV_CHANGED, + g_variant_new("(iiii)", 0, 0, 0, 0)); + } QueueDraw(); } @@ -239,6 +256,9 @@ void PlacesGroup::SetChildView(nux::View* view) { + debug::Introspectable *i = dynamic_cast(view); + if (i) + AddChild(i); _child_view = view; _group_layout->AddView(_child_view, 1); QueueDraw(); @@ -291,20 +311,6 @@ _expand_label->SetText(final); _expand_label->SetVisible(_n_visible_items_in_unexpand_mode < _n_total_items); - _icon->SetAcceptKeyNavFocus(false); - _name->SetAcceptKeyNavFocus(false); - _expand_label->SetAcceptKeyNavFocus(false); - _expand_icon->SetAcceptKeyNavFocus(false); - - if (_expand_label->IsVisible()) - _expand_label->SetAcceptKeyNavFocus(true); - else if (_expand_icon->IsVisible()) - _expand_icon->SetAcceptKeyNavFocus(true); - else if (_name->IsVisible()) - _name->SetAcceptKeyNavFocus(true); - else if (_icon->IsVisible()) - _icon->SetAcceptKeyNavFocus(true); - QueueDraw(); g_free((result_string)); @@ -492,16 +498,22 @@ bool PlacesGroup::HeaderHasKeyFocus() const { - return (_icon && _icon->HasKeyFocus()) || - (_name && _name->HasKeyFocus()) || - (_expand_label && _expand_label->HasKeyFocus()) || - (_expand_icon && _expand_icon->HasKeyFocus()); + return (_header_view && _header_view->HasKeyFocus()); +} + +bool PlacesGroup::HeaderIsFocusable() const +{ + return (_header_view != nullptr); +} + +nux::View* PlacesGroup::GetHeaderFocusableView() const +{ + return _header_view; } bool PlacesGroup::ShouldBeHighlighted() const { - return (_header_view && _header_view->IsMousePointerInside()) || - HeaderHasKeyFocus(); + return HeaderHasKeyFocus(); } // @@ -510,7 +522,7 @@ bool PlacesGroup::AcceptKeyNavFocus() { - return false; + return true; } // @@ -531,6 +543,9 @@ wrapper.add("header-height", _header_view->GetAbsoluteHeight()); wrapper.add("header-has-keyfocus", HeaderHasKeyFocus()); wrapper.add("header-is-highlighted", ShouldBeHighlighted()); + wrapper.add("name", _name->GetText()); + wrapper.add("is-visible", IsVisible()); + wrapper.add("is-expanded", GetExpanded()); } } // namespace unity diff -Nru unity-5.4.0/plugins/unityshell/src/PlacesGroup.h unity-5.6.0/plugins/unityshell/src/PlacesGroup.h --- unity-5.4.0/plugins/unityshell/src/PlacesGroup.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/PlacesGroup.h 2012-03-12 09:16:36.000000000 +0000 @@ -67,6 +67,8 @@ bool GetExpanded() const; int GetHeaderHeight() const; + bool HeaderIsFocusable() const; + nux::View* GetHeaderFocusableView() const; void SetDrawSeparator(bool draw_it); diff -Nru unity-5.4.0/plugins/unityshell/src/PluginAdapter.cpp unity-5.6.0/plugins/unityshell/src/PluginAdapter.cpp --- unity-5.4.0/plugins/unityshell/src/PluginAdapter.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/PluginAdapter.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -579,6 +579,7 @@ CompWindow* top_window_on_monitor = NULL; bool any_on_current = false; bool any_mapped = false; + bool any_mapped_on_current = false; bool forced_unminimize = false; /* sort the list */ @@ -596,6 +597,11 @@ if (win->defaultViewport() == m_Screen->vp()) { any_on_current = true; + + if (!win->minimized()) + { + any_mapped_on_current = true; + } } if (!win->minimized()) @@ -644,7 +650,7 @@ if (!is_mapped) win->raise (); } - else if ((any_mapped && !win->minimized()) || !any_mapped) + else if ((any_mapped_on_current && !win->minimized()) || !any_mapped_on_current) { if (!forced_unminimize || target_vp == m_Screen->vp()) { diff -Nru unity-5.4.0/plugins/unityshell/src/PreviewBase.h unity-5.6.0/plugins/unityshell/src/PreviewBase.h --- unity-5.4.0/plugins/unityshell/src/PreviewBase.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/PreviewBase.h 2012-03-12 09:16:36.000000000 +0000 @@ -28,8 +28,6 @@ #include #include -#include "FilterWidget.h" - namespace unity { class PreviewBase : public nux::View diff -Nru unity-5.4.0/plugins/unityshell/src/PreviewBasicButton.h unity-5.6.0/plugins/unityshell/src/PreviewBasicButton.h --- unity-5.4.0/plugins/unityshell/src/PreviewBasicButton.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/PreviewBasicButton.h 2012-03-12 09:16:36.000000000 +0000 @@ -27,7 +27,6 @@ #include #include #include -#include "FilterWidget.h" namespace unity { diff -Nru unity-5.4.0/plugins/unityshell/src/QuicklistView.cpp unity-5.6.0/plugins/unityshell/src/QuicklistView.cpp --- unity-5.4.0/plugins/unityshell/src/QuicklistView.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/QuicklistView.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include "CairoTexture.h" @@ -55,7 +56,7 @@ QuicklistView::QuicklistView() : _anchorX(0) , _anchorY(0) - , _labelText(TEXT("QuicklistView 1234567890")) + , _labelText("QuicklistView 1234567890") , _top_size(4) , _mouse_down(false) , _enable_quicklist_for_testing(false) @@ -1345,7 +1346,7 @@ { } -void QuicklistView::SetText(nux::NString text) +void QuicklistView::SetText(std::string const& text) { if (_labelText == text) return; @@ -1399,11 +1400,12 @@ void QuicklistView::AddProperties(GVariantBuilder* builder) { - g_variant_builder_add(builder, "{sv}", "x", g_variant_new_int32(GetBaseX())); - g_variant_builder_add(builder, "{sv}", "y", g_variant_new_int32(GetBaseY())); - g_variant_builder_add(builder, "{sv}", "width", g_variant_new_int32(GetBaseWidth())); - g_variant_builder_add(builder, "{sv}", "height", g_variant_new_int32(GetBaseHeight())); - g_variant_builder_add(builder, "{sv}", "active", g_variant_new_boolean(IsVisible())); + variant::BuilderWrapper(builder) + .add("x", GetBaseX()) + .add("y", GetBaseY()) + .add("width", GetBaseWidth()) + .add("height", GetBaseHeight()) + .add("active", IsVisible()); } // diff -Nru unity-5.4.0/plugins/unityshell/src/QuicklistView.h unity-5.6.0/plugins/unityshell/src/QuicklistView.h --- unity-5.4.0/plugins/unityshell/src/QuicklistView.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/QuicklistView.h 2012-03-12 09:16:36.000000000 +0000 @@ -45,7 +45,7 @@ QuicklistView(); ~QuicklistView(); - void SetText(nux::NString text); + void SetText(std::string const& text); void RemoveAllMenuItem(); @@ -135,7 +135,7 @@ //nux::CairoGraphics* _cairo_graphics; int _anchorX; int _anchorY; - nux::NString _labelText; + std::string _labelText; int _top_size; // size of the segment from point 13 to 14. See figure in ql_compute_full_mask_path. bool _mouse_down; diff -Nru unity-5.4.0/plugins/unityshell/src/ResultView.cpp unity-5.6.0/plugins/unityshell/src/ResultView.cpp --- unity-5.4.0/plugins/unityshell/src/ResultView.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/ResultView.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -22,6 +22,7 @@ #include "ResultView.h" +#include "IntrospectableWrappers.h" #include #include @@ -67,6 +68,8 @@ ResultView::~ResultView() { + ClearIntrospectableWrappers(); + for (auto result : results_) { renderer_->Unload(result); @@ -221,5 +224,37 @@ GfxContent.PopClippingRectangle(); } +std::string ResultView::GetName() const +{ + return "ResultView"; +} + +void ResultView::AddProperties(GVariantBuilder* builder) +{ + unity::variant::BuilderWrapper(builder) + .add("expanded", expanded); +} + +debug::Introspectable::IntrospectableList const& ResultView::GetIntrospectableChildren() +{ + ClearIntrospectableWrappers(); + + for (auto result: results_) + { + introspectable_children_.push_back(new debug::ResultWrapper(result)); + } + return introspectable_children_; +} + +void ResultView::ClearIntrospectableWrappers() +{ + // delete old results, then add new results + for (auto old_result: introspectable_children_) + { + delete old_result; + } + introspectable_children_.clear(); +} + } } diff -Nru unity-5.4.0/plugins/unityshell/src/ResultViewGrid.cpp unity-5.6.0/plugins/unityshell/src/ResultViewGrid.cpp --- unity-5.4.0/plugins/unityshell/src/ResultViewGrid.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/ResultViewGrid.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -361,15 +361,19 @@ int total_rows = std::ceil(results_.size() / static_cast(items_per_row)); // items per row is always at least 1 total_rows = (expanded) ? total_rows : 1; // restrict to one row if not expanded - // check for edge cases where we want the keynav to bubble up - if (direction == nux::KEY_NAV_UP && selected_index_ < items_per_row) + // check for edge cases where we want the keynav to bubble up + if (direction == nux::KEY_NAV_LEFT && (selected_index_ % items_per_row == 0)) + return false; // pressed left on the first item, no diiice + else if (direction == nux::KEY_NAV_RIGHT && (selected_index_ == static_cast(results_.size() - 1))) + return false; // pressed right on the last item, nope. nothing for you + else if (direction == nux::KEY_NAV_RIGHT && (selected_index_ % items_per_row) == (items_per_row - 1)) + return false; // pressed right on the last item in the first row in non expanded mode. nothing doing. + else if (direction == nux::KEY_NAV_UP && selected_index_ < items_per_row) return false; // key nav up when already on top row else if (direction == nux::KEY_NAV_DOWN && selected_index_ >= (total_rows-1) * items_per_row) return false; // key nav down when on bottom row - else - return true; - return false; + return true; } bool ResultViewGrid::AcceptKeyNavFocus() @@ -522,9 +526,14 @@ focused_y = (renderer_->height + vertical_spacing) * (selected_index_ / items_per_row); } - ubus_.SendMessage(UBUS_RESULT_VIEW_KEYNAV_CHANGED, - g_variant_new("(iiii)", focused_x, focused_y, renderer_->width(), renderer_->height())); + if (direction != nux::KEY_NAV_NONE) + { + ubus_.SendMessage(UBUS_RESULT_VIEW_KEYNAV_CHANGED, + g_variant_new("(iiii)", focused_x, focused_y, renderer_->width(), renderer_->height())); + } + selection_change.emit(); + } else { @@ -629,11 +638,7 @@ break; ResultRenderer::ResultRendererState state = ResultRenderer::RESULT_RENDERER_NORMAL; - if ((int)(index) == mouse_over_index_) - { - state = ResultRenderer::RESULT_RENDERER_PRELIGHT; - } - else if ((int)(index) == selected_index_) + if ((int)(index) == selected_index_) { state = ResultRenderer::RESULT_RENDERER_SELECTED; } @@ -699,8 +704,12 @@ void ResultViewGrid::MouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags) { uint index = GetIndexAtPosition(x, y); - mouse_over_index_ = index; + if (mouse_over_index_ != index) + { + selected_index_ = mouse_over_index_ = index; + nux::GetWindowCompositor().SetKeyFocusArea(this); + } mouse_last_x_ = x; mouse_last_y_ = y; diff -Nru unity-5.4.0/plugins/unityshell/src/ResultViewGrid.h unity-5.6.0/plugins/unityshell/src/ResultViewGrid.h --- unity-5.4.0/plugins/unityshell/src/ResultViewGrid.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/ResultViewGrid.h 2012-03-12 09:16:36.000000000 +0000 @@ -87,7 +87,7 @@ void PositionPreview(); uint GetIndexAtPosition(int x, int y); - int mouse_over_index_; + uint mouse_over_index_; int active_index_; int selected_index_; uint preview_row_; diff -Nru unity-5.4.0/plugins/unityshell/src/ResultView.h unity-5.6.0/plugins/unityshell/src/ResultView.h --- unity-5.4.0/plugins/unityshell/src/ResultView.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/ResultView.h 2012-03-12 09:16:36.000000000 +0000 @@ -30,6 +30,7 @@ #include #include +#include "Introspectable.h" #include "PreviewBase.h" #include "ResultRenderer.h" @@ -37,7 +38,7 @@ { namespace dash { -class ResultView : public nux::View +class ResultView : public nux::View, public debug::Introspectable { public: NUX_DECLARE_OBJECT_TYPE(ResultView, nux::View); @@ -60,6 +61,10 @@ sigc::signal UriActivated; sigc::signal ChangePreview; // request a new preview, string is the uri + std::string GetName() const; + void AddProperties(GVariantBuilder* builder); + IntrospectableList const& GetIntrospectableChildren(); + protected: virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); @@ -71,6 +76,10 @@ std::string preview_result_uri_; ResultRenderer* renderer_; ResultList results_; + IntrospectableList introspectable_children_; + +private: + void ClearIntrospectableWrappers(); }; } diff -Nru unity-5.4.0/plugins/unityshell/src/SearchBar.cpp unity-5.6.0/plugins/unityshell/src/SearchBar.cpp --- unity-5.4.0/plugins/unityshell/src/SearchBar.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/SearchBar.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -62,19 +62,20 @@ { nux::logging::Logger logger("unity"); - + class ExpanderView : public nux::View { public: ExpanderView(NUX_FILE_LINE_DECL) : nux::View(NUX_FILE_LINE_PARAM) { + SetAcceptKeyNavFocusOnMouseDown(false); + SetAcceptKeyNavFocusOnMouseEnter(true); } protected: void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) - { - }; + {} void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) { @@ -84,7 +85,17 @@ bool AcceptKeyNavFocus() { - return false; + return true; + } + + nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) + { + bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type); + + if (mouse_inside == false) + return nullptr; + + return this; } }; @@ -103,6 +114,7 @@ , disable_glow(false) , show_filter_hint_(true) , expander_view_(nullptr) + , show_filters_(nullptr) , search_bar_width_(642) , live_search_timeout_(0) , start_spinner_timeout_(0) @@ -118,6 +130,7 @@ , disable_glow(false) , show_filter_hint_(show_filter_hint_) , expander_view_(nullptr) + , show_filters_(nullptr) , search_bar_width_(search_bar_width) , live_search_timeout_(0) , start_spinner_timeout_(0) @@ -162,7 +175,7 @@ hint_->SetMaximumWidth(search_bar_width_ - icon->GetWidth()); pango_entry_ = new IMTextEntry(); - pango_entry_->sigTextChanged.connect(sigc::mem_fun(this, &SearchBar::OnSearchChanged)); + pango_entry_->text_changed.connect(sigc::mem_fun(this, &SearchBar::OnSearchChanged)); pango_entry_->activated.connect([&]() { activated.emit(); }); pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); }); pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown)); @@ -218,27 +231,28 @@ layout_->AddView(expander_view_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FULL); // Lambda functions - auto mouse_redraw = [&](int x, int y, unsigned long b, unsigned long k) + auto mouse_expand = [&](int, int, unsigned long, unsigned long) + { + showing_filters = !showing_filters; + }; + + auto key_redraw = [&](nux::Area*, bool, nux::KeyNavDirection) { QueueDraw(); }; - auto mouse_expand = [&](int x, int y, unsigned long b, unsigned long k) + auto key_expand = [&](nux::Area*) { showing_filters = !showing_filters; }; // Signals expander_view_->mouse_click.connect(mouse_expand); - expander_view_->mouse_enter.connect(mouse_redraw); - expander_view_->mouse_leave.connect(mouse_redraw); + expander_view_->key_nav_focus_change.connect(key_redraw); + expander_view_->key_nav_focus_activate.connect(key_expand); show_filters_->mouse_click.connect(mouse_expand); - show_filters_->mouse_enter.connect(mouse_redraw); - show_filters_->mouse_leave.connect(mouse_redraw); expand_icon_->mouse_click.connect(mouse_expand); - expand_icon_->mouse_enter.connect(mouse_redraw); - expand_icon_->mouse_leave.connect(mouse_redraw); - } + } sig_manager_.Add(new Signal (gtk_settings_get_default(), @@ -406,7 +420,7 @@ geo.y -= (HIGHLIGHT_HEIGHT- geo.height) / 2; geo.height = HIGHLIGHT_HEIGHT; geo.width = HIGHLIGHT_WIDTH + HIGHLIGHT_LEFT_PADDING + HIGHLIGHT_RIGHT_PADDING; - geo.x = geo_arrow.x + (geo_arrow.width - 1) - geo.width + HIGHLIGHT_RIGHT_PADDING; + geo.x = geo_arrow.x + (geo_arrow.width - 1) - geo.width + HIGHLIGHT_RIGHT_PADDING; if (!highlight_layer_) highlight_layer_.reset(dash::Style::Instance().FocusOverlay(geo.width, geo.height)); @@ -582,6 +596,11 @@ return pango_entry_; } +nux::View* SearchBar::show_filters() const +{ + return expander_view_; +} + std::string SearchBar::get_search_string() const { return pango_entry_->GetText(); @@ -612,9 +631,7 @@ // bool SearchBar::ShouldBeHighlighted() { - return ((expander_view_ && expander_view_->IsVisible() && expander_view_->IsMouseInside()) || - (show_filters_ && show_filters_->IsVisible() && show_filters_->IsMouseInside()) || - (expand_icon_ && expand_icon_->IsVisible() && expand_icon_->IsMouseInside())); + return ((expander_view_ && expander_view_->IsVisible() && expander_view_->HasKeyFocus())); } // @@ -635,11 +652,16 @@ void SearchBar::AddProperties(GVariantBuilder* builder) { - unity::variant::BuilderWrapper wrapper(builder); - - wrapper.add(GetAbsoluteGeometry()); - wrapper.add("has_focus", pango_entry_->HasKeyFocus()); - wrapper.add("search_string", pango_entry_->GetText()); + unity::variant::BuilderWrapper(builder) + .add(GetAbsoluteGeometry()) + .add("has_focus", pango_entry_->HasKeyFocus()) + .add("search_string", pango_entry_->GetText()) + .add("expander-has-focus", expander_view_->HasKeyFocus()) + .add("showing-filters", showing_filters) + .add("filter-label-x", show_filters_->GetAbsoluteX()) + .add("filter-label-y", show_filters_->GetAbsoluteY()) + .add("filter-label-width", show_filters_->GetAbsoluteWidth()) + .add("filter-label-height", show_filters_->GetAbsoluteHeight()); } } // namespace unity diff -Nru unity-5.4.0/plugins/unityshell/src/SearchBar.h unity-5.6.0/plugins/unityshell/src/SearchBar.h --- unity-5.4.0/plugins/unityshell/src/SearchBar.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/SearchBar.h 2012-03-12 09:16:36.000000000 +0000 @@ -63,6 +63,7 @@ void SearchFinished(); nux::TextEntry* text_entry() const; + nux::View* show_filters() const; nux::RWProperty search_string; nux::Property search_hint; diff -Nru unity-5.4.0/plugins/unityshell/src/SearchBarSpinner.cpp unity-5.6.0/plugins/unityshell/src/SearchBarSpinner.cpp --- unity-5.4.0/plugins/unityshell/src/SearchBarSpinner.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/SearchBarSpinner.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -20,6 +20,7 @@ #include "SearchBarSpinner.h" #include +#include #include "DashStyle.h" @@ -39,9 +40,7 @@ _magnify = style.GetSearchMagnifyIcon(); _close = style.GetSearchCloseIcon(); - _close_glow = style.GetSearchCloseGlowIcon(); _spin = style.GetSearchSpinIcon(); - _spin_glow = style.GetSearchSpinGlowIcon(); _2d_rotate.Identity(); _2d_rotate.Rotate_z(0.0); @@ -71,14 +70,6 @@ texxform.min_filter = nux::TEXFILTER_LINEAR; texxform.mag_filter = nux::TEXFILTER_LINEAR; - GfxContext.QRP_1Tex(geo.x + ((geo.width - _spin_glow->GetWidth()) / 2), - geo.y + ((geo.height - _spin_glow->GetHeight()) / 2), - _spin_glow->GetWidth(), - _spin_glow->GetHeight(), - _spin_glow->GetDeviceTexture(), - texxform, - nux::color::White); - if (_state == STATE_READY) { GfxContext.QRP_1Tex(geo.x + ((geo.width - _magnify->GetWidth()) / 2), @@ -137,14 +128,6 @@ nux::color::White); - GfxContext.QRP_1Tex(geo.x + ((geo.width - _close_glow->GetWidth()) / 2), - geo.y + ((geo.height - _close_glow->GetHeight()) / 2), - _close_glow->GetWidth(), - _close_glow->GetHeight(), - _close_glow->GetDeviceTexture(), - texxform, - nux::color::White); - GfxContext.QRP_1Tex(geo.x + ((geo.width - _close->GetWidth()) / 2), geo.y + ((geo.height - _close->GetHeight()) / 2), _close->GetWidth(), @@ -196,7 +179,7 @@ if (_spinner_timeout) g_source_remove(_spinner_timeout); _spinner_timeout = 0; - + _2d_rotate.Rotate_z(0.0f); _rotation = 0.0f; @@ -218,10 +201,11 @@ { nux::Geometry geo = GetGeometry(); - g_variant_builder_add(builder, "{sv}", "x", g_variant_new_int32(geo.x)); - g_variant_builder_add(builder, "{sv}", "y", g_variant_new_int32(geo.y)); - g_variant_builder_add(builder, "{sv}", "width", g_variant_new_int32(geo.width)); - g_variant_builder_add(builder, "{sv}", "height", g_variant_new_int32(geo.height)); + variant::BuilderWrapper(builder) + .add("x", geo.x) + .add("y", geo.y) + .add("width", geo.width) + .add("height", geo.height); } // diff -Nru unity-5.4.0/plugins/unityshell/src/ShortcutHintPrivate.cpp unity-5.6.0/plugins/unityshell/src/ShortcutHintPrivate.cpp --- unity-5.4.0/plugins/unityshell/src/ShortcutHintPrivate.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/ShortcutHintPrivate.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -16,6 +16,8 @@ * Authored by: Andrea Azzarone */ +#include + #include "ShortcutHintPrivate.h" #include @@ -44,9 +46,9 @@ { std::string ret(scut); - boost::replace_all(ret, "Button1", "Left Mouse"); - boost::replace_all(ret, "Button2", "Middle Mouse"); - boost::replace_all(ret, "Button3", "Right Mouse"); + boost::replace_all(ret, "Button1", _("Left Mouse")); + boost::replace_all(ret, "Button2", _("Middle Mouse")); + boost::replace_all(ret, "Button3", _("Right Mouse")); return ret; } diff -Nru unity-5.4.0/plugins/unityshell/src/StaticCairoText.cpp unity-5.6.0/plugins/unityshell/src/StaticCairoText.cpp --- unity-5.4.0/plugins/unityshell/src/StaticCairoText.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/StaticCairoText.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -39,7 +39,7 @@ { NUX_IMPLEMENT_OBJECT_TYPE (StaticCairoText); -StaticCairoText::StaticCairoText(const TCHAR* text, +StaticCairoText::StaticCairoText(std::string const& text, NUX_FILE_LINE_DECL) : View(NUX_FILE_LINE_PARAM), _fontstring(NULL), @@ -50,7 +50,7 @@ { _textColor = Color(1.0f, 1.0f, 1.0f, 1.0f); - _text = TEXT(text); + _text = text; _texture2D = 0; _need_new_extent_cache = true; _pre_layout_width = 0; @@ -223,7 +223,7 @@ } void -StaticCairoText::SetText(NString const& text) +StaticCairoText::SetText(std::string const& text) { if (_text != text) { @@ -237,8 +237,8 @@ } } -NString -StaticCairoText::GetText() +std::string +StaticCairoText::GetText() const { return _text; } @@ -324,7 +324,7 @@ surface = cairo_image_surface_create(CAIRO_FORMAT_A1, 1, 1); cr = cairo_create(surface); cairo_set_font_options(cr, gdk_screen_get_font_options(screen)); - + layout = pango_cairo_create_layout(cr); desc = pango_font_description_from_string(font); pango_layout_set_font_description(layout, desc); @@ -346,7 +346,7 @@ else pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); - pango_layout_set_markup(layout, _text.GetTCharPtr(), -1); + pango_layout_set_markup(layout, _text.c_str(), -1); pango_layout_set_height(layout, _lines); pango_layout_set_width(layout, maxwidth * PANGO_SCALE); @@ -420,7 +420,7 @@ else pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT); - pango_layout_set_markup(layout, _text.GetTCharPtr(), -1); + pango_layout_set_markup(layout, _text.c_str(), -1); pango_layout_set_width(layout, width * PANGO_SCALE); pango_layout_set_height(layout, height * PANGO_SCALE); diff -Nru unity-5.4.0/plugins/unityshell/src/StaticCairoText.h unity-5.6.0/plugins/unityshell/src/StaticCairoText.h --- unity-5.4.0/plugins/unityshell/src/StaticCairoText.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/StaticCairoText.h 2012-03-12 09:16:36.000000000 +0000 @@ -59,7 +59,7 @@ NUX_ALIGN_BOTTOM = NUX_ALIGN_RIGHT } AlignState; - StaticCairoText(const TCHAR* text, NUX_FILE_LINE_PROTO); + StaticCairoText(std::string const& text, NUX_FILE_LINE_PROTO); ~StaticCairoText(); @@ -77,7 +77,7 @@ bool forceDraw); // public API - void SetText(NString const& text); + void SetText(std::string const& text); void SetTextColor(Color const& textColor); void SetTextEllipsize(EllipsizeState state); void SetTextAlignment(AlignState state); @@ -85,7 +85,7 @@ void SetFont(const char* fontstring); void SetLines(int maximum_lines); - NString GetText(); + std::string GetText() const; int GetLineCount(); @@ -108,7 +108,7 @@ int _cached_base_width; int _cached_base_height; - NString _text; + std::string _text; Color _textColor; EllipsizeState _ellipsize; AlignState _align; diff -Nru unity-5.4.0/plugins/unityshell/src/SwitcherController.cpp unity-5.6.0/plugins/unityshell/src/SwitcherController.cpp --- unity-5.4.0/plugins/unityshell/src/SwitcherController.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/SwitcherController.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -42,7 +42,7 @@ , show_timer_(0) , detail_timer_(0) { - timeout_length = 150; + timeout_length = 75; detail_on_timeout = true; detail_timeout_length = 1500; monitor_ = 0; @@ -265,7 +265,7 @@ switch (detail_mode_) { case TAB_NEXT_WINDOW: - if (model_->detail_selection_index < model_->Selection()->Windows().size () - 1) + if (model_->detail_selection_index < model_->DetailXids().size () - 1) model_->NextDetail(); else model_->Next(); @@ -320,10 +320,10 @@ void Controller::SetDetail(bool value, unsigned int min_windows) { - if (value && model_->Selection()->Windows().size () >= min_windows) + if (value && model_->DetailXids().size () >= min_windows) { model_->detail_selection = true; - detail_mode_ = TAB_NEXT_WINDOW_LOOP; + detail_mode_ = TAB_NEXT_WINDOW; } else { diff -Nru unity-5.4.0/plugins/unityshell/src/Tooltip.cpp unity-5.6.0/plugins/unityshell/src/Tooltip.cpp --- unity-5.4.0/plugins/unityshell/src/Tooltip.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/Tooltip.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -21,6 +21,7 @@ */ #include +#include #include "CairoTexture.h" #include "ubus-server.h" @@ -62,7 +63,7 @@ _vlayout->AddLayout(_top_space, 0); - _tooltip_text = new nux::StaticCairoText(_labelText.GetTCharPtr(), NUX_TRACKER_LOCATION); + _tooltip_text = new nux::StaticCairoText(_labelText, NUX_TRACKER_LOCATION); _tooltip_text->SetTextAlignment(nux::StaticCairoText::AlignState::NUX_ALIGN_CENTRE); _tooltip_text->SetTextVerticalAlignment(nux::StaticCairoText::AlignState::NUX_ALIGN_CENTRE); _tooltip_text->SetMinimumWidth(MINIMUM_TEXT_WIDTH); @@ -528,7 +529,7 @@ { } -void Tooltip::SetText(nux::NString const& text) +void Tooltip::SetText(std::string const& text) { if (_labelText == text) return; @@ -548,12 +549,13 @@ void Tooltip::AddProperties(GVariantBuilder* builder) { - g_variant_builder_add(builder, "{sv}", "text", g_variant_new_string(_labelText.GetTCharPtr())); - g_variant_builder_add(builder, "{sv}", "x", g_variant_new_int32(GetBaseX())); - g_variant_builder_add(builder, "{sv}", "y", g_variant_new_int32(GetBaseY())); - g_variant_builder_add(builder, "{sv}", "width", g_variant_new_int32(GetBaseWidth())); - g_variant_builder_add(builder, "{sv}", "height", g_variant_new_int32(GetBaseHeight())); - g_variant_builder_add(builder, "{sv}", "active", g_variant_new_boolean(IsVisible())); + variant::BuilderWrapper(builder) + .add("text", _labelText) + .add("x", GetBaseX()) + .add("y", GetBaseY()) + .add("width", GetBaseWidth()) + .add("height", GetBaseHeight()) + .add("active", IsVisible()); } } // namespace nux diff -Nru unity-5.4.0/plugins/unityshell/src/Tooltip.h unity-5.6.0/plugins/unityshell/src/Tooltip.h --- unity-5.4.0/plugins/unityshell/src/Tooltip.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/Tooltip.h 2012-03-12 09:16:36.000000000 +0000 @@ -42,7 +42,7 @@ void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw); void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw); - void SetText(nux::NString const& text); + void SetText(std::string const& text); void ShowTooltipWithTipAt(int anchor_tip_x, int anchor_tip_y); @@ -69,7 +69,7 @@ int _anchorX; int _anchorY; - nux::NString _labelText; + std::string _labelText; nux::ObjectPtr _tooltip_text; diff -Nru unity-5.4.0/plugins/unityshell/src/unity-sctext-accessible.cpp unity-5.6.0/plugins/unityshell/src/unity-sctext-accessible.cpp --- unity-5.4.0/plugins/unityshell/src/unity-sctext-accessible.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/unity-sctext-accessible.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -145,7 +145,7 @@ text = dynamic_cast(nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(obj))); if (text != NULL) { - name = text->GetText().GetTCharPtr(); + name = text->GetText().c_str(); pango_parse_markup(name, -1, 0, NULL, &self->priv->stripped_name, NULL, NULL); diff -Nru unity-5.4.0/plugins/unityshell/src/unityshell.cpp unity-5.6.0/plugins/unityshell/src/unityshell.cpp --- unity-5.4.0/plugins/unityshell/src/unityshell.cpp 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/unityshell.cpp 2012-03-12 09:16:36.000000000 +0000 @@ -89,7 +89,12 @@ gboolean is_extension_supported(const gchar* extensions, const gchar* extension); gfloat get_opengl_version_f32(const gchar* version_string); -} +namespace local +{ +// Tap duration in milliseconds. +const int ALT_TAP_DURATION = 250; +} // namespace local +} // anon namespace UnityScreen::UnityScreen(CompScreen* screen) : BaseSwitchScreen (screen) @@ -106,6 +111,7 @@ , _in_paint(false) , relayoutSourceId(0) , _redraw_handle(0) + , alt_tap_timeout_id_(0) , newFocusedWindow(nullptr) , doShellRepaint(false) , allowWindowPaint(false) @@ -291,8 +297,11 @@ optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetAltTabBiasViewportNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); + optionSetAltTabForwardAllInitiate(boost::bind(&UnityScreen::altTabForwardAllInitiate, this, _1, _2, _3)); optionSetAltTabForwardInitiate(boost::bind(&UnityScreen::altTabForwardInitiate, this, _1, _2, _3)); optionSetAltTabForwardTerminate(boost::bind(&UnityScreen::altTabTerminateCommon, this, _1, _2, _3)); + optionSetAltTabForwardAllTerminate(boost::bind(&UnityScreen::altTabTerminateCommon, this, _1, _2, _3)); + optionSetAltTabPrevAllInitiate(boost::bind(&UnityScreen::altTabPrevAllInitiate, this, _1, _2, _3)); optionSetAltTabPrevInitiate(boost::bind(&UnityScreen::altTabPrevInitiate, this, _1, _2, _3)); optionSetAltTabDetailStartInitiate(boost::bind(&UnityScreen::altTabDetailStartInitiate, this, _1, _2, _3)); @@ -304,7 +313,15 @@ optionSetAltTabPrevWindowInitiate(boost::bind(&UnityScreen::altTabPrevWindowInitiate, this, _1, _2, _3)); optionSetAltTabLeftInitiate(boost::bind (&UnityScreen::altTabPrevInitiate, this, _1, _2, _3)); - optionSetAltTabRightInitiate(boost::bind (&UnityScreen::altTabForwardInitiate, this, _1, _2, _3)); + optionSetAltTabRightInitiate([&](CompAction* action, CompAction::State state, CompOption::Vector& options) -> bool + { + if (switcher_controller_->Visible()) + { + switcher_controller_->Next(); + return true; + } + return false; + }); optionSetLauncherSwitcherForwardInitiate(boost::bind(&UnityScreen::launcherSwitcherForwardInitiate, this, _1, _2, _3)); optionSetLauncherSwitcherPrevInitiate(boost::bind(&UnityScreen::launcherSwitcherPrevInitiate, this, _1, _2, _3)); @@ -355,6 +372,9 @@ if (relayoutSourceId != 0) g_source_remove(relayoutSourceId); + if (alt_tap_timeout_id_) + g_source_remove(alt_tap_timeout_id_); + ::unity::ui::IconRenderer::DestroyTextures(); QuicklistManager::Destroy(); @@ -1346,6 +1366,12 @@ skip_other_plugins = launcher_controller_->HandleLauncherKeyEvent(screen->dpy(), key_sym, event->xkey.keycode, event->xkey.state, key_string); if (!skip_other_plugins) skip_other_plugins = dash_controller_->CheckShortcutActivation(key_string); + + if (skip_other_plugins && launcher_controller_->KeyNavIsActive()) + { + launcher_controller_->KeyNavTerminate(false); + EnableCancelAction(false); + } } } break; @@ -1488,7 +1514,7 @@ shortcut_controller_->Show(); } - return false; + return true; } bool UnityScreen::showLauncherKeyTerminate(CompAction* action, @@ -1498,17 +1524,17 @@ if (state & CompAction::StateCancel) return false; - bool accept_state = (state & CompAction::StateCancel) == 0; + bool was_tap = state & CompAction::StateTermTapped; super_keypressed_ = false; - launcher_controller_->KeyNavTerminate(accept_state); - launcher_controller_->HandleLauncherKeyRelease(); + launcher_controller_->KeyNavTerminate(true); + launcher_controller_->HandleLauncherKeyRelease(was_tap); EnableCancelAction(false); shortcut_controller_->SetEnabled(enable_shortcut_overlay_); shortcut_controller_->Hide(); action->setState (action->state() & (unsigned)~(CompAction::StateTermKey)); - return false; + return true; } bool UnityScreen::showPanelFirstMenuKeyInitiate(CompAction* action, @@ -1519,7 +1545,7 @@ // to receive the Terminate event action->setState(action->state() | CompAction::StateTermKey); panel_controller_->StartFirstMenuShow(); - return false; + return true; } bool UnityScreen::showPanelFirstMenuKeyTerminate(CompAction* action, @@ -1529,7 +1555,7 @@ screen->removeGrab(grab_index_, NULL); action->setState (action->state() & (unsigned)~(CompAction::StateTermKey)); panel_controller_->EndFirstMenuShow(); - return false; + return true; } void UnityScreen::SendExecuteCommand() @@ -1543,7 +1569,7 @@ CompOption::Vector& options) { SendExecuteCommand(); - return false; + return true; } void UnityScreen::startLauncherKeyNav() @@ -1572,18 +1598,22 @@ CompOption::Vector& options) { _key_nav_mode_requested = true; - return false; + return true; } -bool UnityScreen::altTabInitiateCommon(CompAction *action, - CompAction::State state, - CompOption::Vector& options) +bool UnityScreen::altTabInitiateCommon(switcher::ShowMode show_mode) { if (!grab_index_) grab_index_ = screen->pushGrab (screen->invisibleCursor(), "unity-switcher"); if (!grab_index_) return false; - + + if (alt_tap_timeout_id_) + { + g_source_remove(alt_tap_timeout_id_); + alt_tap_timeout_id_ = 0; + } + screen->addAction(&optionGetAltTabRight()); screen->addAction(&optionGetAltTabDetailStart()); screen->addAction(&optionGetAltTabDetailStop()); @@ -1597,13 +1627,17 @@ screen->outputDevs()[device].width() - 200, screen->outputDevs()[device].height() - 200), device); - switcher::ShowMode show_mode = optionGetAltTabBiasViewport() ? switcher::ShowMode::CURRENT_VIEWPORT : switcher::ShowMode::ALL; + if (!optionGetAltTabBiasViewport()) + { + if (show_mode == switcher::ShowMode::CURRENT_VIEWPORT) + show_mode = switcher::ShowMode::ALL; + else + show_mode = switcher::ShowMode::CURRENT_VIEWPORT; + } RaiseInputWindows(); - int show_monitor = (show_mode == switcher::ShowMode::CURRENT_VIEWPORT) ? device : -1; - - auto results = launcher_controller_->GetAltTabIcons(show_monitor); + auto results = launcher_controller_->GetAltTabIcons(show_mode == switcher::ShowMode::CURRENT_VIEWPORT); if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::TYPE_BEGIN)) switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results); @@ -1641,19 +1675,39 @@ if (switcher_controller_->Visible()) switcher_controller_->Next(); else - altTabInitiateCommon(action, state, options); + altTabInitiateCommon(switcher::ShowMode::CURRENT_VIEWPORT); action->setState(action->state() | CompAction::StateTermKey); - return false; + return true; +} + +bool UnityScreen::altTabForwardAllInitiate(CompAction* action, + CompAction::State state, + CompOption::Vector& options) +{ + if (switcher_controller_->Visible()) + switcher_controller_->Next(); + else + altTabInitiateCommon(switcher::ShowMode::ALL); + + action->setState(action->state() | CompAction::StateTermKey); + return true; } +bool UnityScreen::altTabPrevAllInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) +{ + if (switcher_controller_->Visible()) + switcher_controller_->Prev(); + + return true; +} bool UnityScreen::altTabPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) { if (switcher_controller_->Visible()) switcher_controller_->Prev(); - return false; + return true; } bool UnityScreen::altTabDetailStartInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) @@ -1661,7 +1715,7 @@ if (switcher_controller_->Visible()) switcher_controller_->SetDetail(true); - return false; + return true; } bool UnityScreen::altTabDetailStopInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) @@ -1669,21 +1723,21 @@ if (switcher_controller_->Visible()) switcher_controller_->SetDetail(false); - return false; + return true; } bool UnityScreen::altTabNextWindowInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) { if (!switcher_controller_->Visible()) { - altTabInitiateCommon(action, state, options); + altTabInitiateCommon(switcher::ShowMode::CURRENT_VIEWPORT); switcher_controller_->Select(1); // always select the current application } switcher_controller_->NextDetail(); action->setState(action->state() | CompAction::StateTermKey); - return false; + return true; } bool UnityScreen::altTabPrevWindowInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) @@ -1691,7 +1745,7 @@ if (switcher_controller_->Visible()) switcher_controller_->PrevDetail(); - return false; + return true; } bool UnityScreen::launcherSwitcherForwardInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) @@ -1707,13 +1761,13 @@ } action->setState(action->state() | CompAction::StateTermKey); - return false; + return true; } bool UnityScreen::launcherSwitcherPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) { launcher_controller_->KeyNavPrevious(); - return false; + return true; } bool UnityScreen::launcherSwitcherTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options) { @@ -1722,7 +1776,7 @@ EnableCancelAction(false); action->setState (action->state() & (unsigned)~(CompAction::StateTermKey)); - return false; + return true; } void UnityScreen::OnLauncherStartKeyNav(GVariant* data) @@ -1745,42 +1799,76 @@ PluginAdapter::Default ()->restoreInputFocus (); } -bool UnityScreen::ShowHudInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) +bool UnityScreen::ShowHudInitiate(CompAction* action, + CompAction::State state, + CompOption::Vector& options) { // to receive the Terminate event if (state & CompAction::StateInitKey) - action->setState(action->state() | CompAction::StateTermKey); - + action->setState(action->state() | CompAction::StateTermKey); last_hud_show_time_ = g_get_monotonic_time(); + /* Workaround to fix #943194 */ + alt_tap_timeout_id_ = g_timeout_add(local::ALT_TAP_DURATION, [] (gpointer data) -> gboolean { + auto self = static_cast(data); + + if (!self->switcher_controller_->Visible()) + { + XUngrabKeyboard(self->screen->dpy(), CurrentTime); + } + + self->alt_tap_timeout_id_ = 0; + return FALSE; + }, this); + + // pass key through return false; } -bool UnityScreen::ShowHudTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options) -{ - if (optionGetShowHud().key().toString() == action->key().toString()) +bool UnityScreen::ShowHudTerminate(CompAction* action, + CompAction::State state, + CompOption::Vector& options) +{ + // Remember StateCancel and StateCommit will be broadcast to all actions + // so we need to verify that we are actually being toggled... + if (!(state & CompAction::StateTermKey)) + return false; + + action->setState(action->state() & ~CompAction::StateTermKey); + + // And only respond to key taps + if (!(state & CompAction::StateTermTapped)) + return false; + + if (alt_tap_timeout_id_) { - if (switcher_controller_->Visible()) - return false; // early exit if the switcher is open + g_source_remove(alt_tap_timeout_id_); + alt_tap_timeout_id_ = 0; + } - gint64 current_time = g_get_monotonic_time(); - if (current_time - last_hud_show_time_ < 150 * 1000) - { - if (hud_controller_->IsVisible()) - { - ubus_manager_.SendMessage(UBUS_HUD_CLOSE_REQUEST); - } - else - { - hud_controller_->ShowHud(); - } - last_hud_show_time_ = 0; - } + gint64 current_time = g_get_monotonic_time(); + if (current_time - last_hud_show_time_ > (local::ALT_TAP_DURATION * 1000)) + { + LOG_DEBUG(logger) << "Tap too long"; + return false; } - action->setState(action->state() & ~CompAction::StateTermKey); + if (switcher_controller_->Visible()) + { + LOG_ERROR(logger) << "this should never happen"; + return false; // early exit if the switcher is open + } - return false; + if (hud_controller_->IsVisible()) + { + ubus_manager_.SendMessage(UBUS_HUD_CLOSE_REQUEST); + } + else + { + hud_controller_->ShowHud(); + } + + return true; } gboolean UnityScreen::initPluginActions(gpointer data) @@ -2582,7 +2670,7 @@ hints_.push_back(new shortcut::Hint(launcher, "", _(" (Press)"), _("Open Launcher, displays shortcuts."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher" )); hints_.push_back(new shortcut::Hint(launcher, "", "", _("Open Launcher keyboard navigation mode."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "keyboard_focus")); - hints_.push_back(new shortcut::Hint(launcher, "", "", _("Switch applications via Launcher."), shortcut::HARDCODED_OPTION, "Super + Tab")); + hints_.push_back(new shortcut::Hint(launcher, "", "", _("Switch applications via Launcher."), shortcut::HARDCODED_OPTION, _("Super + Tab"))); hints_.push_back(new shortcut::Hint(launcher, "", _(" + 1 to 9"), _("Same as clicking on a Launcher icon."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher")); hints_.push_back(new shortcut::Hint(launcher, "", _(" + Shift + 1 to 9"), _("Open new window of the app."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher")); hints_.push_back(new shortcut::Hint(launcher, "", " + T", _("Open the Trash."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher")); @@ -2594,17 +2682,17 @@ hints_.push_back(new shortcut::Hint(dash, "", " + A", _("Open the Dash App Lens."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher")); hints_.push_back(new shortcut::Hint(dash, "", " + F", _("Open the Dash Files Lens."), shortcut::COMPIZ_KEY_OPTION,"unityshell", "show_launcher")); hints_.push_back(new shortcut::Hint(dash, "", " + M", _("Open the Dash Music Lens."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "show_launcher")); - hints_.push_back(new shortcut::Hint(dash, "", "", _("Switches between Lenses."), shortcut::HARDCODED_OPTION, "Ctrl + Tab")); + hints_.push_back(new shortcut::Hint(dash, "", "", _("Switches between Lenses."), shortcut::HARDCODED_OPTION, _("Ctrl + Tab"))); hints_.push_back(new shortcut::Hint(dash, "", "", _("Moves the focus."), shortcut::HARDCODED_OPTION, _("Cursor Keys"))); hints_.push_back(new shortcut::Hint(dash, "", "", _("Open currently focused item."), shortcut::HARDCODED_OPTION, _("Enter & Return"))); hints_.push_back(new shortcut::Hint(dash, "", "", _("'Run Command' mode."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "execute_command")); - // Top Bar - std::string const topbar = _("Top Bar"); + // Menu Bar + std::string const menubar = _("Menu Bar"); - hints_.push_back(new shortcut::Hint(topbar, "", "", _("Reveals application menu."), shortcut::HARDCODED_OPTION, "Alt")); - hints_.push_back(new shortcut::Hint(topbar, "", "", _("Opens the indicator menu."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "panel_first_menu")); - hints_.push_back(new shortcut::Hint(topbar, "", "", _("Moves focus between indicators."), shortcut::HARDCODED_OPTION, _("Cursor Left or Right"))); + hints_.push_back(new shortcut::Hint(menubar, "", "", _("Reveals application menu."), shortcut::HARDCODED_OPTION, "Alt")); + hints_.push_back(new shortcut::Hint(menubar, "", "", _("Opens the indicator menu."), shortcut::COMPIZ_KEY_OPTION, "unityshell", "panel_first_menu")); + hints_.push_back(new shortcut::Hint(menubar, "", "", _("Moves focus between indicators."), shortcut::HARDCODED_OPTION, _("Cursor Left or Right"))); // Switching std::string const switching = _("Switching"); @@ -2625,12 +2713,12 @@ hints_.push_back(new shortcut::Hint(windows, "", "", _("Minimises all windows."), shortcut::COMPIZ_KEY_OPTION, "core", "show_desktop_key")); hints_.push_back(new shortcut::Hint(windows, "", "", _("Maximises the current window."), shortcut::COMPIZ_KEY_OPTION, "core", "maximize_window_key")); hints_.push_back(new shortcut::Hint(windows, "", "", _("Restores or minimises current window."), shortcut::COMPIZ_KEY_OPTION, "core", "unmaximize_window_key")); - hints_.push_back(new shortcut::Hint(windows, "", " or Right", _("Semi-maximises current window."), shortcut::COMPIZ_KEY_OPTION, "grid", "put_left_key")); + hints_.push_back(new shortcut::Hint(windows, "", _(" or Right"), _("Semi-maximises current window."), shortcut::COMPIZ_KEY_OPTION, "grid", "put_left_key")); hints_.push_back(new shortcut::Hint(windows, "", "", _("Closes current window."), shortcut::COMPIZ_KEY_OPTION, "core", "close_window_key")); - hints_.push_back(new shortcut::Hint(windows, "", "", _("Opens window accessibility menu."), shortcut::HARDCODED_OPTION, "Alt + Space")); - hints_.push_back(new shortcut::Hint(windows, "", "", _("Places window in corresponding positions."), shortcut::HARDCODED_OPTION, "Ctrl + Alt + Num")); - hints_.push_back(new shortcut::Hint(windows, "", " Drag", _("Move window."), shortcut::COMPIZ_MOUSE_OPTION, "move", "initiate_button")); - hints_.push_back(new shortcut::Hint(windows, "", " Drag", _("Resize window."), shortcut::COMPIZ_MOUSE_OPTION, "resize", "initiate_button")); + hints_.push_back(new shortcut::Hint(windows, "", "", _("Opens window accessibility menu."), shortcut::HARDCODED_OPTION, _("Alt + Space"))); + hints_.push_back(new shortcut::Hint(windows, "", "", _("Places window in corresponding positions."), shortcut::HARDCODED_OPTION, _("Ctrl + Alt + Num"))); + hints_.push_back(new shortcut::Hint(windows, "", _(" Drag"), _("Move window."), shortcut::COMPIZ_MOUSE_OPTION, "move", "initiate_button")); + hints_.push_back(new shortcut::Hint(windows, "", _(" Drag"), _("Resize window."), shortcut::COMPIZ_MOUSE_OPTION, "resize", "initiate_button")); } /* Window init */ diff -Nru unity-5.4.0/plugins/unityshell/src/unityshell.h unity-5.6.0/plugins/unityshell/src/unityshell.h --- unity-5.4.0/plugins/unityshell/src/unityshell.h 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/src/unityshell.h 2012-03-12 09:16:36.000000000 +0000 @@ -192,15 +192,15 @@ bool executeCommand(CompAction* action, CompAction::State state, CompOption::Vector& options); bool setKeyboardFocusKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); - bool altTabInitiateCommon(CompAction* action, - CompAction::State state, - CompOption::Vector& options); + bool altTabInitiateCommon(switcher::ShowMode mode); bool altTabTerminateCommon(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabForwardInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); + bool altTabForwardAllInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); + bool altTabPrevAllInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabDetailStartInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabDetailStopInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabNextWindowInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); @@ -290,6 +290,7 @@ bool _in_paint; guint32 relayoutSourceId; guint32 _redraw_handle; + guint32 alt_tap_timeout_id_; typedef std::shared_ptr CompActionPtr; typedef std::vector ShortcutActions; ShortcutActions _shortcut_actions; diff -Nru unity-5.4.0/plugins/unityshell/unityshell.xml.in unity-5.6.0/plugins/unityshell/unityshell.xml.in --- unity-5.4.0/plugins/unityshell/unityshell.xml.in 2012-02-17 10:05:55.000000000 +0000 +++ unity-5.6.0/plugins/unityshell/unityshell.xml.in 2012-03-12 09:16:36.000000000 +0000 @@ -36,7 +36,6 @@ compiztoolbox scale expo - largedesktop @@ -95,7 +94,7 @@ - - + + + + - +