diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-09-19 22:55:11 +0200 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-09-19 22:55:11 +0200 |
| commit | 7a34559b48d4b4fda83b74224f9b2336392a0170 (patch) | |
| tree | 0da4a04a3f82f02a7f79293327c61ae84916dfc1 /plugins/unityshell | |
| parent | 5b38b5f6cc3a96ca62cb345e14aaff05a39e8171 (diff) | |
| parent | e27940b0e2fdaf8f9bc0358baa36a2ea56fa1160 (diff) | |
Merging with trunk
(bzr r3506.5.34)
Diffstat (limited to 'plugins/unityshell')
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 133 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 2 | ||||
| -rw-r--r-- | plugins/unityshell/unityshell.xml.in | 12 |
3 files changed, 73 insertions, 74 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 3d2dc0e71..b4d3d35e3 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -349,6 +349,9 @@ UnityScreen::UnityScreen(CompScreen* screen) optionSetLauncherSwitcherPrevInitiate(boost::bind(&UnityScreen::launcherSwitcherPrevInitiate, this, _1, _2, _3)); optionSetLauncherSwitcherForwardTerminate(boost::bind(&UnityScreen::launcherSwitcherTerminate, this, _1, _2, _3)); + optionSetWindowRightMaximizeInitiate(boost::bind(&UnityScreen::rightMaximizeKeyInitiate, this, _1, _2, _3)); + optionSetWindowLeftMaximizeInitiate(boost::bind(&UnityScreen::leftMaximizeKeyInitiate, this, _1, _2, _3)); + optionSetStopVelocityNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetRevealPressureNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); optionSetEdgeResponsivenessNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); @@ -1334,26 +1337,39 @@ void UnityScreen::donePaint() if (animation_controller_->HasRunningAnimations()) nuxDamageCompiz(); - std::list <ShowdesktopHandlerWindowInterface *> remove_windows; - - for (ShowdesktopHandlerWindowInterface *wi : ShowdesktopHandler::animating_windows) + for (auto it = ShowdesktopHandler::animating_windows.begin(); it != ShowdesktopHandler::animating_windows.end();) { - ShowdesktopHandlerWindowInterface::PostPaintAction action = wi->HandleAnimations (0); + auto const& wi = *it; + auto action = wi->HandleAnimations(0); + if (action == ShowdesktopHandlerWindowInterface::PostPaintAction::Remove) - remove_windows.push_back(wi); + { + it = ShowdesktopHandler::animating_windows.erase(it); + continue; + } else if (action == ShowdesktopHandlerWindowInterface::PostPaintAction::Damage) + { wi->AddDamage (); - } + } - for (ShowdesktopHandlerWindowInterface *wi : remove_windows) - { - wi->DeleteHandler (); - ShowdesktopHandler::animating_windows.remove (wi); + ++it; } cScreen->donePaint (); } +void redraw_view_if_damaged(nux::ObjectPtr<nux::View> const& view, CompRegion const& damage) +{ + if (!view || view->IsRedrawNeeded()) + return; + + auto const& geo = view->GetAbsoluteGeometry(); + CompRegion region(geo.x, geo.y, geo.width, geo.height); + + if (damage.intersects(region)) + view->NeedSoftRedraw(); +} + void UnityScreen::compizDamageNux(CompRegion const& damage) { if (!launcher_controller_) @@ -1378,79 +1394,28 @@ void UnityScreen::compizDamageNux(CompRegion const& damage) } } + if (dash_controller_->IsVisible()) + redraw_view_if_damaged(dash_controller_->Dash(), damage); + auto const& launchers = launcher_controller_->launchers(); for (auto const& launcher : launchers) { if (!launcher->Hidden()) { - nux::Geometry const& geo = launcher->GetAbsoluteGeometry(); - CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height); - - if (damage.intersects(launcher_region)) - launcher->QueueDraw(); - - nux::ObjectPtr<nux::View> const& tooltip = launcher->GetActiveTooltip(); - - if (tooltip) - { - nux::Geometry const& g = tooltip->GetAbsoluteGeometry(); - CompRegion tip_region(g.x, g.y, g.width, g.height); - - if (damage.intersects(tip_region)) - tooltip->QueueDraw(); - } - - nux::ObjectPtr<LauncherDragWindow> const& dragged_icon = launcher->GetDraggedIcon(); - - if (dragged_icon) - { - nux::Geometry const& g = dragged_icon->GetAbsoluteGeometry(); - CompRegion icon_region(g.x, g.y, g.width, g.height); - - if (damage.intersects(icon_region)) - dragged_icon->QueueDraw(); - } + redraw_view_if_damaged(launcher, damage); + redraw_view_if_damaged(launcher->GetActiveTooltip(), damage); + redraw_view_if_damaged(launcher->GetDraggedIcon(), damage); } } for (auto const& panel : panel_controller_->panels()) - { - nux::Geometry const& geo = panel->GetAbsoluteGeometry(); - - CompRegion panel_region(geo.x, geo.y, geo.width, geo.height); - - if (damage.intersects(panel_region)) - panel->QueueDraw(); - } + redraw_view_if_damaged(panel, damage); - QuicklistManager* qm = QuicklistManager::Default(); - if (qm) - { - auto const& view = qm->Current(); - - if (view) - { - nux::Geometry const& geo = view->GetAbsoluteGeometry(); - CompRegion quicklist_region(geo.x, geo.y, geo.width, geo.height); + if (QuicklistManager* qm = QuicklistManager::Default()) + redraw_view_if_damaged(qm->Current(), damage); - if (damage.intersects(quicklist_region)) - view->QueueDraw(); - } - } - - if (switcher_controller_ && switcher_controller_->Visible()) - { - auto const& view = switcher_controller_->GetView(); - - if (G_LIKELY(view)) - { - nux::Geometry const& geo = view->GetAbsoluteGeometry(); - CompRegion switcher_region(geo.x, geo.y, geo.width, geo.height); - - if (damage.intersects(switcher_region)) - view->QueueDraw(); - } - } + if (switcher_controller_->Visible()) + redraw_view_if_damaged(switcher_controller_->GetView(), damage); } /* Grab changed nux regions and add damage rects for them */ @@ -2136,12 +2101,14 @@ bool UnityScreen::launcherSwitcherForwardInitiate(CompAction* action, CompAction action->setState(action->state() | CompAction::StateTermKey); return true; } + bool UnityScreen::launcherSwitcherPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) { launcher_controller_->KeyNavPrevious(); return true; } + bool UnityScreen::launcherSwitcherTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options) { bool accept_state = (state & CompAction::StateCancel) == 0; @@ -2164,6 +2131,20 @@ bool UnityScreen::launcherSwitcherTerminate(CompAction* action, CompAction::Stat return true; } +bool UnityScreen::rightMaximizeKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) +{ + auto& WM = WindowManager::Default(); + WM.RightMaximize(WM.GetActiveWindow()); + return true; +} + +bool UnityScreen::leftMaximizeKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) +{ + auto& WM = WindowManager::Default(); + WM.LeftMaximize(WM.GetActiveWindow()); + return true; +} + void UnityScreen::OnLauncherStartKeyNav(GVariant* data) { // Put the launcher BaseWindow at the top of the BaseWindow stack. The @@ -2979,11 +2960,11 @@ CompPoint UnityWindow::tryNotIntersectUI(CompPoint& pos) for (auto const& launcher : launchers) { - nux::Geometry geo = launcher->GetAbsoluteGeometry(); - if (launcher->options()->hide_mode == LAUNCHER_HIDE_AUTOHIDE && launcher->Hidden()) continue; + auto const& geo = launcher->GetAbsoluteGeometry(); + if (geo.IsInside(result)) { if (geo.x + geo.width + 1 + window_geo.width() < target_monitor.x + target_monitor.width) @@ -3554,6 +3535,10 @@ void UnityWindow::AddProperties(GVariantBuilder* builder) .add("xid", (uint64_t)xid) .add("title", wm.GetWindowName(xid)) .add("fake_decorated", uScreen->fake_decorated_windows_.find(this) != uScreen->fake_decorated_windows_.end()) + .add("maximized", wm.IsWindowVerticallyMaximized(xid)) + .add("horizontally_maximized", wm.IsWindowHorizontallyMaximized(xid)) + .add("vertically_maximized", wm.IsWindowVerticallyMaximized(xid)) + .add("minimized", wm.IsWindowMinimized(xid)) .add("scaled", scaled) .add("scaled_close_geo", close_button_geo_) .add("scaled_close_x", close_button_geo_.x) diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index e2b50badf..1e8d46ab7 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -178,6 +178,8 @@ public: bool launcherSwitcherForwardInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool launcherSwitcherPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool launcherSwitcherTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options); + bool rightMaximizeKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); + bool leftMaximizeKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); /* handle option changes and change settings inside of the * panel and dock views */ diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in index d4357bc91..f5ed1b656 100644 --- a/plugins/unityshell/unityshell.xml.in +++ b/plugins/unityshell/unityshell.xml.in @@ -68,6 +68,18 @@ <default><Alt>F10</default> </option> + <option name="window_right_maximize" type="key"> + <_short>Key to vertically maximize the focused window to the right</_short> + <_long>Semi-maximize vertically the focused window on the half right width of the screen</_long> + <default><Control><Super>Right</default> + </option> + + <option name="window_left_maximize" type="key"> + <_short>Key to vertically maximize the focused window to the left</_short> + <_long>Semi-maximize vertically the focused window to the half left width of the screen</_long> + <default><Control><Super>Left</default> + </option> + <option name="panel_opacity" type="float"> <_short>Panel Opacity</_short> <_long>The opacity of the Panel background.</_long> |
