diff -Nru unity-7.2.1+14.04.20140513/AUTHORS unity-7.2.2+14.04.20140714/AUTHORS --- unity-7.2.1+14.04.20140513/AUTHORS 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/AUTHORS 2014-07-14 10:30:44.000000000 -0400 @@ -13,6 +13,7 @@ Alex Launi Alex Launi , Allan LeSage Alex Launi , Thomi Richards + Alfred Neumayer Alfred Neumayer Andrea Azzarone Andrea Azzarone @@ -26,6 +27,7 @@ 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 , 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 diff -Nru unity-7.2.1+14.04.20140513/ChangeLog unity-7.2.2+14.04.20140714/ChangeLog --- unity-7.2.1+14.04.20140513/ChangeLog 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/ChangeLog 2014-07-14 10:30:44.000000000 -0400 @@ -1,3 +1,160 @@ +2014-07-01 Chris Townsend + + Add changelog entry for lp:1281058. + +2014-07-01 Andrea Azzarone + + Add a warning in the session dialog if other sessions are still open. + +2014-06-23 Chris Townsend + + Added changelog entry for lp:1310200. + +2014-06-23 Andrea Azzarone + + Fix skype indicator blinking. + +2014-06-23 Chris Townsend + + Added changelog entry for lp:1316005. + +2014-06-23 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. + +2014-06-23 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. + +2014-06-23 Andrea Azzarone + + Pass the correct options to showLauncherKeyTerminate in UnityScreen::OnLockScreen + +2014-06-23 Chris Townsend + + Added changelog entry for lp:1321043. + +2014-06-23 Andrea Azzarone + + Disable switcher gestures if screen is locked. Fixed a regression. + +2014-06-23 Chris Townsend + + Add changelog entry for lp:1308911. + +2014-06-23 Andrea Azzarone + + Clear the clipboard when locking the screen. + +2014-06-23 Chris Townsend + + Added changelog entry for lp:924840. + +2014-06-23 Marco Trevisan (Treviño) + + ShortcutView: use RawPixel's for the size values and convert them to match current scaling + + Plus dinamically allocate horizontal space, not to cut the text. + +2014-06-23 Chris Townsend + + Added changelog entry for lp:741869. + +2014-06-23 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-06-23 Chris Townsend + + Added changelog entry for lp:1309739. + +2014-06-23 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. + +2014-06-23 Brandon Schaefer + + Lockscreen warning icon needs a tooltip to say what the warning is about! + +2014-06-19 Chris Townsend + + Added changelog entry for lp:1308323. + +2014-06-19 Brandon Schaefer + + ShutdownView: Scale up the Buttons and Text plus Borders of the UnityWindowView. + +2014-06-19 Chris Townsend + + Added changelog entry for lp:1307738. + +2014-06-19 Brandon Schaefer + + TextInput: move the warning icon inside the input field, render it white + +2014-06-19 Chris Townsend + + Added changelog entry for lp:607796. + +2014-06-19 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. + +2014-06-19 Chris Townsend + + Added changelog entry for lp:1304882. + +2014-06-19 Alfred Neumayer + + Restore the launcher position by reversing the animation and unsetting the DND_PUSHED_OFF quirk. + +2014-06-19 Chris Townsend + + Added changelog for #1313280. + +2014-06-19 Marco Trevisan (Treviño) + + UnityScreen: always paint the lockscreen above, just add menu and onboard as exceptions + + Some code cleanup, factorizing similar code. + +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. + +2014-05-13 CI bot + + Releasing 7.2.1+14.04.20140513-0ubuntu1 + +2014-05-13 Stephen M. Webb + + released upstream micro-release 7.2.1 Fixes: 1221673, 1251193, 1291461, 1307748, 1312749, 1313280, 1317276 + +2014-05-13 Stephen M. Webb + + release Unity 7.2.1 + 2014-05-13 Stephen M. Webb debian/changelog: updated with additional lockscreen changes diff -Nru unity-7.2.1+14.04.20140513/CMakeLists.txt unity-7.2.2+14.04.20140714/CMakeLists.txt --- unity-7.2.1+14.04.20140513/CMakeLists.txt 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/CMakeLists.txt 2014-07-14 10:30:44.000000000 -0400 @@ -10,7 +10,7 @@ set (PROJECT_NAME "unity") set (UNITY_MAJOR 7) set (UNITY_MINOR 2) -set (UNITY_MICRO 1) +set (UNITY_MICRO 2) set (UNITY_VERSION "${UNITY_MAJOR}.${UNITY_MINOR}.${UNITY_MICRO}") set (UNITY_API_VERSION "6.0") set (UNITY_COMPONENTS_VERSION "6") diff -Nru unity-7.2.1+14.04.20140513/dash/DashController.cpp unity-7.2.2+14.04.20140714/dash/DashController.cpp --- unity-7.2.1+14.04.20140513/dash/DashController.cpp 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/dash/DashController.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -104,7 +104,9 @@ } }); - WindowManager::Default().initiate_spread.connect(sigc::mem_fun(this, &Controller::HideDash)); + auto& wm = WindowManager::Default(); + wm.initiate_spread.connect(sigc::mem_fun(this, &Controller::HideDash)); + wm.screen_viewport_switch_started.connect(sigc::mem_fun(this, &Controller::HideDash)); dbus_server_.AddObjects(dbus::INTROSPECTION, dbus::PATH); dbus_server_.GetObjects().front()->SetMethodsCallsHandler([this] (std::string const& method, GVariant*) { diff -Nru unity-7.2.1+14.04.20140513/debian/changelog unity-7.2.2+14.04.20140714/debian/changelog --- unity-7.2.1+14.04.20140513/debian/changelog 2014-07-15 10:52:21.000000000 -0400 +++ unity-7.2.2+14.04.20140714/debian/changelog 2014-07-15 10:52:21.000000000 -0400 @@ -1,3 +1,66 @@ +unity (7.2.2+14.04.20140714-0ubuntu1) trusty; urgency=medium + + [ Alfred Neumayer ] + * Restore the launcher position by reversing the animation and + unsetting the DND_PUSHED_OFF quirk. (LP: #1304882) + + [ Brandon Schaefer ] + * TextInput: move the warning icon inside the input field, render it + white (LP: #1307738) + * ShutdownView: Scale up the Buttons and Text plus Borders of the + UnityWindowView. (LP: #1308323) + * Lockscreen warning icon needs a tooltip to say what the warning is + about! (LP: #1308288) + + [ Marco Trevisan (Treviño) ] + * UnityScreen: always paint the lockscreen above, just add menu and + onboard as exceptions Some code cleanup, factorizing similar code. + (LP: #1313280) + * 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. (LP: #607796) + * ShutdownView: Scale up the Buttons and Text plus Borders of the + UnityWindowView. (LP: #1308323) + * SwitcherView: use RawPixel's for the size values and convert them to + match current scaling (LP: #1317348) + * 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. + (LP: #741869) + * ShortcutView: use RawPixel's for the size values and convert them to + match current scaling Plus dinamically allocate horizontal space, + not to cut the text. (LP: #924840) + + [ 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. (LP: #1309739) + * 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. (LP: #1283775) + * Fix issue where the Panel shadow would get drawn over drop down + windows in full screen windows. (LP: #1316005) + * Bump upstream release to 7.2.2. + + [ Andrea Azzarone ] + * Clear the clipboard when locking the screen. (LP: #1308911) + * Disable switcher gestures if screen is locked. Fixed a regression. + (LP: #1321043) + * Pass the correct options to showLauncherKeyTerminate in + UnityScreen::OnLockScreen (LP: #1320438) + * Fix skype indicator blinking. (LP: #1310200) + * Add a warning in the session dialog if other sessions are still + open. (LP: #1281058) + + [ Ubuntu daily release ] + * New rebuild forced + + -- Ubuntu daily release Mon, 14 Jul 2014 14:31:00 +0000 + unity (7.2.1+14.04.20140513-0ubuntu2) trusty; urgency=medium [ Brandon Schaefer ] diff -Nru unity-7.2.1+14.04.20140513/hud/HudController.cpp unity-7.2.2+14.04.20140714/hud/HudController.cpp --- unity-7.2.1+14.04.20140513/hud/HudController.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/hud/HudController.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -102,6 +102,7 @@ WindowManager& wm = WindowManager::Default(); wm.screen_ungrabbed.connect(sigc::mem_fun(this, &Controller::OnScreenUngrabbed)); wm.initiate_spread.connect(sigc::mem_fun(this, &Controller::HideHud)); + wm.screen_viewport_switch_started.connect(sigc::mem_fun(this, &Controller::HideHud)); hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished)); timeline_animator_.updated.connect(sigc::mem_fun(this, &Controller::OnViewShowHideFrame)); diff -Nru unity-7.2.1+14.04.20140513/launcher/AbstractLauncherIcon.h unity-7.2.2+14.04.20140714/launcher/AbstractLauncherIcon.h --- unity-7.2.1+14.04.20140513/launcher/AbstractLauncherIcon.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/AbstractLauncherIcon.h 2014-07-14 10:30:31.000000000 -0400 @@ -110,10 +110,11 @@ UNFOLDED, STARTING, SHIMMER, - CENTER_SAVED, - PROGRESS, DESAT, + GLOW, + PROGRESS, PULSE_ONCE, + CENTER_SAVED, LAST }; diff -Nru unity-7.2.1+14.04.20140513/launcher/ApplicationLauncherIcon.cpp unity-7.2.2+14.04.20140714/launcher/ApplicationLauncherIcon.cpp --- unity-7.2.1+14.04.20140513/launcher/ApplicationLauncherIcon.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/ApplicationLauncherIcon.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -49,9 +49,10 @@ // We use the "bamf-" prefix since the manager is protected, to avoid name clash const std::string WINDOW_MOVE_TIMEOUT = "bamf-window-move"; const std::string ICON_REMOVE_TIMEOUT = "bamf-icon-remove"; -//const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over"; +const std::string ICON_DND_OVER_TIMEOUT = "bamf-icon-dnd-over"; const std::string DEFAULT_ICON = "application-default-icon"; const int MAXIMUM_QUICKLIST_WIDTH = 300; +const int COMPIZ_SCALE_DND_SPREAD = 1 << 7; enum MenuItemType { @@ -723,7 +724,7 @@ void ApplicationLauncherIcon::EnsureWindowState() { - std::bitset monitors; + std::vector number_of_windows_on_monitor(monitors::MAX); for (auto& window: app_->GetWindows()) { @@ -735,18 +736,18 @@ // If monitor is -1 (or negative), show on all monitors. if (monitor < 0) { - monitors.set(); - break; + for (unsigned j; j < monitors::MAX; j++) + ++number_of_windows_on_monitor[j]; } else { - monitors[monitor] = true; + ++number_of_windows_on_monitor[monitor]; } } } for (unsigned i = 0; i < monitors::MAX; i++) - SetWindowVisibleOnMonitor(monitors[i], i); + SetNumberOfWindowsVisibleOnMonitor(number_of_windows_on_monitor[i], i); WindowsChanged.emit(); } @@ -1157,28 +1158,28 @@ return _remote_uri; } -void ApplicationLauncherIcon::OnDndHovered() -{ - // for now, let's not do this, it turns out to be quite buggy - //if (IsRunning()) - // Spread(CompAction::StateInitEdgeDnd, true); -} - void ApplicationLauncherIcon::OnDndEnter() { - /* Disabled, since the DND code is currently disabled as well. - _source_manager.AddTimeout(1000, [this] { - OnDndHovered(); + auto timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp; + + _source_manager.AddTimeout(1000, [this, timestamp] { + WindowManager::Default().TerminateScale(); + + if (!IsRunning()) + return false; + + Focus(ActionArg(ActionArg::Source::LAUNCHER, 1, timestamp)); + + if (GetWindows(WindowFilter::ON_CURRENT_DESKTOP).size() > 1) + Spread(true, COMPIZ_SCALE_DND_SPREAD, false); + return false; }, ICON_DND_OVER_TIMEOUT); - */ } void ApplicationLauncherIcon::OnDndLeave() { - /* Disabled, since the DND code is currently disabled as well. _source_manager.Remove(ICON_DND_OVER_TIMEOUT); - */ } bool ApplicationLauncherIcon::IsFileManager() diff -Nru unity-7.2.1+14.04.20140513/launcher/ApplicationLauncherIcon.h unity-7.2.2+14.04.20140714/launcher/ApplicationLauncherIcon.h --- unity-7.2.1+14.04.20140513/launcher/ApplicationLauncherIcon.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/ApplicationLauncherIcon.h 2014-07-14 10:30:31.000000000 -0400 @@ -83,7 +83,6 @@ void AddProperties(debug::IntrospectionData&); void OnAcceptDrop(DndData const& dnd_data); void OnDndEnter(); - void OnDndHovered(); void OnDndLeave(); void OpenInstanceLauncherIcon(Time timestamp) override; void ToggleSticky(); diff -Nru unity-7.2.1+14.04.20140513/launcher/Launcher.cpp unity-7.2.2+14.04.20140714/launcher/Launcher.cpp --- unity-7.2.1+14.04.20140513/launcher/Launcher.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/Launcher.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -157,6 +157,7 @@ hide_machine_.should_hide_changed.connect(sigc::mem_fun(this, &Launcher::SetHidden)); hide_machine_.reveal_progress.changed.connect(redraw_cb); hover_machine_.should_hover_changed.connect(sigc::mem_fun(this, &Launcher::SetHover)); + bg_effect_helper_.enabled.changed.connect(redraw_cb); mouse_down.connect(sigc::mem_fun(this, &Launcher::RecvMouseDown)); mouse_up.connect(sigc::mem_fun(this, &Launcher::RecvMouseUp)); @@ -599,7 +600,7 @@ else urgent_progress = CLAMP(urgent_progress * 3.0f - 2.0f, 0.0f, 1.0f); // we want to go 3x faster than the urgent normal cycle - arg.glow_intensity = urgent_progress; + arg.glow_intensity = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::GLOW, monitor()) + urgent_progress; if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE) { @@ -809,13 +810,11 @@ } } - float drag_hide_progress = dnd_hide_animation_.GetCurrentValue(); - if (options()->hide_mode != LAUNCHER_HIDE_NEVER && drag_hide_progress > 0.0f) + if (options()->hide_mode != LAUNCHER_HIDE_NEVER) { + float drag_hide_progress = dnd_hide_animation_.GetCurrentValue(); autohide_offset -= geo.width * 0.25f * drag_hide_progress; - - if (drag_hide_progress >= 1.0f) - hide_machine_.SetQuirk(LauncherHideMachine::DND_PUSHED_OFF, true); + hide_machine_.SetQuirk(LauncherHideMachine::DND_PUSHED_OFF, (drag_hide_progress >= 1.0f)); } // Inform the painter where to paint the box @@ -1171,6 +1170,9 @@ hide_machine_.SetQuirk(LauncherHideMachine::SCALE_ACTIVE, active); bg_effect_helper_.enabled = active; + if (hide_machine_.GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE)) + return; + if (active && icon_under_mouse_) icon_under_mouse_->HideTooltip(); @@ -1592,6 +1594,7 @@ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::CENTER_SAVED, ANIM_DURATION, monitor()); icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PROGRESS, ANIM_DURATION, monitor()); icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::DESAT, ANIM_DURATION_SHORT_SHORT, monitor()); + icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::GLOW, ANIM_DURATION_SHORT, monitor()); if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE) icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_SHORT * WIGGLE_CYCLES), monitor()); @@ -2523,7 +2526,10 @@ } if (!steal_drag_ && dnd_hovered_icon_) + { dnd_hovered_icon_->SendDndLeave(); + dnd_hovered_icon_->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, false, monitor()); + } steal_drag_ = false; drag_edge_touching_ = false; @@ -2535,7 +2541,6 @@ { #ifdef USE_X11 SetStateMouseOverLauncher(false); - DndHoveredIconReset(); #endif } @@ -2581,7 +2586,10 @@ mouse_position_.y <= (parent_->GetGeometry().height - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_))) { if (dnd_hovered_icon_) - dnd_hovered_icon_->SendDndLeave(); + { + dnd_hovered_icon_->SendDndLeave(); + dnd_hovered_icon_->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, false, monitor()); + } animation::StartOrReverse(dnd_hide_animation_, animation::Direction::FORWARD); drag_edge_touching_ = true; @@ -2640,6 +2648,9 @@ { hovered_icon->SendDndEnter(); drag_action_ = hovered_icon->QueryAcceptDrop(dnd_data_); + + if (drag_action_ != nux::DNDACTION_NONE) + hovered_icon->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, true, monitor()); } else { @@ -2647,7 +2658,10 @@ } if (dnd_hovered_icon_) + { dnd_hovered_icon_->SendDndLeave(); + dnd_hovered_icon_->SetQuirk(AbstractLauncherIcon::Quirk::GLOW, false, monitor()); + } dnd_hovered_icon_ = hovered_icon; } @@ -2790,8 +2804,10 @@ } } + + hide_machine_.SetQuirk(LauncherHideMachine::MT_DRAG_OUT, drag_out_delta_x_ >= DRAG_OUT_PIXELS - 90.0f); hide_machine_.SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, false); - hide_machine_.SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, false); + animation::SetValue(dnd_hide_animation_, animation::Direction::BACKWARD); #endif } diff -Nru unity-7.2.1+14.04.20140513/launcher/LauncherIcon.cpp unity-7.2.2+14.04.20140714/launcher/LauncherIcon.cpp --- unity-7.2.1+14.04.20140513/launcher/LauncherIcon.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/LauncherIcon.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -80,6 +80,7 @@ , _shortcut(0) , _allow_quicklist_to_show(true) , _center(monitors::MAX) + , _number_of_visible_windows(monitors::MAX) , _quirks(monitors::MAX) , _quirk_animations(monitors::MAX, decltype(_quirk_animations)::value_type(unsigned(Quirk::LAST))) , _last_stable(monitors::MAX) @@ -732,12 +733,15 @@ return {-1, nux::Point3()}; } -void LauncherIcon::SetWindowVisibleOnMonitor(bool val, int monitor) +void LauncherIcon::SetNumberOfWindowsVisibleOnMonitor(int number_of_windows, int monitor) { - if (_has_visible_window[monitor] == val) + if (_number_of_visible_windows[monitor] == number_of_windows) return; - _has_visible_window[monitor] = val; + _has_visible_window[monitor] = (number_of_windows > 0); + + _number_of_visible_windows[monitor] = number_of_windows; + EmitNeedsRedraw(monitor); } diff -Nru unity-7.2.1+14.04.20140513/launcher/LauncherIcon.h unity-7.2.2+14.04.20140714/launcher/LauncherIcon.h --- unity-7.2.1+14.04.20140513/launcher/LauncherIcon.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/LauncherIcon.h 2014-07-14 10:30:31.000000000 -0400 @@ -226,7 +226,7 @@ void SetProgress(float progress); - void SetWindowVisibleOnMonitor(bool val, int monitor); + void SetNumberOfWindowsVisibleOnMonitor(int number_of_windows, int monitor); void Present(float urgency, int length, int monitor = -1); @@ -338,6 +338,7 @@ std::vector _center; std::bitset _has_visible_window; + std::vector _number_of_visible_windows; std::vector> _quirks; std::vector>> _quirk_animations; std::vector _last_stable; diff -Nru unity-7.2.1+14.04.20140513/launcher/SwitcherView.cpp unity-7.2.2+14.04.20140714/launcher/SwitcherView.cpp --- unity-7.2.1+14.04.20140513/launcher/SwitcherView.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/SwitcherView.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -37,26 +37,33 @@ namespace { - unsigned int const VERTICAL_PADDING = 45; - unsigned int const SPREAD_OFFSET = 100; - unsigned int const EXTRA_ICON_SPACE = 10; + RawPixel const VERTICAL_PADDING = 45_em; + RawPixel const BORDER_SIZE = 50_em; + RawPixel const FLAT_SPACING = 20_em; + RawPixel const ICON_SIZE = 128_em; + RawPixel const MINIMUM_SPACING = 10_em; + RawPixel const TILE_SIZE = 150_em; + RawPixel const SPREAD_OFFSET = 100_em; + RawPixel const EXTRA_ICON_SPACE = 10_em; + RawPixel const TEXT_SIZE = 15_em; + + unsigned int const ANIMATION_LENGTH = 250; unsigned int const MAX_DIRECTIONS_CHANGED = 3; + double const TEXT_TILE_MULTIPLIER = 3.5; } NUX_IMPLEMENT_OBJECT_TYPE(SwitcherView); SwitcherView::SwitcherView(ui::AbstractIconRenderer::Ptr const& renderer) : render_boxes(false) - , border_size(50) - , flat_spacing(20) - , icon_size(128) - , minimum_spacing(10) - , tile_size(150) - , vertical_size(tile_size + VERTICAL_PADDING * 2) - , text_size(15) - , animation_length(250) - , monitor(-1) - , spread_size(3.5f) + , border_size(BORDER_SIZE.CP(scale)) + , flat_spacing(FLAT_SPACING.CP(scale)) + , icon_size(ICON_SIZE.CP(scale)) + , minimum_spacing(MINIMUM_SPACING.CP(scale)) + , tile_size(TILE_SIZE.CP(scale)) + , vertical_size(tile_size + VERTICAL_PADDING.CP(scale) * 2) + , text_size(TEXT_SIZE.CP(scale)) + , animation_length(ANIMATION_LENGTH) , icon_renderer_(renderer) , text_view_(new StaticCairoText("")) , animation_(animation_length) @@ -68,13 +75,15 @@ icon_renderer_->monitor = monitors::MAX; icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing); - text_view_->SetMaximumWidth(tile_size * spread_size); + text_view_->SetMaximumWidth(tile_size * TEXT_TILE_MULTIPLIER); text_view_->SetLines(1); text_view_->SetTextColor(nux::color::White); text_view_->SetFont("Ubuntu Bold 10"); + text_view_->SetScale(scale); - icon_size.changed.connect (sigc::mem_fun (this, &SwitcherView::OnIconSizeChanged)); - tile_size.changed.connect (sigc::mem_fun (this, &SwitcherView::OnTileSizeChanged)); + icon_size.changed.connect(sigc::mem_fun(this, &SwitcherView::OnIconSizeChanged)); + tile_size.changed.connect(sigc::mem_fun(this, &SwitcherView::OnTileSizeChanged)); + scale.changed.connect(sigc::mem_fun(this, &SwitcherView::OnScaleChanged)); mouse_move.connect (sigc::mem_fun(this, &SwitcherView::RecvMouseMove)); mouse_down.connect (sigc::mem_fun(this, &SwitcherView::RecvMouseDown)); @@ -112,10 +121,10 @@ .add("vertical-size", vertical_size) .add("text-size", text_size) .add("animation-length", animation_length) - .add("spread-size", spread_size) + .add("spread-size", TEXT_TILE_MULTIPLIER) .add("label", text_view_->GetText()) .add("last_icon_selected", last_icon_selected_) - .add("spread_offset", SPREAD_OFFSET) + .add("spread_offset", SPREAD_OFFSET.CP(scale)) .add("label_visible", text_view_->IsVisible()); } @@ -164,15 +173,27 @@ text_view_->SetText(model->Selection()->tooltip_text(), true); } -void SwitcherView::OnIconSizeChanged (int size) +void SwitcherView::OnIconSizeChanged(int size) { icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing); } -void SwitcherView::OnTileSizeChanged (int size) +void SwitcherView::OnTileSizeChanged(int size) { icon_renderer_->SetTargetSize(tile_size, icon_size, minimum_spacing); - vertical_size = tile_size + VERTICAL_PADDING * 2; + vertical_size = tile_size + VERTICAL_PADDING.CP(scale) * 2; +} + +void SwitcherView::OnScaleChanged(double scale) +{ + text_view_->SetScale(scale); + border_size = BORDER_SIZE.CP(scale); + flat_spacing = FLAT_SPACING.CP(scale); + icon_size = ICON_SIZE.CP(scale); + minimum_spacing = MINIMUM_SPACING.CP(scale); + tile_size = TILE_SIZE.CP(scale); + text_size = TEXT_SIZE.CP(scale); + vertical_size = tile_size + VERTICAL_PADDING.CP(scale) * 2; } void SwitcherView::StartAnimation() @@ -699,7 +720,10 @@ background_geo.height = vertical_size; if (text_view_->IsVisible()) + { background_geo.height += text_size; + text_view_->SetBaseY(background_geo.y + background_geo.height - VERTICAL_PADDING.CP(scale)); + } if (model_) { @@ -714,7 +738,7 @@ nux::Geometry const& spread_bounds = UpdateRenderTargets(progress); ResizeRenderTargets(spread_bounds, progress); // remove extra space consumed by spread - spread_padded_width = spread_bounds.width + SPREAD_OFFSET; + spread_padded_width = spread_bounds.width + SPREAD_OFFSET.CP(scale); max_width -= spread_padded_width - tile_size; int expansion = std::max(0, spread_bounds.height - icon_size); @@ -953,7 +977,6 @@ if (text_view_->IsVisible()) { nux::GetPainter().PushPaintLayerStack(); - text_view_->SetBaseY(last_background_.y + last_background_.height - 45); text_view_->Draw(GfxContext, force_draw); nux::GetPainter().PopPaintLayerStack(); } @@ -961,7 +984,7 @@ int SwitcherView::IconIndexAt(int x, int y) const { - int half_size = icon_size.Get() / 2 + EXTRA_ICON_SPACE; + int half_size = icon_size.Get() / 2 + EXTRA_ICON_SPACE.CP(scale); int icon_index = -1; // Taking icon rotation into consideration will make selection more @@ -998,7 +1021,7 @@ for (unsigned int i = 0; i < render_targets_.size(); ++i) { - if (render_targets_[i]->result.IsPointInside(x + SPREAD_OFFSET, y + SPREAD_OFFSET)) + if (render_targets_[i]->result.IsPointInside(x + SPREAD_OFFSET.CP(scale), y + SPREAD_OFFSET.CP(scale))) return i; } diff -Nru unity-7.2.1+14.04.20140513/launcher/SwitcherView.h unity-7.2.2+14.04.20140714/launcher/SwitcherView.h --- unity-7.2.1+14.04.20140513/launcher/SwitcherView.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/SwitcherView.h 2014-07-14 10:30:31.000000000 -0400 @@ -65,8 +65,6 @@ nux::Property vertical_size; nux::Property text_size; nux::Property animation_length; - nux::Property monitor; - nux::Property spread_size; void SkipAnimation(); @@ -135,8 +133,9 @@ void OnDetailSelectionChanged (bool detail); void OnDetailSelectionIndexChanged (unsigned int index); - void OnIconSizeChanged (int size); - void OnTileSizeChanged (int size); + void OnIconSizeChanged(int size); + void OnTileSizeChanged(int size); + void OnScaleChanged(double scale); nux::Geometry UpdateRenderTargets(float progress); void ResizeRenderTargets(nux::Geometry const& layout_geo, float progress); diff -Nru unity-7.2.1+14.04.20140513/launcher/TrashLauncherIcon.cpp unity-7.2.2+14.04.20140714/launcher/TrashLauncherIcon.cpp --- unity-7.2.1+14.04.20140513/launcher/TrashLauncherIcon.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/TrashLauncherIcon.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -173,6 +173,7 @@ } SetQuirk(LauncherIcon::Quirk::PULSE_ONCE, true); + FullyAnimateQuirkDelayed(100, LauncherIcon::Quirk::SHIMMER); } std::string TrashLauncherIcon::GetName() const diff -Nru unity-7.2.1+14.04.20140513/launcher/VolumeLauncherIcon.cpp unity-7.2.2+14.04.20140714/launcher/VolumeLauncherIcon.cpp --- unity-7.2.1+14.04.20140513/launcher/VolumeLauncherIcon.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/launcher/VolumeLauncherIcon.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -410,6 +410,7 @@ auto timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp; pimpl_->CopyFilesToVolume(dnd_data.Uris(), timestamp); SetQuirk(Quirk::PULSE_ONCE, true); + FullyAnimateQuirkDelayed(100, LauncherIcon::Quirk::SHIMMER); } // diff -Nru unity-7.2.1+14.04.20140513/lockscreen/LockScreenAbstractShield.h unity-7.2.2+14.04.20140714/lockscreen/LockScreenAbstractShield.h --- unity-7.2.1+14.04.20140513/lockscreen/LockScreenAbstractShield.h 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/lockscreen/LockScreenAbstractShield.h 2014-07-14 10:30:31.000000000 -0400 @@ -49,7 +49,6 @@ using MockableBaseWindow::RemoveLayout; virtual bool IsIndicatorOpen() const = 0; - virtual void CheckCapsLockPrompt() = 0; virtual void ActivatePanel() = 0; sigc::signal grab_motion; diff -Nru unity-7.2.1+14.04.20140513/lockscreen/LockScreenController.cpp unity-7.2.2+14.04.20140714/lockscreen/LockScreenController.cpp --- unity-7.2.1+14.04.20140513/lockscreen/LockScreenController.cpp 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/lockscreen/LockScreenController.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -171,7 +171,6 @@ primary_shield_->primary = false; primary_shield_ = shield; - primary_shield_->CheckCapsLockPrompt(); shield->primary = true; nux::GetWindowCompositor().SetAlwaysOnFrontWindow(primary_shield_.GetPointer()); auto move_cb = sigc::mem_fun(this, &Controller::OnPrimaryShieldMotion); @@ -330,9 +329,9 @@ prompt_activation_ = prompt; lockscreen_timeout_.reset(new glib::Timeout(30, [this] { - bool grabbed_by_blank = (blank_window_ && blank_window_->OwnsPointerGrab()); + bool grabbed_by_blank = (blank_window_ && blank_window_->OwnsKeyboardGrab()); - if (WindowManager::Default().IsScreenGrabbed() && !grabbed_by_blank) + if (!grabbed_by_blank && WindowManager::Default().IsScreenGrabbed()) { HideBlankWindow(); LOG_DEBUG(logger) << "Failed to lock the screen: the screen is already grabbed."; diff -Nru unity-7.2.1+14.04.20140513/lockscreen/LockScreenShield.cpp unity-7.2.2+14.04.20140714/lockscreen/LockScreenShield.cpp --- unity-7.2.1+14.04.20140513/lockscreen/LockScreenShield.cpp 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/lockscreen/LockScreenShield.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -86,12 +86,6 @@ } } -void Shield::CheckCapsLockPrompt() -{ - if (prompt_view_) - prompt_view_->CheckIfCapsLockOn(); -} - void Shield::ShowPrimaryView() { GrabPointer(); diff -Nru unity-7.2.1+14.04.20140513/lockscreen/LockScreenShield.h unity-7.2.2+14.04.20140714/lockscreen/LockScreenShield.h --- unity-7.2.1+14.04.20140513/lockscreen/LockScreenShield.h 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/lockscreen/LockScreenShield.h 2014-07-14 10:30:31.000000000 -0400 @@ -39,7 +39,6 @@ Shield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, Accelerators::Ptr const&, int monitor, bool is_primary); bool IsIndicatorOpen() const override; - void CheckCapsLockPrompt() override; void ActivatePanel() override; protected: diff -Nru unity-7.2.1+14.04.20140513/lockscreen/UserPromptView.cpp unity-7.2.2+14.04.20140714/lockscreen/UserPromptView.cpp --- unity-7.2.1+14.04.20140513/lockscreen/UserPromptView.cpp 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/lockscreen/UserPromptView.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -21,12 +21,10 @@ #include #include -#include #include "LockScreenSettings.h" #include "unity-shared/CairoTexture.h" #include "unity-shared/DashStyle.h" -#include "unity-shared/PreviewStyle.h" #include "unity-shared/TextInput.h" #include "unity-shared/StaticCairoText.h" #include "unity-shared/RawPixel.h" @@ -40,9 +38,9 @@ const RawPixel PADDING = 10_em; const RawPixel LAYOUT_MARGIN = 10_em; const RawPixel MSG_LAYOUT_MARGIN = 15_em; -const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; +const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; -const int PROMPT_FONT_SIZE = 13; +const int PROMPT_FONT_SIZE = 13; nux::AbstractPaintLayer* CrateBackgroundLayer(int width, int height) { @@ -78,28 +76,6 @@ rop)); } -nux::AbstractPaintLayer* CreateWarningLayer(nux::BaseTexture* texture) -{ - // Create the texture layer - nux::TexCoordXForm texxform; - - texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); - texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); - texxform.min_filter = nux::TEXFILTER_LINEAR; - texxform.mag_filter = nux::TEXFILTER_LINEAR; - - nux::ROPConfig rop; - rop.Blend = true; - rop.SrcBlend = GL_ONE; - rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; - - return (new nux::TextureLayer(texture->GetDeviceTexture(), - texxform, - nux::color::White, - true, - rop)); -} - std::string SanitizeMessage(std::string const& message) { std::string msg = boost::algorithm::trim_copy(message); @@ -124,7 +100,6 @@ UserPromptView::UserPromptView(session::Manager::Ptr const& session_manager) : nux::View(NUX_TRACKER_LOCATION) , session_manager_(session_manager) - , caps_lock_on_(false) { user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){ AddPrompt(message, /* visible */ true, promise); @@ -146,32 +121,10 @@ ResetLayout(); }); - dash::previews::Style& preview_style = dash::previews::Style::Instance(); - - warning_ = preview_style.GetWarningIcon(); ResetLayout(); user_authenticator_.AuthenticateStart(session_manager_->UserName(), sigc::mem_fun(this, &UserPromptView::AuthenticationCb)); - - // When we get to HiDPI changes here, we will need to update this width - dash::Style& style = dash::Style::Instance(); - spin_icon_width_ = style.GetSearchSpinIcon()->GetWidth(); - - CheckIfCapsLockOn(); -} - -void UserPromptView::CheckIfCapsLockOn() -{ - Display *dpy = nux::GetGraphicsDisplay()->GetX11Display(); - unsigned int state = 0; - XkbGetIndicatorState(dpy, XkbUseCoreKbd, &state); - - // Caps is on 0x1, couldn't find any #define in /usr/include/X11 - if ((state & 0x1) == 1) - caps_lock_on_ = true; - else - caps_lock_on_ = false; } bool UserPromptView::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) @@ -179,7 +132,7 @@ if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ESCAPE)) { if (!focus_queue_.empty()) - focus_queue_.front()->SetText(""); + focus_queue_.front()->text_entry()->SetText(""); return true; } @@ -260,15 +213,6 @@ nux::GetPainter().PushLayer(graphics_engine, geo, bg_layer_.get()); } - if (caps_lock_on_) - { - for (auto const& text_entry : focus_queue_) - PaintWarningIcon(graphics_engine, text_entry->GetGeometry()); - - if (focus_queue_.empty()) - PaintWarningIcon(graphics_engine, cached_focused_geo_); - } - if (GetLayout()) GetLayout()->ProcessDraw(graphics_engine, force_draw); @@ -278,49 +222,16 @@ graphics_engine.PopClippingRectangle(); } -void UserPromptView::PaintWarningIcon(nux::GraphicsEngine& graphics_engine, nux::Geometry const& geo) -{ - nux::Geometry warning_geo = {geo.x + geo.width - GetWarningIconOffset(), - geo.y, warning_->GetWidth(), warning_->GetHeight()}; - - nux::GetPainter().PushLayer(graphics_engine, warning_geo, CreateWarningLayer(warning_)); -} - -int UserPromptView::GetWarningIconOffset() -{ - return warning_->GetWidth() + spin_icon_width_; -} - nux::View* UserPromptView::focus_view() { if (focus_queue_.empty()) return nullptr; for (auto* view : focus_queue_) - if (view->HasKeyboardFocus()) + if (view->text_entry()->HasKeyboardFocus()) return view; - return focus_queue_.front(); -} - -void UserPromptView::ToggleCapsLockBool() -{ - caps_lock_on_ = !caps_lock_on_; - QueueDraw(); -} - -void UserPromptView::RecvKeyUp(unsigned keysym, - unsigned long keycode, - unsigned long state) -{ - if (!caps_lock_on_ && keysym == NUX_VK_CAPITAL) - { - ToggleCapsLockBool(); - } - else if (caps_lock_on_ && keysym == NUX_VK_CAPITAL) - { - ToggleCapsLockBool(); - } + return focus_queue_.front()->text_entry(); } void UserPromptView::AddPrompt(std::string const& message, bool visible, PromiseAuthCodePtr const& promise) @@ -330,18 +241,16 @@ text_input->input_hint = SanitizeMessage(message); text_input->hint_font_size = PROMPT_FONT_SIZE; + text_input->show_caps_lock = true; text_entry->SetPasswordMode(!visible); text_entry->SetPasswordChar("•"); text_entry->SetToggleCursorVisibilityOnKeyFocus(true); - - text_entry->key_up.connect(sigc::mem_fun(this, &UserPromptView::RecvKeyUp)); + text_entry->clipboard_enabled = false; text_input->SetMinimumHeight(Settings::GRID_SIZE); text_input->SetMaximumHeight(Settings::GRID_SIZE); prompt_layout_->AddView(text_input, 1); - focus_queue_.push_back(text_entry); - - CheckIfCapsLockOn(); + focus_queue_.push_back(text_input); // Don't remove it, it helps with a11y. if (focus_queue_.size() == 1) diff -Nru unity-7.2.1+14.04.20140513/lockscreen/UserPromptView.h unity-7.2.2+14.04.20140714/lockscreen/UserPromptView.h --- unity-7.2.1+14.04.20140513/lockscreen/UserPromptView.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/lockscreen/UserPromptView.h 2014-07-14 10:30:31.000000000 -0400 @@ -56,8 +56,6 @@ void AddMessage(std::string const& message, nux::Color const& color); void AuthenticationCb(bool authenticated); - void CheckIfCapsLockOn(); - protected: void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) override; void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) override; @@ -66,12 +64,6 @@ void ResetLayout(); bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character); - void RecvKeyUp(unsigned int, unsigned long, unsigned long); - - void PaintWarningIcon(nux::GraphicsEngine& graphics_engine, nux::Geometry const& geo); - void ToggleCapsLockBool(); - - int GetWarningIconOffset(); session::Manager::Ptr session_manager_; UserAuthenticatorPam user_authenticator_; @@ -81,13 +73,9 @@ StaticCairoText* message_; StaticCairoText* error_; StaticCairoText* invalid_login_; - std::deque focus_queue_; + std::deque focus_queue_; - nux::BaseTexture* warning_; nux::Geometry cached_focused_geo_; - - bool caps_lock_on_; - int spin_icon_width_; }; } diff -Nru unity-7.2.1+14.04.20140513/panel/PanelIndicatorEntryView.cpp unity-7.2.2+14.04.20140714/panel/PanelIndicatorEntryView.cpp --- unity-7.2.1+14.04.20140513/panel/PanelIndicatorEntryView.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/panel/PanelIndicatorEntryView.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -229,6 +229,13 @@ { glib::Object icon(g_icon_new_for_string(proxy_->image_data().c_str(), nullptr)); info = gtk_icon_theme_lookup_by_gicon(theme, icon, size, flags); + + if (!info) + { + // Maybe the icon was just added to the theme, see if a rescan helps. + gtk_icon_theme_rescan_if_needed(theme); + info = gtk_icon_theme_lookup_by_gicon(theme, icon, size, flags); + } } else { diff -Nru unity-7.2.1+14.04.20140513/plugins/unityshell/src/GesturalWindowSwitcher.cpp unity-7.2.2+14.04.20140714/plugins/unityshell/src/GesturalWindowSwitcher.cpp --- unity-7.2.1+14.04.20140513/plugins/unityshell/src/GesturalWindowSwitcher.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/plugins/unityshell/src/GesturalWindowSwitcher.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -115,6 +115,9 @@ GestureDeliveryRequest GesturalWindowSwitcherPrivate::GestureEvent(nux::GestureEvent const& event) { + if (unity_screen->lockscreen_controller()->IsLocked()) + return GestureDeliveryRequest::NONE; + switch (state) { case State::WaitingCompoundGesture: diff -Nru unity-7.2.1+14.04.20140513/plugins/unityshell/src/GesturalWindowSwitcher.h unity-7.2.2+14.04.20140714/plugins/unityshell/src/GesturalWindowSwitcher.h --- unity-7.2.1+14.04.20140513/plugins/unityshell/src/GesturalWindowSwitcher.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/plugins/unityshell/src/GesturalWindowSwitcher.h 2014-07-14 10:30:31.000000000 -0400 @@ -77,6 +77,7 @@ private: GesturalWindowSwitcherPrivate* p; }; + typedef std::shared_ptr ShPtGesturalWindowSwitcher; } // namespace unity diff -Nru unity-7.2.1+14.04.20140513/plugins/unityshell/src/unityshell.cpp unity-7.2.2+14.04.20140714/plugins/unityshell/src/unityshell.cpp --- unity-7.2.1+14.04.20140513/plugins/unityshell/src/unityshell.cpp 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/plugins/unityshell/src/unityshell.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -101,7 +101,7 @@ DECLARE_LOGGER(logger, "unity.shell.compiz"); namespace { -UnityScreen* uScreen = 0; +UnityScreen* uScreen = nullptr; void reset_glib_logging(); void configure_logging(); @@ -168,6 +168,8 @@ , _key_nav_mode_requested(false) , _last_output(nullptr) , force_draw_countdown_(0) + , firstWindowAboveShell(nullptr) + , onboard_(nullptr) , grab_index_(0) , painting_tray_ (false) , last_scroll_event_(0) @@ -522,6 +524,7 @@ void UnityScreen::OnInitiateSpread() { + scale_just_activated_ = super_keypressed_; spread_filter_ = std::make_shared(); spread_filter_->text.changed.connect([this] (std::string const& filter) { if (filter.empty()) @@ -940,7 +943,8 @@ bool UnityScreen::forcePaintOnTop() { - return !allowWindowPaint || + return !allowWindowPaint || + lockscreen_controller_->IsLocked() || ((switcher_controller_->Visible() || WindowManager::Default().IsExpoActive()) && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL)))); @@ -1185,6 +1189,20 @@ return window->minimized (); } +bool UnityWindow::CanBypassLockScreen() const +{ + if (window->type() == CompWindowTypePopupMenuMask && + uScreen->lockscreen_controller_->HasOpenMenu()) + { + return true; + } + + if (window == uScreen->onboard_) + return true; + + return false; +} + void UnityWindow::DoOverrideFrameRegion(CompRegion ®ion) { unsigned int oldUpdateFrameRegionIndex = window->updateFrameRegionGetCurrentIndex(); @@ -1984,19 +2002,7 @@ { PluginAdapter& adapter = PluginAdapter::Default(); adapter.NotifyCompizEvent(plugin, event, option); - compiz::CompizMinimizedWindowHandler::handleCompizEvent (plugin, event, option); - - if (launcher_controller_->IsOverlayOpen() && g_strcmp0(event, "start_viewport_switch") == 0) - { - ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST); - } - - if (super_keypressed_ && g_strcmp0(plugin, "scale") == 0 && - g_strcmp0(event, "activate") == 0) - { - scale_just_activated_ = CompOption::getBoolOptionNamed(option, "active"); - } - + compiz::CompizMinimizedWindowHandler::handleCompizEvent(plugin, event, option); screen->handleCompizEvent(plugin, event, option); } @@ -2834,9 +2840,7 @@ * fully covers the shell on its output. It does not include regular windows * stacked above the shell like DnD icons or Onboard etc. */ - if (G_UNLIKELY(is_nux_window_) && - (!uScreen->lockscreen_controller_->IsLocked() || - uScreen->lockscreen_controller_->opacity() != 1.0f)) + if (G_UNLIKELY(is_nux_window_)) { if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK) { @@ -2893,9 +2897,7 @@ if (uScreen->lockscreen_controller_->IsLocked()) { - if ((window->type() != CompWindowTypePopupMenuMask || - !uScreen->lockscreen_controller_->HasOpenMenu()) && - !window->minimized() && window->resName() != "onboard") + if (!window->minimized() && !CanBypassLockScreen()) { // For some reasons PAINT_WINDOW_NO_CORE_INSTANCE_MASK doesn't work here // (well, it works too much, as it applies to menus too), so we need @@ -2968,6 +2970,7 @@ { auto window_state = window->state(); auto window_type = window->type(); + bool locked = uScreen->lockscreen_controller_->IsLocked(); if (uScreen->doShellRepaint && !uScreen->paint_panel_under_dash_ && window_type == CompWindowTypeNormalMask) { @@ -2984,12 +2987,16 @@ } if (uScreen->doShellRepaint && - !uScreen->forcePaintOnTop () && window == uScreen->firstWindowAboveShell && + !uScreen->forcePaintOnTop() && !uScreen->fullscreenRegion.contains(window->geometry())) { uScreen->paintDisplay(); } + else if (locked && CanBypassLockScreen()) + { + uScreen->paintDisplay(); + } enum class DrawPanelShadow { @@ -3019,7 +3026,7 @@ } else { - if (window->id() == active_window || decoration::Style::Get()->integrated_menus()) + if (window->id() == active_window) { draw_panel_shadow = DrawPanelShadow::BELOW_WINDOW; uScreen->is_desktop_active_ = false; @@ -3038,6 +3045,10 @@ } } } + else if (decoration::Style::Get()->integrated_menus()) + { + draw_panel_shadow = DrawPanelShadow::BELOW_WINDOW; + } else { if (uScreen->is_desktop_active_) @@ -3052,7 +3063,7 @@ } } - if (uScreen->lockscreen_controller_->IsLocked()) + if (locked) draw_panel_shadow = DrawPanelShadow::NO; if (draw_panel_shadow == DrawPanelShadow::BELOW_WINDOW) @@ -3808,8 +3819,12 @@ screen->removeAction(&action); // We notify that super/alt have been released, to avoid to leave unity in inconsistent state - showLauncherKeyTerminate(&optionGetShowLauncher(), CompAction::StateTermKey, getOptions()); - showMenuBarTerminate(&optionGetShowMenuBar(), CompAction::StateTermKey, getOptions()); + CompOption::Vector options(8); + options[7].setName("time", CompOption::TypeInt); + options[7].value().set((int) screen->getCurrentTime()); + + showLauncherKeyTerminate(&optionGetShowLauncher(), CompAction::StateTermKey, options); + showMenuBarTerminate(&optionGetShowMenuBar(), CompAction::StateTermKey, options); } void UnityScreen::OnScreenUnlocked() @@ -3854,14 +3869,14 @@ void UnityScreen::RaiseOSK() { - /* stack any windows named "onboard" above us */ - for (CompWindow *w : screen->windows ()) + /* stack the onboard window above us */ + if (onboard_) { - if (w->resName() == "onboard") + if (nux::BaseWindow* dash = dash_controller_->window()) { - Window xid = dash_controller_->window()->GetInputWindowId(); - XSetTransientForHint (screen->dpy(), w->id(), xid); - w->raise (); + Window xid = dash->GetInputWindowId(); + XSetTransientForHint(screen->dpy(), onboard_->id(), xid); + onboard_->raise(); } } } @@ -3946,8 +3961,10 @@ CompOption::Value v(launcher_width); screen->setOptionForPlugin("expo", "x_offset", v); - if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER) - screen->setOptionForPlugin("scale", "x_offset", v); + if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) + v.set(0); + + screen->setOptionForPlugin("scale", "x_offset", v); }; for (auto const& launcher : launcher_controller_->launchers()) @@ -4108,23 +4125,10 @@ if (window->state() & CompWindowStateFullscreenMask) uScreen->fullscreen_windows_.push_back(window); - /* We might be starting up so make sure that - * we don't deref the dashcontroller that doesnt - * exist */ - dash::Controller::Ptr dp = uScreen->dash_controller_; - - if (dp) + if (window->type() == CompWindowTypeUtilMask && window->resName() == "onboard") { - nux::BaseWindow* w = dp->window (); - - if (w) - { - if (window->resName() == "onboard") - { - Window xid = dp->window()->GetInputWindowId(); - XSetTransientForHint (screen->dpy(), window->id(), xid); - } - } + uScreen->onboard_ = window; + uScreen->RaiseOSK(); } } @@ -4505,6 +4509,9 @@ if (window->state () & CompWindowStateFullscreenMask) uScreen->fullscreen_windows_.remove(window); + if (window == uScreen->onboard_) + uScreen->onboard_ = nullptr; + uScreen->fake_decorated_windows_.erase(this); PluginAdapter::Default().OnWindowClosed(window); } diff -Nru unity-7.2.1+14.04.20140513/plugins/unityshell/src/unityshell.h unity-7.2.2+14.04.20140714/plugins/unityshell/src/unityshell.h --- unity-7.2.1+14.04.20140513/plugins/unityshell/src/unityshell.h 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/plugins/unityshell/src/unityshell.h 2014-07-14 10:30:31.000000000 -0400 @@ -393,6 +393,7 @@ CompRegion nuxRegion; CompRegion fullscreenRegion; CompWindow* firstWindowAboveShell; + CompWindow* onboard_; ::GLFramebufferObject *oldFbo; @@ -520,6 +521,7 @@ bool IsInShowdesktopMode (); bool IsShaded (); bool IsMinimized (); + bool CanBypassLockScreen() const; void DoOverrideFrameRegion (CompRegion &r); void DoHide (); diff -Nru unity-7.2.1+14.04.20140513/po/POTFILES.in unity-7.2.2+14.04.20140714/po/POTFILES.in --- unity-7.2.1+14.04.20140513/po/POTFILES.in 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/po/POTFILES.in 2014-07-14 10:30:31.000000000 -0400 @@ -48,5 +48,6 @@ unity-shared/DashStyle.cpp unity-shared/PreviewStyle.cpp unity-shared/SearchBar.cpp +unity-shared/TextInput.cpp unity-shared/UScreen.cpp gnome/50-unity-launchers.xml.in diff -Nru unity-7.2.1+14.04.20140513/po/unity.pot unity-7.2.2+14.04.20140714/po/unity.pot --- unity-7.2.1+14.04.20140513/po/unity.pot 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/po/unity.pot 2014-07-14 10:30:31.000000000 -0400 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: ayatana-dev@lists.launchpad.net\n" -"POT-Creation-Date: 2013-04-17 16:00+0100\n" +"POT-Creation-Date: 2014-07-01 11:21-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -38,6 +38,26 @@ msgid "Last Updated" msgstr "" +#. The "%s" is used in the dash preview to display the ": " infos +#, c-format +msgid "%s:" +msgstr "" + +msgid "Comments" +msgstr "" + +msgid "This window is not responding" +msgstr "" + +msgid "Do you want to force the application to exit, or wait for it to respond?" +msgstr "" + +msgid "_Wait" +msgstr "" + +msgid "_Force Quit" +msgstr "" + msgid "Type your command" msgstr "" @@ -50,6 +70,12 @@ msgid "Quit" msgstr "" +msgid "Exit" +msgstr "" + +msgid "Close" +msgstr "" + msgid "Search your computer and online sources" msgstr "" @@ -69,13 +95,16 @@ msgid "Waiting to install" msgstr "" +msgid "Installing…" +msgstr "" + msgid "Drop To Add Application" msgstr "" msgid "Trash" msgstr "" -msgid "Empty Trash..." +msgid "Empty Trash…" msgstr "" msgid "Open" @@ -96,6 +125,15 @@ msgid "Unmount" msgstr "" +msgid "Password" +msgstr "" + +msgid "Username" +msgstr "" + +msgid "Invalid password, please try again" +msgstr "" + msgid "Ubuntu Desktop" msgstr "" @@ -105,6 +143,14 @@ msgid "Launcher" msgstr "" +#, c-format +msgid "%s: running: %zu windows open" +msgstr "" + +#, c-format +msgid "%s: running" +msgstr "" + msgid "Quicklist" msgstr "" @@ -165,6 +211,9 @@ msgid "Opens the Dash Music Lens." msgstr "" +msgid "Opens the Dash Photo Lens." +msgstr "" + msgid "Opens the Dash Video Lens." msgstr "" @@ -210,6 +259,9 @@ msgid "Switches between applications." msgstr "" +msgid "Switches between applications from all workspaces." +msgstr "" + msgid "Switches windows of current applications." msgstr "" @@ -234,6 +286,12 @@ msgid "Spreads all windows in the current workspace." msgstr "" +msgid "Spreads all windows." +msgstr "" + +msgid "Spreads all windows in all the workspaces." +msgstr "" + msgid "Minimises all windows." msgstr "" @@ -258,7 +316,7 @@ msgid "Places the window in corresponding position." msgstr "" -msgid "Ctrl + Alt + Num" +msgid "Ctrl + Alt + Num (keypad)" msgstr "" msgid " Drag" @@ -270,6 +328,11 @@ msgid "Resizes the window." msgstr "" +msgid "" +"Other users are logged in. Restarting or shutting down will close their open applications and may cause them to lose work.\n" +"\n" +msgstr "" + msgid "Shut Down" msgstr "" @@ -327,3 +390,7 @@ msgid "Filter results" msgstr "" + +#. avoid wrap lines +msgid "Caps lock is on" +msgstr "" Binary files /tmp/gHsJDVYFrB/unity-7.2.1+14.04.20140513/resources/launcher_icon_glow_62.png and /tmp/Cfly3JkEco/unity-7.2.2+14.04.20140714/resources/launcher_icon_glow_62.png differ diff -Nru unity-7.2.1+14.04.20140513/resources/launcher_icon_glow_62.svg unity-7.2.2+14.04.20140714/resources/launcher_icon_glow_62.svg --- unity-7.2.1+14.04.20140513/resources/launcher_icon_glow_62.svg 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/resources/launcher_icon_glow_62.svg 1969-12-31 19:00:00.000000000 -0500 @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - diff -Nru unity-7.2.1+14.04.20140513/resources/launcher_icon_glow_62.svg.save unity-7.2.2+14.04.20140714/resources/launcher_icon_glow_62.svg.save --- unity-7.2.1+14.04.20140513/resources/launcher_icon_glow_62.svg.save 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.2+14.04.20140714/resources/launcher_icon_glow_62.svg.save 2014-07-14 10:29:52.000000000 -0400 @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff -Nru unity-7.2.1+14.04.20140513/shortcuts/ShortcutController.cpp unity-7.2.2+14.04.20140714/shortcuts/ShortcutController.cpp --- unity-7.2.1+14.04.20140513/shortcuts/ShortcutController.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shortcuts/ShortcutController.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -70,14 +70,12 @@ if (!view_) return; + model->Fill(); view_->SetModel(model); if (Visible()) { - model->Fill(); - auto uscreen = UScreen::GetDefault(); - int monitor = uscreen->GetMonitorAtPosition(view_window_->GetX(), view_window_->GetX()); - auto const& offset = GetOffsetPerMonitor(monitor); + auto const& offset = GetOffsetPerMonitor(view_->monitor()); if (offset.x < 0 || offset.y < 0) { @@ -110,8 +108,8 @@ modeller_->GetCurrentModel()->Fill(); EnsureView(); - int monitor = UScreen::GetDefault()->GetMonitorWithMouse(); - auto const& offset = GetOffsetPerMonitor(monitor); + view_->monitor = UScreen::GetDefault()->GetMonitorWithMouse(); + auto const& offset = GetOffsetPerMonitor(view_->monitor()); if (offset.x < 0 || offset.y < 0) return false; diff -Nru unity-7.2.1+14.04.20140513/shortcuts/ShortcutView.cpp unity-7.2.2+14.04.20140714/shortcuts/ShortcutView.cpp --- unity-7.2.1+14.04.20140513/shortcuts/ShortcutView.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shortcuts/ShortcutView.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -38,10 +38,16 @@ const unsigned MAIN_TITLE_FONT_SIZE = 15; const unsigned SECTION_NAME_FONT_SIZE = 12; const unsigned SHORTKEY_ENTRY_FONT_SIZE = 9; - const unsigned INTER_SPACE_SHORTKEY_DESCRIPTION = 10; - const unsigned SHORTKEY_COLUMN_WIDTH = 150; - const unsigned DESCRIPTION_COLUMN_WIDTH = 265; - const unsigned LINE_SPACING = 5; + const RawPixel INTER_SPACE_SHORTKEY_DESCRIPTION = 10_em; + const RawPixel SHORTKEY_COLUMN_DEFAULT_WIDTH = 150_em; + const RawPixel SHORTKEY_COLUMN_MAX_WIDTH = 350_em; + const RawPixel DESCRIPTION_COLUMN_DEFAULT_WIDTH = 265_em; + const RawPixel DESCRIPTION_COLUMN_MAX_WIDTH = 500_em; + const RawPixel LINE_SPACING = 3_em; + const RawPixel MAIN_HORIZONTAL_PADDING = 30_em; + const RawPixel MAIN_VERTICAL_PADDING = 18_em; + const RawPixel MAIN_CHILDREN_SPACE = 20_em; + const RawPixel COLUMNS_CHILDREN_SPACE = 30_em; // We need this class because SetVisible doesn't work for layouts. class SectionView : public nux::View @@ -72,8 +78,8 @@ : ui::UnityWindowView() { auto main_layout = new nux::VLayout(); - main_layout->SetPadding(30, 18); - main_layout->SetSpaceBetweenChildren(20); + main_layout->SetPadding(MAIN_HORIZONTAL_PADDING.CP(scale), MAIN_VERTICAL_PADDING.CP(scale)); + main_layout->SetSpaceBetweenChildren(MAIN_CHILDREN_SPACE.CP(scale)); SetLayout(main_layout); std::string header = ""+std::string(_("Keyboard Shortcuts"))+""; @@ -81,13 +87,22 @@ auto* header_view = new StaticCairoText(header, NUX_TRACKER_LOCATION); header_view->SetFont(FONT_NAME+" "+std::to_string(MAIN_TITLE_FONT_SIZE)); header_view->SetLines(-1); + header_view->SetScale(scale); main_layout->AddView(header_view, 1 , nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); main_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); columns_layout_ = new nux::HLayout(); - columns_layout_->SetSpaceBetweenChildren(30); + columns_layout_->SetSpaceBetweenChildren(COLUMNS_CHILDREN_SPACE.CP(scale)); main_layout->AddLayout(columns_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); + + scale.changed.connect([this, main_layout, header_view] (double scale) { + main_layout->SetPadding(MAIN_HORIZONTAL_PADDING.CP(scale), MAIN_VERTICAL_PADDING.CP(scale)); + main_layout->SetSpaceBetweenChildren(MAIN_CHILDREN_SPACE.CP(scale)); + columns_layout_->SetSpaceBetweenChildren(COLUMNS_CHILDREN_SPACE.CP(scale)); + header_view->SetScale(scale); + RenderColumns(); + }); } void View::SetModel(Model::Ptr model) @@ -114,14 +129,17 @@ auto* section_name_view = new StaticCairoText(name, NUX_TRACKER_LOCATION); section_name_view->SetFont(FONT_NAME+" "+std::to_string(SECTION_NAME_FONT_SIZE)); section_name_view->SetLines(-1); - layout->AddView(new nux::SpaceLayout(10, 10, 10, 10), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); + section_name_view->SetScale(scale); + const int top_space = (10_em).CP(scale); + const int bottom_space = (15_em).CP(scale); + layout->AddView(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); layout->AddView(section_name_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); - layout->AddView(new nux::SpaceLayout(15, 15, 15, 15), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); + layout->AddView(new nux::SpaceLayout(bottom_space, bottom_space, bottom_space, bottom_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); return layout; } -nux::View* View::CreateShortKeyEntryView(AbstractHint::Ptr const& hint) +nux::View* View::CreateShortKeyEntryView(AbstractHint::Ptr const& hint, StaticCairoText* shortkey_view, StaticCairoText* description_view) { auto* view = new SectionView(NUX_TRACKER_LOCATION); @@ -131,56 +149,56 @@ nux::HLayout* shortkey_layout = new nux::HLayout(NUX_TRACKER_LOCATION); nux::HLayout* description_layout = new nux::HLayout(NUX_TRACKER_LOCATION); - glib::String shortkey(g_markup_escape_text(hint->shortkey().c_str(), -1)); - - std::string skey = ""+shortkey.Str()+""; - auto* shortkey_view = new StaticCairoText(skey, NUX_TRACKER_LOCATION); - shortkey_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); - shortkey_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); - shortkey_view->SetLines(-1); - shortkey_view->SetMinimumWidth(SHORTKEY_COLUMN_WIDTH); - shortkey_view->SetMaximumWidth(SHORTKEY_COLUMN_WIDTH); - - glib::String es_desc(g_markup_escape_text(hint->description().c_str(), -1)); - - auto* description_view = new StaticCairoText(es_desc.Str(), NUX_TRACKER_LOCATION); - description_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); - description_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); - description_view->SetLines(-1); - description_view->SetMinimumWidth(DESCRIPTION_COLUMN_WIDTH); - description_view->SetMaximumWidth(DESCRIPTION_COLUMN_WIDTH); - shortkey_layout->AddView(shortkey_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); shortkey_layout->SetContentDistribution(nux::MAJOR_POSITION_START); - shortkey_layout->SetMinimumWidth(SHORTKEY_COLUMN_WIDTH); - shortkey_layout->SetMaximumWidth(SHORTKEY_COLUMN_WIDTH); description_layout->AddView(description_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); - description_layout->SetMinimumWidth(DESCRIPTION_COLUMN_WIDTH); - description_layout->SetMaximumWidth(DESCRIPTION_COLUMN_WIDTH); layout->AddLayout(shortkey_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); layout->AddLayout(description_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); - layout->SetSpaceBetweenChildren(INTER_SPACE_SHORTKEY_DESCRIPTION); + layout->SetSpaceBetweenChildren(INTER_SPACE_SHORTKEY_DESCRIPTION.CP(scale)); description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); - view->key_changed_conn_ = hint->shortkey.changed.connect([this, view, shortkey_view] (std::string const& new_key) { - bool enabled = !new_key.empty(); - shortkey_view->SetText(enabled ? ""+new_key+"" : ""); - view->SetVisible(enabled); + view->key_changed_conn_ = hint->shortkey.changed.connect([this, view, shortkey_view] (std::string const& key) { + std::string escaped = glib::String(g_markup_escape_text(key.c_str(), -1)).Str(); + + if (!escaped.empty()) + escaped = ""+escaped+""; + + shortkey_view->SetText(escaped); + shortkey_view->SetVisible(!escaped.empty()); + view->SetVisible(shortkey_view->IsVisible()); QueueRelayout(); + QueueDraw(); }); - view->SetVisible(!shortkey.Str().empty()); + view->SetVisible(shortkey_view->IsVisible()); return view; } +StaticCairoText* View::CreateShortcutTextView(std::string const& text, bool bold) +{ + std::string escaped = glib::String(g_markup_escape_text(text.c_str(), -1)).Str(); + + if (bold && !text.empty()) + escaped = ""+escaped+""; + + auto* text_view = new StaticCairoText(escaped, NUX_TRACKER_LOCATION); + text_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); + text_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); + text_view->SetLines(-1); + text_view->SetScale(scale); + text_view->SetVisible(!escaped.empty()); + + return text_view; +} + nux::LinearLayout* View::CreateIntermediateLayout() { nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); - layout->SetSpaceBetweenChildren(LINE_SPACING); + layout->SetSpaceBetweenChildren(LINE_SPACING.CP(scale)); return layout; } @@ -195,9 +213,38 @@ view_layout_->ProcessDraw(GfxContext, force_draw); } +void View::PreLayoutManagement() +{ + UnityWindowView::PreLayoutManagement(); + + for (auto const& column : shortkeys_) + { + int min_width = SHORTKEY_COLUMN_DEFAULT_WIDTH.CP(scale); + + for (auto* shortkey : column) + min_width = std::min(std::max(min_width, shortkey->GetTextExtents().width), shortkey->GetMaximumWidth()); + + for (auto* shortkey : column) + shortkey->SetMinimumWidth(min_width); + } + + for (auto const& column : descriptions_) + { + int min_width = DESCRIPTION_COLUMN_DEFAULT_WIDTH.CP(scale); + + for (auto* description : column) + min_width = std::min(std::max(min_width, description->GetTextExtents().width), description->GetMaximumWidth()); + + for (auto* description : column) + description->SetMinimumWidth(min_width); + } +} + void View::RenderColumns() { columns_layout_->Clear(); + shortkeys_.clear(); + descriptions_.clear(); if (!model_) { @@ -209,11 +256,21 @@ int i = 0; int column_idx = 0; auto const& columns = columns_layout_->GetChildren(); + auto const& categories = model_->categories(); + const int categories_per_column = model_->categories_per_column(); + const int columns_number = categories.size() / categories_per_column + 1; + const int top_space = (23_em).CP(scale); + const int bottom_space = (20_em).CP(scale); + const int max_shortkeys_width = SHORTKEY_COLUMN_MAX_WIDTH.CP(scale); + const int max_descriptions_width = DESCRIPTION_COLUMN_MAX_WIDTH.CP(scale); + + shortkeys_.resize(columns_number); + descriptions_.resize(columns_number); - for (auto const& category : model_->categories()) + for (auto const& category : categories) { // Computing column index based on current index - column_idx = i/model_->categories_per_column(); + column_idx = i/categories_per_column; nux::LinearLayout* section_layout = CreateSectionLayout(category); nux::LinearLayout* intermediate_layout = CreateIntermediateLayout(); @@ -221,19 +278,27 @@ for (auto const& hint : model_->hints().at(category)) { - nux::View* view = CreateShortKeyEntryView(hint); + StaticCairoText* shortkey = CreateShortcutTextView(hint->shortkey(), true); + shortkey->SetMaximumWidth(max_shortkeys_width); + shortkeys_[column_idx].push_back(shortkey); + + StaticCairoText* description = CreateShortcutTextView(hint->description(), false); + description->SetMaximumWidth(max_descriptions_width); + descriptions_[column_idx].push_back(description); + + nux::View* view = CreateShortKeyEntryView(hint, shortkey, description); intermediate_layout->AddView(view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); } section_layout->AddLayout(intermediate_layout, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); - if ((i + 1) % model_->categories_per_column() != 0 && category != model_->categories().back()) + if ((i + 1) % categories_per_column != 0 && category != categories.back()) { // Add a line with some padding after and before each category that is not // the last of the column. - section_layout->AddView(new nux::SpaceLayout(23, 23, 23, 23), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); + section_layout->AddView(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); section_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); - section_layout->AddView(new nux::SpaceLayout(20, 20, 20, 20), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); + section_layout->AddView(new nux::SpaceLayout(bottom_space, bottom_space, bottom_space, bottom_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); } nux::VLayout* column = nullptr; @@ -251,7 +316,7 @@ column->AddView(section_layout, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); - i++; + ++i; } ComputeContentSize(); diff -Nru unity-7.2.1+14.04.20140513/shortcuts/ShortcutView.h unity-7.2.2+14.04.20140714/shortcuts/ShortcutView.h --- unity-7.2.1+14.04.20140513/shortcuts/ShortcutView.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shortcuts/ShortcutView.h 2014-07-14 10:30:31.000000000 -0400 @@ -29,6 +29,8 @@ namespace unity { +class StaticCairoText; + namespace shortcut { @@ -47,8 +49,9 @@ protected: // Protected methods - void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry const& clip); - nux::Geometry GetBackgroundGeometry(); + void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry const& clip) override; + nux::Geometry GetBackgroundGeometry() override; + void PreLayoutManagement() override; // Introspectable methods std::string GetName() const; @@ -56,7 +59,8 @@ private: // Private methods nux::LinearLayout* CreateSectionLayout(std::string const& section_name); - nux::View* CreateShortKeyEntryView(AbstractHint::Ptr const& hint); + nux::View* CreateShortKeyEntryView(AbstractHint::Ptr const&, StaticCairoText* shortkey, StaticCairoText* description); + StaticCairoText* CreateShortcutTextView(std::string const& text, bool bold); nux::LinearLayout* CreateIntermediateLayout(); void RenderColumns(); @@ -64,6 +68,8 @@ // Private members Model::Ptr model_; nux::HLayout* columns_layout_; + std::vector> shortkeys_; + std::vector> descriptions_; friend class TestShortcutView; }; diff -Nru unity-7.2.1+14.04.20140513/shutdown/SessionButton.cpp unity-7.2.2+14.04.20140714/shutdown/SessionButton.cpp --- unity-7.2.1+14.04.20140513/shutdown/SessionButton.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shutdown/SessionButton.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -30,15 +30,15 @@ namespace style { - const std::string FONT = "Ubuntu Light 12"; - - const unsigned BUTTON_SPACE = 9; + std::string const FONT = "Ubuntu Light 12"; + RawPixel const BUTTON_SPACE = 9_em; } NUX_IMPLEMENT_OBJECT_TYPE(Button); Button::Button(Action action, NUX_FILE_LINE_DECL) : nux::View(NUX_FILE_LINE_PARAM) + , scale(1.0) , highlighted(false) , action([this] { return action_; }) , label([this] { return label_view_->GetText(); }) @@ -78,14 +78,21 @@ break; } - normal_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + ".png").c_str(), -1, true)); - highlight_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + "_highlight.png").c_str(), -1, true)); + UpdateTextures(texture_prefix); auto main_layout = new nux::VLayout(); main_layout->SetContentDistribution(nux::MAJOR_POSITION_CENTER); main_layout->SetSpaceBetweenChildren(style::BUTTON_SPACE); SetLayout(main_layout); + scale.changed.connect([this, main_layout, texture_prefix] (double new_scale) { + main_layout->SetSpaceBetweenChildren(style::BUTTON_SPACE.CP(new_scale)); + label_view_->SetScale(new_scale); + + UpdateTextures(texture_prefix); + image_view_->SetTexture(highlighted ? highlight_tex_ : normal_tex_); + }); + image_view_ = new IconTexture(normal_tex_); image_view_->SetInputEventSensitivity(false); main_layout->AddView(image_view_, 1, nux::MINOR_POSITION_CENTER); @@ -111,6 +118,24 @@ }); } +void Button::UpdateTextures(std::string const& texture_prefix) +{ + RawPixel const texture_size = GetDefaultMaxTextureSize(texture_prefix); + + normal_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + ".png").c_str(), texture_size.CP(scale), true)); + highlight_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + "_highlight.png").c_str(), texture_size.CP(scale), true)); +} + +RawPixel Button::GetDefaultMaxTextureSize(std::string const& texture_prefix) const +{ + nux::Size size; + auto const& texture_name = (texture_prefix + ".png"); + gdk_pixbuf_get_file_info(texture_name.c_str(), &size.width, &size.height); + RawPixel max_size = std::max(size.width, size.height); + + return max_size; +} + void Button::Draw(nux::GraphicsEngine& ctx, bool force) { GetLayout()->ProcessDraw(ctx, force); diff -Nru unity-7.2.1+14.04.20140513/shutdown/SessionButton.h unity-7.2.2+14.04.20140714/shutdown/SessionButton.h --- unity-7.2.1+14.04.20140513/shutdown/SessionButton.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shutdown/SessionButton.h 2014-07-14 10:30:31.000000000 -0400 @@ -26,6 +26,7 @@ #include "unity-shared/IconTexture.h" #include "unity-shared/Introspectable.h" +#include "unity-shared/RawPixel.h" #include "unity-shared/StaticCairoText.h" namespace unity @@ -49,6 +50,7 @@ Button(Action, NUX_FILE_LINE_PROTO); + nux::Property scale; nux::Property highlighted; nux::ROProperty action; nux::ROProperty label; @@ -65,6 +67,9 @@ private: friend class TestSessionButton; + void UpdateTextures(std::string const& texture_prefix); + RawPixel GetDefaultMaxTextureSize(std::string const& texture_prefix) const; + Action action_; IconTexture* image_view_; StaticCairoText* label_view_; diff -Nru unity-7.2.1+14.04.20140513/shutdown/SessionController.cpp unity-7.2.2+14.04.20140714/shutdown/SessionController.cpp --- unity-7.2.1+14.04.20140513/shutdown/SessionController.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shutdown/SessionController.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -151,6 +151,8 @@ { view_->size_changed.connect([this] (nux::Area*, int, int) { int monitor = UScreen::GetDefault()->GetMonitorWithMouse(); + view_->monitor = monitor; + auto const& offset = GetOffsetPerMonitor(monitor); view_window_->SetXY(offset.x, offset.y); }); diff -Nru unity-7.2.1+14.04.20140513/shutdown/SessionView.cpp unity-7.2.2+14.04.20140714/shutdown/SessionView.cpp --- unity-7.2.1+14.04.20140513/shutdown/SessionView.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shutdown/SessionView.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -20,10 +20,11 @@ #include "SessionView.h" #include "SessionButton.h" -#include #include #include +#include "unity-shared/RawPixel.h" + namespace unity { namespace session @@ -31,15 +32,15 @@ namespace style { - const std::string FONT = "Ubuntu Light"; - const std::string TITLE_FONT = FONT+" 15"; - const std::string SUBTITLE_FONT = FONT+" 12"; - - const unsigned LEFT_RIGHT_PADDING = 30; - const unsigned TOP_PADDING = 19; - const unsigned BOTTOM_PADDING = 12; - const unsigned MAIN_SPACE = 10; - const unsigned BUTTONS_SPACE = 20; + std::string const FONT = "Ubuntu Light"; + std::string const TITLE_FONT = FONT+" 15"; + std::string const SUBTITLE_FONT = FONT+" 12"; + + RawPixel const LEFT_RIGHT_PADDING = 30_em; + RawPixel const TOP_PADDING = 19_em; + RawPixel const BOTTOM_PADDING = 12_em; + RawPixel const MAIN_SPACE = 10_em; + RawPixel const BUTTONS_SPACE = 20_em; } NUX_IMPLEMENT_OBJECT_TYPE(View); @@ -51,18 +52,15 @@ , key_focus_area_(this) { closable = true; - auto main_layout = new nux::VLayout(); - main_layout->SetTopAndBottomPadding(style::TOP_PADDING, style::BOTTOM_PADDING); - main_layout->SetLeftAndRightPadding(style::LEFT_RIGHT_PADDING); - main_layout->SetSpaceBetweenChildren(style::MAIN_SPACE); - SetLayout(main_layout); + main_layout_ = new nux::VLayout(); + SetLayout(main_layout_); title_ = new StaticCairoText(""); title_->SetFont(style::TITLE_FONT); title_->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); title_->SetInputEventSensitivity(false); title_->SetVisible(false); - main_layout->AddView(title_); + main_layout_->AddView(title_); subtitle_ = new StaticCairoText(""); subtitle_->SetFont(style::SUBTITLE_FONT); @@ -70,15 +68,15 @@ subtitle_->SetInputEventSensitivity(false); subtitle_->SetLines(std::numeric_limits::min()); subtitle_->SetLineSpacing(2); - main_layout->AddView(subtitle_); + main_layout_->AddView(subtitle_); buttons_layout_ = new nux::HLayout(); - buttons_layout_->SetSpaceBetweenChildren(style::BUTTONS_SPACE); - main_layout->AddLayout(buttons_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_PERCENTAGE, 0.0f); + main_layout_->AddLayout(buttons_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_PERCENTAGE, 0.0f); GetBoundingArea()->mouse_click.connect([this] (int, int, unsigned long, unsigned long) { request_close.emit(); }); have_inhibitors.changed.connect(sigc::hide(sigc::mem_fun(this, &View::UpdateText))); + manager_->have_other_open_sessions.changed.connect(sigc::hide(sigc::mem_fun(this, &View::UpdateText))); mode.SetSetterFunction([this] (Mode& target, Mode new_mode) { if (new_mode == Mode::SHUTDOWN && !manager_->CanShutdown()) @@ -98,30 +96,61 @@ Populate(); }); + scale.changed.connect(sigc::hide(sigc::mem_fun(this, &View::UpdateViewSize))); + + UpdateViewSize(); UpdateText(); Populate(); } +void View::UpdateViewSize() +{ + main_layout_->SetTopAndBottomPadding(style::TOP_PADDING.CP(scale()), style::BOTTOM_PADDING.CP(scale())); + main_layout_->SetLeftAndRightPadding(style::LEFT_RIGHT_PADDING.CP(scale())); + main_layout_->SetSpaceBetweenChildren(style::MAIN_SPACE.CP(scale())); + + title_->SetScale(scale()); + subtitle_->SetScale(scale()); + + ReloadCloseButtonTexture(); + + buttons_layout_->SetSpaceBetweenChildren(style::BUTTONS_SPACE.CP(scale())); + + for (auto* area : buttons_layout_->GetChildren()) + { + auto* button = static_cast(area); + button->scale = scale(); + } +} + void View::UpdateText() { - const char* message = nullptr; + std::string message; + std::string other_users_msg; auto const& real_name = manager_->RealName(); auto const& name = (real_name.empty() ? manager_->UserName() : real_name); + other_users_msg = _("Other users are logged in. Restarting or shutting down will close their open applications and may cause them to lose work.\n\n"); + if (mode() == Mode::SHUTDOWN) { title_->SetText(_("Shut Down")); title_->SetVisible(true); + if (manager_->have_other_open_sessions()) + { + message += other_users_msg; + } + if (have_inhibitors()) { - message = _("Hi %s, you have open files that you might want to save " \ - "before shutting down. Are you sure you want to continue?"); + message += _("Hi %s, you have open files that you might want to save " \ + "before shutting down. Are you sure you want to continue?"); } else { - message = _("Goodbye, %s. Are you sure you want to close all programs " \ - "and shut down the computer?"); + message += _("Goodbye, %s. Are you sure you want to close all programs " \ + "and shut down the computer?"); } } else if (mode() == Mode::LOGOUT) @@ -144,27 +173,32 @@ { title_->SetVisible(false); + if (manager_->have_other_open_sessions()) + { + message += other_users_msg; + } + if (have_inhibitors()) { if (buttons_layout_->GetChildren().size() > 3) { // We have enough buttons to show the message without a new line. - message = _("Hi %s, you have open files you might want to save. " \ + message += _("Hi %s, you have open files you might want to save. " \ "Would you like to…"); } else { - message = _("Hi %s, you have open files you might want to save.\n" \ + message += _("Hi %s, you have open files you might want to save.\n" \ "Would you like to…"); } } else { - message = _("Goodbye, %s. Would you like to…"); + message += _("Goodbye, %s. Would you like to…"); } } - subtitle_->SetText(glib::String(g_strdup_printf(message, name.c_str())).Str()); + subtitle_->SetText(glib::String(g_strdup_printf(message.c_str(), name.c_str())).Str()); } void View::Populate() @@ -176,6 +210,7 @@ if (mode() == Mode::LOGOUT) { auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION); + button->scale = scale(); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen)); AddButton(button); @@ -189,12 +224,14 @@ if (mode() == Mode::FULL) { auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION); + button->scale = scale(); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen)); AddButton(button); if (manager_->CanSuspend()) { button = new Button(Button::Action::SUSPEND, NUX_TRACKER_LOCATION); + button->scale = scale(); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Suspend)); AddButton(button); } @@ -202,6 +239,7 @@ if (manager_->CanHibernate()) { button = new Button(Button::Action::HIBERNATE, NUX_TRACKER_LOCATION); + button->scale = scale(); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Hibernate)); AddButton(button); } @@ -210,10 +248,12 @@ if (manager_->CanShutdown()) { auto *button = new Button(Button::Action::REBOOT, NUX_TRACKER_LOCATION); + button->scale = scale(); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Reboot)); AddButton(button); button = new Button(Button::Action::SHUTDOWN, NUX_TRACKER_LOCATION); + button->scale = scale(); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Shutdown)); key_focus_area_ = (mode() == Mode::SHUTDOWN) ? button : key_focus_area_; AddButton(button); @@ -221,6 +261,7 @@ else if (mode() == Mode::FULL) { auto* button = new Button(Button::Action::LOGOUT, NUX_TRACKER_LOCATION); + button->scale = scale(); button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Logout)); AddButton(button); } diff -Nru unity-7.2.1+14.04.20140513/shutdown/SessionView.h unity-7.2.2+14.04.20140714/shutdown/SessionView.h --- unity-7.2.1+14.04.20140513/shutdown/SessionView.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/shutdown/SessionView.h 2014-07-14 10:30:31.000000000 -0400 @@ -22,9 +22,11 @@ #include #include +#include #include #include "UnityCore/SessionManager.h" +#include "unity-shared/EMConverter.h" #include "unity-shared/UnityWindowView.h" #include "UnityCore/SessionManager.h" @@ -71,6 +73,8 @@ private: friend class TestSessionView; + void UpdateViewSize(); + void UpdateText(); void Populate(); void AddButton(Button*); @@ -78,6 +82,7 @@ Manager::Ptr manager_; StaticCairoText* title_; StaticCairoText* subtitle_; + nux::VLayout* main_layout_; nux::HLayout* buttons_layout_; nux::InputArea* key_focus_area_; }; diff -Nru unity-7.2.1+14.04.20140513/tests/test-gestures/LockScreenControllerMock.h unity-7.2.2+14.04.20140714/tests/test-gestures/LockScreenControllerMock.h --- unity-7.2.1+14.04.20140513/tests/test-gestures/LockScreenControllerMock.h 1969-12-31 19:00:00.000000000 -0500 +++ unity-7.2.2+14.04.20140714/tests/test-gestures/LockScreenControllerMock.h 2014-07-14 10:30:31.000000000 -0400 @@ -0,0 +1,43 @@ +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- +/* + * 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 LOCK_SCREEN_CONTROLLER_MOCK_H +#define LOCK_SCREEN_CONTROLLER_MOCK_H + +#include + +namespace unity +{ +namespace lockscreen +{ + +class ControllerMock +{ +public: + typedef std::shared_ptr Ptr; + + bool IsLocked() { + return false; + } +}; + +} +} + +#endif \ No newline at end of file diff -Nru unity-7.2.1+14.04.20140513/tests/test-gestures/sed_script_switcher unity-7.2.2+14.04.20140714/tests/test-gestures/sed_script_switcher --- unity-7.2.1+14.04.20140513/tests/test-gestures/sed_script_switcher 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/tests/test-gestures/sed_script_switcher 2014-07-14 10:30:31.000000000 -0400 @@ -19,8 +19,10 @@ s|\|NuxMock.h|g s|\|CompTimerMock|g s|\|LauncherControllerMock|g +s|\|LockControllerMock|g s|\|SwitcherControllerMock|g s|\|switcher\:\:ControllerMock|g +s|\|lockscreen\:\:ControllerMock|g s|\|launcher\:\:ControllerMock|g /SwitcherView\.h/d s|\|SwitcherViewMock|g diff -Nru unity-7.2.1+14.04.20140513/tests/test-gestures/unityshell_mock.h unity-7.2.2+14.04.20140714/tests/test-gestures/unityshell_mock.h --- unity-7.2.1+14.04.20140513/tests/test-gestures/unityshell_mock.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/tests/test-gestures/unityshell_mock.h 2014-07-14 10:30:31.000000000 -0400 @@ -6,7 +6,7 @@ #include #include "SwitcherControllerMock.h" - +#include "LockScreenControllerMock.h" namespace unity { @@ -29,6 +29,7 @@ UnityScreenMock() { switcher_controller_ = std::make_shared(); + lockscreen_controller_ = std::make_shared(); Reset(); } @@ -59,7 +60,13 @@ return switcher_controller_; } + lockscreen::ControllerMock::Ptr lockscreen_controller() + { + return lockscreen_controller_; + } + switcher::ControllerMock::Ptr switcher_controller_; + lockscreen::ControllerMock::Ptr lockscreen_controller_; int SetUpAndShowSwitcher_count_; }; diff -Nru unity-7.2.1+14.04.20140513/tests/test_lockscreen_controller.cpp unity-7.2.2+14.04.20140714/tests/test_lockscreen_controller.cpp --- unity-7.2.1+14.04.20140513/tests/test_lockscreen_controller.cpp 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/tests/test_lockscreen_controller.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -56,7 +56,6 @@ {} MOCK_CONST_METHOD0(IsIndicatorOpen, bool()); - MOCK_METHOD0(CheckCapsLockPrompt, void()); MOCK_METHOD0(ActivatePanel, void()); }; diff -Nru unity-7.2.1+14.04.20140513/tests/test_switcher_view.cpp unity-7.2.2+14.04.20140714/tests/test_switcher_view.cpp --- unity-7.2.1+14.04.20140513/tests/test_switcher_view.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/tests/test_switcher_view.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -117,8 +117,7 @@ EXPECT_EQ(switcher.vertical_size, switcher.tile_size + VERTICAL_PADDING * 2); EXPECT_EQ(switcher.text_size, 15); EXPECT_EQ(switcher.animation_length, 250); - EXPECT_EQ(switcher.monitor, -1); - EXPECT_EQ(switcher.spread_size, 3.5f); + EXPECT_EQ(switcher.monitor, 0); ASSERT_NE(switcher.text_view_, nullptr); ASSERT_NE(switcher.icon_renderer_, nullptr); EXPECT_EQ(switcher.icon_renderer_->pip_style, ui::OVER_TILE); diff -Nru unity-7.2.1+14.04.20140513/tests/test_unity_window_view.cpp unity-7.2.2+14.04.20140714/tests/test_unity_window_view.cpp --- unity-7.2.1+14.04.20140513/tests/test_unity_window_view.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/tests/test_unity_window_view.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -82,10 +82,10 @@ view.closable = true; ASSERT_NE(view.close_button_, nullptr); - EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIcon()); + EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON)); EXPECT_EQ(view.close_button_->GetParentObject(), &view); - int padding = view.style()->GetCloseButtonPadding(); + int padding = view.style()->GetCloseButtonPadding(view.scale); EXPECT_EQ(view.close_button_->GetBaseX(), padding); EXPECT_EQ(view.close_button_->GetBaseY(), padding); } @@ -96,16 +96,16 @@ ASSERT_NE(view.close_button_, nullptr); view.close_button_->mouse_enter.emit(0, 0, 0, 0); - EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIconHighligted()); + EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON_HIGHLIGHTED)); view.close_button_->mouse_leave.emit(0, 0, 0, 0); - EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIcon()); + EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON)); view.close_button_->mouse_down.emit(0, 0, 0, 0); - EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIconPressed()); + EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON_PRESSED)); view.close_button_->mouse_up.emit(0, 0, 0, 0); - EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIcon()); + EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON)); } TEST_F(TestUnityWindowView, CloseButtonClicksRequestsClose) @@ -185,7 +185,7 @@ view.SetLayout(layout); view.ComputeContentSize(); - int offset = view.style()->GetInternalOffset(); + int offset = view.style()->GetInternalOffset(view.scale); EXPECT_EQ(layout->GetBaseX(), offset); EXPECT_EQ(layout->GetBaseY(), offset); } @@ -199,7 +199,7 @@ TEST_F(TestUnityWindowView, GetInternalBackground) { - int offset = view.style()->GetInternalOffset(); + int offset = view.style()->GetInternalOffset(view.scale); view.background_geo_.Set(g_random_int(), g_random_int(), g_random_int(), g_random_int()); EXPECT_EQ(view.GetInternalBackground(), view.background_geo_.GetExpand(-offset, -offset)); } @@ -240,4 +240,4 @@ } } // ui -} // unity \ No newline at end of file +} // unity diff -Nru unity-7.2.1+14.04.20140513/UnityCore/GnomeSessionManager.cpp unity-7.2.2+14.04.20140714/UnityCore/GnomeSessionManager.cpp --- unity-7.2.1+14.04.20140513/UnityCore/GnomeSessionManager.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/UnityCore/GnomeSessionManager.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -85,6 +85,7 @@ , can_hibernate_(false) , pending_action_(shell::Action::NONE) , shell_server_(test_mode_ ? testing::DBUS_NAME : shell::DBUS_NAME) + , open_sessions_(0) { shell_server_.AddObjects(shell::INTROSPECTION_XML, shell::DBUS_OBJECT_PATH); shell_object_ = shell_server_.GetObject(shell::DBUS_INTERFACE); @@ -126,6 +127,22 @@ }); } + { + dm_proxy_ = std::make_shared("org.freedesktop.DisplayManager", + "/org/freedesktop/DisplayManager", + "org.freedesktop.DisplayManager", + G_BUS_TYPE_SYSTEM); + + dm_proxy_->Connect("SessionAdded", sigc::hide(sigc::mem_fun(this, &Impl::UpdateHaveOtherOpenSessions))); + dm_proxy_->Connect("SessionRemoved", sigc::hide(sigc::mem_fun(this, &Impl::UpdateHaveOtherOpenSessions))); + + UpdateHaveOtherOpenSessions(); + + manager_->have_other_open_sessions.SetGetterFunction([this]() { + return open_sessions_ > 1; + }); + } + CallLogindMethod("CanHibernate", nullptr, [this] (GVariant* variant, glib::Error const& err) { if (err) { @@ -422,6 +439,21 @@ prompt ? manager_->prompt_lock_requested.emit() : manager_->lock_requested.emit(); } +void GnomeManager::Impl::UpdateHaveOtherOpenSessions() +{ + dm_proxy_->GetProperty("Sessions", [this](GVariant* variant) { + GVariantIter *sessions; + g_variant_get(variant, "ao", &sessions); + int open_sessions = g_variant_iter_n_children(sessions); + + if (open_sessions_ != open_sessions) + { + open_sessions_ = open_sessions; + manager_->have_other_open_sessions.changed.emit(open_sessions_); + } + }); +} + // Public implementation GnomeManager::GnomeManager() diff -Nru unity-7.2.1+14.04.20140513/UnityCore/GnomeSessionManagerImpl.h unity-7.2.2+14.04.20140714/UnityCore/GnomeSessionManagerImpl.h --- unity-7.2.1+14.04.20140513/UnityCore/GnomeSessionManagerImpl.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/UnityCore/GnomeSessionManagerImpl.h 2014-07-14 10:30:31.000000000 -0400 @@ -61,6 +61,7 @@ void CallLogindMethod(std::string const& method, GVariant* parameters = nullptr, glib::DBusProxy::CallFinishedCallback const& cb = nullptr); void CallConsoleKitMethod(std::string const& method, GVariant* parameters = nullptr); bool InteractiveMode(); + void UpdateHaveOtherOpenSessions(); GnomeManager* manager_; bool test_mode_; @@ -73,6 +74,9 @@ glib::DBusObject::Ptr shell_object_; glib::DBusProxy::Ptr login_proxy_; glib::DBusProxy::Ptr presence_proxy_; + glib::DBusProxy::Ptr dm_proxy_; + + int open_sessions_; }; } // namespace session diff -Nru unity-7.2.1+14.04.20140513/UnityCore/SessionManager.h unity-7.2.2+14.04.20140714/UnityCore/SessionManager.h --- unity-7.2.1+14.04.20140513/UnityCore/SessionManager.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/UnityCore/SessionManager.h 2014-07-14 10:30:31.000000000 -0400 @@ -23,6 +23,8 @@ #include #include +#include + namespace unity { namespace session @@ -36,6 +38,8 @@ Manager() = default; virtual ~Manager() = default; + nux::ROProperty have_other_open_sessions; + virtual std::string RealName() const = 0; virtual std::string UserName() const = 0; virtual std::string HostName() const = 0; diff -Nru unity-7.2.1+14.04.20140513/unity-shared/EMConverter.cpp unity-7.2.2+14.04.20140714/unity-shared/EMConverter.cpp --- unity-7.2.1+14.04.20140513/unity-shared/EMConverter.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/EMConverter.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -17,6 +17,7 @@ * Authored by: Brandon Schaefer */ +#include #include "EMConverter.h" namespace unity @@ -104,8 +105,7 @@ double EMConverter::CP(int pixels) const { - double pixels_em = PixelsToBaseEM(pixels); - return EMToPixels(pixels_em); + return std::round(pixels * DPIScale()); } double EMConverter::DPIScale() const diff -Nru unity-7.2.1+14.04.20140513/unity-shared/IMTextEntry.cpp unity-7.2.2+14.04.20140714/unity-shared/IMTextEntry.cpp --- unity-7.2.1+14.04.20140513/unity-shared/IMTextEntry.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/IMTextEntry.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -27,10 +27,14 @@ IMTextEntry::IMTextEntry() : TextEntry("", NUX_TRACKER_LOCATION) + , clipboard_enabled(true) {} void IMTextEntry::CopyClipboard() { + if (!clipboard_enabled()) + return; + int start, end; if (GetSelectionBounds(&start, &end)) @@ -52,6 +56,9 @@ void IMTextEntry::Paste(bool primary) { + if (!clipboard_enabled()) + return; + GdkAtom origin = primary ? GDK_SELECTION_PRIMARY : GDK_SELECTION_CLIPBOARD; GtkClipboard* clip = gtk_clipboard_get(origin); diff -Nru unity-7.2.1+14.04.20140513/unity-shared/IMTextEntry.h unity-7.2.2+14.04.20140714/unity-shared/IMTextEntry.h --- unity-7.2.1+14.04.20140513/unity-shared/IMTextEntry.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/IMTextEntry.h 2014-07-14 10:30:31.000000000 -0400 @@ -33,6 +33,8 @@ public: IMTextEntry(); + nux::Property clipboard_enabled; + bool im_preedit(); protected: diff -Nru unity-7.2.1+14.04.20140513/unity-shared/PluginAdapter.cpp unity-7.2.2+14.04.20140714/unity-shared/PluginAdapter.cpp --- unity-7.2.1+14.04.20140513/unity-shared/PluginAdapter.cpp 2014-05-13 16:45:48.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/PluginAdapter.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -190,15 +190,34 @@ _vp_switch_started = false; screen_viewport_switch_ended.emit(); } - else if (IsScaleActive() && g_strcmp0(plugin, "scale") == 0 && - g_strcmp0(event, "activate") == 0) + else if (g_strcmp0(plugin, "scale") == 0 && g_strcmp0(event, "activate") == 0) { - // If the scale plugin is activated again while is already grabbing the screen - // it means that is switching the view (i.e. switching from a spread application - // to another), so we need to notify our clients that it has really terminated - // and initiated again. - terminate_spread.emit(); - initiate_spread.emit(); + bool new_state = CompOption::getBoolOptionNamed(option, "active"); + + if (_spread_state != new_state) + { + _spread_state = new_state; + _spread_state ? initiate_spread.emit() : terminate_spread.emit(); + + if (!_spread_state) + _spread_windows_state = false; + } + else if (_spread_state && new_state) + { + // If the scale plugin is activated again while is already grabbing the screen + // it means that is switching the view (i.e. switching from a spread application + // to another), so we need to notify our clients that it has really terminated + // and initiated again. + + bool old_windows_state = _spread_windows_state; + _spread_state = false; + _spread_windows_state = false; + terminate_spread.emit(); + + _spread_state = true; + _spread_windows_state = old_windows_state; + initiate_spread.emit(); + } } } @@ -249,7 +268,7 @@ /* Initiate the selected action with the arguments */ if (CompAction::CallBack const& initiate_cb = primary_action_->initiate()) - initiate_cb(action, 0, argument); + initiate_cb(action, state, argument); } void MultiActionList::InitiateAll(CompOption::Vector const& extra_args, int state) const @@ -1226,7 +1245,21 @@ bool PluginAdapter::IsScreenGrabbed() const { - return m_Screen->grabbed(); + if (m_Screen->grabbed()) + return true; + + auto* dpy = m_Screen->dpy(); + auto ret = XGrabKeyboard(dpy, m_Screen->root(), True, GrabModeAsync, GrabModeAsync, CurrentTime); + + if (ret == GrabSuccess) + { + XUngrabKeyboard(dpy, CurrentTime); + + if (CompWindow* w = m_Screen->findWindow(m_Screen->activeWindow())) + w->moveInputFocusTo(); + } + + return (ret == AlreadyGrabbed); } bool PluginAdapter::IsViewPortSwitchStarted() const diff -Nru unity-7.2.1+14.04.20140513/unity-shared/RawPixel.cpp unity-7.2.2+14.04.20140714/unity-shared/RawPixel.cpp --- unity-7.2.1+14.04.20140513/unity-shared/RawPixel.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/RawPixel.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -39,7 +39,7 @@ int RawPixel::CP(EMConverter::Ptr const& converter) const { - return std::round(converter->CP(raw_pixel_)); + return converter->CP(raw_pixel_); } int RawPixel::CP(double scale) const diff -Nru unity-7.2.1+14.04.20140513/unity-shared/TextInput.cpp unity-7.2.2+14.04.20140714/unity-shared/TextInput.cpp --- unity-7.2.1+14.04.20140513/unity-shared/TextInput.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/TextInput.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -18,6 +18,15 @@ */ #include "TextInput.h" +#include "unity-shared/IconTexture.h" +#include "unity-shared/DashStyle.h" +#include "unity-shared/RawPixel.h" +#include "unity-shared/PreviewStyle.h" + +#include + +namespace unity +{ namespace { @@ -29,6 +38,14 @@ const int HIGHLIGHT_HEIGHT = 24; +const RawPixel TOOLTIP_Y_OFFSET = 3_em; +const RawPixel TOOLTIP_OFFSET = 10_em; +const RawPixel DEFAULT_ICON_SIZE = 22_em; + +// Caps is on 0x1, couldn't find any #define in /usr/include/X11 +const int CAPS_STATE_ON = 0x1; + +std::string WARNING_ICON = "dialog-warning-symbolic"; // Fonts const std::string HINT_LABEL_DEFAULT_FONT_NAME = "Ubuntu"; const int HINT_LABEL_FONT_SIZE = 11; @@ -38,21 +55,44 @@ } -namespace unity -{ - nux::logging::Logger logger("unity.textinput"); NUX_IMPLEMENT_OBJECT_TYPE(TextInput); +nux::AbstractPaintLayer* CreateWarningLayer(nux::BaseTexture* texture) +{ + // Create the texture layer + nux::TexCoordXForm texxform; + + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); + texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT); + texxform.min_filter = nux::TEXFILTER_LINEAR; + texxform.mag_filter = nux::TEXFILTER_LINEAR; + + nux::ROPConfig rop; + rop.Blend = true; + + rop.SrcBlend = GL_ONE; + rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; + + return (new nux::TextureLayer(texture->GetDeviceTexture(), + texxform, + nux::color::White, + true, + rop)); +} + 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_caps_lock(false) , 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); @@ -74,6 +114,7 @@ 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_->key_up.connect(sigc::mem_fun(this, &TextInput::OnKeyUp)); pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &TextInput::OnEndKeyFocus)); pango_entry_->text_changed.connect([this](nux::TextEntry*) { hint_->SetVisible(input_string().empty()); @@ -86,6 +127,25 @@ layered_layout_->SetActiveLayerN(1); layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX); + warning_ = new IconTexture(LoadWarningIcon(DEFAULT_ICON_SIZE)); + 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) { + if (show_caps_lock) + { + warning_->SetVisible(on); + QueueRelayout(); + QueueDraw(); + } + }); + + show_caps_lock.changed.connect([this] (bool changed) { + if (!warning_tooltip_.IsValid()) + LoadWarningTooltip(); + + CheckIfCapsLockOn(); + }); + spinner_ = new SearchBarSpinner(); spinner_->SetVisible(false); spinner_->SetMinMaxSize(22, 22); @@ -101,6 +161,27 @@ im_preedit.SetGetterFunction(sigc::mem_fun(this, &TextInput::get_im_preedit)); 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(); + }); + + warning_->mouse_leave.connect([this] (int x, int y, int button, int key_flags) { + mouse_over_warning_icon_ = false; + QueueDraw(); + }); +} + +void TextInput::CheckIfCapsLockOn() +{ + Display *dpy = nux::GetGraphicsDisplay()->GetX11Display(); + unsigned int state = 0; + XkbGetIndicatorState(dpy, XkbUseCoreKbd, &state); + + if ((state & CAPS_STATE_ON) == 1) + caps_lock_on = true; + else + caps_lock_on = false; } void TextInput::SetSpinnerVisible(bool visible) @@ -118,6 +199,75 @@ hint_->SetFont((hint_font_name() + " " + std::to_string(hint_font_size())).c_str()); } +nux::ObjectPtr TextInput::LoadWarningIcon(int icon_size) +{ + auto* theme = gtk_icon_theme_get_default(); + GtkIconLookupFlags flags = GTK_ICON_LOOKUP_FORCE_SIZE; + glib::Error error; + glib::Object pixbuf(gtk_icon_theme_load_icon(theme, WARNING_ICON.c_str(), icon_size, flags, &error)); + + if (pixbuf != nullptr) + { + nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf)); + cairo_t* cr = cg.GetInternalContext(); + + cairo_push_group(cr); + gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); + cairo_paint_with_alpha(cr, 1.0); + std::shared_ptr pat(cairo_pop_group(cr), cairo_pattern_destroy); + + cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 1.0f); + cairo_rectangle(cr, 0, 0, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf)); + cairo_mask(cr, pat.get()); + + return texture_ptr_from_cairo_graphics(cg); + } + // Use fallback icon (this one is a png, and does not scale!) + else + { + dash::previews::Style& preview_style = dash::previews::Style::Instance(); + return nux::ObjectPtr(preview_style.GetWarningIcon()); + } +} + +void TextInput::LoadWarningTooltip() +{ + glib::String font_name; + g_object_get(gtk_settings_get_default(), "gtk-font-name", &font_name, NULL); + + glib::Object style_context(gtk_style_context_new()); + std::shared_ptr widget_path(gtk_widget_path_new(), gtk_widget_path_free); + gtk_widget_path_append_type(widget_path.get(), GTK_TYPE_TOOLTIP); + + 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); + + 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_layout_set_height(layout, -1); //avoid wrap lines + pango_layout_set_text(layout, _("Caps lock is on"), -1); + + nux::Size extents; + pango_layout_get_pixel_size(layout, &extents.width, &extents.height); + extents.width += TOOLTIP_OFFSET; + extents.height += TOOLTIP_OFFSET; + + nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, extents.width, extents.height); + cairo_t* cr = cg.GetInternalContext(); + + gtk_render_background(style_context, cr, 0, 0, extents.width, extents.height); + gtk_render_frame(style_context, cr, 0, 0, extents.width, extents.height); + gtk_render_layout(style_context, cr, TOOLTIP_OFFSET/2, TOOLTIP_OFFSET/2, layout); + + warning_tooltip_ = texture_ptr_from_cairo_graphics(cg); +} + void TextInput::OnFontChanged(GtkSettings* settings, GParamSpec* pspec) { glib::String font_name; @@ -175,7 +325,6 @@ nux::GetPainter().PushLayer(GfxContext, highlight_layer_->GetGeometry(), highlight_layer_.get()); } - if (!IsFullRedraw()) { gPainter.PushLayer(GfxContext, bg_layer_->GetGeometry(), bg_layer_.get()); @@ -187,6 +336,9 @@ layout_->ProcessDraw(GfxContext, force_draw); + if (caps_lock_on && mouse_over_warning_icon_) + PaintWarningTooltip(GfxContext); + if (!IsFullRedraw()) { gPainter.PopBackground(); @@ -199,6 +351,18 @@ GfxContext.PopClippingRectangle(); } +void TextInput::PaintWarningTooltip(nux::GraphicsEngine& graphics_engine) +{ + nux::Geometry warning_geo = warning_->GetGeometry(); + + nux::Geometry tooltip_geo = {warning_geo.x - (warning_tooltip_->GetWidth() + TOOLTIP_OFFSET / 2), + warning_geo.y - TOOLTIP_Y_OFFSET, + warning_tooltip_->GetWidth(), + warning_tooltip_->GetHeight()}; + + nux::GetPainter().PushDrawLayer(graphics_engine, tooltip_geo, CreateWarningLayer(warning_tooltip_.GetPointer())); +} + void TextInput::UpdateBackground(bool force) { int RADIUS = 5; @@ -254,6 +418,16 @@ texture2D->UnReference(); } +void TextInput::OnKeyUp(unsigned keysym, + unsigned long keycode, + unsigned long state) +{ + if (!caps_lock_on && keysym == NUX_VK_CAPITAL) + caps_lock_on = true; + else if (caps_lock_on && keysym == NUX_VK_CAPITAL) + caps_lock_on = false; +} + void TextInput::OnMouseButtonDown(int x, int y, unsigned long button, unsigned long key) { hint_->SetVisible(false); diff -Nru unity-7.2.1+14.04.20140513/unity-shared/TextInput.h unity-7.2.2+14.04.20140714/unity-shared/TextInput.h --- unity-7.2.1+14.04.20140513/unity-shared/TextInput.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/TextInput.h 2014-07-14 10:30:31.000000000 -0400 @@ -62,6 +62,8 @@ void SetSpinnerVisible(bool visible); void SetSpinnerState(SpinnerState spinner_state); + void EnableCapsLockWarning() const; + IMTextEntry* text_entry() const; nux::RWProperty input_string; @@ -70,6 +72,7 @@ nux::Property hint_font_size; nux::ROProperty im_active; nux::ROProperty im_preedit; + nux::Property show_caps_lock; private: void OnFontChanged(GtkSettings* settings, GParamSpec* pspec=NULL); @@ -83,9 +86,20 @@ void AddProperties(debug::IntrospectionData&); bool AcceptKeyNavFocus(); + bool ShouldBeHighlighted(); + + nux::Geometry GetWaringIconGeometry() const; + void CheckIfCapsLockOn(); + + nux::ObjectPtr LoadWarningIcon(int icon_size); + void LoadWarningTooltip(); + + void PaintWarningTooltip(nux::GraphicsEngine& graphics_engine); + protected: void OnInputHintChanged(); void OnMouseButtonDown(int x, int y, unsigned long button_flags, unsigned long key_flags); + void OnKeyUp(unsigned keysym, unsigned long keycode, unsigned long state); void OnEndKeyFocus(); // getters & setters @@ -100,20 +114,21 @@ IMTextEntry* pango_entry_; private: - - bool ShouldBeHighlighted(); - std::unique_ptr bg_layer_; std::unique_ptr highlight_layer_; nux::HLayout* layout_; nux::LayeredLayout* layered_layout_; SearchBarSpinner* spinner_; + nux::Property caps_lock_on; int last_width_; int last_height_; + bool mouse_over_warning_icon_; - glib::SignalManager sig_manager_; + IconTexture* warning_; + nux::ObjectPtr warning_tooltip_; + glib::SignalManager sig_manager_; }; } diff -Nru unity-7.2.1+14.04.20140513/unity-shared/UnityWindowStyle.cpp unity-7.2.2+14.04.20140714/unity-shared/UnityWindowStyle.cpp --- unity-7.2.1+14.04.20140513/unity-shared/UnityWindowStyle.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/UnityWindowStyle.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -16,82 +16,155 @@ * * Authored by: Jason Smith * Marco Trevisan + * Brandon Schaefer */ +#include + +#include "UnitySettings.h" #include "UnityWindowStyle.h" +#include "UScreen.h" #include "config.h" -namespace unity { -namespace ui { +#include -UnityWindowStyle::UnityWindowStyle() +namespace unity +{ +namespace ui +{ +namespace { - background_top_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_top.png", -1, true)); - background_left_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_left.png", -1, true)); - background_corner_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/switcher_corner.png", -1, true)); + const char* const SWITCHER_TOP = PKGDATADIR"/switcher_top.png"; + const char* const SWITCHER_LEFT = PKGDATADIR"/switcher_left.png"; + const char* const SWITCHER_CORNER = PKGDATADIR"/switcher_corner.png"; + + const char* const DIALOG_CLOSE = PKGDATADIR"/dialog_close.png"; + const char* const DIALOG_HIGHLIGHT = PKGDATADIR"/dialog_close_highlight.png"; + const char* const DIALOG_PRESS = PKGDATADIR"/dialog_close_press.png"; + + + RawPixel const INTERNAL_OFFSET = 20_em; + RawPixel const BORDER_SIZE = 30_em; + RawPixel const CLOSE_PADDING = 3_em; } -UnityWindowStyle::Ptr const& UnityWindowStyle::Get() +DECLARE_LOGGER(logger, "unity.ui.unity.window.style"); + + +UnityWindowStyle::UnityWindowStyle() { - // This is set only the first time; - static UnityWindowStyle::Ptr instance(new UnityWindowStyle()); - return instance; + unsigned monitors = UScreen::GetDefault()->GetPluggedMonitorsNumber(); + auto& settings = Settings::Instance(); + + // Pre-load scale values per monitor + for (unsigned i = 0; i < monitors; ++i) + { + double scale = settings.Instance().em(i)->DPIScale(); + + if (unity_window_textures_.find(scale) == unity_window_textures_.end()) + LoadAllTextureInScale(scale); + } + + settings.Instance().dpi_changed.connect(sigc::mem_fun(this, &UnityWindowStyle::CleanUpUnusedTextures)); + UScreen::GetDefault()->changed.connect(sigc::mem_fun(this, &UnityWindowStyle::OnMonitorChanged)); } -int UnityWindowStyle::GetBorderSize() const +void UnityWindowStyle::LoadAllTextureInScale(double scale) { - return 30; // as measured from textures + auto& window_textures = unity_window_textures_[scale]; + + window_textures[unsigned(WindowTextureType::BACKGROUND_TOP)] = LoadTexture(scale, SWITCHER_TOP); + window_textures[unsigned(WindowTextureType::BACKGROUND_LEFT)] = LoadTexture(scale, SWITCHER_LEFT); + window_textures[unsigned(WindowTextureType::BACKGROUND_CORNER)] = LoadTexture(scale, SWITCHER_CORNER); + + window_textures[unsigned(WindowTextureType::CLOSE_ICON)] = LoadTexture(scale, DIALOG_CLOSE); + window_textures[unsigned(WindowTextureType::CLOSE_ICON_HIGHLIGHTED)] = LoadTexture(scale, DIALOG_HIGHLIGHT); + window_textures[unsigned(WindowTextureType::CLOSE_ICON_PRESSED)] = LoadTexture(scale, DIALOG_PRESS); } -int UnityWindowStyle::GetInternalOffset() const +nux::BaseTexture* UnityWindowStyle::LoadTexture(double scale, const char* const texture_name) const { - return 20; + RawPixel max_size = GetDefaultMaxTextureSize(texture_name); + return nux::CreateTexture2DFromFile(texture_name, max_size.CP(scale), true); } -int UnityWindowStyle::GetCloseButtonPadding() const +RawPixel UnityWindowStyle::GetDefaultMaxTextureSize(const char* const texture_name) const { - return 3; + nux::Size size; + gdk_pixbuf_get_file_info(texture_name, &size.width, &size.height); + RawPixel max_size = std::max(std::round(size.width), std::round(size.height)); + + return max_size; } -UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetCloseIcon() +void UnityWindowStyle::OnMonitorChanged(int primary, std::vector const& monitors) { - if (!close_icon_) - close_icon_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/dialog_close.png", -1, true)); - - return close_icon_; + CleanUpUnusedTextures(); } -UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetCloseIconHighligted() +// Get current in use scale values, if a scaled value is allocated, but +// not in use clean up the scaled textures in unity_window_textures +void UnityWindowStyle::CleanUpUnusedTextures() { - if (!close_icon_highlighted_) - close_icon_highlighted_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/dialog_close_highlight.png", -1, true)); + unsigned monitors = UScreen::GetDefault()->GetPluggedMonitorsNumber(); + auto& settings = Settings::Instance(); + std::unordered_set used_scales; + + for (unsigned i = 0; i < monitors; ++i) + used_scales.insert(settings.em(i)->DPIScale()); - return close_icon_highlighted_; + for (auto it = unity_window_textures_.begin(); it != unity_window_textures_.end();) + { + if (used_scales.find(it->first) == used_scales.end()) + { + it = unity_window_textures_.erase(it); + } + else + { + ++it; + } + } } -UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetCloseIconPressed() +UnityWindowStyle::Ptr const& UnityWindowStyle::Get() { - if (!close_icon_pressed_) - close_icon_pressed_.Adopt(nux::CreateTexture2DFromFile(PKGDATADIR"/dialog_close_press.png", -1, true)); - - return close_icon_pressed_; + // This is set only the first time; + static UnityWindowStyle::Ptr instance(new UnityWindowStyle()); + return instance; } -UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetBackgroundTop() const +int UnityWindowStyle::GetBorderSize(double scale) const { - return background_top_; + return BORDER_SIZE.CP(scale); // as measured from textures } -UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetBackgroundLeft() const +int UnityWindowStyle::GetInternalOffset(double scale) const { - return background_left_; + return INTERNAL_OFFSET.CP(scale); } -UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetBackgroundCorner() const +int UnityWindowStyle::GetCloseButtonPadding(double scale) const { - return background_corner_; + return CLOSE_PADDING.CP(scale); } +UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetTexture(double scale, WindowTextureType const& type) +{ + auto it = unity_window_textures_.find(scale); + if (it == unity_window_textures_.end()) + { + LoadAllTextureInScale(scale); + it = unity_window_textures_.find(scale); + if (it == unity_window_textures_.end()) + { + LOG_ERROR(logger) << "Failed to create unity window style textures, for scale size: " << scale; + return BaseTexturePtr(nullptr); + } + } + + return it->second[unsigned(type)]; } -} + +} // namespace ui +} // namespace unity diff -Nru unity-7.2.1+14.04.20140513/unity-shared/UnityWindowStyle.h unity-7.2.2+14.04.20140714/unity-shared/UnityWindowStyle.h --- unity-7.2.1+14.04.20140513/unity-shared/UnityWindowStyle.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/UnityWindowStyle.h 2014-07-14 10:30:31.000000000 -0400 @@ -16,6 +16,7 @@ * * Authored by: Jason Smith * Marco Trevisan + * Brandon Schaefer */ #ifndef UNITYWINDOWSTYLE_H @@ -24,8 +25,23 @@ #include #include -namespace unity { -namespace ui { +#include "RawPixel.h" + +namespace unity +{ +namespace ui +{ + +enum class WindowTextureType : unsigned +{ + BACKGROUND_TOP, + BACKGROUND_LEFT, + BACKGROUND_CORNER, + CLOSE_ICON, + CLOSE_ICON_HIGHLIGHTED, + CLOSE_ICON_PRESSED, + Size +}; class UnityWindowStyle { @@ -35,29 +51,28 @@ static UnityWindowStyle::Ptr const& Get(); - BaseTexturePtr GetCloseIcon(); - BaseTexturePtr GetCloseIconHighligted(); - BaseTexturePtr GetCloseIconPressed(); - int GetCloseButtonPadding() const; - - BaseTexturePtr GetBackgroundTop() const; - BaseTexturePtr GetBackgroundLeft() const; - BaseTexturePtr GetBackgroundCorner() const; - int GetBorderSize() const; - int GetInternalOffset() const; + BaseTexturePtr GetTexture(double scale, WindowTextureType const& type); + int GetCloseButtonPadding(double scale) const; + int GetBorderSize(double scale) const; + int GetInternalOffset(double scale) const; private: UnityWindowStyle(); - BaseTexturePtr background_top_; - BaseTexturePtr background_left_; - BaseTexturePtr background_corner_; - BaseTexturePtr close_icon_; - BaseTexturePtr close_icon_highlighted_; - BaseTexturePtr close_icon_pressed_; + void ReloadIcons(); + void LoadAllTextureInScale(double scale); + nux::BaseTexture* LoadTexture(double scale, const char* const texture_name) const; + RawPixel GetDefaultMaxTextureSize(const char* const texture_name) const; + + void OnMonitorChanged(int primary, std::vector const& monitors); + void CleanUpUnusedTextures(); + + typedef std::array UnityWindowTextures; + std::unordered_map unity_window_textures_; + }; -} -} +} // namespace ui +} // namespace unity #endif diff -Nru unity-7.2.1+14.04.20140513/unity-shared/UnityWindowView.cpp unity-7.2.2+14.04.20140714/unity-shared/UnityWindowView.cpp --- unity-7.2.1+14.04.20140513/unity-shared/UnityWindowView.cpp 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/UnityWindowView.cpp 2014-07-14 10:30:31.000000000 -0400 @@ -32,6 +32,8 @@ : View(NUX_FILE_LINE_PARAM) , style(UnityWindowStyle::Get()) , closable(false) + , monitor(0) + , scale(Settings::Instance().em()->DPIScale()) , internal_layout_(nullptr) , bg_helper_(this) { @@ -47,6 +49,8 @@ live_background = false; + monitor.changed.connect(sigc::hide(sigc::mem_fun(this, &UnityWindowView::OnDPIChanged))); + Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &UnityWindowView::OnDPIChanged)); closable.changed.connect(sigc::mem_fun(this, &UnityWindowView::OnClosableChanged)); background_color.changed.connect(sigc::hide(sigc::mem_fun(this, &View::QueueDraw))); } @@ -60,6 +64,17 @@ bounding_area_->UnParentObject(); } +void UnityWindowView::OnDPIChanged() +{ + scale = Settings::Instance().em(monitor())->DPIScale(); + + if (internal_layout_) + { + int offset = style()->GetInternalOffset(scale); + view_layout_->SetPadding(offset, offset); + } +} + void UnityWindowView::SetBackgroundHelperGeometryGetter(BackgroundEffectHelper::GeometryGetterFunc const& func) { bg_helper_.SetGeometryGetter(func); @@ -109,6 +124,11 @@ return View::FindKeyFocusArea(etype, key_code, modifiers); } +void UnityWindowView::ReloadCloseButtonTexture() +{ + OnClosableChanged(closable); +} + void UnityWindowView::OnClosableChanged(bool closable) { if (!closable) @@ -117,34 +137,38 @@ return; } - auto const& texture = style()->GetCloseIcon(); - int padding = style()->GetCloseButtonPadding(); + auto const& texture = style()->GetTexture(scale, WindowTextureType::CLOSE_ICON); + int padding = style()->GetCloseButtonPadding(scale); + close_button_ = new IconTexture(texture); close_button_->SetBaseXY(padding, padding); close_button_->SetParentObject(this); close_button_->mouse_enter.connect([this](int, int, unsigned long, unsigned long) { if (close_button_->IsMouseOwner()) - close_button_->SetTexture(style()->GetCloseIconPressed()); + close_button_->SetTexture(style()->GetTexture(scale, WindowTextureType::CLOSE_ICON_PRESSED)); else - close_button_->SetTexture(style()->GetCloseIconHighligted()); + close_button_->SetTexture(style()->GetTexture(scale, WindowTextureType::CLOSE_ICON_HIGHLIGHTED)); }); close_button_->mouse_leave.connect([this](int, int, unsigned long, unsigned long) { - close_button_->SetTexture(style()->GetCloseIcon()); + close_button_->SetTexture(style()->GetTexture(scale, WindowTextureType::CLOSE_ICON)); }); close_button_->mouse_down.connect([this](int, int, unsigned long, unsigned long) { - close_button_->SetTexture(style()->GetCloseIconPressed()); + close_button_->SetTexture(style()->GetTexture(scale, WindowTextureType::CLOSE_ICON_PRESSED)); }); close_button_->mouse_up.connect([this](int, int, unsigned long, unsigned long) { bool inside = close_button_->IsMouseInside(); - close_button_->SetTexture(inside ? style()->GetCloseIconHighligted() : style()->GetCloseIcon()); + if (inside) + close_button_->SetTexture(style()->GetTexture(scale, WindowTextureType::CLOSE_ICON_HIGHLIGHTED)); + else + close_button_->SetTexture(style()->GetTexture(scale, WindowTextureType::CLOSE_ICON)); }); close_button_->mouse_click.connect([this](int, int, unsigned long, unsigned long) { - close_button_->SetTexture(style()->GetCloseIcon()); + close_button_->SetTexture(style()->GetTexture(scale, WindowTextureType::CLOSE_ICON)); request_close.emit(); }); @@ -155,7 +179,7 @@ { if (layout && layout->IsLayout()) { - int offset = style()->GetInternalOffset(); + int offset = style()->GetInternalOffset(scale); // We wrap the internal layout adding some padding, so that inherited classes // can ignore the offsets we define here. @@ -180,7 +204,8 @@ nux::Geometry UnityWindowView::GetInternalBackground() { - int offset = style()->GetInternalOffset(); + int offset = style()->GetInternalOffset(scale); + return GetBackgroundGeometry().GetExpand(-offset, -offset); } @@ -330,7 +355,9 @@ void UnityWindowView::DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo) { - int border = style()->GetBorderSize(); + int border = style()->GetBorderSize(scale); + + auto background_corner_textrue = style()->GetTexture(scale, WindowTextureType::BACKGROUND_CORNER)->GetDeviceTexture(); GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); @@ -344,7 +371,7 @@ texxform.u1 = border; texxform.v1 = border; GfxContext.QRP_1Tex (geo.x, geo.y, - border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White); + border, border, background_corner_textrue, texxform, nux::color::White); // Draw TOP-RIGHT CORNER texxform.u0 = 0; @@ -354,7 +381,7 @@ texxform.flip_u_coord = true; texxform.flip_v_coord = false; GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y, - border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White); + border, border, background_corner_textrue, texxform, nux::color::White); // Draw BOTTOM-LEFT CORNER texxform.u0 = 0; @@ -364,7 +391,7 @@ texxform.flip_u_coord = false; texxform.flip_v_coord = true; GfxContext.QRP_1Tex (geo.x, geo.y + geo.height - border, - border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White); + border, border, background_corner_textrue, texxform, nux::color::White); // Draw BOTTOM-RIGHT CORNER texxform.u0 = 0; @@ -374,10 +401,11 @@ texxform.flip_u_coord = true; texxform.flip_v_coord = true; GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + geo.height - border, - border, border, style()->GetBackgroundCorner()->GetDeviceTexture(), texxform, nux::color::White); + border, border, background_corner_textrue, texxform, nux::color::White); - int top_width = style()->GetBackgroundTop()->GetWidth(); - int top_height = style()->GetBackgroundTop()->GetHeight(); + auto background_top = style()->GetTexture(scale, WindowTextureType::BACKGROUND_TOP); + int top_width = background_top->GetWidth(); + int top_height = background_top->GetHeight(); // Draw TOP BORDER texxform.u0 = 0; @@ -386,7 +414,7 @@ texxform.v1 = top_height; texxform.flip_u_coord = false; texxform.flip_v_coord = false; - GfxContext.QRP_1Tex (geo.x + border, geo.y, geo.width - border - border, border, style()->GetBackgroundTop()->GetDeviceTexture(), texxform, nux::color::White); + GfxContext.QRP_1Tex (geo.x + border, geo.y, geo.width - border - border, border, background_top->GetDeviceTexture(), texxform, nux::color::White); // Draw BOTTOM BORDER texxform.u0 = 0; @@ -395,11 +423,11 @@ texxform.v1 = top_height; texxform.flip_u_coord = false; texxform.flip_v_coord = true; - GfxContext.QRP_1Tex (geo.x + border, geo.y + geo.height - border, geo.width - border - border, border, style()->GetBackgroundTop()->GetDeviceTexture(), texxform, nux::color::White); - + GfxContext.QRP_1Tex (geo.x + border, geo.y + geo.height - border, geo.width - border - border, border, background_top->GetDeviceTexture(), texxform, nux::color::White); - int left_width = style()->GetBackgroundLeft()->GetWidth(); - int left_height = style()->GetBackgroundLeft()->GetHeight(); + auto background_left = style()->GetTexture(scale, WindowTextureType::BACKGROUND_LEFT); + int left_width = background_left->GetWidth(); + int left_height = background_left->GetHeight(); // Draw LEFT BORDER texxform.u0 = 0; @@ -408,7 +436,7 @@ texxform.v1 = left_height; texxform.flip_u_coord = false; texxform.flip_v_coord = false; - GfxContext.QRP_1Tex (geo.x, geo.y + border, border, geo.height - border - border, style()->GetBackgroundLeft()->GetDeviceTexture(), texxform, nux::color::White); + GfxContext.QRP_1Tex (geo.x, geo.y + border, border, geo.height - border - border, background_left->GetDeviceTexture(), texxform, nux::color::White); // Draw RIGHT BORDER texxform.u0 = 0; @@ -417,7 +445,7 @@ texxform.v1 = left_height; texxform.flip_u_coord = true; texxform.flip_v_coord = false; - GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + border, border, geo.height - border - border, style()->GetBackgroundLeft()->GetDeviceTexture(), texxform, nux::color::White); + GfxContext.QRP_1Tex (geo.x + geo.width - border, geo.y + border, border, geo.height - border - border, background_left->GetDeviceTexture(), texxform, nux::color::White); GfxContext.GetRenderStates().SetBlend(false); } diff -Nru unity-7.2.1+14.04.20140513/unity-shared/UnityWindowView.h unity-7.2.2+14.04.20140714/unity-shared/UnityWindowView.h --- unity-7.2.1+14.04.20140513/unity-shared/UnityWindowView.h 2014-05-13 16:45:29.000000000 -0400 +++ unity-7.2.2+14.04.20140714/unity-shared/UnityWindowView.h 2014-07-14 10:30:31.000000000 -0400 @@ -23,6 +23,7 @@ #include "unity-shared/BackgroundEffectHelper.h" #include "unity-shared/IconTexture.h" + #include "Introspectable.h" #include "UnityWindowStyle.h" #include @@ -41,6 +42,8 @@ nux::Property background_color; nux::Property style; nux::Property closable; + nux::Property monitor; + nux::Property scale; UnityWindowView(NUX_FILE_LINE_PROTO); virtual ~UnityWindowView(); @@ -64,6 +67,8 @@ virtual nux::Geometry GetBlurredBackgroundGeometry(); void SetBackgroundHelperGeometryGetter(BackgroundEffectHelper::GeometryGetterFunc const&); + void ReloadCloseButtonTexture(); + // Introspectable methods std::string GetName() const; void AddProperties(debug::IntrospectionData&); @@ -71,6 +76,7 @@ private: friend class TestUnityWindowView; + void OnDPIChanged(); void OnClosableChanged(bool closable); void DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo);