diff -Nru unity-7.2.3+14.04.20140826/AUTHORS unity-7.2.4+14.04.20141217/AUTHORS --- unity-7.2.3+14.04.20140826/AUTHORS 2014-08-26 09:48:40.000000000 -0400 +++ unity-7.2.4+14.04.20141217/AUTHORS 2014-12-17 15:51:37.000000000 -0500 @@ -13,7 +13,6 @@ Alex Launi Alex Launi , Allan LeSage Alex Launi , Thomi Richards - Alfred Neumayer Alfred Neumayer Andrea Azzarone Andrea Azzarone @@ -27,7 +26,6 @@ Bilal Akhtar , Thomi Richards Brandon Schaefer Brandon Schaefer , Brandon Schaefer - Brandon Schaefer , Marco Trevisan (Treviño) Brandon Schaefer , MC Return Brandon Schaefer , Nick Dedekind Brandon Schaefer Chris Townsend Chris Townsend , Andrea Azzarone + Chris Townsend , Stephen M. Webb CI bot Daniel d'Andrada Daniel van Vugt @@ -90,7 +89,6 @@ Jay Taoko , Mirco Müller Jay Taoko , Robert Carr Jeremy Bicha - Jinkyu Yi jokerdino@bvm128.zdom.org Jussi Pakkanen Ken VanDine @@ -111,6 +109,7 @@ Marco Mariani , Thomi Richards Marco Trevisan Marco Trevisan + Marco Trevisan , Marc Deslauriers Marco Trevisan Marco Trevisan (Treviño) Marco Trevisan (Treviño) , 3v1n0 @@ -118,12 +117,10 @@ Marco Trevisan (Treviño) , Andrea Cimitan Marco Trevisan (Treviño) , Brandon Schaefer Marco Trevisan (Treviño) , Brandon Schaefer , Tim Penhey - Marco Trevisan (Treviño) , Eleni Maria Stea Marco Trevisan (Treviño) , Lukas Vacek Marco Trevisan (Treviño) , Michal Hruby Marco Trevisan (Treviño) , Sam Spilsbury Marco Trevisan (Treviño) , Thomi Richards - Marco Trevisan (Treviño) Marco Trevisan (Treviño), Marco Trevisan (Treviño) Marius Gedminas Martin Albisetti @@ -189,7 +186,7 @@ smspillaz , Sam Spilsbury Stephen M. Webb Stephen M. Webb , Andrew McCarthy - Stephen M. Webb , Pawel Szubert + Stephen M. Webb , Marco Trevisan (Treviño) , Andrea Azzarone Steve Langasek Sven Baars Tarmac diff -Nru unity-7.2.3+14.04.20140826/ChangeLog unity-7.2.4+14.04.20141217/ChangeLog --- unity-7.2.3+14.04.20140826/ChangeLog 2014-08-26 09:48:40.000000000 -0400 +++ unity-7.2.4+14.04.20141217/ChangeLog 2014-12-17 15:51:37.000000000 -0500 @@ -1,3 +1,76 @@ +2014-08-26 CI bot + + Releasing 7.2.3+14.04.20140826-0ubuntu1 + +2014-08-26 Chris Townsend + + Release Unity 7.2.3. + +2014-08-26 Stephen M. Webb + + marked new upstream release as an UNRELEASED package + +2014-08-25 Stephen M. Webb + + removed downstream Ubuntu patches because upstream changes are now included + +2014-08-25 Stephen M. Webb + + merged in security updates from Ubuntu + +2014-07-24 Chris Townsend + + Bump version to 7.2.3. + +2014-08-26 Stephen M. Webb + + Prepare fixes for upstream micro-release 7.2.3. Fixes: 1283415, 1292391, 1306211, 1312107, 1320051, 1320071, 1324114, 1339629, 1340171, 1340394, 1340477, 1340992, 1340996, 1342208, 1342731, 1347735 + +2014-08-06 Marco Trevisan (Treviño) + + debian/patches: removing security patch, now included in branch + +2014-08-06 Marco Trevisan (Treviño) + + Merging with trunk + +2014-08-06 Marco Trevisan (Treviño) + + debian/changelog: add new revisions + +2014-08-06 Marco Trevisan (Treviño) + + SwitcherView, PanelService: correctly handle horizontal and vertical scroll events + +2014-08-06 Andrea Azzarone + + TextInput: use GdkKeymap to check the caps-lock status + +2014-08-06 Marco Trevisan (Treviño) + + PlacesOverlayVScrollBar: redirect the mouse wheel scroll events coming from the thumb to the scrollview + + This will make the scrollview to handle then and perform the same scrolling action it would do otherwise. + +2014-08-06 Marco Trevisan (Treviño) + + LockScreenShield: Add GrabScreen function and retry to make sure we really get grab + + It might happen that the grab is not possible because the PluginAdapter::IsScreenGrabbed + request has still not being fully processed, and thus nux is not able to grab the + pointer/keyboard. By doing this we instead try to grab the screen, and if this is + not happening, we wait a little until we don't get the ungrab event. + + In this way, if we eventually get the grab, all will work as expected. + Otherwise, we cancel the lock request (very unlikely to happen). + +2014-08-06 Marco Trevisan (Treviño) + + PlacesOverlayVScrollBar and VScrollBarOverlayWindow: add support for scaling + + Add a new ScrollView class to create ScrollViews with an OverlayScrollbar and with scaling support. + Using them in dash Scopes and Previews. + 2014-07-24 Chris Townsend Added changelog entry for lp:1340477. @@ -13,11 +86,11 @@ 2014-07-24 Marco Trevisan (Treviño) OverlayRendering: correctly scale the overlays borders and edges to match settings - + DashStyle has been modified to return smart pointers of textures that are loaded depending on the scale level. The cache will make sure that we don't duplicate the textures and that they get removed when not needed anymore. - + Also thanks to this the SearchBarSpinner textures (and the other spinners as well) uses the SVGs scaled at the proper size (I desgined a new SVG for the magnifier, as we only had a PNG). @@ -37,7 +110,7 @@ 2014-07-24 Marco Trevisan (Treviño) Previews: scale the dash preview contents to match current monitor scaling - + Improved also the scaling of search-bar, spinner, categories and many other components. 2014-07-23 Chris Townsend @@ -55,10 +128,10 @@ 2014-07-23 Marco Trevisan (Treviño) LockScreenAcceleratorController: do ther configured action on power special keys press - + We finally can suspend, shutdown, hibernate or start the screensaver when the screen is locked, using the Suspend, Sleep, Hibernate and PowerOff hardware keys. - + Also the Shutdown dialog doesn't allow now to lock the session if it is not allowed by settings. 2014-07-23 Chris Townsend @@ -77,6 +150,14 @@ Remove cross fade effect during lock/unlocking. A simple fading works just fine. +2014-08-05 Marco Trevisan + + * SECURITY UPDATE: more screen locking fixes (LP: #1349128) + - debian/patches/lp1349128.patch: flush after ungrabbing the keyboard + in unity-shared/PluginAdapter.cpp, add GrabScreen() function that + retries to lockscreen/LockScreenController.cpp, + lockscreen/LockScreenShield.cpp, lockscreen/LockScreenShield.h. + 2014-07-14 CI bot Releasing 7.2.2+14.04.20140714-0ubuntu1 @@ -126,6 +207,63 @@ Add a warning in the session dialog if other sessions are still open. +2014-07-01 Andrea Azzarone + + Add a warning in the session dialog if other sessions are still open. + +2014-06-23 Marco Trevisan (Treviño) + + PluginAdapter: pass the state to compiz plugins activations + + Fixes Scale triggering on DnD + +2014-06-10 Marco Trevisan (Treviño) + + PluginAdapter: pass the state to compiz plugins activations + + Fixes Scale triggering on DnD + +2014-06-06 CI bot + + Releasing 7.2.0+14.10.20140606.1-0ubuntu1 + +2014-06-06 Marco Trevisan (Treviño) + + SwitcherView: use RawPixel's for the size values and convert them to match current scaling Fixes: 1317348 + +2014-06-06 Chris Townsend + + Fix issue where scaling the edge illumination up and down with the size of the Launcher icons would cause the illumination border to be offset and smaller than the icon. Fixes: 1309739 + +2014-06-06 Brandon Schaefer + + Lockscreen warning icon needs a tooltip to say what the warning is about! Fixes: 1308288 + +2014-06-06 Brandon Schaefer + + ShutdownView: Scale up the Buttons and Text plus Borders of the UnityWindowView. Fixes: 1308323 + +2014-06-06 Brandon Schaefer + + TextInput: move the warning icon inside the input field, render it white Fixes: 1307738 + +2014-06-05 Brandon Schaefer + + * Merge trunk + +2014-06-06 Marco Trevisan (Treviño) + + ApplicationLauncherIcon: Focus and, in case, Spread the windows on DnD + + After 1 second that an user is over an icon, that icon should focus the relative + application and Spread its windows if it has more than one opened. + + Correctly handle the DnD scale in launcher, and apply glow to the icon under pointer. Fixes: 607796, 727902, 754580, 839728 + +2014-06-06 Alfred Neumayer + + Restore the launcher position by reversing the animation and unsetting the DND_PUSHED_OFF quirk. Fixes: 1304882 + 2014-06-23 Chris Townsend Added changelog entry for lp:1310200. @@ -134,6 +272,10 @@ Fix skype indicator blinking. +2014-05-30 Andrea Azzarone + + Fix skype indicator blinking. + 2014-06-23 Chris Townsend Added changelog entry for lp:1316005. @@ -142,6 +284,10 @@ Fix issue where the Panel shadow would get drawn over drop down windows in full screen windows. +2014-05-28 Chris Townsend + + Fix issue where the Panel shadow would get drawn over drop down windows in full screen windows. + 2014-06-23 Chris Townsend Added changelog entry for lp:1283775. @@ -150,6 +296,24 @@ Fix issue where the number of Launcher icon pips are not always properly updated when a new window of an already running application is opened. +2014-05-28 Chris Townsend + + Get rid of break statement since we need to continue the loop. + Relax if/else if logic and just assign boolean regardless what the current value is. + +2014-05-28 Chris Townsend + + Create a new method that replaces SetWindowVisibleOnMonitor() which also keeps the number of visible windows per monitor for a particular app. + Also, remove some of the helper functions added in a previous commit. + +2014-05-27 Chris Townsend + + Use counter for calculating number of app windows in a viewport and also check if the number of app windows has changed outside of the for loop in order to update Launcher pips for all Launchers in multi-monitor scenarios. + +2014-05-26 Chris Townsend + + Fix issue where the number of Launcher icon pips are not always properly updated when a new window of an already running application is opened. + 2014-06-23 Chris Townsend Added changelog entry for lp:1320438. @@ -158,6 +322,10 @@ Pass the correct options to showLauncherKeyTerminate in UnityScreen::OnLockScreen +2014-05-26 Andrea Azzarone + + Pass the correct options to showLauncherKeyTerminate in UnityScreen::OnLockScreen. + 2014-06-23 Chris Townsend Added changelog entry for lp:1321043. @@ -166,6 +334,26 @@ Disable switcher gestures if screen is locked. Fixed a regression. +2014-05-20 Andrea Azzarone + + Remove unwated changes. + +2014-05-20 Andrea Azzarone + + Disable switcher gestures if screen is locked. Fixed a regression. + +2014-05-20 Andrea Azzarone + + Restore clibpoard on unlock. Update tests too. + +2014-05-20 Andrea Azzarone + + Clear the clipboard when locking the screen. + +2014-05-16 Andrea Azzarone + + Clear the clipboard when locking the screen. + 2014-06-23 Chris Townsend Add changelog entry for lp:1308911. @@ -174,6 +362,14 @@ Clear the clipboard when locking the screen. +2014-05-26 Andrea Azzarone + + Enable clipboard by default. + +2014-05-26 Andrea Azzarone + + Disable clibpoard during lockscreen. + 2014-06-23 Chris Townsend Added changelog entry for lp:924840. @@ -184,6 +380,58 @@ Plus dinamically allocate horizontal space, not to cut the text. +2014-05-16 Marco Trevisan (Treviño) + + Merging with lp:~3v1n0/unity/dynamic-shortcut-hint + +2014-05-14 Marco Trevisan (Treviño) + + ShortcutView: increase max column widths to make sure they will work with big text + +2014-05-14 Marco Trevisan (Treviño) + + ShortcutView: adjust column maximum width inside PreLayoutManagement instead that when filling the model + +2014-05-14 Marco Trevisan (Treviño) + + ShortcutView: some cleanup + +2014-05-14 Marco Trevisan (Treviño) + + ShortcutView: define maximum columns width, way longer than before + +2014-05-14 Marco Trevisan (Treviño) + + ShortcutView: reduce the line spacing to match old values + + This migtht be caused by the StaticCairoText usage, and this spacing actually matches design + +2014-05-14 Marco Trevisan (Treviño) + + ShortcutController: always fill the model before setting it + +2014-05-14 Marco Trevisan (Treviño) + + ShortcutView: compute maximum columns width based on text size + + In this way the text won't be truncated. The text size is computed per each column + +2014-05-16 Marco Trevisan (Treviño) + + Merging with lp:~brandontschaefer/unity/shutdown-dialog-hi-dpi + +2014-05-13 Marco Trevisan (Treviño) + + ShortcutView: use string literal to build RawPixel's + +2014-05-13 Marco Trevisan (Treviño) + + Merge with trunk + +2014-05-08 Marco Trevisan (Treviño) + + ShortcutView: use RawPixel's for the size values and convert them to match current scaling + 2014-06-23 Chris Townsend Added changelog entry for lp:741869. @@ -196,6 +444,124 @@ takes the grab, then we need to ensure that there's no grab by trying to get one. We only care about keyboard here, since pointer grabs don't affect us in general. +2014-05-13 Marco Trevisan (Treviño) + + LockScreenController: don't try to lock if there's a keyboard grab around + +2014-05-13 Marco Trevisan (Treviño) + + PluginAdapter: try to grab the screen to make sure that the screen is not grabbed + + FocusIn event with NotifyGrab mode is not always triggered by X when a window + takes the grab, then we need to ensure that there's no grab by trying to get one. + We only care about keyboard here, since pointer grabs don't affect us in general. + +2014-05-12 CI bot + + Releasing 7.2.0+14.10.20140512.4-0ubuntu1 + +2014-05-12 Stephen M. Webb + + disabled precompiled headers on arm64 Ubuntu package builds Fixes: 1317276 + +2014-05-12 Stephen M. Webb + + lockscreen/LockScreenAccelerators.h: added required header for std:vector definition + +2014-05-12 Mathieu Trudel-Lapierre + + Sync with distro upload for 7.2.0+14.04.20140423-0ubuntu2 + - replace autopilot-desktop Depends in unity-autopilot with autopilot-desktop-legacy. + +2014-05-07 Mathieu Trudel-Lapierre + + Sync with distro + +2014-05-12 Andrea Azzarone + + Add a warning in the session dialog if other sessions are still open. Fixes: 1281058 + +2014-05-09 Andrea Azzarone + + Update string. + +2014-05-09 Andrea Azzarone + + Merge trunk. + +2014-04-17 Andrea Azzarone + + Send the changed event. + +2014-04-16 Andrea Azzarone + + Use a ROProperty. + +2014-04-16 Andrea Azzarone + + Add an extra /n. + +2014-04-11 Andrea Azzarone + + Fix string. + +2014-04-11 Andrea Azzarone + + Remove new line. + +2014-04-11 Andrea Azzarone + + Add a warning in the session dialog if other sessions are still open. + +2014-05-12 Brandon Schaefer + + Set the max width, so our static text wraps. So we don't end up rendering text out of the view area. Fixes: 1312749 + +2014-05-12 Marco Trevisan (Treviño) + + DebugDBusInterface: match properties if they are in the AP array form [, ] Fixes: 1307748 + +2014-05-12 Marco Trevisan (Treviño) + + PluginAdapter: make sure we don't try to call an invalid initiate/terminate callback function Fixes: 1221673 + +2014-05-12 Marco Trevisan (Treviño) + + UnityScreen: don't try to show Dash/Hud if the screen is grabbed + + Also move the dash opening out from LauncherController, and get rid of UBus + as first initialization source, as it can only slow things down here. Fixes: 741869 + +2014-05-12 Marco Trevisan (Treviño) + + UnityScreen: always paint the lockscreen above, just add menu and onboard as exceptions + + Some code cleanup, factorizing similar code. Fixes: 1313280 + +2014-05-12 Jinkyu Yi + + Dash: Fix problem at checking blacklisted unicode range Fixes: 1251193 + +2014-05-12 William Hua + + Add proper support for modifier-only shortcuts on the lock screen. Fixes: 1291461 + +2014-06-23 Chris Townsend + + Added changelog for lp:1317348. + +2014-06-23 Marco Trevisan (Treviño) + + SwitcherView: use RawPixel's for the size values and convert them to match current scaling + +2014-05-08 Marco Trevisan (Treviño) + + TestSwitcherView: remove obsolete property check + +2014-05-08 Marco Trevisan (Treviño) + + SwitcherView: use RawPixel's for the size values and convert them to match current scaling + 2014-06-23 Chris Townsend Added changelog entry for lp:1309739. @@ -204,6 +570,14 @@ Fix issue where scaling the edge illumination up and down with the size of the Launcher icons would cause the illumination border to be offset and smaller than the icon. +2014-05-08 Chris Townsend + + Revert the last change and instead, use the icon glow .png file instead of the .svg since Gdk does not seem to be able to handle properly scaling the svg file. + +2014-05-06 Chris Townsend + + Fix issue where scaling the edge illumination up and down with the size of the Launcher icons would cause the illumination border to be offset and smaller than the icon. + 2014-06-23 Chris Townsend Added changelog entry for lp:1308288. @@ -212,6 +586,35 @@ Lockscreen warning icon needs a tooltip to say what the warning is about! +2014-04-23 Brandon Schaefer + + * Load the warning icon only when we enable show caps lock. + +2014-04-22 Brandon Schaefer + + * Remove spin_icon_width + +2014-04-22 Brandon Schaefer + + * Merge from parent. Fix conflicts. + +2014-04-22 Brandon Schaefer + + * Merge trunk + +2014-04-15 Brandon Schaefer + + * Fix multi monitor issue + * Fix translation issue + +2014-04-15 Brandon Schaefer + + * No magic strings! + +2014-04-15 Brandon Schaefer + + * Add a nice warning tooltip + 2014-06-19 Chris Townsend Added changelog entry for lp:1308323. @@ -220,6 +623,109 @@ ShutdownView: Scale up the Buttons and Text plus Borders of the UnityWindowView. +2014-05-13 Brandon Schaefer + + * Much better way to clean up textures + +2014-05-13 Brandon Schaefer + + * Clean up unused textures when a dpi changes, or a monitor changes + +2014-05-08 Brandon Schaefer + + * Pre-load textures based on scale value of monitors + +2014-05-08 Brandon Schaefer + + * Merge Marcos branch again + +2014-05-08 Marco Trevisan (Treviño) + + UnityWindowView: don't keep EMConverter around, we don't need it... Let's use just scale + +2014-05-08 Brandon Schaefer + + * Move the CP() call for the const sizes to UnityWindowStyle + +2014-05-08 Brandon Schaefer + + * Merge Marcos branch + * Merge trunk + +2014-05-08 Marco Trevisan (Treviño) + + SessionButton: don't scale the button size twice... + +2014-05-08 Marco Trevisan (Treviño) + + SessionButton: remove useless definition + +2014-05-08 Marco Trevisan (Treviño) + + UnityWindowView: only expose scale instead of the EMConverter, so we get proper notifications + +2014-05-08 Marco Trevisan (Treviño) + + ShortcutController: set the monitor property + +2014-05-08 Marco Trevisan (Treviño) + + UnityWindowView: don't include UnitySettings in the header... + +2014-05-08 Marco Trevisan (Treviño) + + SwitcherView: use the UnityWindowView monitor value and scale padding correctly + +2014-05-08 Marco Trevisan (Treviño) + + RawPixel: no need to round here, EMConverter will do it + +2014-05-08 Marco Trevisan (Treviño) + + EMConverter: just multiply the pixels per DPIScale, it's simpler and safer + +2014-05-08 Marco Trevisan (Treviño) + + UnityWindowView: make sure we update the internal offset correctly + +2014-05-08 Marco Trevisan (Treviño) + + Merging with lp:~brandontschaefer/unity/shutdown-dialog-hi-dpi + +2014-05-07 Brandon Schaefer + + * Use a map to map textures based on scale size, so we only load scale sizes we need, + and still cache them. Good for multi monitor. + +2014-05-06 Brandon Schaefer + + * Scale the borders + +2014-05-06 Brandon Schaefer + + * Scale the closeable window button as well. + * TODO Window border, a bit more tricky... + +2014-05-05 Brandon Schaefer + + * Fix reviews issues. + +2014-05-02 Brandon Schaefer + + * Undo changes that aren't part of branch + +2014-04-25 Brandon Schaefer + + * Merge trunk + +2014-04-25 Brandon Schaefer + + * Fixes based on review + +2014-04-24 Brandon Schaefer + + * First stage of Shutdown Dialog HiDPI Support + 2014-06-19 Chris Townsend Added changelog entry for lp:1307738. @@ -228,6 +734,41 @@ TextInput: move the warning icon inside the input field, render it white +2014-04-17 Brandon Schaefer + + * Need the relayout, otherwise the icon is late to show + +2014-04-17 Brandon Schaefer + + * Make caps_lock_on private + +2014-04-17 Brandon Schaefer + + * Move QueueDraw to the changed callback. + * Remove ToggleCapsLock + +2014-04-16 Brandon Schaefer + + * Move over detectiong caps lock to TextInput.cpp as well. + * Steal Marcos code that puts the Warning icon into a layout (Thanks!) + +2014-04-15 Brandon Schaefer + + * Use a fallback icon + +2014-04-15 Brandon Schaefer + + * Move the warning icon over the TextInput. + * This will make adjusting the IMTextEntry width a bit easier (still a TODO) + +2014-04-14 Brandon Schaefer + + * Use the gnome theme to load the warning icon. Looks better, and will scale :) + +2014-04-14 Brandon Schaefer + + * make sure we draw the waring icon above the text entry + 2014-06-19 Chris Townsend Added changelog entry for lp:607796. @@ -241,6 +782,49 @@ Correctly handle the DnD scale in launcher, and apply glow to the icon under pointer. +2014-04-16 Marco Trevisan (Treviño) + + {Trash,Volume}LauncherIcon: also shimmer on drop-accept + +2014-04-16 Marco Trevisan (Treviño) + + Launcher: glow launcher icons under the dnd if they accept dropping on them + +2014-04-16 Marco Trevisan (Treviño) + + AbstractLauncherIcon: add GLOW quirk + +2014-04-16 Marco Trevisan (Treviño) + + {Dash,Hud}Controller: use wm signals instead of UBus to hide on VP switch + +2014-04-16 Marco Trevisan (Treviño) + + UnityScreen: initialize scale_just_activated_ on OnInitiateSpread + +2014-04-16 Marco Trevisan (Treviño) + + Launcher: don't desaturate the icons when spread is started during DnD + + Also make sure we redraw when bg_effect_helper status changes + +2014-04-16 Marco Trevisan (Treviño) + + UnityScreen: make sure we always set the scale "x_offset" value + +2014-04-16 Marco Trevisan (Treviño) + + PluginAdapter: listen to compiz scale events also for setting scale active/disactive + + This will allow to get the scale status also when it doesn't take the grab (like in the DnD case) + +2014-04-16 Marco Trevisan (Treviño) + + ApplicationLauncherIcon: Focus and, in case, Spread the application windows after some DnD over the icon + + After 1 second that an user is over an icon, that icon should focus the relative application and Spread its windows + if it has more than one opened + 2014-06-19 Chris Townsend Added changelog entry for lp:1304882. @@ -249,6 +833,26 @@ Restore the launcher position by reversing the animation and unsetting the DND_PUSHED_OFF quirk. +2014-04-16 Alfred Neumayer + + Remove redundant SetHidden() + +2014-04-15 Alfred Neumayer + + Unhide the launcher if it was manually dragged out before DND. + +2014-04-15 Alfred Neumayer + + Base change on Trevinhos patch. + +2014-04-14 Alfred Neumayer + + The animation shouldn't get reversed twice as that looks odd. + +2014-04-14 Alfred Neumayer + + Unset DND_PUSHED_OFF and reverse the animation to make launcher reappear after DND. + 2014-06-19 Chris Townsend Added changelog for #1313280. @@ -259,6 +863,18 @@ Some code cleanup, factorizing similar code. +2014-05-02 Marco Trevisan (Treviño) + + UnityWindow: add just one function that computes if a window can bypass lockscreen + +2014-05-02 Marco Trevisan (Treviño) + + UnityScreen: use a better (and cheaper) way to recognize Onboard window + +2014-05-02 Marco Trevisan (Treviño) + + UnityScreen: always paint the lockscreen above, just add menu and onboard as exceptions + 2014-06-06 Chris Townsend Modify debian/changleog to match what's in distro since a branch to fix a bug was not actually included in the Trusty SRU. diff -Nru unity-7.2.3+14.04.20140826/CMakeLists.txt unity-7.2.4+14.04.20141217/CMakeLists.txt --- unity-7.2.3+14.04.20140826/CMakeLists.txt 2014-08-26 09:48:40.000000000 -0400 +++ unity-7.2.4+14.04.20141217/CMakeLists.txt 2014-12-17 15:51:54.000000000 -0500 @@ -10,7 +10,7 @@ set (PROJECT_NAME "unity") set (UNITY_MAJOR 7) set (UNITY_MINOR 2) -set (UNITY_MICRO 3) +set (UNITY_MICRO 4) set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}") set (UNITY_API_VERSION "6.0") set (UNITY_COMPONENTS_VERSION "6") @@ -259,6 +259,7 @@ add_subdirectory(unity-shared) add_subdirectory(dash) add_subdirectory(launcher) +add_subdirectory(data) if (ENABLE_X_SUPPORT) add_subdirectory(hud) add_subdirectory(lockscreen) diff -Nru unity-7.2.3+14.04.20140826/dash/FilterBasicButton.cpp unity-7.2.4+14.04.20141217/dash/FilterBasicButton.cpp --- unity-7.2.3+14.04.20140826/dash/FilterBasicButton.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/dash/FilterBasicButton.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,6 +20,7 @@ */ #include "unity-shared/DashStyle.h" +#include "unity-shared/UnitySettings.h" #include "FilterBasicButton.h" namespace unity @@ -70,6 +71,7 @@ }); scale.changed.connect(sigc::mem_fun(this, &FilterBasicButton::UpdateScale)); + Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &FilterBasicButton::InitTheme))); } void FilterBasicButton::InitTheme() @@ -81,11 +83,12 @@ normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL))); focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &FilterBasicButton::RedrawFocusOverlay))); - SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale)); + double font_scaling = Settings::Instance().font_scaling() * scale; + SetMinimumWidth(MIN_BUTTON_WIDTH.CP(font_scaling)); ApplyMinWidth(); - SetMinimumHeight(BUTTON_HEIGHT.CP(scale)); - SetMaximumHeight(BUTTON_HEIGHT.CP(scale)); + SetMinimumHeight(BUTTON_HEIGHT.CP(font_scaling)); + SetMaximumHeight(BUTTON_HEIGHT.CP(font_scaling)); } void FilterBasicButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state) diff -Nru unity-7.2.3+14.04.20140826/dash/previews/ActionButton.cpp unity-7.2.4+14.04.20141217/dash/previews/ActionButton.cpp --- unity-7.2.3+14.04.20140826/dash/previews/ActionButton.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/dash/previews/ActionButton.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -25,6 +25,7 @@ #include #include "unity-shared/IconTexture.h" #include "unity-shared/StaticCairoText.h" +#include "unity-shared/UnitySettings.h" namespace unity { @@ -51,6 +52,7 @@ Init(); BuildLayout(label, icon_hint, ""); scale.changed.connect(sigc::mem_fun(this, &ActionButton::UpdateScale)); + Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &ActionButton::InitTheme))); } ActionButton::~ActionButton() @@ -93,8 +95,9 @@ cr_normal_.reset(new nux::CairoWrapper(geo, sigc::bind(sigc::mem_fun(this, &ActionButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL))); cr_focus_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &ActionButton::RedrawFocusOverlay))); - SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(scale)); - SetMinimumWidth(MIN_BUTTON_WIDTH.CP(scale)); + double font_scaling = Settings::Instance().font_scaling() * scale; + SetMinimumHeight(MIN_BUTTON_HEIGHT.CP(font_scaling)); + SetMinimumWidth(MIN_BUTTON_WIDTH.CP(font_scaling)); } void ActionButton::SetExtraHint(std::string const& extra_hint, std::string const& font_hint) diff -Nru unity-7.2.3+14.04.20140826/dash/previews/ErrorPreview.cpp unity-7.2.4+14.04.20141217/dash/previews/ErrorPreview.cpp --- unity-7.2.3+14.04.20140826/dash/previews/ErrorPreview.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/dash/previews/ErrorPreview.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -37,6 +37,7 @@ #include "stdio.h" #include "config.h" +#include namespace unity { diff -Nru unity-7.2.3+14.04.20140826/dash/previews/PaymentPreview.cpp unity-7.2.4+14.04.20141217/dash/previews/PaymentPreview.cpp --- unity-7.2.3+14.04.20140826/dash/previews/PaymentPreview.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/dash/previews/PaymentPreview.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,8 +20,10 @@ * Manuel de la Pena * */ -#include #include "PaymentPreview.h" + +#include +#include #include "unity-shared/CoverArt.h" #include "unity-shared/DashStyle.h" #include "unity-shared/PreviewStyle.h" diff -Nru unity-7.2.3+14.04.20140826/data/CMakeLists.txt unity-7.2.4+14.04.20141217/data/CMakeLists.txt --- unity-7.2.3+14.04.20140826/data/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/data/CMakeLists.txt 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1 @@ +add_subdirectory(pam) \ No newline at end of file diff -Nru unity-7.2.3+14.04.20140826/data/pam/CMakeLists.txt unity-7.2.4+14.04.20141217/data/pam/CMakeLists.txt --- unity-7.2.3+14.04.20140826/data/pam/CMakeLists.txt 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/data/pam/CMakeLists.txt 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1 @@ +install(FILES unity DESTINATION ${CMAKE_SYSCONFDIR}/pam.d) \ No newline at end of file diff -Nru unity-7.2.3+14.04.20140826/data/pam/unity unity-7.2.4+14.04.20141217/data/pam/unity --- unity-7.2.3+14.04.20140826/data/pam/unity 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/data/pam/unity 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1,2 @@ +@include common-auth +auth optional pam_gnome_keyring.so diff -Nru unity-7.2.3+14.04.20140826/debian/changelog unity-7.2.4+14.04.20141217/debian/changelog --- unity-7.2.3+14.04.20140826/debian/changelog 2014-12-29 10:02:06.000000000 -0500 +++ unity-7.2.4+14.04.20141217/debian/changelog 2014-12-29 10:02:06.000000000 -0500 @@ -1,3 +1,62 @@ +unity (7.2.4+14.04.20141217-0ubuntu1) trusty; urgency=medium + + [ Andrea Azzarone ] + * Share lockscreen password between screens (lp: #1308540) + * Allow a distinct pam config file for greeter and for lock-screen. + (lp: #1305440) + * Add an arrow activator in the lockscreen. (lp: #1332509) + * Make sure GetScreenGeometry returns the correct value (lp: #1374785). + * unmapped all windows prior to shutdown (lp: #1370017) (lp: #1375271) + + [ Brandon Schaefer ] + * fix tooltip for the "Show Desktop / Restore Windows" icon in the Alt-Tab + switcher (lp: #1237132) + * Use CONFIG instead of CACHE to store the first_run.stamp (lp: #1328677) + + [ Eleni Maria Stea ] + * LayoutSystem: make sure the exposed open windows are displayed in the + preserved order (lp: #1349281). + + [ handsome_feng ] + * added support for getting the distro name from /etc/os-release + (lp: #1329584) + + [ Iain Lane ] + * When grabbing keys, try prefixing "XF86" if the key isn't found. GNOME + gives us unprefixed keys sometimes (lp: #1302885). + + [ Marco Trevisan (Treviño) ] + * make the Launcher icon count badge width depend on the text value width + and scaling (lp: #1353070) (lp: #1354498) (lp: #796527) (lp: #1066971) + (lp: #1361713) + * DecoratedWindow: make edges independent from borders and properly update + them on actions change (lp: #1276177), (lp: #1299741), (lp: #1301776), + (lp: #1324104), (lp: #1364225), (lp: #1373695) + * Lockscreen: scale the UI elements based on current monitor scaling + (lp: #1292218) + * UnityScreen: when filtering out windows in spread, make sure we unscale + them (lp: #1316265). + * PanelMenuView: ensure that proper window tiles and buttons are shown at + the right place (lp: #1384910) (lp: #1384958) (lp: #1385285) + * SearchBar, ActionButtons, IconRenderer: include the font scaling when + scaling textual items (lp: #1332947) (lp: #1361751) (lp: #1362162) + (lp: #1362346). + * ApplicationLauncherIcon: make sure we close the dash if DnD is accepted + and the application window is about to be focused (lp: #1350331). + * SwitcherView: set progress on icon render args (lp: #1361679). + * LockScreenController: wait for the primary shield to get the grab + before setting the session locked (lp: #1368427) (lp: #1371764). + * added decorations to windows in non-focused workspaces (lp: #1383468) + + [ Stephen M. Webb ] + * updated the unity(1) manpage to match the actual command (lp: #1059275) + * bumped package version to match upstream + + [ Marco Trevisan (Treviño) ] + * Preparing for unity 7.2.4 + + -- Ubuntu daily release Wed, 17 Dec 2014 20:52:10 +0000 + unity (7.2.3+14.04.20140826-0ubuntu1) trusty; urgency=medium [ Andrea Azzarone ] @@ -2189,6 +2248,9 @@ unity (7.0.0daily13.05.08ubuntu.unity.next-0ubuntu1) raring; urgency=low * Automatic snapshot from revision 3317 (ubuntu-unity/next) + + -- Ubuntu daily release Fri, 31 May 2013 04:06:11 +0000 + unity (7.0.0daily13.05.01.1ubuntu.unity.next-0ubuntu1) raring; urgency=low [ Sebastien Bacher ] diff -Nru unity-7.2.3+14.04.20140826/debian/rules unity-7.2.4+14.04.20141217/debian/rules --- unity-7.2.3+14.04.20140826/debian/rules 2014-12-29 10:02:06.000000000 -0500 +++ unity-7.2.4+14.04.20141217/debian/rules 2014-12-29 10:02:06.000000000 -0500 @@ -23,7 +23,7 @@ SCOPES_RECOMMENDS := $(shell perl debian/scopes-recommends-generator /usr/share/unity/client-scopes.json) -cmake_base_options := -DUSE_GSETTINGS=TRUE -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_PACKAGING_ENABLED=TRUE -DCOMPIZ_PLUGIN_INSTALL_TYPE=package +cmake_base_options := -DUSE_GSETTINGS=TRUE -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_PACKAGING_ENABLED=TRUE -DCMAKE_SYSCONFDIR=/etc -DCOMPIZ_PLUGIN_INSTALL_TYPE=package ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(gles2_architectures))) cmake_gl_options := -DBUILD_GLES=TRUE -DDISABLE_MAINTAINER_CFLAGS=ON endif diff -Nru unity-7.2.3+14.04.20140826/debian/unity.install unity-7.2.4+14.04.20141217/debian/unity.install --- unity-7.2.3+14.04.20140826/debian/unity.install 2014-12-29 10:02:06.000000000 -0500 +++ unity-7.2.4+14.04.20141217/debian/unity.install 2014-12-29 10:02:06.000000000 -0500 @@ -1,3 +1,4 @@ +etc/pam.d usr/bin usr/lib/compiz usr/share/man/*/unity.1 diff -Nru unity-7.2.3+14.04.20140826/debian/unity.migrations unity-7.2.4+14.04.20141217/debian/unity.migrations --- unity-7.2.3+14.04.20140826/debian/unity.migrations 2014-12-29 10:02:06.000000000 -0500 +++ unity-7.2.4+14.04.20141217/debian/unity.migrations 2014-12-29 10:02:06.000000000 -0500 @@ -1,2 +1,3 @@ tools/migration-scripts/01_unity_change_dconf_path tools/migration-scripts/02_unity_setup_text_scale_factor +tools/migration-scripts/03_unity_first_run_stamp_move diff -Nru unity-7.2.3+14.04.20140826/decorations/DecoratedWindow.cpp unity-7.2.4+14.04.20141217/decorations/DecoratedWindow.cpp --- unity-7.2.3+14.04.20140826/decorations/DecoratedWindow.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecoratedWindow.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -1,6 +1,6 @@ // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* - * Copyright (C) 2013 Canonical Ltd + * Copyright (C) 2013-2014 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 @@ -46,8 +46,12 @@ , cwin_(CompositeWindow::get(win_)) , glwin_(GLWindow::get(win_)) , frame_(0) - , dirty_geo_(true) , monitor_(0) + , dirty_geo_(true) + , dirty_frame_(false) + , deco_elements_(cu::DecorationElement::NONE) + , last_mwm_decor_(win_->mwmDecor()) + , last_actions_(win_->actions()) , cv_(Settings::Instance().em()) { active.changed.connect([this] (bool active) { @@ -107,14 +111,32 @@ void Window::Impl::Update() { - ShouldBeDecorated() ? Decorate() : Undecorate(); + UpdateElements(); + + if (deco_elements_ & (cu::DecorationElement::EDGE | cu::DecorationElement::BORDER)) + Decorate(); + else + Undecorate(); + + last_mwm_decor_ = win_->mwmDecor(); + last_actions_ = win_->actions(); } void Window::Impl::Decorate() { SetupExtents(); UpdateFrame(); - SetupWindowControls(); + SetupWindowEdges(); + + if (deco_elements_ & cu::DecorationElement::BORDER) + { + SetupWindowControls(); + } + else + { + CleanupWindowControls(); + bg_textures_.clear(); + } } void Window::Impl::Undecorate() @@ -122,6 +144,7 @@ UnsetExtents(); UnsetFrame(); CleanupWindowControls(); + CleanupWindowEdges(); bg_textures_.clear(); } @@ -141,22 +164,39 @@ if (win_->hasUnmapReference()) return; - auto const& sb = Style::Get()->Border(); - CompWindowExtents border(cv_->CP(sb.left), - cv_->CP(sb.right), - cv_->CP(sb.top), - cv_->CP(sb.bottom)); - - auto const& ib = Style::Get()->InputBorder(); - CompWindowExtents input(cv_->CP(sb.left + ib.left), - cv_->CP(sb.right + ib.right), - cv_->CP(sb.top + ib.top), - cv_->CP(sb.bottom + ib.bottom)); + CompWindowExtents border; + + if (deco_elements_ & cu::DecorationElement::BORDER) + { + auto const& sb = Style::Get()->Border(); + border.left = cv_->CP(sb.left); + border.right = cv_->CP(sb.right); + border.top = cv_->CP(sb.top); + border.bottom = cv_->CP(sb.bottom); + } + + CompWindowExtents input(border); + + if (deco_elements_ & cu::DecorationElement::EDGE) + { + auto const& ib = Style::Get()->InputBorder(); + input.left += cv_->CP(ib.left); + input.right += cv_->CP(ib.right); + input.top += cv_->CP(ib.top); + input.bottom += cv_->CP(ib.bottom); + } if (win_->border() != border || win_->input() != input) win_->setWindowFrameExtents(&border, &input); } +void Window::Impl::SendFrameExtents() +{ + UpdateElements(cu::WindowFilter::UNMAPPED); + SetupExtents(); + win_->setWindowFrameExtents(&win_->border(), &win_->input()); +} + void Window::Impl::UnsetFrame() { if (!frame_) @@ -185,6 +225,15 @@ UpdateFrameGeo(frame_geo); } +void Window::Impl::UpdateFrameActions() +{ + if (!dirty_frame_ && (win_->mwmDecor() != last_mwm_decor_ || win_->actions() != last_actions_)) + { + dirty_frame_ = true; + Damage(); + } +} + void Window::Impl::CreateFrame(nux::Geometry const& frame_geo) { /* Since we're reparenting windows here, we need to grab the server @@ -282,6 +331,42 @@ win_->updateFrameRegion(); } +void Window::Impl::SetupWindowEdges() +{ + if (input_mixer_) + return; + + dpi_changed_ = Settings::Instance().dpi_changed.connect([this] { + Update(); + edge_borders_->scale = cv_->DPIScale(); + if (top_layout_) top_layout_->scale = cv_->DPIScale(); + }); + + input_mixer_ = std::make_shared(); + edge_borders_ = std::make_shared(win_); + edge_borders_->scale = cv_->DPIScale(); + input_mixer_->PushToFront(edge_borders_); + + UpdateWindowEdgesGeo(); +} + +void Window::Impl::UpdateWindowEdgesGeo() +{ + if (!edge_borders_) + return; + + auto const& input = win_->inputRect(); + edge_borders_->SetCoords(input.x(), input.y()); + edge_borders_->SetSize(input.width(), input.height()); +} + +void Window::Impl::CleanupWindowEdges() +{ + input_mixer_.reset(); + edge_borders_.reset(); + dpi_changed_->disconnect(); +} + void Window::Impl::SetupWindowControls() { if (top_layout_) @@ -293,26 +378,7 @@ Decorate(); }); - dpi_changed_ = Settings::Instance().dpi_changed.connect([this] { - Update(); - top_layout_->scale = cv_->DPIScale(); - }); - - input_mixer_ = std::make_shared(); - - if (win_->actions() & CompWindowActionResizeMask) - { - auto edges = std::make_shared(win_); - grab_edge_ = edges->GetEdge(Edge::Type::GRAB); - edge_borders_ = edges; - } - else /*if (win_->actions() & CompWindowActionMoveMask)*/ - { - edge_borders_ = std::make_shared(win_); - grab_edge_ = edge_borders_; - } - - input_mixer_->PushToFront(edge_borders_); + grab_edge_ = std::static_pointer_cast(edge_borders_)->GetEdge(Edge::Type::GRAB); auto padding = style->Padding(Side::TOP); top_layout_ = std::make_shared(); @@ -347,6 +413,7 @@ top_layout_->Append(title_layout); input_mixer_->PushToFront(top_layout_); + dirty_frame_ = false; SetupAppMenu(); RedrawDecorations(); @@ -357,12 +424,12 @@ if (title_) last_title_ = title_->text(); + if (input_mixer_) + input_mixer_->Remove(top_layout_); + UnsetAppMenu(); theme_changed_->disconnect(); - dpi_changed_->disconnect(); top_layout_.reset(); - input_mixer_.reset(); - edge_borders_.reset(); } bool Window::Impl::IsMaximized() const @@ -370,26 +437,25 @@ return (win_->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE; } -bool Window::Impl::ShadowDecorated() const +void Window::Impl::UpdateElements(cu::WindowFilter::Value wf) { if (!parent_->scaled() && IsMaximized()) - return false; + { + deco_elements_ = cu::DecorationElement::NONE; + return; + } - if (!cu::IsWindowShadowDecorable(win_)) - return false; + deco_elements_ = cu::WindowDecorationElements(win_, wf); +} - return true; +bool Window::Impl::ShadowDecorated() const +{ + return deco_elements_ & cu::DecorationElement::SHADOW; } bool Window::Impl::FullyDecorated() const { - if (!parent_->scaled() && IsMaximized()) - return false; - - if (!cu::IsWindowFullyDecorable(win_)) - return false; - - return true; + return deco_elements_ & cu::DecorationElement::BORDER; } bool Window::Impl::ShouldBeDecorated() const @@ -431,6 +497,7 @@ } deco_tex.SetCoords(geo.x, geo.y); + deco_tex.quad.region = deco_tex.quad.box; } void Window::Impl::UpdateDecorationTextures() @@ -442,7 +509,6 @@ } auto const& geo = win_->borderRect(); - auto const& input = win_->inputRect(); auto const& border = win_->border(); bg_textures_.resize(4); @@ -454,19 +520,18 @@ top_layout_->SetCoords(geo.x(), geo.y()); top_layout_->SetSize(geo.width(), border.top); - if (edge_borders_) - { - edge_borders_->SetCoords(input.x(), input.y()); - edge_borders_->SetSize(input.width(), input.height()); - } - SyncMenusGeometries(); } void Window::Impl::ComputeShadowQuads() { - if (last_shadow_rect_.isEmpty() && !ShadowDecorated()) + if (!(deco_elements_ & cu::DecorationElement::SHADOW)) + { + if (!last_shadow_rect_.isEmpty()) + last_shadow_rect_.setGeometry(0, 0, 0, 0); + return; + } const auto* texture = ShadowTexture(); @@ -554,6 +619,12 @@ if (shadows_rect != last_shadow_rect_) { + auto const& win_region = win_->region(); + quads[Quads::Pos::TOP_LEFT].region = CompRegion(quads[Quads::Pos::TOP_LEFT].box) - win_region; + quads[Quads::Pos::TOP_RIGHT].region = CompRegion(quads[Quads::Pos::TOP_RIGHT].box) - win_region; + quads[Quads::Pos::BOTTOM_LEFT].region = CompRegion(quads[Quads::Pos::BOTTOM_LEFT].box) - win_region; + quads[Quads::Pos::BOTTOM_RIGHT].region = CompRegion(quads[Quads::Pos::BOTTOM_RIGHT].box) - win_region; + last_shadow_rect_ = shadows_rect; win_->updateWindowOutputExtents(); } @@ -563,16 +634,31 @@ GLWindowPaintAttrib const& attrib, CompRegion const& region, unsigned mask) { + if (!(mask & PAINT_SCREEN_TRANSFORMED_MASK) && win_->defaultViewport() != screen->vp()) + { + return; + } + if (dirty_geo_) parent_->UpdateDecorationPosition(); + + if (dirty_frame_) + { + dirty_frame_ = false; + CleanupWindowControls(); + CleanupWindowEdges(); + Update(); + } } void Window::Impl::Draw(GLMatrix const& transformation, GLWindowPaintAttrib const& attrib, CompRegion const& region, unsigned mask) { - if (last_shadow_rect_.isEmpty()) + if (last_shadow_rect_.isEmpty() || (!(mask & PAINT_SCREEN_TRANSFORMED_MASK) && win_->defaultViewport() != screen->vp())) + { return; + } auto const& clip_region = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ? infiniteRegion : region; mask |= PAINT_WINDOW_BLEND_MASK; @@ -582,7 +668,7 @@ for (unsigned i = 0; i < shadow_quads_.size(); ++i) { auto& quad = shadow_quads_[Quads::Pos(i)]; - glwin_->glAddGeometry({quad.matrix}, CompRegion(quad.box) - win_->region(), clip_region); + glwin_->glAddGeometry(quad.matrices, quad.region, clip_region); } if (glwin_->vertexBuffer()->end()) @@ -594,7 +680,7 @@ continue; glwin_->vertexBuffer()->begin(); - glwin_->glAddGeometry({dtex.quad.matrix}, dtex.quad.box, clip_region); + glwin_->glAddGeometry(dtex.quad.matrices, dtex.quad.region, clip_region); if (glwin_->vertexBuffer()->end()) glwin_->glDrawTexture(dtex, transformation, attrib, mask); @@ -707,6 +793,9 @@ if (top_layout_) top_layout_->scale = cv_->DPIScale(); + + if (edge_borders_) + edge_borders_->scale = cv_->DPIScale(); } } @@ -789,6 +878,7 @@ { impl_->UpdateMonitor(); impl_->ComputeShadowQuads(); + impl_->UpdateWindowEdgesGeo(); impl_->UpdateDecorationTextures(); impl_->UpdateForceQuitDialogPosition(); impl_->dirty_geo_ = false; @@ -808,7 +898,8 @@ { data.add(impl_->win_->borderRect()) .add("input_geo", impl_->win_->inputRect()) - .add("content_geo", impl_->win_->region().boundingRect()) + .add("content_geo", impl_->win_->geometry()) + .add("region", impl_->win_->region().boundingRect()) .add("title", title()) .add("active", impl_->active()) .add("scaled", scaled()) diff -Nru unity-7.2.3+14.04.20140826/decorations/DecorationsEdgeBorders.cpp unity-7.2.4+14.04.20141217/decorations/DecorationsEdgeBorders.cpp --- unity-7.2.3+14.04.20140826/decorations/DecorationsEdgeBorders.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecorationsEdgeBorders.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -26,21 +26,31 @@ { namespace { -const int MIN_CORNER_EDGE = 10; +const RawPixel MIN_CORNER_EDGE = 10_em; } EdgeBorders::EdgeBorders(CompWindow* win) { - items_.resize(size_t(Edge::Type::Size)); + scale.changed.connect(sigc::hide(sigc::mem_fun(this, &EdgeBorders::Relayout))); - for (unsigned i = 0; i < unsigned(Edge::Type::Size); ++i) + if (win->actions() & CompWindowActionResizeMask) { - auto type = Edge::Type(i); + items_.resize(size_t(Edge::Type::Size)); - if (type == Edge::Type::GRAB) - items_[i] = std::make_shared(win); - else - items_[i] = std::make_shared(win, type); + for (unsigned i = 0; i < unsigned(Edge::Type::Size); ++i) + { + auto type = Edge::Type(i); + + if (type == Edge::Type::GRAB) + items_[i] = std::make_shared(win); + else + items_[i] = std::make_shared(win, type); + } + } + else /*if (win->actions() & CompWindowActionMoveMask)*/ + { + items_.resize(size_t(Edge::Type::GRAB) + 1); + items_[unsigned(Edge::Type::GRAB)] = std::make_shared(win); } Relayout(); @@ -54,10 +64,17 @@ auto const& ib = win->input(); using namespace compiz::window::extents; - Extents edges(std::max(ib.left, MIN_CORNER_EDGE), - std::max(ib.right, MIN_CORNER_EDGE), - std::max(ib.top, MIN_CORNER_EDGE), - std::max(ib.bottom, MIN_CORNER_EDGE)); + int min_corner_edge = MIN_CORNER_EDGE.CP(scale); + Extents edges(std::max(ib.left, min_corner_edge), + std::max(ib.right, min_corner_edge), + std::max(ib.top, min_corner_edge), + std::max(ib.bottom, min_corner_edge)); + + grab_edge->SetCoords(rect_.x() + ib.left, rect_.y() + ib.top - b.top); + grab_edge->SetSize(rect_.width() - ib.left - ib.right, b.top); + + if (items_.size() != size_t(Edge::Type::Size)) + return; auto item = items_[unsigned(Edge::Type::TOP)]; item->SetCoords(rect_.x() + edges.left, rect_.y()); @@ -90,10 +107,6 @@ item = items_[unsigned(Edge::Type::BOTTOM_RIGHT)]; item->SetCoords(rect_.x2() - edges.right, rect_.y2() - edges.bottom); item->SetSize(edges.right, edges.bottom); - - item = items_[unsigned(Edge::Type::GRAB)]; - item->SetCoords(rect_.x() + ib.left, rect_.y() + ib.top - b.top); - item->SetSize(rect_.width() - ib.left - ib.right, b.top); } Item::Ptr const& EdgeBorders::GetEdge(Edge::Type type) const diff -Nru unity-7.2.3+14.04.20140826/decorations/DecorationsForceQuitDialog.cpp unity-7.2.4+14.04.20141217/decorations/DecorationsForceQuitDialog.cpp --- unity-7.2.3+14.04.20140826/decorations/DecorationsForceQuitDialog.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecorationsForceQuitDialog.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -141,7 +141,7 @@ auto const& deco_style = decoration::Style::Get(); auto const& offset = deco_style->ShadowOffset(); - int max_offset = std::max(std::abs(offset.x), std::abs(offset.y)); + int max_offset = std::max(std::abs(offset.x * 4), std::abs(offset.y * 4)); gtk_container_set_border_width(GTK_CONTAINER(self), deco_style->ActiveShadowRadius()+max_offset); auto* screen = gtk_window_get_screen(self); @@ -259,18 +259,32 @@ auto const& radius = deco_style->CornerRadius(); auto const& offset = deco_style->ShadowOffset(); auto const& color = deco_style->ActiveShadowColor(); + auto const& backcolor = deco_style->InactiveShadowColor(); int decoration_radius = std::max({radius.top, radius.left, radius.right, radius.bottom}); - gtk_css_provider_load_from_data(style, (R"(SheetStyleDialog { + gtk_css_provider_load_from_data(style, (R"( + SheetStyleDialog { background-color: #f7f6f5; color: #4a4a4a; border-radius: )"+std::to_string(decoration_radius)+R"(px; - box-shadow: )"+std::to_string(offset.x)+"px "+std::to_string(offset.y)+"px "+ + box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+ std::to_string(deco_style->ActiveShadowRadius())+"px "+ "rgba("+std::to_string(int(color.red * 255.0))+", "+ std::to_string(int(color.green * 255.0))+", "+ std::to_string(int(color.blue * 255.0))+", "+ std::to_string(int(color.alpha))+'.'+std::to_string(int(color.alpha*10000.0))+')'+R"(; + } + + SheetStyleDialog:backdrop { + background-color: shade(#f7f6f5, 1.2); + color: shade(#4a4a4a, 1.5); + border-radius: )"+std::to_string(decoration_radius)+R"(px; + box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+ + std::to_string(deco_style->InactiveShadowRadius())+"px "+ + "rgba("+std::to_string(int(backcolor.red * 255.0))+", "+ + std::to_string(int(backcolor.green * 255.0))+", "+ + std::to_string(int(backcolor.blue * 255.0))+", "+ + std::to_string(int(backcolor.alpha))+'.'+std::to_string(int(backcolor.alpha*10000.0))+')'+R"(; })").c_str(), -1, nullptr); auto* style_ctx = gtk_widget_get_style_context(self); diff -Nru unity-7.2.3+14.04.20140826/decorations/DecorationsManager.cpp unity-7.2.4+14.04.20141217/decorations/DecorationsManager.cpp --- unity-7.2.3+14.04.20140826/decorations/DecorationsManager.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecorationsManager.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -44,8 +44,7 @@ } Manager::Impl::Impl(decoration::Manager* parent, menu::Manager::Ptr const& menu) - : active_window_(0) - , enable_add_supported_atoms_(true) + : enable_add_supported_atoms_(true) , data_pool_(DataPool::Get()) , menu_manager_(menu) { @@ -55,7 +54,6 @@ Display* dpy = screen->dpy(); atom::_NET_REQUEST_FRAME_EXTENTS = XInternAtom(dpy, "_NET_REQUEST_FRAME_EXTENTS", False); atom::_NET_WM_VISIBLE_NAME = XInternAtom(dpy, "_NET_WM_VISIBLE_NAME", False); - screen->updateSupportedWmHints(); auto rebuild_cb = sigc::mem_fun(this, &Impl::OnShadowOptionsChanged); manager_->active_shadow_color.changed.connect(sigc::hide(sigc::bind(rebuild_cb, true))); @@ -208,15 +206,13 @@ bool Manager::Impl::HandleEventBefore(XEvent* event) { - active_window_ = screen->activeWindow(); - switch (event->type) { case ClientMessage: if (event->xclient.message_type == atom::_NET_REQUEST_FRAME_EXTENTS) { if (Window::Ptr const& win = GetWindowByXid(event->xclient.window)) - win->impl_->Decorate(); + win->impl_->SendFrameExtents(); } else if (event->xclient.message_type == Atoms::toolkitAction) { @@ -254,31 +250,26 @@ bool Manager::Impl::HandleEventAfter(XEvent* event) { - if (screen->activeWindow() != active_window_) - { - // Do this when _NET_ACTIVE_WINDOW changes on root! - if (active_deco_win_) - active_deco_win_->impl_->active = false; - - active_window_ = screen->activeWindow(); - auto const& new_active = GetWindowByXid(active_window_); - active_deco_win_ = new_active; - - if (new_active) - new_active->impl_->active = true; - } - switch (event->type) { case PropertyNotify: { - if (event->xproperty.atom == Atoms::mwmHints) + if (event->xproperty.atom == Atoms::winActive) + { + if (active_deco_win_) + active_deco_win_->impl_->active = false; + + auto const& new_active = GetWindowByXid(screen->activeWindow()); + active_deco_win_ = new_active; + + if (new_active) + new_active->impl_->active = true; + } + else if (event->xproperty.atom == Atoms::mwmHints || + event->xproperty.atom == Atoms::wmAllowedActions) { if (Window::Ptr const& win = GetWindowByXid(event->xproperty.window)) - { - win->impl_->CleanupWindowControls(); - win->Update(); - } + win->impl_->UpdateFrameActions(); } else if (event->xproperty.atom == XA_WM_NAME || event->xproperty.atom == Atoms::wmName || @@ -445,7 +436,7 @@ .add("active_shadow_radius", active_shadow_radius()) .add("inactive_shadow_color", inactive_shadow_color()) .add("inactive_shadow_radius", inactive_shadow_radius()) - .add("active_window", impl_->active_window_); + .add("active_window", screen->activeWindow()); } debug::Introspectable::IntrospectableList Manager::GetIntrospectableChildren() diff -Nru unity-7.2.3+14.04.20140826/decorations/DecorationsPriv.h unity-7.2.4+14.04.20141217/decorations/DecorationsPriv.h --- unity-7.2.3+14.04.20140826/decorations/DecorationsPriv.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecorationsPriv.h 2014-12-17 15:51:54.000000000 -0500 @@ -1,6 +1,6 @@ // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* - * Copyright (C) 2013 Canonical Ltd + * Copyright (C) 2013-2014 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 @@ -88,15 +88,20 @@ void SetupAppMenu(); bool ActivateMenu(std::string const&); void ShowForceQuitDialog(bool, Time); + void SendFrameExtents(); private: void UnsetExtents(); void SetupExtents(); + void UpdateElements(cu::WindowFilter::Value wf = cu::WindowFilter::NONE); void UpdateMonitor(); void UpdateFrame(); void CreateFrame(nux::Geometry const&); void UpdateFrameGeo(nux::Geometry const&); + void UpdateFrameActions(); void UnsetFrame(); + void SetupWindowEdges(); + void CleanupWindowEdges(); void SetupWindowControls(); void CleanupWindowControls(); void UnsetAppMenu(); @@ -109,6 +114,7 @@ void ComputeShadowQuads(); void UpdateDecorationTextures(); + void UpdateWindowEdgesGeo(); void UpdateForceQuitDialogPosition(); void RenderDecorationTexture(Side, nux::Geometry const&); void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask); @@ -122,8 +128,12 @@ ::CompositeWindow* cwin_; ::GLWindow* glwin_; ::Window frame_; - bool dirty_geo_; int monitor_; + bool dirty_geo_; + bool dirty_frame_; + unsigned deco_elements_; + unsigned last_mwm_decor_; + unsigned last_actions_; CompRect last_shadow_rect_; Quads shadow_quads_; @@ -176,7 +186,6 @@ friend class Manager; friend struct Window::Impl; - ::Window active_window_; bool enable_add_supported_atoms_; DataPool::Ptr data_pool_; diff -Nru unity-7.2.3+14.04.20140826/decorations/DecorationsTitle.cpp unity-7.2.4+14.04.20141217/decorations/DecorationsTitle.cpp --- unity-7.2.3+14.04.20140826/decorations/DecorationsTitle.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecorationsTitle.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -80,6 +80,7 @@ Style::Get()->DrawTitle(text(), state, text_ctx, texture_size_.width / scale(), texture_size_.height / scale(), bg_geo * (1.0/scale)); SetTexture(text_ctx); + texture_.UpdateMatrix(); } void Title::SetX(int x) diff -Nru unity-7.2.3+14.04.20140826/decorations/DecorationsWidgets.cpp unity-7.2.4+14.04.20141217/decorations/DecorationsWidgets.cpp --- unity-7.2.3+14.04.20140826/decorations/DecorationsWidgets.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecorationsWidgets.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -226,6 +226,12 @@ // +TexturedItem::TexturedItem() + : dirty_region_(false) +{ + geo_parameters_changed.connect([this] { dirty_region_ = true; }); +} + void TexturedItem::SetTexture(cu::SimpleTexture::Ptr const& tex) { auto prev_geo = Geometry(); @@ -254,8 +260,14 @@ if (!visible || Geometry().isEmpty() || !texture_) return; + if (dirty_region_) + { + texture_.quad.region = texture_.quad.box; + dirty_region_ = false; + } + ctx->vertexBuffer()->begin(); - ctx->glAddGeometry({texture_.quad.matrix}, texture_.quad.box, clip); + ctx->glAddGeometry(texture_.quad.matrices, texture_.quad.region, clip); if (ctx->vertexBuffer()->end()) ctx->glDrawTexture(texture_, transformation, attrib, mask); diff -Nru unity-7.2.3+14.04.20140826/decorations/DecorationsWidgets.h unity-7.2.4+14.04.20141217/decorations/DecorationsWidgets.h --- unity-7.2.3+14.04.20140826/decorations/DecorationsWidgets.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/decorations/DecorationsWidgets.h 2014-12-17 15:51:54.000000000 -0500 @@ -121,6 +121,8 @@ public: typedef std::shared_ptr Ptr; + TexturedItem(); + void SetTexture(cu::SimpleTexture::Ptr const&); void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask); void SetCoords(int x, int y); @@ -133,6 +135,9 @@ CompRect& InternalGeo(); cu::SimpleTextureQuad texture_; + +private: + bool dirty_region_; }; diff -Nru unity-7.2.3+14.04.20140826/doc/unity.1 unity-7.2.4+14.04.20141217/doc/unity.1 --- unity-7.2.3+14.04.20140826/doc/unity.1 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/doc/unity.1 2014-12-17 15:51:54.000000000 -0500 @@ -1,4 +1,4 @@ -.TH unity "1" "9 December 2010" "" "Linux User's Manual" +.TH unity "1" "09 August 2014" "" "Linux User's Manual" .SH NAME unity \- wrapper for starting the unity shell and handling fallback @@ -12,17 +12,42 @@ The \fBunity\fP program can be used to start the Unity shell as a compiz module, and to specify how to handle logging, debugging, as well as how to deal with the user's profile. .SH OPTIONS -.IP \fB\-\-advanced\-debug\fP -Runs unity under debugging (using GDB or another debugger tool) to help tracking issues. Should only be used on request from a developper following a bug report. +.TP +.BR \-\-advanced\-debug +Runs unity under debugging (using \fBgdb\fR or another debugger tool) to help tracking issues. Should only be used on request from a developer following a bug report. + +.TP +.BR "-\-compiz-path \fICOMPIZ_PATH\fR" +Runs the compositor from a non-standard location. + +.TP +.BR \-\-debug +Runs Unity under +.B gdb +and prints a stack trace on crash. + +.TP +.BR \-h ", " \-\-help +Prints a usage message and exits. -.IP \fB\-\-log\fP\ \fIfilename\fP +.TP +.BR "\-\-log \fIfilename\fR" This parameter, followed by a path or filename, tells the Unity shell to store logs in the specified file. -.IP \fB\-\-reset\fP -This option allows the user to reset profile parameters in compiz and restart the Unity shell with default settings. +.TP +.BR \-\-replace +Deprecated option for backwards compatibility. Has no effect. + +.TP +.BR \-\-reset\-icons +Resets the default Launcher icons. + +.TP +.BR \-v ", " \-\-version +Shows the program version number and exits. -.IP \fB\-\-verbose\fP -This option turns on displaying additional debugging output for the Unity shell. It can be used by the user to debug configuration issues. This option is often used along with the \fB\-\-log\fP option to save output to a file. +.TP +.BR \-\-verbose .SH "SEE ALSO" .B unity-panel-service diff -Nru unity-7.2.3+14.04.20140826/hud/HudIconTextureSource.cpp unity-7.2.4+14.04.20141217/hud/HudIconTextureSource.cpp --- unity-7.2.3+14.04.20140826/hud/HudIconTextureSource.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/hud/HudIconTextureSource.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -109,11 +109,6 @@ return nux::Color(0.0f, 0.0f, 0.0f, 0.0f); } -nux::BaseTexture* HudIconTextureSource::Emblem() -{ - return nullptr; -} - } } diff -Nru unity-7.2.3+14.04.20140826/hud/HudIconTextureSource.h unity-7.2.4+14.04.20141217/hud/HudIconTextureSource.h --- unity-7.2.3+14.04.20140826/hud/HudIconTextureSource.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/hud/HudIconTextureSource.h 2014-12-17 15:51:54.000000000 -0500 @@ -37,7 +37,6 @@ virtual nux::Color BackgroundColor() const; virtual nux::BaseTexture* TextureForSize(int size); virtual nux::Color GlowColor(); - virtual nux::BaseTexture* Emblem(); void ColorForIcon(GdkPixbuf* pixbuf); private: diff -Nru unity-7.2.3+14.04.20140826/launcher/ApplicationLauncherIcon.cpp unity-7.2.4+14.04.20141217/launcher/ApplicationLauncherIcon.cpp --- unity-7.2.3+14.04.20140826/launcher/ApplicationLauncherIcon.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/ApplicationLauncherIcon.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -33,6 +33,7 @@ #include "MultiMonitor.h" #include "unity-shared/DesktopApplicationManager.h" #include "unity-shared/GnomeFileManager.h" +#include "unity-shared/UBusWrapper.h" #include "unity-shared/UBusMessages.h" #include "unity-shared/UScreen.h" @@ -1168,6 +1169,7 @@ if (!IsRunning()) return false; + UBusManager::SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); Focus(ActionArg(ActionArg::Source::LAUNCHER, 1, timestamp)); if (GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() > 1) diff -Nru unity-7.2.3+14.04.20140826/launcher/DesktopLauncherIcon.cpp unity-7.2.4+14.04.20141217/launcher/DesktopLauncherIcon.cpp --- unity-7.2.3+14.04.20140826/launcher/DesktopLauncherIcon.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/DesktopLauncherIcon.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -33,7 +33,9 @@ : SimpleLauncherIcon(IconType::DESKTOP) , show_in_switcher_(true) { - tooltip_text = _("Show Desktop"); + WindowManager::Default().show_desktop_changed.connect(sigc::mem_fun(this, &DesktopLauncherIcon::UpdateTooltipText)); + + UpdateTooltipText(); icon_name = "desktop"; SetQuirk(Quirk::VISIBLE, true); SetShortcut('d'); @@ -43,6 +45,16 @@ { SimpleLauncherIcon::ActivateLauncherIcon(arg); WindowManager::Default().ShowDesktop(); + UpdateTooltipText(); +} + +void DesktopLauncherIcon::UpdateTooltipText() +{ + auto const& wm = WindowManager::Default(); + if (wm.InShowDesktop()) + tooltip_text = _("Restore Windows"); + else + tooltip_text = _("Show Desktop"); } std::string DesktopLauncherIcon::GetName() const diff -Nru unity-7.2.3+14.04.20140826/launcher/DesktopLauncherIcon.h unity-7.2.4+14.04.20141217/launcher/DesktopLauncherIcon.h --- unity-7.2.3+14.04.20140826/launcher/DesktopLauncherIcon.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/DesktopLauncherIcon.h 2014-12-17 15:51:54.000000000 -0500 @@ -41,6 +41,8 @@ std::string GetRemoteUri() const; private: + void UpdateTooltipText(); + bool show_in_switcher_; }; diff -Nru unity-7.2.3+14.04.20140826/launcher/Launcher.cpp unity-7.2.4+14.04.20141217/launcher/Launcher.cpp --- unity-7.2.3+14.04.20140826/launcher/Launcher.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/Launcher.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -1219,6 +1219,7 @@ Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_height), monitor_geo.height - panel_height); icon_renderer_->monitor = new_monitor; + icon_renderer_->scale = cv_->DPIScale(); SetIconSize(options()->tile_size, options()->icon_size); } @@ -1516,10 +1517,7 @@ void Launcher::SetIconSize(int tile_size, int icon_size) { - ui::IconRenderer::DestroyShortcutTextures(); - icon_size_ = tile_size; - icon_renderer_->scale = cv_->DPIScale(); icon_renderer_->SetTargetSize(icon_size_.CP(cv_), RawPixel(icon_size).CP(cv_), SPACE_BETWEEN_ICONS.CP(cv_)); AbstractLauncherIcon::icon_size = icon_size_; diff -Nru unity-7.2.3+14.04.20140826/launcher/LauncherIcon.cpp unity-7.2.4+14.04.20141217/launcher/LauncherIcon.cpp --- unity-7.2.3+14.04.20140826/launcher/LauncherIcon.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/LauncherIcon.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -59,6 +59,9 @@ const std::string CENTER_STABILIZE_TIMEOUT = "center-stabilize-timeout"; const std::string PRESENT_TIMEOUT = "present-timeout"; const std::string QUIRK_DELAY_TIMEOUT = "quirk-delay-timeout"; + +const int COUNT_FONT_SIZE = 11; +const int COUNT_PADDING = 2; } NUX_IMPLEMENT_OBJECT_TYPE(LauncherIcon); @@ -69,7 +72,6 @@ LauncherIcon::LauncherIcon(IconType type) : _icon_type(type) , _sticky(false) - , _remote_urgent(false) , _present_urgency(0) , _progress(0.0f) , _sort_priority(DefaultPriority(type)) @@ -100,6 +102,11 @@ mouse_up.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseUp)); mouse_click.connect(sigc::mem_fun(this, &LauncherIcon::RecvMouseClick)); + auto const& count_rebuild_cb = sigc::mem_fun(this, &LauncherIcon::CleanCountTextures); + Settings::Instance().dpi_changed.connect(count_rebuild_cb); + Settings::Instance().font_scaling.changed.connect(sigc::hide(count_rebuild_cb)); + icon_size.changed.connect(sigc::hide(count_rebuild_cb)); + for (unsigned i = 0; i < monitors::MAX; ++i) { for (unsigned j = 0; j < static_cast(Quirk::LAST); ++j) @@ -966,14 +973,42 @@ return result; } -nux::BaseTexture* -LauncherIcon::Emblem() +nux::BaseTexture* LauncherIcon::Emblem() const { return _emblem.GetPointer(); } -void -LauncherIcon::SetEmblem(LauncherIcon::BaseTexturePtr const& emblem) +nux::BaseTexture* LauncherIcon::CountTexture(double scale) +{ + int count = Count(); + + if (!count) + return nullptr; + + auto it = _counts.find(scale); + + if (it != _counts.end()) + return it->second.GetPointer(); + + auto const& texture = DrawCountTexture(count, scale); + _counts[scale] = texture; + return texture.GetPointer(); +} + +unsigned LauncherIcon::Count() const +{ + if (!_remote_entries.empty()) + { + auto const& remote = _remote_entries.front(); + + if (remote->CountVisible()) + return remote->Count(); + } + + return 0; +} + +void LauncherIcon::SetEmblem(LauncherIcon::BaseTexturePtr const& emblem) { _emblem = emblem; EmitNeedsRedraw(); @@ -994,55 +1029,42 @@ emblem->UnReference(); } -void -LauncherIcon::SetEmblemText(std::string const& text) +void LauncherIcon::CleanCountTextures() { - PangoLayout* layout = NULL; - - PangoContext* pangoCtx = NULL; - PangoFontDescription* desc = NULL; - GdkScreen* screen = gdk_screen_get_default(); // not ref'ed - GtkSettings* settings = gtk_settings_get_default(); // not ref'ed - gchar* fontName = NULL; - - int width = 32; - int height = 8 * 2; - int font_height = height - 5; - - - nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height); - cairo_t* cr = cg.GetInternalContext(); - - cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); - cairo_paint(cr); - - cairo_set_operator(cr, CAIRO_OPERATOR_OVER); - - - layout = pango_cairo_create_layout(cr); - - g_object_get(settings, "gtk-font-name", &fontName, NULL); - desc = pango_font_description_from_string(fontName); - pango_font_description_set_absolute_size(desc, pango_units_from_double(font_height)); - - pango_layout_set_font_description(layout, desc); - pango_font_description_free(desc); + _counts.clear(); + EmitNeedsRedraw(); +} - pango_layout_set_width(layout, pango_units_from_double(width - 4.0f)); - pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR); - pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_NONE); - pango_layout_set_markup_with_accel(layout, text.c_str(), -1, '_', NULL); +BaseTexturePtr LauncherIcon::DrawCountTexture(unsigned count, double scale) +{ + glib::Object pango_ctx(gdk_pango_context_get()); + glib::Object layout(pango_layout_new(pango_ctx)); - pangoCtx = pango_layout_get_context(layout); // is not ref'ed - pango_cairo_context_set_font_options(pangoCtx, - gdk_screen_get_font_options(screen)); + glib::String font_name; + g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, nullptr); + std::shared_ptr desc(pango_font_description_from_string(font_name), pango_font_description_free); + int font_size = pango_units_from_double(Settings::Instance().font_scaling() * COUNT_FONT_SIZE); + pango_font_description_set_absolute_size(desc.get(), font_size); + pango_layout_set_font_description(layout, desc.get()); + + pango_layout_set_width(layout, pango_units_from_double(icon_size() * 0.75)); + pango_layout_set_height(layout, -1); + pango_layout_set_wrap(layout, PANGO_WRAP_CHAR); + pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_MIDDLE); + pango_layout_set_text(layout, std::to_string(count).c_str(), -1); - PangoRectangle logical_rect, ink_rect; - pango_layout_get_extents(layout, &logical_rect, &ink_rect); + PangoRectangle ink_rect; + pango_layout_get_pixel_extents(layout, &ink_rect, nullptr); /* DRAW OUTLINE */ - float radius = height / 2.0f - 1.0f; - float inset = radius + 1.0f; + const float height = ink_rect.height + COUNT_PADDING * 4; + const float inset = height / 2.0; + const float radius = inset - 1.0f; + const float width = ink_rect.width + inset + COUNT_PADDING * 2; + + nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, std::round(width * scale), std::round(height * scale)); + cairo_surface_set_device_scale(cg.GetSurface(), scale, scale); + cairo_t* cr = cg.GetInternalContext(); cairo_move_to(cr, inset, height - 1.0f); cairo_arc(cr, inset, inset, radius, 0.5 * M_PI, 1.5 * M_PI); @@ -1059,16 +1081,11 @@ cairo_set_line_width(cr, 1.0f); /* DRAW TEXT */ - cairo_move_to(cr, - (int)((width - pango_units_to_double(logical_rect.width)) / 2.0f), - (int)((height - pango_units_to_double(logical_rect.height)) / 2.0f - pango_units_to_double(logical_rect.y))); + cairo_move_to(cr, (width - ink_rect.width) / 2.0 - ink_rect.x, + (height - ink_rect.height) / 2.0 - ink_rect.y); pango_cairo_show_layout(cr, layout); - SetEmblem(texture_ptr_from_cairo_graphics(cg)); - - // clean up - g_object_unref(layout); - g_free(fontName); + return texture_ptr_from_cairo_graphics(cg); } void @@ -1077,26 +1094,34 @@ SetEmblem(BaseTexturePtr()); } -void -LauncherIcon::InsertEntryRemote(LauncherEntryRemote::Ptr const& remote) +void LauncherIcon::InsertEntryRemote(LauncherEntryRemote::Ptr const& remote) { - if (std::find(_entry_list.begin(), _entry_list.end(), remote) != _entry_list.end()) + if (!remote || std::find(_remote_entries.begin(), _remote_entries.end(), remote) != _remote_entries.end()) return; - _entry_list.push_front(remote); + _remote_entries.push_back(remote); AddChild(remote.get()); + SelectEntryRemote(remote); +} - remote->emblem_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemChanged)); - remote->count_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountChanged)); - remote->progress_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressChanged)); - remote->quicklist_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteQuicklistChanged)); - - remote->emblem_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemVisibleChanged)); - remote->count_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountVisibleChanged)); - remote->progress_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressVisibleChanged)); +void LauncherIcon::SelectEntryRemote(LauncherEntryRemote::Ptr const& remote) +{ + if (!remote) + return; - remote->urgent_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteUrgentChanged)); + auto& cm = _remote_connections; + cm.Clear(); + cm.Add(remote->emblem_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemChanged))); + cm.Add(remote->count_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountChanged))); + cm.Add(remote->progress_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressChanged))); + cm.Add(remote->quicklist_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteQuicklistChanged))); + + cm.Add(remote->emblem_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteEmblemVisibleChanged))); + cm.Add(remote->count_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteCountVisibleChanged))); + cm.Add(remote->progress_visible_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteProgressVisibleChanged))); + + cm.Add(remote->urgent_changed.connect(sigc::mem_fun(this, &LauncherIcon::OnRemoteUrgentChanged))); if (remote->EmblemVisible()) OnRemoteEmblemVisibleChanged(remote.get()); @@ -1113,28 +1138,30 @@ OnRemoteQuicklistChanged(remote.get()); } -void -LauncherIcon::RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote) +void LauncherIcon::RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote) { - if (std::find(_entry_list.begin(), _entry_list.end(), remote) == _entry_list.end()) - return; + auto remote_it = std::find(_remote_entries.begin(), _remote_entries.end(), remote); - _entry_list.remove(remote); - RemoveChild(remote.get()); + if (remote_it == _remote_entries.end()) + return; - DeleteEmblem(); SetQuirk(Quirk::PROGRESS, false); - if (_remote_urgent) + if (remote->Urgent()) SetQuirk(Quirk::URGENT, false); + _remote_entries.erase(remote_it); + RemoveChild(remote.get()); + DeleteEmblem(); _remote_menus = nullptr; + + if (!_remote_entries.empty()) + SelectEntryRemote(_remote_entries.back()); } void LauncherIcon::OnRemoteUrgentChanged(LauncherEntryRemote* remote) { - _remote_urgent = remote->Urgent(); SetQuirk(Quirk::URGENT, remote->Urgent()); } @@ -1153,14 +1180,7 @@ if (!remote->CountVisible()) return; - if (remote->Count() / 10000 != 0) - { - SetEmblemText("****"); - } - else - { - SetEmblemText(std::to_string(remote->Count())); - } + CleanCountTextures(); } void @@ -1190,14 +1210,7 @@ void LauncherIcon::OnRemoteCountVisibleChanged(LauncherEntryRemote* remote) { - if (remote->CountVisible()) - { - SetEmblemText(std::to_string(remote->Count())); - } - else - { - DeleteEmblem(); - } + CleanCountTextures(); } void diff -Nru unity-7.2.3+14.04.20140826/launcher/LauncherIcon.h unity-7.2.4+14.04.20141217/launcher/LauncherIcon.h --- unity-7.2.3+14.04.20140826/launcher/LauncherIcon.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/LauncherIcon.h 2014-12-17 15:51:54.000000000 -0500 @@ -154,14 +154,15 @@ } nux::BaseTexture* TextureForSize(int size); - - nux::BaseTexture* Emblem(); + nux::BaseTexture* Emblem() const override; + nux::BaseTexture* CountTexture(double scale) override; MenuItemsVector Menus(); + unsigned Count() const; - void InsertEntryRemote(LauncherEntryRemote::Ptr const& remote); - - void RemoveEntryRemote(LauncherEntryRemote::Ptr const& remote); + void InsertEntryRemote(LauncherEntryRemote::Ptr const&); + void SelectEntryRemote(LauncherEntryRemote::Ptr const&); + void RemoveEntryRemote(LauncherEntryRemote::Ptr const&); nux::DndAction QueryAcceptDrop(DndData const& dnd_data) { @@ -323,9 +324,10 @@ void LoadQuicklist(); void OnTooltipEnabledChanged(bool value); + void CleanCountTextures(); + BaseTexturePtr DrawCountTexture(unsigned count, double scale); bool _sticky; - bool _remote_urgent; float _present_urgency; float _progress; int _sort_priority; @@ -346,8 +348,10 @@ time::Spec _last_action; BaseTexturePtr _emblem; + std::unordered_map _counts; - std::list _entry_list; + std::vector _remote_entries; + connection::Manager _remote_connections; glib::Object _remote_menus; static glib::Object _unity_theme; diff -Nru unity-7.2.3+14.04.20140826/launcher/MockLauncherIcon.h unity-7.2.4+14.04.20141217/launcher/MockLauncherIcon.h --- unity-7.2.3+14.04.20140826/launcher/MockLauncherIcon.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/MockLauncherIcon.h 2014-12-17 15:51:54.000000000 -0500 @@ -329,11 +329,6 @@ return icon_; } - nux::BaseTexture* Emblem() - { - return 0; - } - MenuItemsVector Menus() { return MenuItemsVector (); diff -Nru unity-7.2.3+14.04.20140826/launcher/SwitcherView.cpp unity-7.2.4+14.04.20141217/launcher/SwitcherView.cpp --- unity-7.2.3+14.04.20140826/launcher/SwitcherView.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/SwitcherView.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -76,9 +76,10 @@ icon_renderer_->pip_style = OVER_TILE; icon_renderer_->monitor = monitors::MAX; icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing); + icon_renderer_->scale = scale(); text_view_->SetMaximumWidth(tile_size * TEXT_TILE_MULTIPLIER); - text_view_->SetLines(1); + text_view_->SetLines(-1); text_view_->SetTextColor(nux::color::White); text_view_->SetFont("Ubuntu Bold 10"); text_view_->SetScale(scale); @@ -196,6 +197,7 @@ tile_size = TILE_SIZE.CP(scale); text_size = TEXT_SIZE.CP(scale); vertical_size = tile_size + VERTICAL_PADDING.CP(scale) * 2; + icon_renderer_->scale = scale; } void SwitcherView::StartAnimation() @@ -540,6 +542,12 @@ arg.backlight_intensity = 0.7f; } + if (icon->GetQuirk(AbstractLauncherIcon::Quirk::PROGRESS, monitor)) + { + arg.progress_bias = 0.0; + arg.progress = CLAMP(icon->GetProgress(), 0.0f, 1.0f); + } + return arg; } diff -Nru unity-7.2.3+14.04.20140826/launcher/Tooltip.cpp unity-7.2.4+14.04.20141217/launcher/Tooltip.cpp --- unity-7.2.3+14.04.20140826/launcher/Tooltip.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/launcher/Tooltip.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -144,11 +144,12 @@ _tooltip_text->SetMinimumWidth(text_min_width); _tooltip_text->SetMinimumHeight(text_height); + int space_height = _padding.CP(cv_) + CORNER_RADIUS.CP(cv_); if (text_height < ANCHOR_HEIGHT.CP(cv_)) - { - _top_space->SetMinMaxSize(1, (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2 + _padding.CP(cv_) + CORNER_RADIUS.CP(cv_)); - _bottom_space->SetMinMaxSize(1, (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2 + 1 + _padding.CP(cv_) + CORNER_RADIUS.CP(cv_)); - } + space_height += (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2; + + _top_space->SetMinMaxSize(1, space_height); + _bottom_space->SetMinMaxSize(1, space_height + 1); CairoBaseWindow::PreLayoutManagement(); } diff -Nru unity-7.2.3+14.04.20140826/lockscreen/BackgroundSettings.cpp unity-7.2.4+14.04.20141217/lockscreen/BackgroundSettings.cpp --- unity-7.2.3+14.04.20140826/lockscreen/BackgroundSettings.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/BackgroundSettings.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -25,6 +25,7 @@ #include "LockScreenSettings.h" #include "unity-shared/CairoTexture.h" #include "unity-shared/PanelStyle.h" +#include "unity-shared/UnitySettings.h" #include "unity-shared/UScreen.h" namespace unity @@ -35,7 +36,7 @@ { const std::string SETTINGS_NAME = "org.gnome.desktop.background"; -constexpr int GetGridOffset(int size) { return (size % Settings::GRID_SIZE) / 2; } +inline int GetGridOffset(int size) { return (size % Settings::GRID_SIZE) / 2; } } BackgroundSettings::BackgroundSettings() @@ -45,26 +46,27 @@ gnome_bg_load_from_preferences(gnome_bg_, settings); } -BackgroundSettings::~BackgroundSettings() -{} - BaseTexturePtr BackgroundSettings::GetBackgroundTexture(int monitor) { nux::Geometry const& geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); + double scale = unity::Settings::Instance().em(monitor)->DPIScale(); auto& settings = Settings::Instance(); nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height); + cairo_surface_set_device_scale(cairo_graphics.GetSurface(), scale, scale); cairo_t* c = cairo_graphics.GetInternalContext(); + double s_width = geo.width / scale; + double s_height = geo.height / scale; cairo_surface_t* bg_surface = nullptr; if (settings.use_user_background()) { - bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), geo.width, geo.height, FALSE); + bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), s_width, s_height, FALSE); } else if (!settings.background().empty()) { - glib::Object pixbuf(gdk_pixbuf_new_from_file_at_scale(settings.background().c_str(), geo.width, geo.height, FALSE, NULL)); + glib::Object pixbuf(gdk_pixbuf_new_from_file_at_scale(settings.background().c_str(), s_width, s_height, FALSE, NULL)); if (pixbuf) bg_surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL); @@ -85,15 +87,15 @@ if (!settings.logo().empty()) { - int grid_x_offset = GetGridOffset(geo.width); - int grid_y_offset = GetGridOffset(geo.height); + int grid_x_offset = GetGridOffset(s_width); + int grid_y_offset = GetGridOffset(s_height); cairo_surface_t* logo_surface = cairo_image_surface_create_from_png(settings.logo().c_str()); if (logo_surface) { int height = cairo_image_surface_get_height(logo_surface); int x = grid_x_offset; - int y = grid_y_offset + Settings::GRID_SIZE * (geo.height / Settings::GRID_SIZE - 1) - height; + int y = grid_y_offset + Settings::GRID_SIZE * (s_height / Settings::GRID_SIZE - 1) - height; cairo_save(c); cairo_translate(c, x, y); @@ -107,8 +109,8 @@ if (settings.draw_grid()) { - int width = geo.width; - int height = geo.height; + double width = s_width; + double height = s_height; int grid_x_offset = GetGridOffset(width); int grid_y_offset = GetGridOffset(height) + panel::Style::Instance().PanelHeight(monitor); diff -Nru unity-7.2.3+14.04.20140826/lockscreen/BackgroundSettings.h unity-7.2.4+14.04.20141217/lockscreen/BackgroundSettings.h --- unity-7.2.3+14.04.20140826/lockscreen/BackgroundSettings.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/BackgroundSettings.h 2014-12-17 15:51:54.000000000 -0500 @@ -41,7 +41,6 @@ { public: BackgroundSettings(); - ~BackgroundSettings(); BaseTexturePtr GetBackgroundTexture(int monitor); diff -Nru unity-7.2.3+14.04.20140826/lockscreen/CMakeLists.txt unity-7.2.4+14.04.20141217/lockscreen/CMakeLists.txt --- unity-7.2.3+14.04.20140826/lockscreen/CMakeLists.txt 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/CMakeLists.txt 2014-12-17 15:51:54.000000000 -0500 @@ -27,6 +27,8 @@ LockScreenAcceleratorController.cpp LockScreenAccelerators.cpp ScreenSaverDBusManager.cpp + ShutdownNotifier.cpp + SuspendNotifier.cpp UserAuthenticatorPam.cpp UserPromptView.cpp ) diff -Nru unity-7.2.3+14.04.20140826/lockscreen/CofView.cpp unity-7.2.4+14.04.20141217/lockscreen/CofView.cpp --- unity-7.2.3+14.04.20140826/lockscreen/CofView.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/CofView.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -18,6 +18,7 @@ */ #include "CofView.h" +#include "unity-shared/RawPixel.h" #include "config.h" @@ -25,11 +26,23 @@ { namespace lockscreen { +namespace +{ +const std::string COF_FILE = "cof.png"; +} CofView::CofView() // FIXME (andy) if we get an svg cof we can make it fullscreen independent. - : IconTexture(PKGDATADIR"/cof.png", 66) -{} + : IconTexture(PKGDATADIR"/"+COF_FILE, -1) + , scale(1.0) +{ + scale.changed.connect([this] (double scale) { + int w, h; + gdk_pixbuf_get_file_info((PKGDATADIR"/" + COF_FILE).c_str(), &w, &h); + SetSize(RawPixel(std::max(w, h)).CP(scale)); + ReLoadIcon(); + }); +} nux::Area* CofView::FindAreaUnderMouse(nux::Point const& mouse_position, nux::NuxEventType event_type) diff -Nru unity-7.2.3+14.04.20140826/lockscreen/CofView.h unity-7.2.4+14.04.20141217/lockscreen/CofView.h --- unity-7.2.3+14.04.20140826/lockscreen/CofView.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/CofView.h 2014-12-17 15:51:54.000000000 -0500 @@ -27,11 +27,13 @@ namespace lockscreen { -class CofView : public unity::IconTexture +class CofView : public IconTexture { public: CofView(); + nux::Property scale; + nux::Area* FindAreaUnderMouse(nux::Point const& mouse_position, nux::NuxEventType event_type) override; }; diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenAbstractShield.h unity-7.2.4+14.04.20141217/lockscreen/LockScreenAbstractShield.h --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenAbstractShield.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenAbstractShield.h 2014-12-17 15:51:54.000000000 -0500 @@ -32,25 +32,37 @@ namespace lockscreen { +class UserPromptView; + class AbstractShield : public MockableBaseWindow { public: - AbstractShield(session::Manager::Ptr const& session, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor_num, bool is_primary) + AbstractShield(session::Manager::Ptr const& session, + indicator::Indicators::Ptr const& indicators, + Accelerators::Ptr const& accelerators, + nux::ObjectPtr const& prompt_view, + int monitor_num, bool is_primary) : MockableBaseWindow("Unity Lockscreen") , primary(is_primary) , monitor(monitor_num) + , scale(1.0) , session_manager_(session) , indicators_(indicators) , accelerators_(accelerators) + , prompt_view_(prompt_view) {} nux::Property primary; nux::Property monitor; + nux::Property scale; using MockableBaseWindow::RemoveLayout; + virtual bool HasGrab() const = 0; virtual bool IsIndicatorOpen() const = 0; virtual void ActivatePanel() = 0; + sigc::signal grabbed; + sigc::signal grab_failed; sigc::signal grab_motion; sigc::signal grab_key; @@ -58,6 +70,7 @@ session::Manager::Ptr session_manager_; indicator::Indicators::Ptr indicators_; Accelerators::Ptr accelerators_; + nux::ObjectPtr prompt_view_; }; } // lockscreen diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenController.cpp unity-7.2.4+14.04.20141217/lockscreen/LockScreenController.cpp --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenController.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenController.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,6 +20,7 @@ #include "LockScreenController.h" #include +#include #include #include "LockScreenShield.h" @@ -59,6 +60,7 @@ , session_manager_(session_manager) , upstart_wrapper_(upstart_wrapper) , shield_factory_(shield_factory) + , suspend_notifier_(std::make_shared()) , fade_animator_(LOCK_FADE_DURATION) , blank_window_animator_(IDLE_FADE_DURATION) , test_mode_(test_mode) @@ -77,7 +79,7 @@ }); hidden_window_connection_->block(); - suspend_connection_ = uscreen->suspending.connect([this] { + suspend_notifier_->RegisterInterest([this](){ if (Settings::Instance().lock_on_suspend()) session_manager_->PromptLockScreen(); }); @@ -100,8 +102,7 @@ fade_animator_.finished.connect([this] { if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD) { - motion_connection_->disconnect(); - key_connection_->disconnect(); + primary_shield_connections_.Clear(); uscreen_connection_->block(); hidden_window_connection_->block(); session_manager_->is_locked = false; @@ -173,10 +174,7 @@ primary_shield_ = shield; shield->primary = true; nux::GetWindowCompositor().SetAlwaysOnFrontWindow(primary_shield_.GetPointer()); - auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion); - motion_connection_ = shield->grab_motion.connect(move_cb); - auto key_cb = sigc::hide(sigc::hide(sigc::mem_fun(this, &Controller::ResetPostLockScreenSaver))); - key_connection_ = shield->grab_key.connect(key_cb); + SetupPrimaryShieldConnections(); break; } } @@ -184,14 +182,52 @@ ResetPostLockScreenSaver(); } +void Controller::SetupPrimaryShieldConnections() +{ + if (!primary_shield_.IsValid()) + return; + + primary_shield_connections_.Clear(); + + auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion); + primary_shield_connections_.Add(primary_shield_->grab_motion.connect(move_cb)); + + auto key_cb = sigc::hide(sigc::hide(sigc::mem_fun(this, &Controller::ResetPostLockScreenSaver))); + primary_shield_connections_.Add(primary_shield_->grab_key.connect(key_cb)); + + if (!session_manager_->is_locked()) + { + primary_shield_connections_.Add(primary_shield_->grabbed.connect([this] { + session_manager_->is_locked = true; + })); + + primary_shield_connections_.Add(primary_shield_->grab_failed.connect([this] { + if (!session_manager_->is_locked()) + { + LOG_ERROR(logger) << "Impossible to get the grab to lock the screen"; + session_manager_->unlock_requested.emit(); + } + })); + } +} + void Controller::EnsureShields(std::vector const& monitors) { int num_monitors = monitors.size(); int shields_size = shields_.size(); int primary = UScreen::GetDefault()->GetMonitorWithMouse(); + // Keep a reference of the old prompt_view + nux::ObjectPtr prompt_view(prompt_view_.GetPointer()); + shields_.resize(num_monitors); + if (!prompt_view) + { + prompt_view = test_mode_ ? nullptr : new UserPromptView(session_manager_); + prompt_view_ = prompt_view.GetPointer(); + } + for (int i = 0; i < num_monitors; ++i) { auto& shield = shields_[i]; @@ -199,7 +235,7 @@ if (i >= shields_size) { - shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), i, i == primary); + shield = shield_factory_->CreateShield(session_manager_, indicators_, accelerator_controller_->GetAccelerators(), prompt_view, i, i == primary); is_new = true; } @@ -208,7 +244,7 @@ shield->SetGeometry(new_geo); shield->SetMinMaxSize(new_geo.width, new_geo.height); - shield->primary = (i == primary); + shield->primary = false; shield->monitor = i; // XXX: manually emit nux::Area::geometry_changed beucase nux can fail to emit it. @@ -224,10 +260,7 @@ primary_shield_ = shields_[primary]; primary_shield_->primary = true; - auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion); - motion_connection_ = primary_shield_->grab_motion.connect(move_cb); - auto key_cb = sigc::hide(sigc::hide(sigc::mem_fun(this, &Controller::ResetPostLockScreenSaver))); - key_connection_ = primary_shield_->grab_key.connect(key_cb); + SetupPrimaryShieldConnections(); } void Controller::EnsureBlankWindow() @@ -349,7 +382,6 @@ HideBlankWindow(); LockScreen(); - session_manager_->is_locked = true; if (prompt_activation_) { @@ -410,6 +442,11 @@ indicators_ = std::make_shared(); upstart_wrapper_->Emit("desktop-lock"); + shutdown_notifier_ = std::make_shared(); + shutdown_notifier_->RegisterInterest([](){ + WindowManager::Default().UnmapAllNoNuxWindowsSync(); + }); + accelerator_controller_ = std::make_shared(session_manager_); auto activate_key = WindowManager::Default().activate_indicators_key(); auto accelerator = std::make_shared(activate_key.second, 0, activate_key.first); @@ -435,6 +472,7 @@ shield->PushToFront(); }); + session_manager_->is_locked = primary_shield_->HasGrab(); nux::GetWindowCompositor().SetAlwaysOnFrontWindow(primary_shield_.GetPointer()); animation::StartOrReverse(fade_animator_, animation::Direction::FORWARD); } @@ -447,6 +485,8 @@ void Controller::OnUnlockRequested() { + shutdown_notifier_.reset(); + lockscreen_timeout_.reset(); screensaver_post_lock_timeout_.reset(); diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenController.h unity-7.2.4+14.04.20141217/lockscreen/LockScreenController.h --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenController.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenController.h 2014-12-17 15:51:54.000000000 -0500 @@ -27,6 +27,9 @@ #include "LockScreenShieldFactory.h" #include "LockScreenAcceleratorController.h" #include "ScreenSaverDBusManager.h" +#include "ShutdownNotifier.h" +#include "SuspendNotifier.h" +#include "UserPromptView.h" #include "unity-shared/BackgroundEffectHelper.h" #include "unity-shared/UpstartWrapper.h" @@ -35,9 +38,13 @@ namespace lockscreen { +class UserPromptView; + class Controller : public sigc::trackable { public: + typedef std::shared_ptr Ptr; + Controller(DBusManager::Ptr const&, session::Manager::Ptr const&, UpstartWrapper::Ptr const& upstart_wrapper = std::make_shared(), ShieldFactoryInterface::Ptr const& shield_factory = std::make_shared(), @@ -61,6 +68,7 @@ void BlankWindowGrabEnable(bool grab); void SimulateActivity(); void ResetPostLockScreenSaver(); + void SetupPrimaryShieldConnections(); void ActivatePanel(); void OnLockRequested(bool prompt); @@ -71,6 +79,7 @@ std::vector> shields_; nux::ObjectWeakPtr primary_shield_; + nux::ObjectWeakPtr prompt_view_; nux::ObjectPtr blank_window_; DBusManager::Ptr dbus_manager_; @@ -79,6 +88,8 @@ AcceleratorController::Ptr accelerator_controller_; UpstartWrapper::Ptr upstart_wrapper_; ShieldFactoryInterface::Ptr shield_factory_; + ShutdownNotifier::Ptr shutdown_notifier_; + SuspendNotifier::Ptr suspend_notifier_; nux::animation::AnimateValue fade_animator_; nux::animation::AnimateValue blank_window_animator_; @@ -88,10 +99,8 @@ BlurType old_blur_type_; connection::Wrapper uscreen_connection_; - connection::Wrapper suspend_connection_; connection::Wrapper hidden_window_connection_; - connection::Wrapper motion_connection_; - connection::Wrapper key_connection_; + connection::Manager primary_shield_connections_; glib::Source::UniquePtr lockscreen_timeout_; glib::Source::UniquePtr lockscreen_delay_timeout_; diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenPanel.cpp unity-7.2.4+14.04.20141217/lockscreen/LockScreenPanel.cpp --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenPanel.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenPanel.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -82,7 +82,9 @@ indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest)); monitor.changed.connect([this, hostname] (int monitor) { - hostname->SetScale(unity::Settings::Instance().em(monitor)->DPIScale()); + double scale = unity::Settings::Instance().em(monitor)->DPIScale(); + hostname->SetScale(scale); + static_cast(GetLayout())->SetLeftAndRightPadding(PADDING.CP(scale), 0); indicators_view_->SetMonitor(monitor); BuildTexture(); QueueRelayout(); @@ -108,12 +110,39 @@ return; indicators_view_->AddIndicator(indicator); + + if (!active) + { + for (auto const& entry : indicator->GetEntries()) + { + if (entry->active()) + { + active = true; + indicators_view_->ActivateEntry(entry->id()); + OnEntryActivated(GetPanelName(), entry->id(), entry->geometry()); + break; + } + } + } + QueueRelayout(); QueueDraw(); } void Panel::RemoveIndicator(indicator::Indicator::Ptr const& indicator) { + if (active) + { + for (auto const& entry : indicator->GetEntries()) + { + if (entry->active()) + { + active = false; + break; + } + } + } + indicators_view_->RemoveIndicator(indicator); QueueRelayout(); QueueDraw(); @@ -121,7 +150,7 @@ std::string Panel::GetPanelName() const { - return "LockScreenPanel" + std::to_string(monitor); + return "LockScreenPanel"; } void Panel::OnIndicatorViewUpdated() diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenSettings.cpp unity-7.2.4+14.04.20141217/lockscreen/LockScreenSettings.cpp --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenSettings.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenSettings.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -55,6 +55,8 @@ const std::string USE_OSK = "screen-keyboard-enabled"; } +const RawPixel Settings::GRID_SIZE = 40_em; + struct Settings::Impl { Impl() diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenSettings.h unity-7.2.4+14.04.20141217/lockscreen/LockScreenSettings.h --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenSettings.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenSettings.h 2014-12-17 15:51:54.000000000 -0500 @@ -21,6 +21,7 @@ #define UNITY_LOCKSCREEN_SETTINGS_H #include +#include "unity-shared/RawPixel.h" namespace unity { @@ -48,7 +49,7 @@ nux::Property lock_on_suspend; nux::Property use_legacy; - static const int GRID_SIZE = 40; + static const RawPixel GRID_SIZE; private: struct Impl; diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenShield.cpp unity-7.2.4+14.04.20141217/lockscreen/LockScreenShield.cpp --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenShield.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenShield.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -19,7 +19,6 @@ #include "LockScreenShield.h" -#include #include #include #include @@ -30,6 +29,7 @@ #include "LockScreenSettings.h" #include "UserPromptView.h" #include "unity-shared/UScreen.h" +#include "unity-shared/UnitySettings.h" #include "unity-shared/WindowManager.h" namespace unity @@ -38,23 +38,30 @@ { namespace { -DECLARE_LOGGER(logger, "unity.lockscreen.shield"); -const unsigned MAX_GRAB_WAIT = 50; +const unsigned MAX_GRAB_WAIT = 100; } -Shield::Shield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor_num, bool is_primary) - : AbstractShield(session_manager, indicators, accelerators, monitor_num, is_primary) +Shield::Shield(session::Manager::Ptr const& session_manager, + indicator::Indicators::Ptr const& indicators, + Accelerators::Ptr const& accelerators, + nux::ObjectPtr const& prompt_view, + int monitor_num, bool is_primary) + : AbstractShield(session_manager, indicators, accelerators, prompt_view, monitor_num, is_primary) , bg_settings_(std::make_shared()) - , prompt_view_(nullptr) , panel_view_(nullptr) + , cof_view_(nullptr) { + UpdateScale(); is_primary ? ShowPrimaryView() : ShowSecondaryView(); EnableInputWindow(true); + unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Shield::UpdateScale)); geometry_changed.connect([this] (nux::Area*, nux::Geometry&) { UpdateBackgroundTexture();}); monitor.changed.connect([this] (int monitor) { + UpdateScale(); + if (panel_view_) panel_view_->monitor = monitor; @@ -69,12 +76,31 @@ QueueDraw(); }); + scale.changed.connect([this] (double scale) { + if (prompt_view_ && primary()) + prompt_view_->scale = scale; + + if (cof_view_) + cof_view_->scale = scale; + + if (prompt_layout_) + prompt_layout_->SetLeftAndRightPadding(2 * Settings::GRID_SIZE.CP(scale)); + + background_layer_.reset(); + UpdateBackgroundTexture(); + }); + mouse_move.connect([this] (int x, int y, int, int, unsigned long, unsigned long) { auto const& abs_geo = GetAbsoluteGeometry(); grab_motion.emit(abs_geo.x + x, abs_geo.y + y); }); } +void Shield::UpdateScale() +{ + scale = unity::Settings::Instance().em(monitor)->DPIScale(); +} + void Shield::UpdateBackgroundTexture() { auto const& monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); @@ -95,6 +121,7 @@ { regrab_conn_->disconnect(); regrab_timeout_.reset(); + grabbed.emit(); } else { @@ -104,18 +131,29 @@ if (cancel_on_failure) { regrab_timeout_.reset(new glib::Timeout(MAX_GRAB_WAIT, [this] { - LOG_ERROR(logger) << "Impossible to get the grab to lock the screen"; - session_manager_->unlock_requested.emit(); + grab_failed.emit(); return false; })); } } } +bool Shield::HasGrab() const +{ + auto& wc = nux::GetWindowCompositor(); + return (wc.GetPointerGrabArea() == this && wc.GetKeyboardGrabArea() == this); +} + void Shield::ShowPrimaryView() { if (primary_layout_) { + if (prompt_view_) + { + prompt_view_->scale = scale(); + prompt_layout_->AddView(prompt_view_.GetPointer()); + } + GrabScreen(false); SetLayout(primary_layout_.GetPointer()); return; @@ -128,20 +166,26 @@ main_layout->AddView(CreatePanel()); - nux::HLayout* prompt_layout = new nux::HLayout(); - prompt_layout->SetLeftAndRightPadding(2 * Settings::GRID_SIZE); + prompt_layout_ = new nux::HLayout(); + prompt_layout_->SetLeftAndRightPadding(2 * Settings::GRID_SIZE.CP(scale)); - prompt_view_ = CreatePromptView(); - prompt_layout->AddView(prompt_view_); + if (prompt_view_) + { + prompt_view_->scale = scale(); + prompt_layout_->AddView(prompt_view_.GetPointer()); + } // 10 is just a random number to center the prompt view. main_layout->AddSpace(0, 10); - main_layout->AddLayout(prompt_layout); + main_layout->AddLayout(prompt_layout_.GetPointer()); main_layout->AddSpace(0, 10); } void Shield::ShowSecondaryView() { + if (prompt_layout_) + prompt_layout_->RemoveChildObject(prompt_view_.GetPointer()); + if (cof_layout_) { SetLayout(cof_layout_.GetPointer()); @@ -153,8 +197,9 @@ SetLayout(cof_layout_.GetPointer()); // The circle of friends - CofView* cof_view = new CofView(); - main_layout->AddView(cof_view); + cof_view_ = new CofView(); + cof_view_->scale = scale(); + main_layout->AddView(cof_view_); } Panel* Shield::CreatePanel() @@ -182,20 +227,6 @@ return panel_view_; } -UserPromptView* Shield::CreatePromptView() -{ - auto* prompt_view = new UserPromptView(session_manager_); - - auto width = 8 * Settings::GRID_SIZE; - auto height = 3 * Settings::GRID_SIZE; - - prompt_view->SetMinimumWidth(width); - prompt_view->SetMaximumWidth(width); - prompt_view->SetMinimumHeight(height); - - return prompt_view; -} - nux::Area* Shield::FindKeyFocusArea(unsigned etype, unsigned long keysym, unsigned long modifiers) { if (primary) diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenShieldFactory.cpp unity-7.2.4+14.04.20141217/lockscreen/LockScreenShieldFactory.cpp --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenShieldFactory.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenShieldFactory.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -19,15 +19,20 @@ #include "LockScreenShieldFactory.h" #include "LockScreenShield.h" +#include "UserPromptView.h" namespace unity { namespace lockscreen { -nux::ObjectPtr ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, Accelerators::Ptr const& accelerators, int monitor, bool is_primary) +nux::ObjectPtr ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, + indicator::Indicators::Ptr const& indicators, + Accelerators::Ptr const& accelerators, + nux::ObjectPtr const& prompt_view, + int monitor, bool is_primary) { - return nux::ObjectPtr(new Shield(session_manager, indicators, accelerators, monitor, is_primary)); + return nux::ObjectPtr(new Shield(session_manager, indicators, accelerators, prompt_view, monitor, is_primary)); } } diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenShieldFactory.h unity-7.2.4+14.04.20141217/lockscreen/LockScreenShieldFactory.h --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenShieldFactory.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenShieldFactory.h 2014-12-17 15:51:54.000000000 -0500 @@ -31,18 +31,28 @@ namespace lockscreen { +class UserPromptView; + struct ShieldFactoryInterface { typedef std::shared_ptr Ptr; virtual ~ShieldFactoryInterface() = default; - virtual nux::ObjectPtr CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary) = 0; + virtual nux::ObjectPtr CreateShield(session::Manager::Ptr const&, + indicator::Indicators::Ptr const&, + Accelerators::Ptr const&, + nux::ObjectPtr const&, + int monitor, bool is_primary) = 0; }; struct ShieldFactory : ShieldFactoryInterface { - nux::ObjectPtr CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary) override; + nux::ObjectPtr CreateShield(session::Manager::Ptr const&, + indicator::Indicators::Ptr const&, + Accelerators::Ptr const&, + nux::ObjectPtr const&, + int monitor, bool is_primary) override; }; } diff -Nru unity-7.2.3+14.04.20140826/lockscreen/LockScreenShield.h unity-7.2.4+14.04.20141217/lockscreen/LockScreenShield.h --- unity-7.2.3+14.04.20140826/lockscreen/LockScreenShield.h 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/LockScreenShield.h 2014-12-17 15:51:54.000000000 -0500 @@ -33,12 +33,18 @@ class UserAuthenticator; class UserPromptView; class Panel; +class CofView; class Shield : public AbstractShield { public: - Shield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary); + Shield(session::Manager::Ptr const&, + indicator::Indicators::Ptr const&, + Accelerators::Ptr const&, + nux::ObjectPtr const&, + int monitor, bool is_primary); + bool HasGrab() const override; bool IsIndicatorOpen() const override; void ActivatePanel() override; @@ -52,18 +58,19 @@ void GrabScreen(bool cancel_on_failure); void ShowPrimaryView(); void ShowSecondaryView(); + void UpdateScale(); Panel* CreatePanel(); - UserPromptView* CreatePromptView(); std::shared_ptr bg_settings_; std::unique_ptr background_layer_; nux::ObjectPtr primary_layout_; + nux::ObjectPtr prompt_layout_; nux::ObjectPtr cof_layout_; connection::Wrapper panel_active_conn_; connection::Wrapper regrab_conn_; glib::Source::UniquePtr regrab_timeout_; - UserPromptView* prompt_view_; Panel* panel_view_; + CofView* cof_view_; }; } diff -Nru unity-7.2.3+14.04.20140826/lockscreen/ShutdownNotifier.cpp unity-7.2.4+14.04.20141217/lockscreen/ShutdownNotifier.cpp --- unity-7.2.3+14.04.20140826/lockscreen/ShutdownNotifier.cpp 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/lockscreen/ShutdownNotifier.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2014 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: Andrea Azzarone + */ + +#include "ShutdownNotifier.h" + +#include +#include "UnityCore/GLibDBusProxy.h" + +namespace unity +{ +namespace lockscreen +{ + +DECLARE_LOGGER(logger, "unity.lockscreen.shutdownnotifier"); + +// +// Private Implementation +// + +class ShutdownNotifier::Impl +{ +public: + Impl(); + ~Impl(); + + bool RegisterInterest(ShutdownCallback const& cb); + void UnregisterInterest(); + + void Inhibit(); + void Uninhibit(); + bool IsInhibited() const; + +private: + std::shared_ptr logind_proxy_; + ShutdownCallback cb_; + gint delay_inhibit_fd_; +}; + +ShutdownNotifier::Impl::Impl() + : logind_proxy_(std::make_shared("org.freedesktop.login1", + "/org/freedesktop/login1", + "org.freedesktop.login1.Manager", + G_BUS_TYPE_SYSTEM)) + , delay_inhibit_fd_(-1) +{} + +ShutdownNotifier::Impl::~Impl() +{ + UnregisterInterest(); +} + +bool ShutdownNotifier::Impl::RegisterInterest(ShutdownCallback const& cb) +{ + if (!cb or cb_) + return false; + + cb_ = cb; + + Inhibit(); + + logind_proxy_->Connect("PrepareForShutdown", [this](GVariant* variant) { + bool active = glib::Variant(variant).GetBool(); + + if (active) + { + cb_(); + UnregisterInterest(); + } + }); + + return true; +} + +void ShutdownNotifier::Impl::UnregisterInterest() +{ + if (!cb_) + return; + + Uninhibit(); + + logind_proxy_->DisconnectSignal("PrepareForShutdown"); + cb_ = nullptr; +} + +void ShutdownNotifier::Impl::Inhibit() +{ + if (IsInhibited()) + return; + + GVariant* args = g_variant_new("(ssss)", "shutdown", "Unity Lockscreen", "Screen is locked", "delay"); + + logind_proxy_->CallWithUnixFdList("Inhibit", args, [this] (GVariant* variant, glib::Error const& e) { + if (e) + { + LOG_ERROR(logger) << "Failed to inhbit suspend"; + } + delay_inhibit_fd_ = glib::Variant(variant).GetInt32(); + }); +} + +void ShutdownNotifier::Impl::Uninhibit() +{ + if (!IsInhibited()) + return; + + close(delay_inhibit_fd_); + delay_inhibit_fd_ = -1; +} + +bool ShutdownNotifier::Impl::IsInhibited() const +{ + return delay_inhibit_fd_ != -1; +} + +// +// End Private Implementation +// + +ShutdownNotifier::ShutdownNotifier() + : pimpl_(new(Impl)) +{} + +ShutdownNotifier::~ShutdownNotifier() +{} + +bool ShutdownNotifier::RegisterInterest(ShutdownCallback const& cb) +{ + return pimpl_->RegisterInterest(cb); +} + +void ShutdownNotifier::UnregisterInterest() +{ + pimpl_->UnregisterInterest(); +} + +} +} diff -Nru unity-7.2.3+14.04.20140826/lockscreen/ShutdownNotifier.h unity-7.2.4+14.04.20141217/lockscreen/ShutdownNotifier.h --- unity-7.2.3+14.04.20140826/lockscreen/ShutdownNotifier.h 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/lockscreen/ShutdownNotifier.h 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2014 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: Andrea Azzarone + */ + +#ifndef UNITY_LOCKSCREEN_SHUTDOWN_NOTIFIER +#define UNITY_LOCKSCREEN_SHUTDOWN_NOTIFIER + +#include +#include + +namespace unity +{ +namespace lockscreen +{ + +typedef std::function ShutdownCallback; + +class ShutdownNotifier +{ +public: + typedef std::shared_ptr Ptr; + + ShutdownNotifier(); + ~ShutdownNotifier(); + + bool RegisterInterest(ShutdownCallback const&); + void UnregisterInterest(); + +private: + class Impl; + std::unique_ptr pimpl_; +}; + +} +} + +#endif diff -Nru unity-7.2.3+14.04.20140826/lockscreen/SuspendNotifier.cpp unity-7.2.4+14.04.20141217/lockscreen/SuspendNotifier.cpp --- unity-7.2.3+14.04.20140826/lockscreen/SuspendNotifier.cpp 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/lockscreen/SuspendNotifier.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2014 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: Andrea Azzarone + */ + +#include "SuspendNotifier.h" + +#include +#include "UnityCore/GLibDBusProxy.h" + +namespace unity +{ +namespace lockscreen +{ + +DECLARE_LOGGER(logger, "unity.lockscreen.suspendnotifier"); + +// +// Private Implementation +// + +class SuspendNotifier::Impl +{ +public: + Impl(); + ~Impl(); + + bool RegisterInterest(SuspendCallback const& cb); + void UnregisterInterest(); + + void Inhibit(); + void Uninhibit(); + bool IsInhibited() const; + +private: + std::shared_ptr logind_proxy_; + SuspendCallback cb_; + gint delay_inhibit_fd_; +}; + +SuspendNotifier::Impl::Impl() + : logind_proxy_(std::make_shared("org.freedesktop.login1", + "/org/freedesktop/login1", + "org.freedesktop.login1.Manager", + G_BUS_TYPE_SYSTEM)) + , delay_inhibit_fd_(-1) +{} + +SuspendNotifier::Impl::~Impl() +{ + UnregisterInterest(); +} + +bool SuspendNotifier::Impl::RegisterInterest(SuspendCallback const& cb) +{ + if (!cb or cb_) + return false; + + cb_ = cb; + + Inhibit(); + + logind_proxy_->Connect("PrepareForSleep", [this](GVariant* variant) { + bool active = glib::Variant(variant).GetBool(); + + if (active) // suspending + { + cb_(); + Uninhibit(); + } + else // resuming + { + Inhibit(); + } + }); + + return true; +} + +void SuspendNotifier::Impl::UnregisterInterest() +{ + Uninhibit(); + + logind_proxy_->DisconnectSignal("PrepareForSleep"); + cb_ = nullptr; +} + +void SuspendNotifier::Impl::Inhibit() +{ + if (IsInhibited()) + return; + + GVariant* args = g_variant_new("(ssss)", "sleep", "Unity Lockscreen", "Unity wants to lock screen before suspending.", "delay"); + + logind_proxy_->CallWithUnixFdList("Inhibit", args, [this] (GVariant* variant, glib::Error const& e) { + if (e) + { + LOG_ERROR(logger) << "Failed to inhbit suspend"; + } + delay_inhibit_fd_ = glib::Variant(variant).GetInt32(); + }); +} + +void SuspendNotifier::Impl::Uninhibit() +{ + if (!IsInhibited()) + return; + + close(delay_inhibit_fd_); + delay_inhibit_fd_ = -1; +} + +bool SuspendNotifier::Impl::IsInhibited() const +{ + return delay_inhibit_fd_ != -1; +} + +// +// End Private Implementation +// + +SuspendNotifier::SuspendNotifier() + : pimpl_(new(Impl)) +{} + +SuspendNotifier::~SuspendNotifier() +{} + +bool SuspendNotifier::RegisterInterest(SuspendCallback const& cb) +{ + return pimpl_->RegisterInterest(cb); +} + +void SuspendNotifier::UnregisterInterest() +{ + pimpl_->UnregisterInterest(); +} + +} +} diff -Nru unity-7.2.3+14.04.20140826/lockscreen/SuspendNotifier.h unity-7.2.4+14.04.20141217/lockscreen/SuspendNotifier.h --- unity-7.2.3+14.04.20140826/lockscreen/SuspendNotifier.h 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/lockscreen/SuspendNotifier.h 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2014 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: Andrea Azzarone + */ + +#ifndef UNITY_LOCKSCREEN_SUSPEND_NOTIFIER +#define UNITY_LOCKSCREEN_SHUTDOWN_NOTIFIER + +#include +#include + +namespace unity +{ +namespace lockscreen +{ + +typedef std::function SuspendCallback; + +class SuspendNotifier +{ +public: + typedef std::shared_ptr Ptr; + + SuspendNotifier(); + ~SuspendNotifier(); + + bool RegisterInterest(SuspendCallback const&); + void UnregisterInterest(); + +private: + class Impl; + std::unique_ptr pimpl_; +}; + +} +} + +#endif \ No newline at end of file diff -Nru unity-7.2.3+14.04.20140826/lockscreen/UserAuthenticatorPam.cpp unity-7.2.4+14.04.20141217/lockscreen/UserAuthenticatorPam.cpp --- unity-7.2.3+14.04.20140826/lockscreen/UserAuthenticatorPam.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/UserAuthenticatorPam.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -70,8 +70,7 @@ conversation.conv = ConversationFunction; conversation.appdata_ptr = static_cast(this); - // FIXME (andy) We should install our own unityshell pam file. - return pam_start("lightdm", username_.c_str(), + return pam_start("unity", username_.c_str(), &conversation, &pam_handle_) == PAM_SUCCESS; } diff -Nru unity-7.2.3+14.04.20140826/lockscreen/UserPromptView.cpp unity-7.2.4+14.04.20141217/lockscreen/UserPromptView.cpp --- unity-7.2.3+14.04.20140826/lockscreen/UserPromptView.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/UserPromptView.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -19,6 +19,9 @@ #include "UserPromptView.h" +#include "config.h" +#include + #include #include @@ -38,12 +41,12 @@ const RawPixel LAYOUT_MARGIN = 10_em; const RawPixel MSG_LAYOUT_MARGIN = 15_em; const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; - const int PROMPT_FONT_SIZE = 13; -nux::AbstractPaintLayer* CrateBackgroundLayer(int width, int height) +nux::AbstractPaintLayer* CrateBackgroundLayer(double width, double height, double scale) { nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height); + cairo_surface_set_device_scale(cg.GetSurface(), scale, scale); cairo_t* cr = cg.GetInternalContext(); cairo_set_source_rgba(cr, 0.1, 0.1, 0.1, 0.4); @@ -52,12 +55,12 @@ 1.0, 0, 0, Settings::GRID_SIZE * 0.3, - width, height); + width/scale, height/scale); cairo_fill_preserve(cr); - cairo_set_source_rgba (cr, 0.4, 0.4, 0.4, 0.4); - cairo_set_line_width (cr, 1); + cairo_set_source_rgba(cr, 0.4, 0.4, 0.4, 0.4); + cairo_set_line_width(cr, 1); cairo_stroke (cr); // Create the texture layer @@ -98,7 +101,11 @@ UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager) : nux::View(NUX_TRACKER_LOCATION) + , scale(1.0) , session_manager_(session_manager) + , username_(nullptr) + , msg_layout_(nullptr) + , prompt_layout_(nullptr) { user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){ AddPrompt(message, /* visible */ true, promise); @@ -120,12 +127,65 @@ ResetLayout(); }); + scale.changed.connect(sigc::hide(sigc::mem_fun(this, &UserPromptView::UpdateSize))); + + UpdateSize(); ResetLayout(); user_authenticator_.AuthenticateStart(session_manager_->UserName(), sigc::mem_fun(this, &UserPromptView::AuthenticationCb)); } +void UserPromptView::UpdateSize() +{ + auto width = 8 * Settings::GRID_SIZE.CP(scale); + auto height = 3 * Settings::GRID_SIZE.CP(scale); + + SetMinimumWidth(width); + SetMaximumWidth(width); + SetMinimumHeight(height); + + if (nux::Layout* layout = GetLayout()) + { + layout->SetLeftAndRightPadding(PADDING.CP(scale)); + layout->SetTopAndBottomPadding(PADDING.CP(scale)); + static_cast(layout)->SetVerticalInternalMargin(LAYOUT_MARGIN.CP(scale)); + } + + if (username_) + username_->SetScale(scale); + + if (msg_layout_) + { + msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale)); + + for (auto* area : msg_layout_->GetChildren()) + { + area->SetMaximumWidth(width); + static_cast(area)->SetScale(scale); + } + } + + if (prompt_layout_) + { + prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale)); + + for (auto* area : prompt_layout_->GetChildren()) + { + auto* text_input = static_cast(area); + text_input->SetMinimumHeight(Settings::GRID_SIZE.CP(scale)); + text_input->SetMaximumHeight(Settings::GRID_SIZE.CP(scale)); + text_input->scale = scale(); + } + } + + bg_layer_.reset(); + + ComputeContentSize(); + QueueRelayout(); + QueueDraw(); +} + bool UserPromptView::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) { if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ESCAPE)) @@ -145,24 +205,25 @@ SetLayout(new nux::VLayout()); - GetLayout()->SetLeftAndRightPadding(PADDING); - GetLayout()->SetTopAndBottomPadding(PADDING); - static_cast(GetLayout())->SetVerticalInternalMargin(LAYOUT_MARGIN); + GetLayout()->SetLeftAndRightPadding(PADDING.CP(scale)); + GetLayout()->SetTopAndBottomPadding(PADDING.CP(scale)); + static_cast(GetLayout())->SetVerticalInternalMargin(LAYOUT_MARGIN.CP(scale)); auto const& real_name = session_manager_->RealName(); auto const& name = (real_name.empty() ? session_manager_->UserName() : real_name); - unity::StaticCairoText* username = new unity::StaticCairoText(name); - username->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE)); - GetLayout()->AddView(username); + username_ = new unity::StaticCairoText(name); + username_->SetScale(scale); + username_->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE)); + GetLayout()->AddView(username_); msg_layout_ = new nux::VLayout(); - msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN); + msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale)); msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true); GetLayout()->AddLayout(msg_layout_); prompt_layout_ = new nux::VLayout(); - prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN); + prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale)); prompt_layout_->SetReconfigureParentLayoutOnGeometryChange(true); GetLayout()->AddLayout(prompt_layout_); @@ -187,6 +248,21 @@ } } +void UserPromptView::EnsureBGLayer() +{ + auto const& geo = GetGeometry(); + + if (bg_layer_) + { + auto const& layer_geo = bg_layer_->GetGeometry(); + + if (layer_geo.width == geo.width && layer_geo.height == geo.height) + return; + } + + bg_layer_.reset(CrateBackgroundLayer(geo.width, geo.height, scale)); +} + void UserPromptView::Draw(nux::GraphicsEngine& graphics_engine, bool /* force_draw */) { nux::Geometry const& geo = GetGeometry(); @@ -194,7 +270,7 @@ graphics_engine.PushClippingRectangle(geo); nux::GetPainter().PaintBackground(graphics_engine, geo); - bg_layer_.reset(CrateBackgroundLayer(geo.width, geo.height)); + EnsureBGLayer(); nux::GetPainter().PushDrawLayer(graphics_engine, geo, bg_layer_.get()); nux::GetPainter().PopBackground(); @@ -208,7 +284,7 @@ if (!IsFullRedraw()) { - bg_layer_.reset(CrateBackgroundLayer(geo.width, geo.height)); + EnsureBGLayer(); nux::GetPainter().PushLayer(graphics_engine, geo, bg_layer_.get()); } @@ -238,16 +314,18 @@ auto* text_input = new unity::TextInput(); auto* text_entry = text_input->text_entry(); + text_input->scale = scale(); text_input->input_hint = SanitizeMessage(message); text_input->hint_font_size = PROMPT_FONT_SIZE; text_input->show_caps_lock = true; + text_input->show_activator = true; text_entry->SetPasswordMode(!visible); text_entry->SetPasswordChar("•"); text_entry->SetToggleCursorVisibilityOnKeyFocus(true); text_entry->clipboard_enabled = false; - text_input->SetMinimumHeight(Settings::GRID_SIZE); - text_input->SetMaximumHeight(Settings::GRID_SIZE); + text_input->SetMinimumHeight(Settings::GRID_SIZE.CP(scale)); + text_input->SetMaximumHeight(Settings::GRID_SIZE.CP(scale)); prompt_layout_->AddView(text_input, 1); focus_queue_.push_back(text_input); @@ -288,6 +366,7 @@ { nux::Geometry const& geo = GetGeometry(); auto* view = new unity::StaticCairoText(""); + view->SetScale(scale); view->SetFont(Settings::Instance().font_name()); view->SetTextColor(color); view->SetText(message); diff -Nru unity-7.2.3+14.04.20140826/lockscreen/UserPromptView.h unity-7.2.4+14.04.20141217/lockscreen/UserPromptView.h --- unity-7.2.3+14.04.20140826/lockscreen/UserPromptView.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/lockscreen/UserPromptView.h 2014-12-17 15:51:54.000000000 -0500 @@ -48,7 +48,8 @@ { public: UserPromptView(session::Manager::Ptr const& session_manager); - ~UserPromptView() {}; + + nux::Property scale; nux::View* focus_view(); @@ -62,17 +63,17 @@ private: void ResetLayout(); + void UpdateSize(); + void EnsureBGLayer(); bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character); session::Manager::Ptr session_manager_; UserAuthenticatorPam user_authenticator_; std::shared_ptr bg_layer_; + StaticCairoText* username_; nux::VLayout* msg_layout_; nux::VLayout* prompt_layout_; - StaticCairoText* message_; - StaticCairoText* error_; - StaticCairoText* invalid_login_; std::deque focus_queue_; nux::Geometry cached_focused_geo_; diff -Nru unity-7.2.3+14.04.20140826/panel/PanelIndicatorEntryView.cpp unity-7.2.4+14.04.20141217/panel/PanelIndicatorEntryView.cpp --- unity-7.2.3+14.04.20140826/panel/PanelIndicatorEntryView.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/panel/PanelIndicatorEntryView.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -426,7 +426,7 @@ } } - glib::Object context(gdk_pango_context_get_for_screen(gdk_screen_get_default())); + glib::Object context(gdk_pango_context_get()); std::shared_ptr desc(pango_font_description_from_string(font.c_str()), pango_font_description_free); pango_context_set_font_description(context, desc.get()); pango_context_set_language(context, gtk_get_default_language()); diff -Nru unity-7.2.3+14.04.20140826/panel/PanelMenuView.cpp unity-7.2.4+14.04.20141217/panel/PanelMenuView.cpp --- unity-7.2.3+14.04.20140826/panel/PanelMenuView.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/panel/PanelMenuView.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,6 +20,7 @@ #include #include +#include #include "PanelMenuView.h" #include "unity-shared/AnimationUtils.h" @@ -53,6 +54,32 @@ const std::string WINDOW_ACTIVATED_TIMEOUT = "window-activated-timeout"; const std::string UPDATE_SHOW_NOW_TIMEOUT = "update-show-now-timeout"; const std::string INTEGRATED_MENUS_DOUBLE_CLICK_TIMEOUT = "integrated-menus-double-click-timeout"; + +std::string get_current_desktop() +{ + std::ifstream fin("/etc/os-release"); + std::string temp; + std::string os_release_name("Ubuntu"); + + if (fin.is_open()) + { + while (getline(fin, temp)) + { + if (temp.substr(0,4) == "NAME") + { + os_release_name = boost::erase_all_copy(temp.substr(temp.find_last_of('=')+1), "\""); + break; + } + } + fin.close(); + } + + //this is done to avoid breaking translation before 14.10. + if (os_release_name.empty() || os_release_name == "Ubuntu") + return _("Ubuntu Desktop"); + else + return glib::String(g_strdup_printf(_("%s Desktop"), os_release_name.c_str())).Str(); +} } PanelMenuView::PanelMenuView(menu::Manager::Ptr const& menus) @@ -73,9 +100,8 @@ , ignore_menu_visibility_(false) , integrated_menus_(decoration::Style::Get()->integrated_menus()) , active_xid_(0) - , desktop_name_(_("Ubuntu Desktop")) + , desktop_name_(get_current_desktop()) { - BamfWindow* active_win = bamf_matcher_get_active_window(matcher_); if (BAMF_IS_WINDOW(active_win)) active_xid_ = bamf_window_get_xid(active_win); @@ -249,6 +275,9 @@ if (!mouse_inside) return nullptr; + if (WindowManager::Default().IsExpoActive()) + return nullptr; + Area* found_area = nullptr; if (!integrated_menus_ && !we_control_active_ && !spread_showing_) @@ -360,14 +389,12 @@ bool PanelMenuView::ShouldDrawButtons() const { + if (spread_showing_) + return true; + if (integrated_menus_) { - if (spread_showing_) - return true; - - WindowManager& wm = WindowManager::Default(); - - if (!wm.IsExpoActive() && !wm.IsScaleActive()) + if (!WindowManager::Default().IsExpoActive()) return (GetMaximizedWindow() != 0); return false; @@ -375,9 +402,7 @@ if (we_control_active_ && is_maximized_ && !launcher_keynav_ && !switcher_showing_) { - WindowManager& wm = WindowManager::Default(); - - if (!wm.IsExpoActive()) + if (!WindowManager::Default().IsExpoActive()) { if (is_inside_ || show_now_activated_ || new_application_) return true; @@ -387,9 +412,6 @@ } } - if (spread_showing_) - return true; - return false; } @@ -795,7 +817,7 @@ auto state = WidgetState::NORMAL; float dpi_scale = Settings::Instance().em(monitor_)->DPIScale(); - if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsScaleActive()) + if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsExpoActive()) { title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale); @@ -828,10 +850,9 @@ { if (integrated_menus_ || (!switcher_showing_ && !launcher_keynav_)) { - WindowManager& wm = WindowManager::Default(); std::string new_title; - if (wm.IsExpoActive()) + if (WindowManager::Default().IsExpoActive()) { new_title = desktop_name_; } @@ -1103,7 +1124,10 @@ } if (is_maximized_) - maximized_set_.insert(active_xid_); + { + maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), active_xid_), maximized_wins_.end()); + maximized_wins_.push_front(active_xid_); + } // register callback for new view view_name_changed_signal_.Connect(new_view, "name-changed", @@ -1159,7 +1183,7 @@ void PanelMenuView::OnWindowMinimized(Window xid) { - maximized_set_.erase(xid); + maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); if (xid == active_xid_) { @@ -1175,18 +1199,24 @@ void PanelMenuView::OnWindowUnminimized(Window xid) { - if (WindowManager::Default().IsWindowMaximized(xid)) - maximized_set_.insert(xid); - if (xid == active_xid_) { + if (WindowManager::Default().IsWindowMaximized(xid)) + maximized_wins_.push_front(xid); + if (Refresh()) QueueDraw(); } - else if (integrated_menus_ && IsWindowUnderOurControl(xid)) + else { - if (Refresh()) - QueueDraw(); + if (WindowManager::Default().IsWindowMaximized(xid)) + maximized_wins_.push_back(xid); + + if (integrated_menus_ && IsWindowUnderOurControl(xid)) + { + if (Refresh()) + QueueDraw(); + } } } @@ -1194,7 +1224,7 @@ { // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap) // we need to do this again on BamfView closed signal. - maximized_set_.erase(xid); + maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); if (xid == active_xid_) { @@ -1212,22 +1242,26 @@ { if (WindowManager::Default().IsWindowMaximized(xid)) { - maximized_set_.insert(xid); - if (xid == active_xid_) { + maximized_wins_.push_front(xid); + if (Refresh()) QueueDraw(); } + else + { + maximized_wins_.push_back(xid); + } } } void PanelMenuView::OnWindowMaximized(Window xid) { - maximized_set_.insert(xid); - if (xid == active_xid_) { + maximized_wins_.push_front(xid); + // We need to update the is_inside_ state in the case of maximization by grab auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord(); is_inside_ = GetAbsoluteGeometry().IsInside(mouse); @@ -1236,16 +1270,21 @@ if (Refresh()) FullRedraw(); } - else if (integrated_menus_ && IsWindowUnderOurControl(xid)) + else { - if (Refresh()) - QueueDraw(); + maximized_wins_.push_back(xid); + + if (integrated_menus_ && IsWindowUnderOurControl(xid)) + { + if (Refresh()) + QueueDraw(); + } } } void PanelMenuView::OnWindowRestored(Window xid) { - maximized_set_.erase(xid); + maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end()); if (active_xid_ == xid) { @@ -1344,7 +1383,7 @@ Window window_xid = 0; // Find the front-most of the maximized windows we are controlling - for (auto xid : maximized_set_) + for (auto xid : maximized_wins_) { // We can safely assume only the front-most is visible if (IsValidWindow(xid)) @@ -1769,8 +1808,8 @@ { PanelIndicatorsView::SetMonitor(monitor); + maximized_wins_.clear(); monitor_geo_ = UScreen::GetDefault()->GetMonitorGeometry(monitor_); - maximized_set_.clear(); GList* windows = bamf_matcher_get_window_stack_for_monitor(matcher_, monitor_); for (GList* l = windows; l; l = l->next) @@ -1780,12 +1819,18 @@ auto window = static_cast(l->data); auto view = static_cast(l->data); + auto xid = bamf_window_get_xid(window); if (bamf_view_is_active(view)) - active_xid_ = bamf_window_get_xid(window); + active_xid_ = xid; if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED) - maximized_set_.insert(bamf_window_get_xid(window)); + { + if (xid == active_xid_) + maximized_wins_.push_front(xid); + else + maximized_wins_.push_back(xid); + } } Window maximized = GetMaximizedWindow(); diff -Nru unity-7.2.3+14.04.20140826/panel/PanelMenuView.h unity-7.2.4+14.04.20141217/panel/PanelMenuView.h --- unity-7.2.3+14.04.20140826/panel/PanelMenuView.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/panel/PanelMenuView.h 2014-12-17 15:51:54.000000000 -0500 @@ -170,7 +170,7 @@ bool is_desktop_focused_; PanelIndicatorEntryView* last_active_view_; - std::set maximized_set_; + std::deque maximized_wins_; glib::Object new_application_; std::list> new_apps_; std::string panel_title_; diff -Nru unity-7.2.3+14.04.20140826/plugins/unityshell/src/unityshell.cpp unity-7.2.4+14.04.20141217/plugins/unityshell/src/unityshell.cpp --- unity-7.2.3+14.04.20140826/plugins/unityshell/src/unityshell.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/plugins/unityshell/src/unityshell.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -278,6 +278,7 @@ CompositeScreenInterface::setHandler(cScreen); GLScreenInterface::setHandler(gScreen); ScaleScreenInterface::setHandler(sScreen); + screen->updateSupportedWmHints(); PluginAdapter::Initialize(screen); AddChild(&WindowManager::Default()); @@ -534,7 +535,19 @@ else { CompMatch windows_match; - for (auto xid : spread_filter_->FilteredWindows()) + auto const& filtered_windows = spread_filter_->FilteredWindows(); + + for (auto const& swin : sScreen->getWindows()) + { + if (filtered_windows.find(swin->window->id()) != filtered_windows.end()) + continue; + + auto* uwin = UnityWindow::get(swin->window); + uwin->OnTerminateSpread(); + fake_decorated_windows_.erase(uwin); + } + + for (auto xid : filtered_windows) windows_match |= "xid="+std::to_string(xid); auto match = sScreen->getCustomMatch(); @@ -2791,23 +2804,6 @@ return "Unity"; } -bool isNuxWindow(CompWindow* value) -{ - std::vector const& xwns = nux::XInputWindow::NativeHandleList(); - auto id = value->id(); - - // iterate loop by hand rather than use std::find as this is considerably faster - // we care about performance here because of the high frequency in which this function is - // called (nearly every frame) - unsigned int size = xwns.size(); - for (unsigned int i = 0; i < size; ++i) - { - if (xwns[i] == id) - return true; - } - return false; -} - void UnityScreen::RaiseInputWindows() { std::vector const& xwns = nux::XInputWindow::NativeHandleList(); @@ -3715,7 +3711,6 @@ } auto max_bounds = NuxGeometryFromCompRect(output.workArea()); - if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER) { int monitor_width = unity_settings_.LauncherWidth(monitor); @@ -3729,19 +3724,18 @@ layout.spacing = local::SCALE_SPACING.CP(monitor_scale); int padding = local::SCALE_PADDING.CP(monitor_scale); max_bounds.Expand(-padding, -padding); - layout.LayoutWindows(layout_windows, max_bounds, final_bounds); + layout.LayoutWindowsNearest(layout_windows, max_bounds, final_bounds); - auto lw_it = layout_windows.begin(); - for (auto const& sw : scaled_windows) + for (auto const& lw : layout_windows) { - if (lw_it == layout_windows.end()) - break; - - LayoutWindow::Ptr const& lw = *lw_it; + auto sw_it = std::find_if(scaled_windows.begin(), scaled_windows.end(), [&lw] (ScaleWindow* sw) { + return sw->window->id() == lw->xid; + }); - if (sw->window->id() != lw->xid) + if (sw_it == scaled_windows.end()) continue; + ScaleWindow* sw = *sw_it; ScaleSlot slot(CompRectFromNuxGeo(lw->result)); slot.scale = lw->scale; @@ -3758,7 +3752,6 @@ slot.filled = true; sw->setSlot(slot); - ++lw_it; } } @@ -3781,6 +3774,7 @@ if (hud_controller_->IsVisible()) hud_controller_->HideHud(); + menus_->Indicators()->CloseActiveEntry(); launcher_controller_->ClearTooltips(); if (launcher_controller_->KeyNavIsActive()) @@ -3999,7 +3993,7 @@ return launcher_controller_; } -std::shared_ptr UnityScreen::lockscreen_controller() +lockscreen::Controller::Ptr UnityScreen::lockscreen_controller() { return lockscreen_controller_; } @@ -4038,8 +4032,8 @@ void UnityScreen::ShowFirstRunHints() { sources_.AddTimeoutSeconds(1, [this] { - auto const& cache_dir = DesktopUtilities::GetUserCacheDirectory(); - if (!cache_dir.empty() && !g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS)) + auto const& config_dir = DesktopUtilities::GetUserConfigDirectory(); + if (!config_dir.empty() && !g_file_test((config_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS)) { // We focus the panel, so the shortcut hint will be hidden at first user input auto const& panels = panel_controller_->panels(); @@ -4052,7 +4046,7 @@ shortcut_controller_->Show(); glib::Error error; - g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error); + g_file_set_contents((config_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error); if (error) { @@ -4092,7 +4086,7 @@ , close_icon_state_(decoration::WidgetState::NORMAL) , deco_win_(uScreen->deco_manager_->HandleWindow(window)) , need_fake_deco_redraw_(false) - , is_nux_window_(isNuxWindow(window)) + , is_nux_window_(PluginAdapter::IsNuxWindow(window)) { WindowInterface::setHandler(window); GLWindowInterface::setHandler(gWindow); @@ -4428,7 +4422,7 @@ } else { - window->setShowDesktopMode (false); + window->setShowDesktopMode(false); } } } diff -Nru unity-7.2.3+14.04.20140826/plugins/unityshell/src/unityshell.h unity-7.2.4+14.04.20141217/plugins/unityshell/src/unityshell.h --- unity-7.2.3+14.04.20140826/plugins/unityshell/src/unityshell.h 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/plugins/unityshell/src/unityshell.h 2014-12-17 15:51:54.000000000 -0500 @@ -239,7 +239,7 @@ switcher::Controller::Ptr switcher_controller(); launcher::Controller::Ptr launcher_controller(); - std::shared_ptr lockscreen_controller(); + lockscreen::Controller::Ptr lockscreen_controller(); bool DoesPointIntersectUnityGeos(nux::Point const& pt); @@ -348,7 +348,7 @@ session::DBusManager::Ptr session_dbus_manager_; session::Controller::Ptr session_controller_; lockscreen::DBusManager::Ptr screensaver_dbus_manager_; - std::shared_ptr lockscreen_controller_; + lockscreen::Controller::Ptr lockscreen_controller_; debug::DebugDBusInterface debugger_; std::unique_ptr bghash_; spread::Filter::Ptr spread_filter_; Binary files /tmp/ZHUedd5nKF/unity-7.2.3+14.04.20140826/resources/arrow_right.png and /tmp/DPrsEeUC_G/unity-7.2.4+14.04.20141217/resources/arrow_right.png differ diff -Nru unity-7.2.3+14.04.20140826/services/panel-main.c unity-7.2.4+14.04.20141217/services/panel-main.c --- unity-7.2.3+14.04.20140826/services/panel-main.c 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/services/panel-main.c 2014-12-17 15:51:54.000000000 -0500 @@ -82,6 +82,9 @@ " " " " "" + "" + " " + "" " " " " " " @@ -254,6 +257,11 @@ g_dbus_method_invocation_return_value (invocation, NULL); g_free(entry_id); } + else if (g_strcmp0 (method_name, "CloseActiveEntry") == 0) + { + panel_service_close_active_entry (service); + g_dbus_method_invocation_return_value (invocation, NULL); + } } static void diff -Nru unity-7.2.3+14.04.20140826/services/panel-service.c unity-7.2.4+14.04.20141217/services/panel-service.c --- unity-7.2.3+14.04.20140826/services/panel-service.c 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/services/panel-service.c 2014-12-17 15:51:54.000000000 -0500 @@ -2383,6 +2383,8 @@ IndicatorObject *object; IndicatorObjectEntry *entry; + g_return_if_fail (PANEL_IS_SERVICE (self)); + entry = get_indicator_entry_by_id (self, entry_id); g_return_if_fail (entry); @@ -2399,6 +2401,8 @@ IndicatorObject *object; IndicatorObjectEntry *entry; + g_return_if_fail (PANEL_IS_SERVICE (self)); + entry = get_indicator_entry_by_id (self, entry_id); g_return_if_fail (entry); @@ -2427,3 +2431,14 @@ entry, 1, direction); } } + +void +panel_service_close_active_entry (PanelService *self) +{ + g_return_if_fail (PANEL_IS_SERVICE (self)); + + if (GTK_IS_MENU (self->priv->last_menu)) + { + gtk_menu_popdown (GTK_MENU (self->priv->last_menu)); + } +} diff -Nru unity-7.2.3+14.04.20140826/services/panel-service.h unity-7.2.4+14.04.20141217/services/panel-service.h --- unity-7.2.3+14.04.20140826/services/panel-service.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/services/panel-service.h 2014-12-17 15:51:54.000000000 -0500 @@ -122,6 +122,8 @@ const gchar *entry_id, gint32 delta); +void panel_service_close_active_entry (PanelService *self); + G_END_DECLS #endif /* _PANEL_SERVICE_H_ */ diff -Nru unity-7.2.3+14.04.20140826/tests/CMakeLists.txt unity-7.2.4+14.04.20141217/tests/CMakeLists.txt --- unity-7.2.3+14.04.20140826/tests/CMakeLists.txt 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/tests/CMakeLists.txt 2014-12-17 15:51:54.000000000 -0500 @@ -131,7 +131,6 @@ test_favorite_store_gsettings.cpp test_favorite_store_private.cpp test_launcher_entry_remote.cpp - test_launcher_model.cpp test_launcher_options.cpp test_layout_system.cpp test_model_iterator.cpp @@ -242,6 +241,7 @@ test_launcher_hover_machine.cpp test_launcher_icon.cpp test_launcher_minimize_speed.cpp + test_launcher_model.cpp test_launcher_tooltip.cpp test_lockscreen_controller.cpp test_panel_controller.cpp diff -Nru unity-7.2.3+14.04.20140826/tests/mock_indicators.h unity-7.2.4+14.04.20141217/tests/mock_indicators.h --- unity-7.2.3+14.04.20140826/tests/mock_indicators.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/tests/mock_indicators.h 2014-12-17 15:51:54.000000000 -0500 @@ -36,6 +36,7 @@ // Implementing Indicators virtual functions MOCK_METHOD2(SyncGeometries, void(std::string const&, EntryLocationMap const&)); MOCK_METHOD5(ShowEntriesDropdown, void(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y)); + MOCK_METHOD0(CloseActiveEntry, void()); MOCK_CONST_METHOD0(IconPaths, std::vector const&()); MOCK_METHOD2(OnEntryScroll, void(std::string const&, int delta)); MOCK_METHOD5(OnEntryShowMenu, void(std::string const&, unsigned xid, int x, int y, unsigned button)); diff -Nru unity-7.2.3+14.04.20140826/tests/test_lockscreen_controller.cpp unity-7.2.4+14.04.20141217/tests/test_lockscreen_controller.cpp --- unity-7.2.3+14.04.20140826/tests/test_lockscreen_controller.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/tests/test_lockscreen_controller.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,6 +20,7 @@ #include using namespace testing; +#include "lockscreen/UserPromptView.h" #include "lockscreen/LockScreenController.h" #include @@ -29,6 +30,7 @@ #include "lockscreen/LockScreenSettings.h" #include "lockscreen/ScreenSaverDBusManager.h" +#include "unity-shared/DashStyle.h" #include "unity-shared/PanelStyle.h" #include "unity-shared/UScreen.h" #include "test_mock_session_manager.h" @@ -52,16 +54,21 @@ struct MockShield : AbstractShield { MockShield() - : AbstractShield(nullptr, nullptr, nullptr, 0, false) + : AbstractShield(nullptr, nullptr, nullptr, nux::ObjectPtr(), 0, false) {} MOCK_CONST_METHOD0(IsIndicatorOpen, bool()); MOCK_METHOD0(ActivatePanel, void()); + MOCK_CONST_METHOD0(HasGrab, bool()); }; struct ShieldFactoryMock : ShieldFactoryInterface { - nux::ObjectPtr CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int, bool) override + nux::ObjectPtr CreateShield(session::Manager::Ptr const&, + indicator::Indicators::Ptr const&, + Accelerators::Ptr const&, + nux::ObjectPtr const&, + int, bool) override { return nux::ObjectPtr(new MockShield()); } @@ -95,6 +102,7 @@ nux::animation::AnimationController animation_controller; MockUScreen uscreen; + unity::dash::Style dash_style; unity::panel::Style panel_style; unity::lockscreen::Settings lockscreen_settings; session::MockManager::Ptr session_manager; diff -Nru unity-7.2.3+14.04.20140826/tests/test_main_xless.cpp unity-7.2.4+14.04.20141217/tests/test_main_xless.cpp --- unity-7.2.3+14.04.20140826/tests/test_main_xless.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/tests/test_main_xless.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -3,18 +3,17 @@ #include #include #include - +#include "test_utils.h" const gchar* LOCAL_DATA_DIR = BUILDDIR"/tests/data:/usr/share"; int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); -#if G_ENCODE_VERSION (GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 - g_type_init(); -#endif - setlocale(LC_ALL, "C"); + setlocale(LC_ALL, "C"); + g_setenv("LC_ALL", "C", TRUE); + Utils::init_gsettings_test_environment(); g_setenv("XDG_DATA_DIRS", LOCAL_DATA_DIR, TRUE); // Slightly higher as we're more likely to test things we know will fail diff -Nru unity-7.2.3+14.04.20140826/tests/test_previews_music_payment.cpp unity-7.2.4+14.04.20141217/tests/test_previews_music_payment.cpp --- unity-7.2.3+14.04.20140826/tests/test_previews_music_payment.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/tests/test_previews_music_payment.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff -Nru unity-7.2.3+14.04.20140826/tests/test_text_input.cpp unity-7.2.4+14.04.20141217/tests/test_text_input.cpp --- unity-7.2.3+14.04.20140826/tests/test_text_input.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/tests/test_text_input.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -23,6 +23,7 @@ #include #include "unity-shared/DashStyle.h" +#include "unity-shared/StaticCairoText.h" #include "unity-shared/TextInput.h" #include "test_utils.h" diff -Nru unity-7.2.3+14.04.20140826/tools/migration-scripts/03_unity_first_run_stamp_move unity-7.2.4+14.04.20141217/tools/migration-scripts/03_unity_first_run_stamp_move --- unity-7.2.3+14.04.20140826/tools/migration-scripts/03_unity_first_run_stamp_move 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.4+14.04.20141217/tools/migration-scripts/03_unity_first_run_stamp_move 2014-12-17 15:51:54.000000000 -0500 @@ -0,0 +1,35 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright (C) 2014 Canonical +# +# Authors: +# Brandon Schaefer +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; version 3. +# +# This program is distributed in the hope that it will be useful, but WITHOUTa +# 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, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +from gi.repository import GLib +from os import path, rename, mkdir + +old_first_run_path = GLib.get_user_cache_dir() + "/unity/first_run.stamp" +new_first_run_path = GLib.get_user_config_dir() + "/unity" + +# If we have the old first_run.stamp file, we must move it to the new location +if path.isfile(old_first_run_path): + + # make sure the new dir exists before attempting to move + if not path.isdir(new_first_run_path): + mkdir(new_first_run_path) + + new_first_run_path += "/first_run.stamp" + rename(old_first_run_path, new_first_run_path) diff -Nru unity-7.2.3+14.04.20140826/UnityCore/DBusIndicators.cpp unity-7.2.4+14.04.20141217/UnityCore/DBusIndicators.cpp --- unity-7.2.3+14.04.20140826/UnityCore/DBusIndicators.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/DBusIndicators.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -55,6 +55,7 @@ void Sync(GVariant* args, glib::Error const&); void SyncGeometries(std::string const& name, EntryLocationMap const& locations); void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y); + void CloseActiveEntry(); void OnConnected(); void OnDisconnected(); @@ -313,6 +314,11 @@ gproxy_.Call("ScrollEntry", g_variant_new("(si)", entry_id.c_str(), delta)); } +void DBusIndicators::Impl::CloseActiveEntry() +{ + gproxy_.Call("CloseActiveEntry"); +} + void DBusIndicators::Impl::Sync(GVariant* args, glib::Error const& error) { if (!args || error) @@ -489,6 +495,11 @@ pimpl->ShowEntriesDropdown(entries, selected, xid, x, y); } +void DBusIndicators::CloseActiveEntry() +{ + pimpl->CloseActiveEntry(); +} + void DBusIndicators::OnEntryScroll(std::string const& entry_id, int delta) { pimpl->OnEntryScroll(entry_id, delta); diff -Nru unity-7.2.3+14.04.20140826/UnityCore/DBusIndicators.h unity-7.2.4+14.04.20141217/UnityCore/DBusIndicators.h --- unity-7.2.3+14.04.20140826/UnityCore/DBusIndicators.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/DBusIndicators.h 2014-12-17 15:51:54.000000000 -0500 @@ -40,6 +40,7 @@ std::vector const& IconPaths() const; void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y); void SyncGeometries(std::string const& name, EntryLocationMap const& locations); + void CloseActiveEntry(); protected: virtual void OnEntryScroll(std::string const& entry_id, int delta); diff -Nru unity-7.2.3+14.04.20140826/UnityCore/DesktopUtilities.cpp unity-7.2.4+14.04.20141217/UnityCore/DesktopUtilities.cpp --- unity-7.2.3+14.04.20140826/UnityCore/DesktopUtilities.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/DesktopUtilities.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -66,6 +66,18 @@ return ""; } +std::string DesktopUtilities::GetUserConfigDirectory() +{ + const char *config_dir = g_get_user_config_dir(); + auto unity_config = glib::gchar_to_string(config_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S); + + if (g_mkdir_with_parents(unity_config.c_str(), 0700) >= 0) + return unity_config; + + LOG_ERROR(logger) << "Impossible to create unity config folder '"<< unity_config <<"' !"; + return ""; +} + std::string DesktopUtilities::GetUserRuntimeDirectory() { const char *runtime_dir = g_get_user_runtime_dir(); diff -Nru unity-7.2.3+14.04.20140826/UnityCore/DesktopUtilities.h unity-7.2.4+14.04.20141217/UnityCore/DesktopUtilities.h --- unity-7.2.3+14.04.20140826/UnityCore/DesktopUtilities.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/DesktopUtilities.h 2014-12-17 15:51:54.000000000 -0500 @@ -32,6 +32,7 @@ static std::string GetUserDataDirectory(); static std::string GetUserCacheDirectory(); static std::string GetUserRuntimeDirectory(); + static std::string GetUserConfigDirectory(); static std::vector GetSystemDataDirectories(); static std::vector GetDataDirectories(); diff -Nru unity-7.2.3+14.04.20140826/UnityCore/GLibDBusProxy.cpp unity-7.2.4+14.04.20141217/UnityCore/GLibDBusProxy.cpp --- unity-7.2.3+14.04.20140826/UnityCore/GLibDBusProxy.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/GLibDBusProxy.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -21,7 +21,7 @@ #include "GLibDBusProxy.h" -#include +#include #include #include #include @@ -30,6 +30,8 @@ #include "GLibSignal.h" #include "GLibSource.h" +#include + namespace unity { namespace glib @@ -47,7 +49,7 @@ { public: typedef std::vector Callbacks; - typedef std::map SignalHandlers; + typedef std::unordered_map SignalHandlers; Impl(DBusProxy* owner, string const& name, @@ -74,6 +76,12 @@ GCancellable *cancellable, GDBusCallFlags flags, int timeout_msec); + void CallWithUnixFdList(std::string const& method_name, + GVariant* parameters, + CallFinishedCallback const& callback, + GCancellable *cancellable, + GDBusCallFlags flags, + int timeout_msec); void Connect(string const& signal_name, ReplyCallback const& callback); void DisconnectSignal(string const& signal_name); @@ -85,6 +93,7 @@ static void OnProxyConnectCallback(GObject* source, GAsyncResult* res, gpointer impl); static void OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data); + static void OnCallWithUnixFdListCallback(GObject* source, GAsyncResult* res, gpointer call_data); struct CallData { @@ -399,6 +408,50 @@ data); } +void DBusProxy::Impl::CallWithUnixFdList(string const& method_name, + GVariant* parameters, + CallFinishedCallback const& callback, + GCancellable* cancellable, + GDBusCallFlags flags, + int timeout_msec) +{ + GCancellable* target_canc = cancellable != NULL ? cancellable : cancellable_; + + if (!proxy_) + { + glib::Variant sinked_parameters(parameters); + glib::Object canc(target_canc, glib::AddRef()); + WaitForProxy(canc, timeout_msec, [this, method_name, sinked_parameters, callback, canc, flags, timeout_msec] (glib::Error const& err) + { + if (err) + { + callback(glib::Variant(), err); + LOG_WARNING(logger) << "Cannot call method " << method_name + << ": " << err; + } + else + { + CallWithUnixFdList(method_name, sinked_parameters, callback, canc, flags, timeout_msec); + } + }); + return; + } + + CallData* data = new CallData(); + data->callback = callback; + data->method_name = method_name; + + g_dbus_proxy_call_with_unix_fd_list(proxy_, + method_name.c_str(), + parameters, + flags, + timeout_msec, + nullptr, + target_canc, + DBusProxy::Impl::OnCallWithUnixFdListCallback, + data); +} + void DBusProxy::Impl::OnCallCallback(GObject* source, GAsyncResult* res, gpointer call_data) { glib::Error error; @@ -407,7 +460,7 @@ if (error) { - if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { // silently ignore, don't even invoke callback, FIXME: really? return; @@ -425,6 +478,39 @@ data->callback(result, error); } +void DBusProxy::Impl::OnCallWithUnixFdListCallback(GObject* source, GAsyncResult* res, gpointer call_data) +{ + glib::Object fd_list; + + glib::Error error; + std::unique_ptr data(static_cast(call_data)); + glib::Variant result(g_dbus_proxy_call_with_unix_fd_list_finish(G_DBUS_PROXY(source), &fd_list, res, &error), glib::StealRef()); + + if (error) + { + if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + // silently ignore, don't even invoke callback, FIXME: really? + return; + } + else + { + LOG_WARNING(logger) << "Calling method \"" << data->method_name + << "\" on object path: \"" + << g_dbus_proxy_get_object_path(G_DBUS_PROXY(source)) + << "\" failed: " << error; + } + } + + if (data->callback) + { + gint idx; + g_variant_get(result, "(h)", &idx); + gint fd = g_unix_fd_list_get(fd_list, idx, nullptr); + data->callback(glib::Variant(fd), error); + } +} + void DBusProxy::Impl::Connect(std::string const& signal_name, ReplyCallback const& callback) { if (!callback) @@ -487,6 +573,17 @@ timeout_msec); } +void DBusProxy::CallWithUnixFdList(std::string const& method_name, + GVariant* parameters, + CallFinishedCallback const& callback, + GCancellable *cancellable, + GDBusCallFlags flags, + int timeout_msec) +{ + pimpl->CallWithUnixFdList(method_name, parameters, callback, cancellable, + flags, timeout_msec); +} + glib::Variant DBusProxy::GetProperty(std::string const& name) const { if (IsConnected()) diff -Nru unity-7.2.3+14.04.20140826/UnityCore/GLibDBusProxy.h unity-7.2.4+14.04.20141217/UnityCore/GLibDBusProxy.h --- unity-7.2.3+14.04.20140826/UnityCore/GLibDBusProxy.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/GLibDBusProxy.h 2014-12-17 15:51:54.000000000 -0500 @@ -64,6 +64,12 @@ GCancellable *cancellable = nullptr, GDBusCallFlags flags = G_DBUS_CALL_FLAGS_NONE, int timeout_msec = -1); + void CallWithUnixFdList(std::string const& method_name, + GVariant* parameters = nullptr, + CallFinishedCallback const& callback = nullptr, + GCancellable *cancellable = nullptr, + GDBusCallFlags flags = G_DBUS_CALL_FLAGS_NONE, + int timeout_msec = -1); bool IsConnected() const; diff -Nru unity-7.2.3+14.04.20140826/UnityCore/GLibWrapper.h unity-7.2.4+14.04.20141217/UnityCore/GLibWrapper.h --- unity-7.2.3+14.04.20140826/UnityCore/GLibWrapper.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/GLibWrapper.h 2014-12-17 15:51:54.000000000 -0500 @@ -56,6 +56,7 @@ operator T* () const; operator bool() const; T* operator->() const; + T** operator&(); T* RawPtr() const; // Release ownership of the object. No unref will occur. T* Release(); diff -Nru unity-7.2.3+14.04.20140826/UnityCore/GLibWrapper-inl.h unity-7.2.4+14.04.20141217/UnityCore/GLibWrapper-inl.h --- unity-7.2.3+14.04.20140826/UnityCore/GLibWrapper-inl.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/GLibWrapper-inl.h 2014-12-17 15:51:54.000000000 -0500 @@ -94,6 +94,18 @@ } template +T** Object::operator&() +{ + if (object_) + { + g_object_unref(object_); + object_ = nullptr; + } + + return &object_; +} + +template Object::operator bool() const { return bool(object_); diff -Nru unity-7.2.3+14.04.20140826/UnityCore/GnomeSessionManager.cpp unity-7.2.4+14.04.20141217/UnityCore/GnomeSessionManager.cpp --- unity-7.2.3+14.04.20140826/UnityCore/GnomeSessionManager.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/GnomeSessionManager.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -432,7 +432,6 @@ return; } - // FIXME (andy) we should ask gnome-session to emit the logind signal prompt ? manager_->prompt_lock_requested.emit() : manager_->lock_requested.emit(); } diff -Nru unity-7.2.3+14.04.20140826/UnityCore/Indicators.h unity-7.2.4+14.04.20141217/UnityCore/Indicators.h --- unity-7.2.3+14.04.20140826/UnityCore/Indicators.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/UnityCore/Indicators.h 2014-12-17 15:51:54.000000000 -0500 @@ -44,6 +44,7 @@ virtual void SyncGeometries(std::string const& panel, EntryLocationMap const&) = 0; virtual void ShowEntriesDropdown(Indicator::Entries const&, Entry::Ptr const&, unsigned xid, int x, int y) = 0; + virtual void CloseActiveEntry() = 0; // Signals sigc::signal on_object_added; diff -Nru unity-7.2.3+14.04.20140826/unity-shared/CompizUtils.cpp unity-7.2.4+14.04.20141217/unity-shared/CompizUtils.cpp --- unity-7.2.3+14.04.20140826/unity-shared/CompizUtils.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/CompizUtils.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -1,6 +1,6 @@ // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- /* -* Copyright (C) 2013 Canonical Ltd +* Copyright (C) 2013-2014 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 @@ -30,6 +30,11 @@ { const unsigned PIXMAP_DEPTH = 32; const float DEFAULT_SCALE = 1.0f; + const unsigned DECORABLE_WINDOW_TYPES = CompWindowTypeDialogMask | + CompWindowTypeModalDialogMask | + CompWindowTypeUtilMask | + CompWindowTypeMenuMask | + CompWindowTypeNormalMask; } SimpleTexture::SimpleTexture(GLTexture::List const& tex) @@ -39,7 +44,7 @@ // SimpleTextureQuad::SimpleTextureQuad() - : scale(DEFAULT_SCALE) + : scale_(DEFAULT_SCALE) {} bool SimpleTextureQuad::SetTexture(SimpleTexture::Ptr const& simple_texture) @@ -52,24 +57,27 @@ if (st && st->texture()) { auto* tex = st->texture(); - CompPoint old_coords(quad.box.x(), quad.box.y()); - short invalid = std::numeric_limits::min(); - quad.box.setGeometry(invalid, invalid, tex->width() * scale, tex->height() * scale); - SetCoords(old_coords.x(), old_coords.y()); + CompSize size(tex->width() * scale_, tex->height() * scale_); + + if (quad.box.width() != size.width() || quad.box.height() != size.height()) + { + quad.box.setSize(size); + UpdateMatrix(); + } } return true; } -bool SimpleTextureQuad::SetScale(float s) +bool SimpleTextureQuad::SetScale(double s) { - if (!st || scale == s) + if (!st || scale_ == s) return false; - scale = s; + scale_ = s; auto* tex = st->texture(); - quad.box.setWidth(tex->width() * scale); - quad.box.setHeight(tex->height() * scale); + quad.box.setWidth(tex->width() * scale_); + quad.box.setHeight(tex->height() * scale_); UpdateMatrix(); return true; } @@ -91,8 +99,8 @@ int y = quad.box.y(); quad.matrix = (st && st->texture()) ? st->texture()->matrix() : GLTexture::Matrix(); - quad.matrix.xx /= scale; - quad.matrix.yy /= scale; + quad.matrix.xx /= scale_; + quad.matrix.yy /= scale_; quad.matrix.x0 = 0.0f - COMP_TEX_COORD_X(quad.matrix, x); quad.matrix.y0 = 0.0f - COMP_TEX_COORD_Y(quad.matrix, y); } @@ -166,57 +174,68 @@ return cairo_xlib_surface_get_height(surface_); } -bool IsWindowShadowDecorable(CompWindow* win) +// +// + +unsigned WindowDecorationElements(CompWindow* win, WindowFilter::Value wf) { + unsigned elements = DecorationElement::NONE; + if (!win) - return false; + return elements; - if (!win->isViewable()) - return false; + if (!win->isViewable() && wf == WindowFilter::NONE) + return elements; if (win->wmType() & (CompWindowTypeDockMask | CompWindowTypeDesktopMask)) - return false; + return elements; - if (win->region().numRects() != 1) // Non rectangular windows - return false; + if (win->inShowDesktopMode()) + return elements; - if (win->alpha()) - return WindowHasMotifDecorations(win); + auto const& region = win->region(); + bool rectangular = (region.numRects() == 1); + bool alpha = win->alpha(); - return true; -} + if (!rectangular && alpha) // Non-rectangular windows with alpha channel + return elements; -bool IsWindowFullyDecorable(CompWindow* win) -{ - if (!win) - return false; + if (region.boundingRect() != win->geometry()) // Shaped windows + return elements; - if (!IsWindowShadowDecorable(win)) - return false; + if (rectangular) + elements |= DecorationElement::SHADOW; - return WindowHasMotifDecorations(win); + if (!win->overrideRedirect() && + (win->type() & DECORABLE_WINDOW_TYPES) && + (win->frame() || win->hasUnmapReference() || wf == WindowFilter::UNMAPPED)) + { + if (win->actions() & CompWindowActionResizeMask) + elements |= DecorationElement::EDGE; + + if (rectangular && (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle))) + elements |= DecorationElement::BORDER; + } + + if (alpha && !(elements & DecorationElement::BORDER) && !(win->mwmDecor() & MwmDecorBorder)) + elements &= ~DecorationElement::SHADOW; + + return elements; } -bool WindowHasMotifDecorations(CompWindow* win) +bool IsWindowEdgeDecorable(CompWindow* win) { - if (!win) - return false; - - if (win->overrideRedirect()) - return false; + return WindowDecorationElements(win) & DecorationElement::EDGE; +} - switch (win->type()) - { - case CompWindowTypeDialogMask: - case CompWindowTypeModalDialogMask: - case CompWindowTypeUtilMask: - case CompWindowTypeMenuMask: - case CompWindowTypeNormalMask: - if (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle)) - return true; - } +bool IsWindowShadowDecorable(CompWindow* win) +{ + return WindowDecorationElements(win) & DecorationElement::SHADOW; +} - return false; +bool IsWindowFullyDecorable(CompWindow* win) +{ + return WindowDecorationElements(win) & DecorationElement::BORDER; } } // compiz_utils namespace diff -Nru unity-7.2.3+14.04.20140826/unity-shared/CompizUtils.h unity-7.2.4+14.04.20141217/unity-shared/CompizUtils.h --- unity-7.2.3+14.04.20140826/unity-shared/CompizUtils.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/CompizUtils.h 2014-12-17 15:51:54.000000000 -0500 @@ -31,8 +31,15 @@ struct TextureQuad { + TextureQuad() + : matrices(1) + , matrix(matrices[0]) + {} + CompRect box; - GLTexture::Matrix matrix; + CompRegion region; + GLTexture::MatrixList matrices; + GLTexture::Matrix& matrix; }; struct SimpleTexture @@ -59,11 +66,13 @@ { SimpleTextureQuad(); bool SetTexture(SimpleTexture::Ptr const&); - bool SetScale(float scale); + bool SetScale(double scale); bool SetCoords(int x, int y); bool SetX(int x); bool SetY(int y); + void UpdateMatrix(); + operator SimpleTexture::Ptr() const { return st; } operator bool() const { return st && st->texture(); } operator GLTexture*() const { return st ? st->texture() : nullptr; } @@ -73,8 +82,7 @@ TextureQuad quad; private: - void UpdateMatrix(); - float scale; + double scale_; }; struct PixmapTexture : SimpleTexture @@ -111,9 +119,32 @@ cairo_t *cr_; }; +namespace WindowFilter +{ +enum Value +{ + NONE, + UNMAPPED +}; +} + +namespace DecorationElement +{ +enum +{ + NONE = 0, + EDGE = (1 << 0), + SHADOW = (1 << 1), + BORDER = (1 << 2), + FULL = EDGE|SHADOW|BORDER +}; +} + +unsigned WindowDecorationElements(CompWindow*, WindowFilter::Value wf = WindowFilter::NONE); + +bool IsWindowEdgeDecorable(CompWindow*); bool IsWindowShadowDecorable(CompWindow*); bool IsWindowFullyDecorable(CompWindow*); -bool WindowHasMotifDecorations(CompWindow*); } // compiz_utils namespace } // unity namespace diff -Nru unity-7.2.3+14.04.20140826/unity-shared/DashStyle.cpp unity-7.2.4+14.04.20141217/unity-shared/DashStyle.cpp --- unity-7.2.3+14.04.20140826/unity-shared/DashStyle.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/DashStyle.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -383,9 +383,9 @@ ::pango_layout_context_changed(layout); PangoRectangle log_rect; - ::pango_layout_get_extents(layout, NULL, &log_rect); - text_width_ = log_rect.width / PANGO_SCALE; - text_height_ = log_rect.height / PANGO_SCALE; + ::pango_layout_get_pixel_extents(layout, NULL, &log_rect); + text_width_ = log_rect.width; + text_height_ = log_rect.height; owner_->changed.emit(); @@ -1396,10 +1396,10 @@ pango_cairo_context_set_resolution(pangoCtx, 96.0 * Settings::Instance().font_scaling()); pango_layout_context_changed(layout); - pango_layout_get_extents(layout, &inkRect, NULL); + pango_layout_get_pixel_extents(layout, &inkRect, NULL); - width = inkRect.width / PANGO_SCALE; - height = inkRect.height / PANGO_SCALE; + width = inkRect.width; + height = inkRect.height; // clean up pango_font_description_free(desc); @@ -1444,11 +1444,8 @@ if (text_size > 0) { - pango_font_description_set_absolute_size(desc, text_size * PANGO_SCALE); - } - else if (desc) - { - text_size = pango_font_description_get_size(desc) / PANGO_SCALE; + text_size = pango_units_from_double(Settings::Instance().font_scaling() * text_size); + pango_font_description_set_absolute_size(desc, text_size); } PangoWeight weight; diff -Nru unity-7.2.3+14.04.20140826/unity-shared/DecorationStyle.cpp unity-7.2.4+14.04.20141217/unity-shared/DecorationStyle.cpp --- unity-7.2.3+14.04.20140826/unity-shared/DecorationStyle.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/DecorationStyle.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -147,8 +147,8 @@ , ctx_(gtk_style_context_new()) , settings_(g_settings_new(SETTINGS_NAME.c_str())) , usettings_(g_settings_new(UNITY_SETTINGS_NAME.c_str())) - , title_pango_ctx_(gdk_pango_context_get_for_screen(gdk_screen_get_default())) - , menu_item_pango_ctx_(gdk_pango_context_get_for_screen(gdk_screen_get_default())) + , title_pango_ctx_(gdk_pango_context_get()) + , menu_item_pango_ctx_(gdk_pango_context_get()) , title_alignment_(0) , title_indent_(0) , title_fade_(0) diff -Nru unity-7.2.3+14.04.20140826/unity-shared/GnomeKeyGrabber.cpp unity-7.2.4+14.04.20141217/unity-shared/GnomeKeyGrabber.cpp --- unity-7.2.3+14.04.20140826/unity-shared/GnomeKeyGrabber.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/GnomeKeyGrabber.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -200,6 +200,15 @@ CompAction action; action.keyFromString(accelerator); + if (action.key().toString().empty()) + { + CompString prefixed = "XF86" + CompString(accelerator); + LOG_DEBUG(logger) << "Can't grab \"" << accelerator << "\", trying \"" << prefixed << "\""; + action.keyFromString(prefixed); + } + else + LOG_DEBUG(logger) << "grabAccelerator \"" << accelerator << "\""; + if (!isActionPostponed(action)) { action.setState(CompAction::StateInitKey); diff -Nru unity-7.2.3+14.04.20140826/unity-shared/IconRenderer.cpp unity-7.2.4+14.04.20141217/unity-shared/IconRenderer.cpp --- unity-7.2.3+14.04.20140826/unity-shared/IconRenderer.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/IconRenderer.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -31,6 +31,8 @@ #include "unity-shared/CairoTexture.h" #include "unity-shared/DecorationStyle.h" #include "unity-shared/TextureCache.h" +#include "unity-shared/UnitySettings.h" +#include "unity-shared/WindowManager.h" #include "GraphicsUtils.h" #include @@ -199,6 +201,8 @@ const std::array TILE_SIZES = { 54, 150 }; const std::array GLOW_SIZES = { 62, 200 }; const std::array MARKER_SIZES = { 19, 37 }; + +constexpr double count_scaling(double icon_size, bool switcher) { return icon_size / (TILE_SIZES[local::IconSize::SMALL] * (switcher ? 2.0 : 1.0)); } } // anonymous namespace } // local namespace @@ -210,7 +214,6 @@ return instance; } - nux::ObjectPtr RenderLabelTexture(char label, int icon_size, nux::Color const& bg_color); nux::ObjectPtr offscreen_progress_texture; nux::ObjectPtr shader_program_uv_persp_correction; #ifndef USE_GLES @@ -224,8 +227,6 @@ int ColorifyColor; int DesatFactor; - std::map labels; - private: TexturesPool(); @@ -249,14 +250,18 @@ LocalTextures(IconRenderer* parent) : parent_(parent) { - theme_conn_ = decoration::Style::Get()->theme.changed.connect([this] (std::string const&) { + connections_.Add(decoration::Style::Get()->theme.changed.connect([this] (std::string const&) { auto& cache = TextureCache::GetDefault(); for (auto const& tex_data : texture_files_) cache.Invalidate(tex_data.name, tex_data.size, tex_data.size); ReloadIconSizedTextures(parent_->icon_size, parent_->image_size); - }); + })); + + auto clear_labels = sigc::hide(sigc::mem_fun(this, &LocalTextures::ClearLabels)); + connections_.Add(Settings::Instance().font_scaling.changed.connect(clear_labels)); + connections_.Add(WindowManager::Default().average_color.changed.connect(clear_labels)); } void ReloadIconSizedTextures(int icon_size, int image_size) @@ -298,6 +303,22 @@ *tex_data.tex_ptr = cache.FindTexture(tex_data.name, tex_data.size, tex_data.size, texture_loader); } + nux::BaseTexture* RenderLabelTexture(char label, int icon_size, nux::Color const&); + + BaseTexturePtr const& GetLabelTexture(char label, int icon_size, nux::Color const& color) + { + labels_.push_back(TextureCache::GetDefault().FindTexture(std::string(1, label), icon_size, icon_size, [this, &color] (std::string const& label, int size, int) { + return RenderLabelTexture(label[0], size, color); + })); + + return labels_.back(); + } + + void ClearLabels() + { + labels_.clear(); + } + BaseTexturePtr icon_background; BaseTexturePtr icon_selected_background; BaseTexturePtr icon_edge; @@ -315,7 +336,8 @@ IconRenderer* parent_; struct TextureData { BaseTexturePtr* tex_ptr; std::string name; int size; }; std::vector texture_files_; - connection::Wrapper theme_conn_; + std::vector labels_; + connection::Manager connections_; }; IconRenderer::IconRenderer() @@ -335,6 +357,7 @@ icon_size = tile_size; image_size = image_size_; local_textures_->ReloadIconSizedTextures(icon_size, image_size); + local_textures_->ClearLabels(); } spacing = spacing_; @@ -352,6 +375,7 @@ GetInverseScreenPerspectiveMatrix(ViewMatrix, ProjectionMatrix, geo.width, geo.height, 0.1f, 1000.0f, DEGTORAD(90)); nux::Matrix4 const& PremultMatrix = ProjectionMatrix * ViewMatrix; + int monitor = this->monitor(); std::list::iterator it; int i; @@ -363,6 +387,7 @@ it->logical_center == launcher_icon->LastLogicalCenter(monitor) && it->rotation == launcher_icon->LastRotation(monitor) && it->skip == launcher_icon->WasSkipping(monitor) && + launcher_icon->Count() == launcher_icon->LastCount(monitor) && (launcher_icon->Emblem() != nullptr) == launcher_icon->HadEmblem(monitor)) { continue; @@ -372,6 +397,7 @@ launcher_icon->RememberRotation(monitor, it->rotation); launcher_icon->RememberSkip(monitor, it->skip); launcher_icon->RememberEmblem(monitor, launcher_icon->Emblem() != nullptr); + launcher_icon->RememberCount(monitor, launcher_icon->Count()); float w = icon_size; float h = icon_size; @@ -423,16 +449,26 @@ UpdateIconTransform(launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, ui::IconTextureSource::TRANSFORM_HIT_AREA); - if (launcher_icon->Emblem()) + float emb_w, emb_h; + nux::BaseTexture* emblem = launcher_icon->Emblem(); + + if (nux::BaseTexture* count_texture = launcher_icon->CountTexture(local::count_scaling(icon_size, pip_style != OUTSIDE_TILE))) { - nux::BaseTexture* emblem = launcher_icon->Emblem(); + emblem = count_texture; + emb_w = emblem->GetWidth(); + emb_h = emblem->GetHeight(); + } + else if (emblem) + { + emb_w = std::round(emblem->GetWidth() * scale()); + emb_h = std::round(emblem->GetHeight() * scale()); + } + if (emblem) + { float w = icon_size; float h = icon_size; - float emb_w = emblem->GetWidth(); - float emb_h = emblem->GetHeight(); - x = it->render_center.x + (icon_size * 0.50f - emb_w - icon_size * 0.05f); // puts right edge of emblem just over the edge of the launcher icon y = it->render_center.y - icon_size * 0.50f; // y = top left corner position of emblem z = it->render_center.z; @@ -718,17 +754,28 @@ tile_transform); } - if (arg.icon->Emblem()) + if (nux::BaseTexture* count_texture = arg.icon->CountTexture(local::count_scaling(icon_size, pip_style != OUTSIDE_TILE))) { RenderElement(GfxContext, arg, - arg.icon->Emblem()->GetDeviceTexture(), + count_texture->GetDeviceTexture(), nux::color::White, nux::color::White, arg.alpha, force_filter, arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_EMBLEM, monitor)); } + else if (arg.icon->Emblem()) + { + RenderElement(GfxContext, + arg, + arg.icon->Emblem()->GetDeviceTexture(), + nux::color::White, + nux::color::White, + arg.alpha, + force_filter || scale != 1.0, + arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_EMBLEM, monitor)); + } // draw indicators RenderIndicators(GfxContext, @@ -741,20 +788,8 @@ // draw superkey-shortcut label if (arg.draw_shortcut && arg.shortcut_label) { - char shortcut = (char) arg.shortcut_label; - - BaseTexturePtr label; - auto label_it = textures_->labels.find(shortcut); - - if (label_it != textures_->labels.end()) - { - label = label_it->second; - } - else - { - label = textures_->RenderLabelTexture(shortcut, icon_size, shortcut_color); - textures_->labels[shortcut] = label; - } + char shortcut = static_cast(arg.shortcut_label); + auto const& label = local_textures_->GetLabelTexture(shortcut, icon_size, shortcut_color); RenderElement(GfxContext, arg, @@ -767,7 +802,7 @@ } } -nux::ObjectPtr IconRenderer::TexturesPool::RenderLabelTexture(char label, int icon_size, nux::Color const& bg_color) +nux::BaseTexture* IconRenderer::LocalTextures::RenderLabelTexture(char label, int icon_size, nux::Color const& bg_color) { nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, icon_size, icon_size); cairo_t* cr = cg.GetInternalContext(); @@ -791,27 +826,27 @@ cairo_set_source_rgba(cr, bg_color.red, bg_color.green, bg_color.blue, 0.20f); cairo_fill(cr); - const double text_ratio = 0.75; - double text_size = label_size * text_ratio; glib::Object layout(pango_cairo_create_layout(cr)); g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, NULL); std::shared_ptr desc(pango_font_description_from_string(font_name), pango_font_description_free); - pango_font_description_set_absolute_size(desc.get(), text_size * PANGO_SCALE); + const double text_ratio = 0.75; + int text_size = pango_units_from_double(label_size * text_ratio * Settings::Instance().font_scaling()); + pango_font_description_set_absolute_size(desc.get(), text_size); pango_layout_set_font_description(layout, desc.get()); pango_layout_set_text(layout, &label, 1); - nux::Size extents; - pango_layout_get_pixel_size(layout, &extents.width, &extents.height); + PangoRectangle ink_rect; + pango_layout_get_pixel_extents(layout, &ink_rect, nullptr); // position and paint text cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f); - double x = label_x - std::round((extents.width - label_w) / 2.0f); - double y = label_y - std::round((extents.height - label_h) / 2.0f); + double x = label_x - std::round((ink_rect.width - label_w) / 2.0f) - ink_rect.x; + double y = label_y - std::round((ink_rect.height - label_h) / 2.0f) - ink_rect.y; cairo_move_to(cr, x, y); pango_cairo_show_layout(cr, layout); - return texture_ptr_from_cairo_graphics(cg); + return texture_from_cairo_graphics(cg); } void IconRenderer::RenderElement(nux::GraphicsEngine& GfxContext, @@ -1153,11 +1188,6 @@ unity::graphics::PopOffscreenRenderTarget(); } -void IconRenderer::DestroyShortcutTextures() -{ - TexturesPool::Get()->labels.clear(); -} - void IconRenderer::GetInverseScreenPerspectiveMatrix(nux::Matrix4& ViewMatrix, nux::Matrix4& PerspectiveMatrix, int ViewportWidth, int ViewportHeight, diff -Nru unity-7.2.3+14.04.20140826/unity-shared/IconRenderer.h unity-7.2.4+14.04.20141217/unity-shared/IconRenderer.h --- unity-7.2.3+14.04.20140826/unity-shared/IconRenderer.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/IconRenderer.h 2014-12-17 15:51:54.000000000 -0500 @@ -44,8 +44,6 @@ void SetTargetSize(int tile_size, int image_size, int spacing); - static void DestroyShortcutTextures(); - protected: void RenderElement(nux::GraphicsEngine& GfxContext, RenderArg const& arg, diff -Nru unity-7.2.3+14.04.20140826/unity-shared/IconTexture.cpp unity-7.2.4+14.04.20141217/unity-shared/IconTexture.cpp --- unity-7.2.3+14.04.20140826/unity-shared/IconTexture.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/IconTexture.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -142,7 +142,7 @@ -1, _size, sigc::mem_fun(this, &IconTexture::IconLoaded)); } - else if (_icon_name.find("http://") == 0) + else if (_icon_name.find("://") != std::string::npos) { _handle = IconLoader::GetDefault().LoadFromURI(_icon_name, -1, _size, sigc::mem_fun(this, &IconTexture::IconLoaded)); diff -Nru unity-7.2.3+14.04.20140826/unity-shared/IconTextureSource.cpp unity-7.2.4+14.04.20141217/unity-shared/IconTextureSource.cpp --- unity-7.2.3+14.04.20140826/unity-shared/IconTextureSource.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/IconTextureSource.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -19,6 +19,7 @@ #include "IconTextureSource.h" #include "MultiMonitor.h" +#include "unity-shared/UnitySettings.h" namespace unity { @@ -34,11 +35,16 @@ IconTextureSource::IconTextureSource() : skip_(RENDERERS_SIZE, false) , had_emblem_(RENDERERS_SIZE, false) + , last_count_(RENDERERS_SIZE, 0) , last_render_center_(RENDERERS_SIZE) , last_logical_center_(RENDERERS_SIZE) , last_rotation_(RENDERERS_SIZE) , transformations_(RENDERERS_SIZE, decltype(transformations_)::value_type(TRANSFORM_SIZE, std::vector(4))) -{} +{ + auto reset_count_cb = sigc::mem_fun(this, &IconTextureSource::ResetLastCount); + Settings::Instance().dpi_changed.connect(reset_count_cb); + Settings::Instance().font_scaling.changed.connect(sigc::hide(reset_count_cb)); +} std::vector & IconTextureSource::GetTransform(TransformIndex index, int monitor) { @@ -91,5 +97,35 @@ return had_emblem_[monitor]; } +void IconTextureSource::RememberCount(int monitor, unsigned count) +{ + last_count_[monitor] = count; +} + +unsigned IconTextureSource::LastCount(int monitor) const +{ + return last_count_[monitor]; +} + +unsigned IconTextureSource::Count() const +{ + return 0; +} + +void IconTextureSource::ResetLastCount() +{ + std::fill(last_count_.begin(), last_count_.end(), 0); +} + +nux::BaseTexture* IconTextureSource::Emblem() const +{ + return nullptr; +} + +nux::BaseTexture* IconTextureSource::CountTexture(double scale) +{ + return nullptr; +} + } } \ No newline at end of file diff -Nru unity-7.2.3+14.04.20140826/unity-shared/IconTextureSource.h unity-7.2.4+14.04.20141217/unity-shared/IconTextureSource.h --- unity-7.2.3+14.04.20140826/unity-shared/IconTextureSource.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/IconTextureSource.h 2014-12-17 15:51:54.000000000 -0500 @@ -46,7 +46,7 @@ }; IconTextureSource(); - virtual ~IconTextureSource() {} + virtual ~IconTextureSource() = default; std::vector & GetTransform(TransformIndex index, int monitor); @@ -62,17 +62,23 @@ void RememberEmblem(int monitor, bool has_emblem); bool HadEmblem(int monitor) const; - virtual nux::Color BackgroundColor() const = 0; + void RememberCount(int monitor, unsigned count); + unsigned LastCount(int monitor) const; + virtual nux::Color BackgroundColor() const = 0; virtual nux::Color GlowColor() = 0; - virtual nux::BaseTexture* TextureForSize(int size) = 0; - virtual nux::BaseTexture* Emblem() = 0; + virtual unsigned Count() const; + virtual nux::BaseTexture* CountTexture(double scale); + virtual nux::BaseTexture* Emblem() const; private: + void ResetLastCount(); + std::vector skip_; std::vector had_emblem_; + std::vector last_count_; std::vector last_render_center_; std::vector last_logical_center_; std::vector last_rotation_; diff -Nru unity-7.2.3+14.04.20140826/unity-shared/LayoutSystem.cpp unity-7.2.4+14.04.20141217/unity-shared/LayoutSystem.cpp --- unity-7.2.3+14.04.20140826/unity-shared/LayoutSystem.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/LayoutSystem.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -32,7 +32,33 @@ if (windows.empty()) return; - LayoutGridWindows(windows, max_bounds, final_bounds); + LayoutGridWindows(windows, GetRows(windows, max_bounds), max_bounds, final_bounds); +} + +void LayoutSystem::LayoutWindowsNearest(LayoutWindow::Vector& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds) +{ + if (windows.empty()) + return; + + std::stable_sort(windows.begin(), windows.end(), [](LayoutWindow::Ptr const& a, LayoutWindow::Ptr const& b) { + return a->geo.y < b->geo.y; + }); + + std::vector rows = GetRows(windows, max_bounds); + LayoutWindow::Vector ordered_windows; + + for (auto& row : rows) + { + std::stable_sort(row.begin(), row.end(), [](LayoutWindow::Ptr const& a, LayoutWindow::Ptr const& b) { + return (a->geo.x + a->geo.width / 2) < (b->geo.x + b->geo.width / 2); + }); + + for (auto const& win : row) + ordered_windows.push_back(win); + } + + LayoutGridWindows(ordered_windows, rows, max_bounds, final_bounds); + windows = ordered_windows; } nux::Size LayoutSystem::GridSizeForWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds) const @@ -229,10 +255,8 @@ return rows; } -void LayoutSystem::LayoutGridWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds) +void LayoutSystem::LayoutGridWindows(LayoutWindow::Vector const& windows, std::vector const& rows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds) { - std::vector const& rows = GetRows(windows, max_bounds); - int height = rows.size(); int non_spacing_height = max_bounds.height - ((height - 1) * spacing); int row_height = std::min (max_row_height(), non_spacing_height / height); diff -Nru unity-7.2.3+14.04.20140826/unity-shared/LayoutSystem.h unity-7.2.4+14.04.20141217/unity-shared/LayoutSystem.h --- unity-7.2.3+14.04.20140826/unity-shared/LayoutSystem.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/LayoutSystem.h 2014-12-17 15:51:54.000000000 -0500 @@ -64,10 +64,11 @@ LayoutSystem(); void LayoutWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds); + void LayoutWindowsNearest(LayoutWindow::Vector& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds); std::vector GetRowSizes(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds) const; protected: - void LayoutGridWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds); + void LayoutGridWindows(LayoutWindow::Vector const& windows, std::vector const& rows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds); nux::Geometry LayoutRow(LayoutWindow::Vector const& row, nux::Geometry const& row_bounds); nux::Geometry CompressAndPadRow(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds); diff -Nru unity-7.2.3+14.04.20140826/unity-shared/PluginAdapter.cpp unity-7.2.4+14.04.20141217/unity-shared/PluginAdapter.cpp --- unity-7.2.3+14.04.20140826/unity-shared/PluginAdapter.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/PluginAdapter.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -554,9 +554,10 @@ bool PluginAdapter::IsWindowObscured(Window window_id) const { - CompWindow* window = m_Screen->findWindow(window_id); + if (_spread_state) + return false; - if (window) + if (CompWindow* window = m_Screen->findWindow(window_id)) { if (window->inShowDesktopMode()) return true; @@ -1005,11 +1006,13 @@ void PluginAdapter::OnShowDesktop() { _in_show_desktop = true; + show_desktop_changed.emit(); } void PluginAdapter::OnLeaveDesktop() { _in_show_desktop = false; + show_desktop_changed.emit(); } void PluginAdapter::UpdateShowDesktopState() @@ -1452,6 +1455,40 @@ _last_focused_window = NULL; } +void PluginAdapter::UnmapAllNoNuxWindowsSync() +{ + for (auto const& window : m_Screen->windows()) + { + if (!IsNuxWindow(window) && (window->isMapped() || window->isViewable())) + { + if (window->overrideRedirect()) + { + XUnmapWindow(m_Screen->dpy(), window->id()); + } + else + { + window->hide(); + } + } + } + + XSync(m_Screen->dpy(), False); +} + +bool PluginAdapter::IsNuxWindow(CompWindow* value) +{ + std::vector const& xwns = nux::XInputWindow::NativeHandleList(); + auto id = value->id(); + + unsigned int size = xwns.size(); + for (unsigned int i = 0; i < size; ++i) + { + if (xwns[i] == id) + return true; + } + return false; +} + void PluginAdapter::AddProperties(debug::IntrospectionData& wrapper) { wrapper.add(GetScreenGeometry()) diff -Nru unity-7.2.3+14.04.20140826/unity-shared/PluginAdapter.h unity-7.2.4+14.04.20141217/unity-shared/PluginAdapter.h --- unity-7.2.3+14.04.20140826/unity-shared/PluginAdapter.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/PluginAdapter.h 2014-12-17 15:51:54.000000000 -0500 @@ -193,6 +193,9 @@ Window GetTopWindowAbove(Window xid) const; + void UnmapAllNoNuxWindowsSync(); + static bool IsNuxWindow(CompWindow* value); + protected: PluginAdapter(CompScreen* screen); void AddProperties(debug::IntrospectionData&); diff -Nru unity-7.2.3+14.04.20140826/unity-shared/SearchBar.cpp unity-7.2.4+14.04.20141217/unity-shared/SearchBar.cpp --- unity-7.2.3+14.04.20140826/unity-shared/SearchBar.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/SearchBar.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,17 +20,24 @@ #include "config.h" #include +#include #include #include +#include #include +#include #include #include "SearchBar.h" #include "CairoTexture.h" #include "DashStyle.h" #include "GraphicsUtils.h" +#include "IconTexture.h" +#include "IMTextEntry.h" #include "RawPixel.h" +#include "SearchBarSpinner.h" +#include "StaticCairoText.h" #include "UnitySettings.h" namespace unity @@ -65,7 +72,7 @@ const RawPixel FILTER_HORIZONTAL_MARGIN = 8_em; // Fonts -const std::string HINT_LABEL_FONT_SIZE = "20px"; +const std::string HINT_LABEL_FONT_SIZE = "15"; // == 20px const std::string HINT_LABEL_FONT_STYLE = "Italic"; const std::string HINT_LABEL_DEFAULT_FONT = "Ubuntu " + HINT_LABEL_FONT_STYLE + " " + HINT_LABEL_FONT_SIZE; @@ -252,9 +259,8 @@ expand_icon_->mouse_click.connect(mouse_expand); } - sig_manager_.Add(gtk_settings_get_default(), "notify::gtk-font-name", - sigc::mem_fun(this, &SearchBar::OnFontChanged)); - OnFontChanged(gtk_settings_get_default()); + sig_manager_.Add(gtk_settings_get_default(), "notify::gtk-font-name", sigc::hide(sigc::mem_fun(this, &SearchBar::OnFontChanged))); + OnFontChanged(); search_hint.changed.connect([this](std::string const& s) { OnSearchHintChanged(); }); search_string.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_search_string)); @@ -263,6 +269,7 @@ im_preedit.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_im_preedit)); showing_filters.changed.connect(sigc::mem_fun(this, &SearchBar::OnShowingFiltersChanged)); scale.changed.connect(sigc::mem_fun(this, &SearchBar::UpdateScale)); + Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &SearchBar::UpdateSearchBarSize))); can_refine_search.changed.connect([this] (bool can_refine) { if (show_filter_hint_) @@ -289,7 +296,8 @@ entry_layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_SPINNER_AND_TEXT.CP(scale())); - pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE.CP(scale())); + double font_scaling = scale() * Settings::Instance().font_scaling(); + pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE.CP(font_scaling)); if (show_filter_hint_) { @@ -329,7 +337,7 @@ layered_layout_->SetMinimumHeight(entry_min); layered_layout_->SetMaximumHeight(entry_min); - int search_bar_height = style.GetSearchBarHeight().CP(scale); + int search_bar_height = style.GetSearchBarHeight().CP(font_scaling); SetMinimumHeight(search_bar_height); SetMaximumHeight(search_bar_height); } @@ -347,19 +355,19 @@ UpdateSearchBarSize(); } -void SearchBar::OnFontChanged(GtkSettings* settings, GParamSpec* pspec) +void SearchBar::OnFontChanged() { glib::String font_name; PangoFontDescription* desc; std::ostringstream font_desc; - g_object_get(settings, "gtk-font-name", &font_name, NULL); + g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, NULL); desc = pango_font_description_from_string(font_name.Value()); if (desc) { pango_entry_->SetFontFamily(pango_font_description_get_family(desc)); - pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE); + pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE.CP(scale * Settings::Instance().font_scaling())); pango_entry_->SetFontOptions(gdk_screen_get_font_options(gdk_screen_get_default())); font_desc << pango_font_description_get_family(desc) << " " << HINT_LABEL_FONT_STYLE << " " << HINT_LABEL_FONT_SIZE; @@ -586,7 +594,7 @@ cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.7f); cairo_stroke(cr); - nux::BaseTexture* texture2D = texture_from_cairo_graphics(cairo_graphics); + auto texture2D = texture_ptr_from_cairo_graphics(cairo_graphics); nux::TexCoordXForm texxform; texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); @@ -602,8 +610,6 @@ nux::color::White, true, rop)); - - texture2D->UnReference(); } void SearchBar::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key) diff -Nru unity-7.2.3+14.04.20140826/unity-shared/SearchBar.h unity-7.2.4+14.04.20141217/unity-shared/SearchBar.h --- unity-7.2.3+14.04.20140826/unity-shared/SearchBar.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/SearchBar.h 2014-12-17 15:51:54.000000000 -0500 @@ -20,28 +20,28 @@ #ifndef SEARCH_BAR_H #define SEARCH_BAR_H -#include -#include -#include -#include #include +#include #include #include -#include "SearchBarSpinner.h" -#include "unity-shared/IconTexture.h" -#include "unity-shared/IMTextEntry.h" #include "unity-shared/Introspectable.h" -#include "unity-shared/StaticCairoText.h" namespace nux { class AbstractPaintLayer; +class LayeredLayout; class LinearLayout; +class SpaceLayout; +class VLayout; } namespace unity { +class IconTexture; +class IMTextEntry; +class SearchBarSpinner; +class StaticCairoText; class SearchBar : public unity::debug::Introspectable, public nux::View { @@ -71,7 +71,7 @@ sigc::signal live_search_reached; private: - void OnFontChanged(GtkSettings* settings, GParamSpec* pspec=NULL); + void OnFontChanged(); void OnSearchHintChanged(); void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); diff -Nru unity-7.2.3+14.04.20140826/unity-shared/SearchBarSpinner.h unity-7.2.4+14.04.20141217/unity-shared/SearchBarSpinner.h --- unity-7.2.3+14.04.20140826/unity-shared/SearchBarSpinner.h 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/SearchBarSpinner.h 2014-12-17 15:51:54.000000000 -0500 @@ -22,8 +22,6 @@ #include #include -#include -#include #include #include #include "unity-shared/Introspectable.h" diff -Nru unity-7.2.3+14.04.20140826/unity-shared/SpreadFilter.cpp unity-7.2.4+14.04.20141217/unity-shared/SpreadFilter.cpp --- unity-7.2.3+14.04.20140826/unity-shared/SpreadFilter.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/SpreadFilter.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,11 +20,13 @@ #include "SpreadFilter.h" #include +#include + #include "AnimationUtils.h" +#include "ApplicationManager.h" #include "SearchBar.h" #include "UnitySettings.h" #include "WindowManager.h" -#include "ApplicationManager.h" #include "RawPixel.h" namespace unity diff -Nru unity-7.2.3+14.04.20140826/unity-shared/StandaloneWindowManager.h unity-7.2.4+14.04.20141217/unity-shared/StandaloneWindowManager.h --- unity-7.2.3+14.04.20140826/unity-shared/StandaloneWindowManager.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/StandaloneWindowManager.h 2014-12-17 15:51:54.000000000 -0500 @@ -163,6 +163,8 @@ virtual std::string GetStringProperty(Window window_id, Atom) const; virtual std::vector GetCardinalProperty(Window window_id, Atom) const; + virtual void UnmapAllNoNuxWindowsSync() {}; + // Mock functions StandaloneWindow::Ptr GetWindowByXid(Window window_id) const; void AddStandaloneWindow(StandaloneWindow::Ptr const& window); diff -Nru unity-7.2.3+14.04.20140826/unity-shared/TextInput.cpp unity-7.2.4+14.04.20141217/unity-shared/TextInput.cpp --- unity-7.2.3+14.04.20140826/unity-shared/TextInput.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/TextInput.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -17,24 +17,38 @@ * Authored by: Manuel de la Pena */ +#include "config.h" #include "TextInput.h" -#include "unity-shared/IconTexture.h" -#include "unity-shared/DashStyle.h" -#include "unity-shared/RawPixel.h" -#include "unity-shared/PreviewStyle.h" + +#include +#include + +#include +#include +#include +#include + +#include "CairoTexture.h" +#include "StaticCairoText.h" +#include "IconTexture.h" +#include "IMTextEntry.h" +#include "DashStyle.h" +#include "PreviewStyle.h" +#include "RawPixel.h" +#include "TextureCache.h" +#include "UnitySettings.h" namespace unity { namespace { -const float kExpandDefaultIconOpacity = 1.0f; - -const int SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT = 10; -const int LEFT_INTERNAL_PADDING = 6; -const int TEXT_INPUT_RIGHT_BORDER = 10; - -const int HIGHLIGHT_HEIGHT = 24; +const int BORDER_RADIUS = 5; +const int TOOLTIP_WAIT = 500; +const RawPixel SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT = 10_em; +const RawPixel LEFT_INTERNAL_PADDING = 6_em; +const RawPixel TEXT_INPUT_RIGHT_BORDER = 10_em; +const RawPixel HINT_PADDING = 3_em; const RawPixel TOOLTIP_Y_OFFSET = 3_em; const RawPixel TOOLTIP_OFFSET = 10_em; @@ -46,15 +60,11 @@ const int HINT_LABEL_FONT_SIZE = 11; const std::string PANGO_ENTRY_DEFAULT_FONT_FAMILY = "Ubuntu"; -const int PANGO_ENTRY_FONT_SIZE = 14; - -} +const RawPixel PANGO_ENTRY_FONT_SIZE = 14_em; nux::logging::Logger logger("unity.textinput"); -NUX_IMPLEMENT_OBJECT_TYPE(TextInput); - -nux::AbstractPaintLayer* CreateWarningLayer(nux::BaseTexture* texture) +std::shared_ptr CreateWarningLayer(nux::BaseTexture* texture) { // Create the texture layer nux::TexCoordXForm texxform; @@ -70,43 +80,43 @@ rop.SrcBlend = GL_ONE; rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; - return (new nux::TextureLayer(texture->GetDeviceTexture(), - texxform, - nux::color::White, - true, - rop)); + return std::make_shared(texture->GetDeviceTexture(), texxform, nux::color::White, true, rop); +} } +NUX_IMPLEMENT_OBJECT_TYPE(TextInput); + TextInput::TextInput(NUX_FILE_LINE_DECL) : View(NUX_FILE_LINE_PARAM) , input_hint("") , hint_font_name(HINT_LABEL_DEFAULT_FONT_NAME) , hint_font_size(HINT_LABEL_FONT_SIZE) + , show_activator(false) , show_caps_lock(false) + , scale(1.0) , bg_layer_(new nux::ColorLayer(nux::Color(0xff595853), true)) , caps_lock_on(false) , last_width_(-1) , last_height_(-1) - , mouse_over_warning_icon_(false) { layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); - layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING, TEXT_INPUT_RIGHT_BORDER); - layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT); + layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING.CP(scale), TEXT_INPUT_RIGHT_BORDER.CP(scale)); + layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT.CP(scale)); SetLayout(layout_); - nux::HLayout* hint_layout = new nux::HLayout(NUX_TRACKER_LOCATION); - hint_layout->SetLeftAndRightPadding(3, 3); + hint_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION); + hint_layout_->SetLeftAndRightPadding(HINT_PADDING.CP(scale), HINT_PADDING.CP(scale)); hint_ = new StaticCairoText(""); hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f)); - hint_layout->AddView(hint_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); + hint_->SetScale(scale); + hint_layout_->AddView(hint_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); hint_font_name.changed.connect(sigc::hide(sigc::mem_fun(this, &TextInput::UpdateHintFont))); hint_font_size.changed.connect(sigc::hide(sigc::mem_fun(this, &TextInput::UpdateHintFont))); UpdateHintFont(); pango_entry_ = new IMTextEntry(); pango_entry_->SetFontFamily(PANGO_ENTRY_DEFAULT_FONT_FAMILY.c_str()); - pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE); pango_entry_->cursor_moved.connect([this](int i) { QueueDraw(); }); pango_entry_->mouse_down.connect(sigc::mem_fun(this, &TextInput::OnMouseButtonDown)); pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &TextInput::OnEndKeyFocus)); @@ -115,13 +125,16 @@ }); layered_layout_ = new nux::LayeredLayout(); - layered_layout_->AddLayer(hint_layout); + layered_layout_->AddLayer(hint_layout_); layered_layout_->AddLayer(pango_entry_); layered_layout_->SetPaintAll(true); layered_layout_->SetActiveLayerN(1); layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); - warning_ = new IconTexture(LoadWarningIcon(DEFAULT_ICON_SIZE)); + UpdateSize(); + + // Caps lock warning + warning_ = new IconTexture(LoadWarningIcon(DEFAULT_ICON_SIZE.CP(scale))); warning_->SetVisible(caps_lock_on()); layout_->AddView(warning_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); caps_lock_on.changed.connect([this] (bool on) { @@ -133,21 +146,35 @@ } }); - show_caps_lock.changed.connect([this] (bool changed) { - if (!warning_tooltip_.IsValid()) - LoadWarningTooltip(); + show_caps_lock.changed.connect(sigc::hide(sigc::mem_fun(this, &TextInput::CheckIfCapsLockOn))); + scale.changed.connect(sigc::mem_fun(this, &TextInput::UpdateScale)); + Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &TextInput::UpdateSize))); + + // Activator + activator_ = new IconTexture(LoadActivatorIcon(DEFAULT_ICON_SIZE.CP(scale))); + activator_->SetVisible(show_activator()); + layout_->AddView(activator_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); - CheckIfCapsLockOn(); + show_activator.changed.connect([this] (bool value) { + activator_->SetVisible(value); + }); + + activator_->mouse_click.connect([this](int, int, unsigned long, unsigned long) { + pango_entry_->activated.emit(); }); + // Spinner spinner_ = new SearchBarSpinner(); spinner_->SetVisible(false); - spinner_->SetMinMaxSize(22, 22); + spinner_->scale = scale(); layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); - sig_manager_.Add(gtk_settings_get_default(), - "notify::gtk-font-name", sigc::mem_fun(this, &TextInput::OnFontChanged)); - OnFontChanged(gtk_settings_get_default()); + sig_manager_.Add(gtk_settings_get_default(), "notify::gtk-font-name", sigc::hide(sigc::mem_fun(this, &TextInput::OnFontChanged))); + OnFontChanged(); + + sig_manager_.Add(gdk_keymap_get_default(), "state-changed", [this](GdkKeymap*) { + CheckIfCapsLockOn(); + }); sig_manager_.Add(gdk_keymap_get_default(), "state-changed", [this](GdkKeymap*) { CheckIfCapsLockOn(); @@ -160,16 +187,47 @@ input_hint.changed.connect([this](std::string const& s) { OnInputHintChanged(); }); warning_->mouse_enter.connect([this] (int x, int y, int button, int key_flags) { - mouse_over_warning_icon_ = true; - QueueDraw(); + tooltip_timeout_.reset(new glib::Timeout(TOOLTIP_WAIT, [this] { + tooltip_timeout_.reset(); + QueueDraw(); + return false; + })); }); warning_->mouse_leave.connect([this] (int x, int y, int button, int key_flags) { - mouse_over_warning_icon_ = false; - QueueDraw(); + tooltip_timeout_ ? tooltip_timeout_.reset() : QueueDraw(); }); } +void TextInput::UpdateSize() +{ + pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE.CP(scale * Settings::Instance().font_scaling())); + int entry_min = pango_entry_->GetMinimumHeight(); + pango_entry_->SetMaximumHeight(entry_min); + layered_layout_->SetMinimumHeight(entry_min); + layered_layout_->SetMaximumHeight(entry_min); +} + +void TextInput::UpdateScale(double scale) +{ + layout_->SetLeftAndRightPadding(LEFT_INTERNAL_PADDING.CP(scale), TEXT_INPUT_RIGHT_BORDER.CP(scale)); + layout_->SetSpaceBetweenChildren(SPACE_BETWEEN_ENTRY_AND_HIGHLIGHT.CP(scale)); + + UpdateSize(); + + hint_layout_->SetLeftAndRightPadding(HINT_PADDING.CP(scale), HINT_PADDING.CP(scale)); + hint_->SetScale(scale); + hint_->SetMaximumHeight(pango_entry_->GetMinimumHeight()); + + spinner_->scale = scale; + activator_->SetTexture(LoadActivatorIcon(DEFAULT_ICON_SIZE.CP(scale))); + warning_->SetTexture(LoadWarningIcon(DEFAULT_ICON_SIZE.CP(scale))); + warning_tooltip_.Release(); + + QueueRelayout(); + QueueDraw(); +} + void TextInput::CheckIfCapsLockOn() { GdkKeymap* keymap = gdk_keymap_get_default(); @@ -179,6 +237,7 @@ void TextInput::SetSpinnerVisible(bool visible) { spinner_->SetVisible(visible); + activator_->SetVisible(!visible && show_activator()); } void TextInput::SetSpinnerState(SpinnerState spinner_state) @@ -191,6 +250,12 @@ hint_->SetFont((hint_font_name() + " " + std::to_string(hint_font_size())).c_str()); } +nux::ObjectPtr TextInput::LoadActivatorIcon(int icon_size) +{ + TextureCache& cache = TextureCache::GetDefault(); + return cache.FindTexture("arrow_right.png", icon_size, icon_size); +} + nux::ObjectPtr TextInput::LoadWarningIcon(int icon_size) { auto* theme = gtk_icon_theme_get_default(); @@ -234,13 +299,13 @@ gtk_style_context_set_path(style_context, widget_path.get()); gtk_style_context_add_class(style_context, "tooltip"); - glib::Object layout; - glib::Object context(gdk_pango_context_get_for_screen(gdk_screen_get_default())); - layout = pango_layout_new(context); + glib::Object context(gdk_pango_context_get()); + glib::Object layout(pango_layout_new(context)); std::shared_ptr desc(pango_font_description_from_string(font_name), pango_font_description_free); pango_context_set_font_description(context, desc.get()); pango_context_set_language(context, gtk_get_default_language()); + pango_cairo_context_set_resolution(context, 96.0 * Settings::Instance().font_scaling()); pango_layout_set_height(layout, -1); //avoid wrap lines pango_layout_set_text(layout, _("Caps lock is on"), -1); @@ -250,7 +315,8 @@ extents.width += TOOLTIP_OFFSET; extents.height += TOOLTIP_OFFSET; - nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, extents.width, extents.height); + nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, RawPixel(extents.width).CP(scale), RawPixel(extents.height).CP(scale)); + cairo_surface_set_device_scale(cg.GetSurface(), scale, scale); cairo_t* cr = cg.GetInternalContext(); gtk_render_background(style_context, cr, 0, 0, extents.width, extents.height); @@ -260,27 +326,28 @@ warning_tooltip_ = texture_ptr_from_cairo_graphics(cg); } -void TextInput::OnFontChanged(GtkSettings* settings, GParamSpec* pspec) +void TextInput::OnFontChanged() { glib::String font_name; PangoFontDescription* desc; - g_object_get(settings, "gtk-font-name", &font_name, NULL); + g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, NULL); desc = pango_font_description_from_string(font_name.Value()); if (desc) { pango_entry_->SetFontFamily(pango_font_description_get_family(desc)); - pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE); pango_entry_->SetFontOptions(gdk_screen_get_font_options(gdk_screen_get_default())); + UpdateSize(); if (hint_font_name() == HINT_LABEL_DEFAULT_FONT_NAME) { std::ostringstream font_desc; font_desc << pango_font_description_get_family(desc) << " " << hint_font_size(); hint_->SetFont(font_desc.str().c_str()); - pango_font_description_free(desc); } + + pango_font_description_free(desc); } } @@ -328,8 +395,8 @@ layout_->ProcessDraw(GfxContext, force_draw); - if (caps_lock_on && mouse_over_warning_icon_) - PaintWarningTooltip(GfxContext); + if (caps_lock_on && warning_->IsMouseInside() && !tooltip_timeout_) + PaintWarningTooltip(GfxContext); if (!IsFullRedraw()) { @@ -345,42 +412,39 @@ void TextInput::PaintWarningTooltip(nux::GraphicsEngine& graphics_engine) { - nux::Geometry warning_geo = warning_->GetGeometry(); + nux::Geometry const& warning_geo = warning_->GetGeometry(); - nux::Geometry tooltip_geo = {warning_geo.x - (warning_tooltip_->GetWidth() + TOOLTIP_OFFSET / 2), - warning_geo.y - TOOLTIP_Y_OFFSET, + if (!warning_tooltip_.IsValid()) + LoadWarningTooltip(); + + nux::Geometry tooltip_geo = {warning_geo.x - (warning_tooltip_->GetWidth() + TOOLTIP_OFFSET.CP(scale) / 2), + warning_geo.y - TOOLTIP_Y_OFFSET.CP(scale), warning_tooltip_->GetWidth(), warning_tooltip_->GetHeight()}; - nux::GetPainter().PushDrawLayer(graphics_engine, tooltip_geo, CreateWarningLayer(warning_tooltip_.GetPointer())); + auto const& warning_layer = CreateWarningLayer(warning_tooltip_.GetPointer()); + nux::GetPainter().PushDrawLayer(graphics_engine, tooltip_geo, warning_layer.get()); } void TextInput::UpdateBackground(bool force) { - int RADIUS = 5; nux::Geometry geo(GetGeometry()); - LOG_DEBUG(logger) << "height: " - << geo.height << " - " - << layout_->GetGeometry().height << " - " - << pango_entry_->GetGeometry().height; - - if (geo.width == last_width_ - && geo.height == last_height_ - && force == false) + if (geo.width == last_width_ && geo.height == last_height_ && !force) return; last_width_ = geo.width; last_height_ = geo.height; nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, last_width_, last_height_); + cairo_surface_set_device_scale(cairo_graphics.GetSurface(), scale, scale); cairo_t* cr = cairo_graphics.GetInternalContext(); cairo_graphics.DrawRoundedRectangle(cr, 1.0f, 0.5, 0.5, - RADIUS, - last_width_ - 1, last_height_ - 1, + BORDER_RADIUS, + (last_width_/scale) - 1, (last_height_/scale) - 1, false); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); @@ -390,7 +454,7 @@ cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.7f); cairo_stroke(cr); - nux::BaseTexture* texture2D = texture_from_cairo_graphics(cairo_graphics); + auto texture2D = texture_ptr_from_cairo_graphics(cairo_graphics); nux::TexCoordXForm texxform; texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); @@ -406,8 +470,6 @@ nux::color::White, true, rop)); - - texture2D->UnReference(); } void TextInput::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key) diff -Nru unity-7.2.3+14.04.20140826/unity-shared/TextInput.h unity-7.2.4+14.04.20141217/unity-shared/TextInput.h --- unity-7.2.3+14.04.20140826/unity-shared/TextInput.h 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/TextInput.h 2014-12-17 15:51:54.000000000 -0500 @@ -20,36 +20,27 @@ #ifndef TEXTINPUT_H #define TEXTINPUT_H -#include "config.h" - -#include -#include - #include -#include -#include -#include -#include -#include -#include #include #include -#include "CairoTexture.h" -#include "unity-shared/IconTexture.h" -#include "unity-shared/IMTextEntry.h" -#include "unity-shared/Introspectable.h" -#include "unity-shared/SearchBarSpinner.h" -#include "unity-shared/StaticCairoText.h" +#include "Introspectable.h" +#include "IMTextEntry.h" +#include "SearchBarSpinner.h" namespace nux { class AbstractPaintLayer; +class LayeredLayout; class LinearLayout; +class HLayout; } namespace unity { +class IconTexture; +class StaticCairoText; +class SearchBarSpinner; class TextInput : public unity::debug::Introspectable, public nux::View { @@ -72,14 +63,18 @@ nux::Property hint_font_size; nux::ROProperty im_active; nux::ROProperty im_preedit; + nux::Property show_activator; nux::Property show_caps_lock; + nux::Property scale; private: - void OnFontChanged(GtkSettings* settings, GParamSpec* pspec=NULL); + void OnFontChanged(); void UpdateHintFont(); void Draw(nux::GraphicsEngine& GfxContext, bool force_draw); void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw); void UpdateBackground(bool force); + void UpdateScale(double); + void UpdateSize(); std::string GetName() const; @@ -91,6 +86,7 @@ nux::Geometry GetWaringIconGeometry() const; void CheckIfCapsLockOn(); + nux::ObjectPtr LoadActivatorIcon(int icon_size); nux::ObjectPtr LoadWarningIcon(int icon_size); void LoadWarningTooltip(); @@ -116,17 +112,19 @@ std::unique_ptr bg_layer_; std::unique_ptr highlight_layer_; nux::HLayout* layout_; + nux::HLayout* hint_layout_; nux::LayeredLayout* layered_layout_; SearchBarSpinner* spinner_; nux::Property caps_lock_on; int last_width_; int last_height_; - bool mouse_over_warning_icon_; IconTexture* warning_; + IconTexture* activator_; nux::ObjectPtr warning_tooltip_; + glib::Source::UniquePtr tooltip_timeout_; glib::SignalManager sig_manager_; }; diff -Nru unity-7.2.3+14.04.20140826/unity-shared/UnitySettings.cpp unity-7.2.4+14.04.20141217/unity-shared/UnitySettings.cpp --- unity-7.2.3+14.04.20140826/unity-shared/UnitySettings.cpp 2014-08-26 09:48:28.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/UnitySettings.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -20,6 +20,7 @@ #include #include +#include #include #include "DecorationStyle.h" @@ -60,6 +61,7 @@ const int DEFAULT_LAUNCHER_WIDTH = 64; const int MINIMUM_DESKTOP_HEIGHT = 800; +const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1; const double DEFAULT_DPI = 96.0f; } @@ -302,6 +304,7 @@ void UpdateAppsScaling(double scale) { changing_gnome_settings_ = true; + changing_gnome_settings_timeout_.reset(); unsigned integer_scaling = std::max(1, scale); double point_scaling = scale / static_cast(integer_scaling); double text_scale_factor = parent_->font_scaling() * point_scaling; @@ -310,7 +313,11 @@ g_settings_set_int(gnome_ui_settings_, GNOME_CURSOR_SIZE.c_str(), cursor_size); g_settings_set_uint(gnome_ui_settings_, GNOME_SCALE_FACTOR.c_str(), integer_scaling); g_settings_set_double(gnome_ui_settings_, GNOME_TEXT_SCALE_FACTOR.c_str(), text_scale_factor); - changing_gnome_settings_ = false; + + changing_gnome_settings_timeout_.reset(new glib::TimeoutSeconds(GNOME_SETTINGS_CHANGED_WAIT_SECONDS, [this] { + changing_gnome_settings_ = false; + return false; + }, glib::Source::Priority::LOW)); } Settings* parent_; @@ -319,6 +326,7 @@ glib::Object ui_settings_; glib::Object ubuntu_ui_settings_; glib::Object gnome_ui_settings_; + glib::Source::UniquePtr changing_gnome_settings_timeout_; glib::SignalManager signals_; std::vector em_converters_; std::vector launcher_widths_; diff -Nru unity-7.2.3+14.04.20140826/unity-shared/UScreen.cpp unity-7.2.4+14.04.20141217/unity-shared/UScreen.cpp --- unity-7.2.3+14.04.20140826/unity-shared/UScreen.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/UScreen.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -38,7 +38,8 @@ proxy_.Connect("PrepareForSleep", [this] (GVariant* data) { gboolean val; g_variant_get(data, "(b)", &val); - val ? suspending.emit() : resuming.emit(); + if (!val) + resuming.emit(); }); Refresh(); @@ -80,6 +81,15 @@ int UScreen::GetMonitorAtPosition(int x, int y) const { + int idx = 0; + + for (auto const& monitor : monitors_) + { + if (monitor.IsPointInside(x, y)) + return idx; + ++idx; + } + return gdk_screen_get_monitor_at_point(screen_, x, y); } @@ -95,9 +105,21 @@ nux::Geometry UScreen::GetScreenGeometry() const { - int width = gdk_screen_get_width(screen_); - int height = gdk_screen_get_height(screen_); - return nux::Geometry(0, 0, width, height); + if (monitors_.empty()) + return {}; + + auto rightmost_geo = max_element(monitors_.begin(), monitors_.end(), [](nux::Geometry const& a, nux::Geometry const& b) { + return a.x + a.width < b.x + b.width; + }); + + auto lower_geo = max_element(monitors_.begin(), monitors_.end(), [](nux::Geometry const& a, nux::Geometry const& b) { + return a.y + a.height < b.y + b.height; + }); + + auto width = rightmost_geo->x + rightmost_geo->width; + auto height = lower_geo->y + lower_geo->height; + + return {0, 0, width, height}; } const std::string UScreen::GetMonitorName(int output_number = 0) const diff -Nru unity-7.2.3+14.04.20140826/unity-shared/UScreen.h unity-7.2.4+14.04.20141217/unity-shared/UScreen.h --- unity-7.2.3+14.04.20140826/unity-shared/UScreen.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/UScreen.h 2014-12-17 15:51:54.000000000 -0500 @@ -51,7 +51,6 @@ // sigc::signal const&> changed; - sigc::signal suspending; sigc::signal resuming; const std::string GetMonitorName(int output_number) const; diff -Nru unity-7.2.3+14.04.20140826/unity-shared/WindowManager.h unity-7.2.4+14.04.20141217/unity-shared/WindowManager.h --- unity-7.2.3+14.04.20140826/unity-shared/WindowManager.h 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/WindowManager.h 2014-12-17 15:51:54.000000000 -0500 @@ -169,6 +169,9 @@ virtual std::string GetStringProperty(Window, Atom) const = 0; virtual std::vector GetCardinalProperty(Window, Atom) const = 0; + virtual void UnmapAllNoNuxWindowsSync() = 0; + + // Nux Modifiers, Nux Keycode (= X11 KeySym) nux::Property> close_window_key; nux::Property> activate_indicators_key; @@ -189,6 +192,8 @@ sigc::signal window_moved; sigc::signal window_focus_changed; + sigc::signal show_desktop_changed; + sigc::signal initiate_spread; sigc::signal terminate_spread; diff -Nru unity-7.2.3+14.04.20140826/unity-shared/XWindowManager.cpp unity-7.2.4+14.04.20141217/unity-shared/XWindowManager.cpp --- unity-7.2.3+14.04.20140826/unity-shared/XWindowManager.cpp 2014-08-26 09:48:14.000000000 -0400 +++ unity-7.2.4+14.04.20141217/unity-shared/XWindowManager.cpp 2014-12-17 15:51:54.000000000 -0500 @@ -83,7 +83,7 @@ { LOG_ERROR(logger) << "Impossible to get the property " << gdk_x11_get_xatom_name(atom) << " for window " << window_id << ": invalid string type: " - << gdk_x11_get_xatom_name(Atoms::utf8String); + << gdk_x11_get_xatom_name(type); return std::string(); }