From 10b771c175d22eb2e114f039c4397d113fab1782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 2 Nov 2015 16:07:28 +0100 Subject: UnityWindow: draw decorations before the window itself (bzr r3983.15.3) --- plugins/unityshell/src/unityshell.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 468d12966..7f1ec295a 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -2995,9 +2995,8 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, wAttrib.brightness *= 0.75f; } - bool ret = gWindow->glPaint(wAttrib, matrix, region, mask); deco_win_->Paint(matrix, wAttrib, region, mask); - return ret; + return gWindow->glPaint(wAttrib, matrix, region, mask); } /* handle window painting in an opengl context @@ -3120,8 +3119,8 @@ bool UnityWindow::glDraw(const GLMatrix& matrix, if (draw_panel_shadow == DrawPanelShadow::BELOW_WINDOW) uScreen->paintPanelShadow(region); - bool ret = gWindow->glDraw(matrix, attrib, region, mask); deco_win_->Draw(matrix, attrib, region, mask); + bool ret = gWindow->glDraw(matrix, attrib, region, mask); if (draw_panel_shadow == DrawPanelShadow::OVER_WINDOW) uScreen->paintPanelShadow(region); -- cgit v1.2.3 From b21cd4c3c835a574f771e2b8b62c5735b8536e76 Mon Sep 17 00:00:00 2001 From: handsome_feng <445865575@qq.com> Date: Wed, 4 Nov 2015 16:54:13 +0800 Subject: Added the launcher position setting in UnitySettings. (bzr r3999.7.2) --- plugins/unityshell/src/unityshell.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 53273ca77..88fee50c2 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -4004,8 +4004,10 @@ void UnityScreen::initLauncher() auto* launcher = static_cast(area); int launcher_width = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); + int launcher_height = h - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); unity::Settings::Instance().SetLauncherWidth(launcher_width, launcher->monitor); + unity::Settings::Instance().SetLauncherHeight(launcher_height, launcher->monitor); shortcut_controller_->SetAdjustment(launcher_width, panel_style_.PanelHeight(launcher->monitor)); CompOption::Value v(launcher_width); -- cgit v1.2.3 From 105aac52fecb82a4bcfdaeb748dc4056ea7c1411 Mon Sep 17 00:00:00 2001 From: handsome_feng <445865575@qq.com> Date: Wed, 11 Nov 2015 16:01:50 +0800 Subject: use launchersize instead of launcherWidth/launcherHeight (bzr r3999.7.3) --- plugins/unityshell/src/unityshell.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 88fee50c2..dd861c5a2 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -78,6 +78,7 @@ #include "UScreen.h" #include "config.h" +#include "unity-shared/UnitySettings.h" /* FIXME: once we get a better method to add the toplevel windows to the accessible root object, this include would not be required */ @@ -3764,9 +3765,9 @@ bool UnityScreen::layoutSlotsAndAssignWindows() } auto max_bounds = NuxGeometryFromCompRect(output.workArea()); - if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER) + if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER && Settings::Instance().launcher_position() == LauncherPosition::LEFT) { - int monitor_width = unity_settings_.LauncherWidth(monitor); + int monitor_width = unity_settings_.LauncherSize(monitor); max_bounds.x += monitor_width; max_bounds.width -= monitor_width; } @@ -4003,14 +4004,19 @@ void UnityScreen::initLauncher() * that must not be considered when drawing an overlay */ auto* launcher = static_cast(area); - int launcher_width = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); - int launcher_height = h - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); + int launcher_size = 0; + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + launcher_size = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); + else + launcher_size = h - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); - unity::Settings::Instance().SetLauncherWidth(launcher_width, launcher->monitor); - unity::Settings::Instance().SetLauncherHeight(launcher_height, launcher->monitor); - shortcut_controller_->SetAdjustment(launcher_width, panel_style_.PanelHeight(launcher->monitor)); + unity::Settings::Instance().SetLauncherSize(launcher_size, launcher->monitor); + if (Settings::Instance().launcher_position == LauncherPosition::LEFT) + shortcut_controller_->SetAdjustment(launcher_size, panel_style_.PanelHeight(launcher->monitor)); + else + shortcut_controller_->SetAdjustment(0, panel_style_.PanelHeight(launcher->monitor)); - CompOption::Value v(launcher_width); + CompOption::Value v(launcher_size); screen->setOptionForPlugin("expo", "x_offset", v); if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) -- cgit v1.2.3 From 4c796b9d968cd395d0096d56e3ff3bd5402c3ebc Mon Sep 17 00:00:00 2001 From: handsome_feng <445865575@qq.com> Date: Thu, 10 Dec 2015 17:21:31 +0800 Subject: fix some problem in autopilot (bzr r3999.7.10) --- plugins/unityshell/src/unityshell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 816e9657e..e519e48c9 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -4056,7 +4056,7 @@ void UnityScreen::initLauncher() manager->PromptLockScreen(); auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) { - /* The launcher geometry includes 1px used to draw the right margin + /* The launcher geometry includes 1px used to draw the right/top margin * that must not be considered when drawing an overlay */ auto* launcher = static_cast(area); -- cgit v1.2.3 From 39d1e3b03e20ac6789d37278ce6510147e61e8ea Mon Sep 17 00:00:00 2001 From: handsome_feng <445865575@qq.com> Date: Wed, 23 Dec 2015 17:29:24 +0800 Subject: cleanups (bzr r3999.7.16) --- plugins/unityshell/src/unityshell.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index a42b38980..471214e7b 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -4070,10 +4070,10 @@ void UnityScreen::InitUnityComponents() launcher_size = h - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); unity::Settings::Instance().SetLauncherSize(launcher_size, launcher->monitor); + int adjustment_x = 0; if (Settings::Instance().launcher_position == LauncherPosition::LEFT) - shortcut_controller_->SetAdjustment(launcher_size, panel_style_.PanelHeight(launcher->monitor)); - else - shortcut_controller_->SetAdjustment(0, panel_style_.PanelHeight(launcher->monitor)); + adjustment_x = launcher_size; + shortcut_controller_->SetAdjustment(adjustment_x, panel_style_.PanelHeight(launcher->monitor)); CompOption::Value v(launcher_size); screen->setOptionForPlugin("expo", "x_offset", v); -- cgit v1.2.3 From a6ec0ea7b641eb4f099c9ccb554fe6ae57016b5e Mon Sep 17 00:00:00 2001 From: handsome_feng <445865575@qq.com> Date: Tue, 12 Jan 2016 15:43:31 +0800 Subject: modified the x_offset for plugin 'expo' and 'scale' (bzr r3999.7.20) --- plugins/unityshell/src/unityshell.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 471214e7b..2ddf8c6c9 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -4063,25 +4063,31 @@ void UnityScreen::InitUnityComponents() * that must not be considered when drawing an overlay */ auto* launcher = static_cast(area); - int launcher_size = 0; - if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) - launcher_size = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); + auto launcher_position = Settings::Instance().launcher_position(); + + int size = 0; + if (launcher_position == LauncherPosition::LEFT) + size = w; else - launcher_size = h - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); + size = h; + int launcher_size = size - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); unity::Settings::Instance().SetLauncherSize(launcher_size, launcher->monitor); int adjustment_x = 0; - if (Settings::Instance().launcher_position == LauncherPosition::LEFT) + if (launcher_position == LauncherPosition::LEFT) adjustment_x = launcher_size; shortcut_controller_->SetAdjustment(adjustment_x, panel_style_.PanelHeight(launcher->monitor)); - CompOption::Value v(launcher_size); - screen->setOptionForPlugin("expo", "x_offset", v); + if (launcher_position == LauncherPosition::LEFT) + { + CompOption::Value v(launcher_size); + screen->setOptionForPlugin("expo", "x_offset", v); - if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) - v.set(0); + if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) + v.set(0); - screen->setOptionForPlugin("scale", "x_offset", v); + screen->setOptionForPlugin("scale", "x_offset", v); + } }; auto check_launchers_size = [this, on_launcher_size_changed] { -- cgit v1.2.3 From 7be1a2546ef19f6e0a2597e11bd43f3877967008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sun, 24 Jan 2016 12:12:20 -0800 Subject: InputRemove: remove scoped array (bzr r4067.1.3) --- plugins/unityshell/src/inputremover.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/inputremover.cpp b/plugins/unityshell/src/inputremover.cpp index b28e7a1e2..ec09f9eeb 100644 --- a/plugins/unityshell/src/inputremover.cpp +++ b/plugins/unityshell/src/inputremover.cpp @@ -19,12 +19,12 @@ * Sam Spilsbury */ -#include -#include #include "inputremover.h" +#include #include #include #include +#include namespace { @@ -347,8 +347,7 @@ compiz::WindowInputRemover::writeProperty (XRectangle *input, */ const size_t dataSize = headerSize + (nInput * 4); - boost::scoped_array data(new unsigned long[dataSize]); - + std::vector data(dataSize); data[0] = propVersion; data[1] = nInput; data[2] = inputOrdering; @@ -370,7 +369,7 @@ compiz::WindowInputRemover::writeProperty (XRectangle *input, type, fmt, PropModeReplace, - reinterpret_cast(data.get()), + reinterpret_cast(data.data()), dataSize); return true; -- cgit v1.2.3 From 567d8417e81ae89ab5225a866da69e0b9ace399a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 9 Feb 2016 02:26:22 +0100 Subject: CMake: use GNUInstallDirs with native multi-arch support We can now use CMAKE_INSTALL_*DIR instead of defining them manually. Also disable networkarea region plugin build by default. (bzr r4068.2.1) --- plugins/unityshell/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/CMakeLists.txt b/plugins/unityshell/CMakeLists.txt index 01a300589..b7e5b5f78 100644 --- a/plugins/unityshell/CMakeLists.txt +++ b/plugins/unityshell/CMakeLists.txt @@ -10,6 +10,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "") set(revert_compiz TRUE) endif() +set (libdir ${CMAKE_INSTALL_LIBDIR}) +set (includedir ${CMAKE_INSTALL_INCLUDEDIR}) +set (libdir ${CMAKE_INSTALL_LIBDIR}) +set (datadir ${CMAKE_INSTALL_FULL_DATADIR}) + compiz_plugin (unityshell PKGDEPS ${UNITY_PLUGIN_DEPS} PLUGINDEPS composite opengl compiztoolbox scale @@ -50,4 +55,4 @@ set_target_properties(unityshell # # Data # -install (FILES plugin-unityshell.png DESTINATION ${DATADIR}/ccsm/icons/hicolor/64x64/apps) +install (FILES plugin-unityshell.png DESTINATION ${COMPIZ_DATADIR}/ccsm/icons/hicolor/64x64/apps) -- cgit v1.2.3 From dff5930335a8ef8d73bfe7d25b9bb2d9101d5453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 9 Mar 2016 18:25:16 +0100 Subject: inputremover: load atom just once (bzr r3983.15.8) --- plugins/unityshell/src/inputremover.cpp | 13 +++++-------- plugins/unityshell/src/inputremover.h | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/inputremover.cpp b/plugins/unityshell/src/inputremover.cpp index ec09f9eeb..c24639c81 100644 --- a/plugins/unityshell/src/inputremover.cpp +++ b/plugins/unityshell/src/inputremover.cpp @@ -88,6 +88,7 @@ compiz::WindowInputRemover::WindowInputRemover (Display *dpy, Window shapeWindow, Window propWindow) : mDpy (dpy), + mProperty (XInternAtom (mDpy, "_UNITY_SAVED_WINDOW_SHAPE", False)), mShapeWindow (shapeWindow), mPropWindow (propWindow), mShapeMask (0), @@ -328,7 +329,6 @@ compiz::WindowInputRemover::writeProperty (XRectangle *input, int nInput, int inputOrdering) { - Atom prop = XInternAtom (mDpy, "_UNITY_SAVED_WINDOW_SHAPE", FALSE); Atom type = XA_CARDINAL; int fmt = 32; @@ -365,7 +365,7 @@ compiz::WindowInputRemover::writeProperty (XRectangle *input, /* No need to check return code, always returns 0 */ XChangeProperty(mDpy, mPropWindow, - prop, + mProperty, type, fmt, PropModeReplace, @@ -381,7 +381,6 @@ compiz::WindowInputRemover::queryProperty(XRectangle **input, int *inputOrdering) { - Atom prop = XInternAtom (mDpy, "_UNITY_SAVED_WINDOW_SHAPE", FALSE); Atom type = XA_CARDINAL; int fmt = 32; @@ -399,7 +398,7 @@ compiz::WindowInputRemover::queryProperty(XRectangle **input, * long the rest of the property is going to be */ if (!XGetWindowProperty(mDpy, mPropWindow, - prop, + mProperty, 0L, headerLength, FALSE, @@ -438,7 +437,7 @@ compiz::WindowInputRemover::queryProperty(XRectangle **input, if (!XGetWindowProperty(mDpy, mPropWindow, - prop, + mProperty, 0L, fullLength, FALSE, @@ -486,9 +485,7 @@ compiz::WindowInputRemover::queryProperty(XRectangle **input, void compiz::WindowInputRemover::clearProperty() { - Atom prop = XInternAtom (mDpy, "_UNITY_SAVED_WINDOW_SHAPE", FALSE); - - XDeleteProperty(mDpy, mPropWindow, prop); + XDeleteProperty(mDpy, mPropWindow, mProperty); } bool diff --git a/plugins/unityshell/src/inputremover.h b/plugins/unityshell/src/inputremover.h index d5c6f5a45..764327acb 100644 --- a/plugins/unityshell/src/inputremover.h +++ b/plugins/unityshell/src/inputremover.h @@ -97,6 +97,7 @@ private: void clearRectangles (); Display *mDpy; + Atom mProperty; Window mShapeWindow; Window mPropWindow; unsigned long mShapeMask; -- cgit v1.2.3 From 9559b59b73baea406d0d883fe5a20f97df1192bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 9 Mar 2016 18:28:36 +0100 Subject: UnityScreen: handle adding/removing supported atoms at this level (bzr r3983.15.9) --- plugins/unityshell/src/unityshell.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index f2dada7bf..265ed89bc 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -175,6 +175,12 @@ const std::string HUD_UNGRAB_WAIT = "hud-ungrab-wait"; const std::string FIRST_RUN_STAMP = "first_run.stamp"; const std::string LOCKED_STAMP = "locked.stamp"; } // namespace local + +namespace atom +{ +Atom _UNITY_SAVED_WINDOW_SHAPE = 0; +} + } // anon namespace UnityScreen::UnityScreen(CompScreen* screen) @@ -311,6 +317,8 @@ UnityScreen::UnityScreen(CompScreen* screen) CompositeScreenInterface::setHandler(cScreen); GLScreenInterface::setHandler(gScreen); ScaleScreenInterface::setHandler(sScreen); + + atom::_UNITY_SAVED_WINDOW_SHAPE = XInternAtom(screen->dpy(), "_UNITY_SAVED_WINDOW_SHAPE", False); screen->updateSupportedWmHints(); nux::NuxInitialize(0); @@ -504,8 +512,10 @@ UnityScreen::~UnityScreen() QuicklistManager::Destroy(); decoration::DataPool::Reset(); SaveLockStamp(false); - reset_glib_logging(); + + screen->addSupportedAtomsSetEnabled(this, false); + screen->updateSupportedWmHints(); } void UnityScreen::InitAltTabNextWindow() @@ -1768,6 +1778,7 @@ void UnityScreen::determineNuxDamage(CompRegion& nux_damage) void UnityScreen::addSupportedAtoms(std::vector& atoms) { screen->addSupportedAtoms(atoms); + atoms.push_back(atom::_UNITY_SAVED_WINDOW_SHAPE); deco_manager_->AddSupportedAtoms(atoms); } @@ -4180,13 +4191,17 @@ bool WindowHasInconsistentShapeRects(Display *d, Window w) int n; Atom *atoms = XListProperties(d, w, &n); bool has_inconsistent_shape = false; - static Atom unity_shape_rects_atom = XInternAtom(d, "_UNITY_SAVED_WINDOW_SHAPE", False); for (int i = 0; i < n; ++i) - if (atoms[i] == unity_shape_rects_atom) + { + if (atoms[i] == atom::_UNITY_SAVED_WINDOW_SHAPE) + { has_inconsistent_shape = true; + break; + } + } - XFree (atoms); + XFree(atoms); return has_inconsistent_shape; } } -- cgit v1.2.3 From bd4f8127fcd9945e3c27e24518f0d557c5f651cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 9 Mar 2016 18:30:50 +0100 Subject: UnityScreen: expose _UNITY_SHELL atom on _NET_SUPPORTED Just a way to be sure that we're running in unity (bzr r3983.15.10) --- plugins/unityshell/src/unityshell.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 265ed89bc..a4108cc9a 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -178,6 +178,7 @@ const std::string LOCKED_STAMP = "locked.stamp"; namespace atom { +Atom _UNITY_SHELL = 0; Atom _UNITY_SAVED_WINDOW_SHAPE = 0; } @@ -318,6 +319,7 @@ UnityScreen::UnityScreen(CompScreen* screen) GLScreenInterface::setHandler(gScreen); ScaleScreenInterface::setHandler(sScreen); + atom::_UNITY_SHELL = XInternAtom(screen->dpy(), "_UNITY_SHELL", False); atom::_UNITY_SAVED_WINDOW_SHAPE = XInternAtom(screen->dpy(), "_UNITY_SAVED_WINDOW_SHAPE", False); screen->updateSupportedWmHints(); @@ -1778,6 +1780,7 @@ void UnityScreen::determineNuxDamage(CompRegion& nux_damage) void UnityScreen::addSupportedAtoms(std::vector& atoms) { screen->addSupportedAtoms(atoms); + atoms.push_back(atom::_UNITY_SHELL); atoms.push_back(atom::_UNITY_SAVED_WINDOW_SHAPE); deco_manager_->AddSupportedAtoms(atoms); } -- cgit v1.2.3 From b67c6cb27fbeea70156f3d72b86a29f1c85883e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 30 Mar 2016 20:18:07 +0200 Subject: Launcher, Dash, Panel, Lockscreen: properly use themed TextureCache reloading textures on theme changes (bzr r4093.2.7) --- plugins/unityshell/src/unityshell.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 9be648368..de308d819 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -41,6 +41,7 @@ #include "PanelView.h" #include "PluginAdapter.h" #include "QuicklistManager.h" +#include "TextureCache.h" #include "Timer.h" #include "XKeyboardUtil.h" #include "unityshell.h" @@ -4006,6 +4007,10 @@ void UnityScreen::InitUnityComponents() bghash_.reset(new BGHash()); LOG_INFO(logger) << "InitUnityComponents-BGHash " << timer.ElapsedSeconds() << "s"; + // Ugly hack to ensure that texture cache will connect promptly to theme changed signal + TextureCache::GetDefault(); + LOG_INFO(logger) << "InitUnityComponents-TextureCache " << timer.ElapsedSeconds() << "s"; + auto xdnd_collection_window = std::make_shared(); auto xdnd_start_stop_notifier = std::make_shared(); auto xdnd_manager = std::make_shared(xdnd_start_stop_notifier, xdnd_collection_window); -- cgit v1.2.3 From e38d767ec0f43e20457b7622fd5f37f4434fc68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 31 Mar 2016 05:59:33 +0200 Subject: UnityScreen: Load the panel shadow from theme and properly scale it (bzr r4093.2.20) --- plugins/unityshell/src/unityshell.cpp | 23 +++++++++++++++-------- plugins/unityshell/src/unityshell.h | 1 + 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index de308d819..417269462 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -42,6 +42,7 @@ #include "PluginAdapter.h" #include "QuicklistManager.h" #include "TextureCache.h" +#include "ThemeSettings.h" #include "Timer.h" #include "XKeyboardUtil.h" #include "unityshell.h" @@ -447,10 +448,8 @@ UnityScreen::UnityScreen(CompScreen* screen) InitGesturesSupport(); - CompString name(PKGDATADIR"/panel-shadow.png"); - CompString pname("unityshell"); - CompSize size(1, 20); - _shadow_texture = GLTexture::readImageToTexture(name, pname, size); + LoadPanelShadowTexture(); + theme::Settings::Get()->theme.changed.connect(sigc::hide(sigc::mem_fun(this, &UnityScreen::LoadPanelShadowTexture))); ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, [this](GVariant * data) { @@ -708,6 +707,14 @@ void UnityScreen::nuxEpilogue() glDisable(GL_SCISSOR_TEST); } +void UnityScreen::LoadPanelShadowTexture() +{ + CompString name(theme::Settings::Get()->ThemedFilePath("panel_shadow", {PKGDATADIR})); + CompString pname; + CompSize size; + _shadow_texture = GLTexture::readImageToTexture(name, pname, size); +} + void UnityScreen::setPanelShadowMatrix(GLMatrix const& matrix) { panel_shadow_matrix_ = matrix; @@ -715,15 +722,15 @@ void UnityScreen::setPanelShadowMatrix(GLMatrix const& matrix) void UnityScreen::FillShadowRectForOutput(CompRect& shadowRect, CompOutput const& output) { - if (_shadow_texture.empty ()) + if (_shadow_texture.empty()) return; - int monitor = PluginAdapter::Default().MonitorGeometryIn(NuxGeometryFromCompRect(output)); - float panel_h = static_cast(panel_style_.PanelHeight(monitor)); + int monitor = WM.MonitorGeometryIn(NuxGeometryFromCompRect(output)); + float panel_h = panel_style_.PanelHeight(monitor); float shadowX = output.x(); float shadowY = output.y() + panel_h; float shadowWidth = output.width(); - float shadowHeight = _shadow_texture[0]->height(); + float shadowHeight = _shadow_texture[0]->height() * unity_settings_.em(monitor)->DPIScale(); shadowRect.setGeometry(shadowX, shadowY, shadowWidth, shadowHeight); } diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 7235ac118..cc714b37d 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -292,6 +292,7 @@ private: void OnInitiateSpread(); void OnTerminateSpread(); + void LoadPanelShadowTexture(); void DamagePanelShadow(); void OnViewHidden(nux::BaseWindow *bw); -- cgit v1.2.3 From 3f9213dc3239e44ef2cf32d3ef959dcdd023522d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 31 Mar 2016 07:57:11 +0200 Subject: Launcher, Panel, TextInput: use cache texture_invalidated to reload textures So we can remove we workaround in UnitySettings as the signal is always emitted after removing all the themed textures that we have. (bzr r4093.2.28) --- plugins/unityshell/src/unityshell.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 417269462..5070f37da 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -41,7 +41,6 @@ #include "PanelView.h" #include "PluginAdapter.h" #include "QuicklistManager.h" -#include "TextureCache.h" #include "ThemeSettings.h" #include "Timer.h" #include "XKeyboardUtil.h" @@ -4014,10 +4013,6 @@ void UnityScreen::InitUnityComponents() bghash_.reset(new BGHash()); LOG_INFO(logger) << "InitUnityComponents-BGHash " << timer.ElapsedSeconds() << "s"; - // Ugly hack to ensure that texture cache will connect promptly to theme changed signal - TextureCache::GetDefault(); - LOG_INFO(logger) << "InitUnityComponents-TextureCache " << timer.ElapsedSeconds() << "s"; - auto xdnd_collection_window = std::make_shared(); auto xdnd_start_stop_notifier = std::make_shared(); auto xdnd_manager = std::make_shared(xdnd_start_stop_notifier, xdnd_collection_window); -- cgit v1.2.3 From 0f15110afb7499bbc12cb99a763ecc35a106e0f5 Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Tue, 5 Apr 2016 15:23:27 +0200 Subject: Fix typo. Fixes LP: #1559427 (bzr r4100.1.1) --- plugins/unityshell/unityshell_xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/unityshell_xml.in b/plugins/unityshell/unityshell_xml.in index 56a95842a..ee1469345 100644 --- a/plugins/unityshell/unityshell_xml.in +++ b/plugins/unityshell/unityshell_xml.in @@ -95,7 +95,7 @@ -- cgit v1.2.3 From c6621825e77a24ca546c93d6f5d0c5d00d1c7f4e Mon Sep 17 00:00:00 2001 From: handsome_feng <445865575@qq.com> Date: Tue, 26 Apr 2016 15:48:33 +0800 Subject: Change the x_offset of expo when launcher position changed (bzr r4105.10.1) --- plugins/unityshell/src/unityshell.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 5070f37da..586c7b528 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -4098,16 +4098,16 @@ void UnityScreen::InitUnityComponents() adjustment_x = launcher_size; shortcut_controller_->SetAdjustment(adjustment_x, panel_style_.PanelHeight(launcher->monitor)); - if (launcher_position == LauncherPosition::LEFT) - { - CompOption::Value v(launcher_size); - screen->setOptionForPlugin("expo", "x_offset", v); + CompOption::Value v(launcher_size); + if (launcher_position == LauncherPosition::BOTTOM) + v.set(0); - if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) - v.set(0); + screen->setOptionForPlugin("expo", "x_offset", v); - screen->setOptionForPlugin("scale", "x_offset", v); - } + if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) + v.set(0); + + screen->setOptionForPlugin("scale", "x_offset", v); }; auto check_launchers_size = [this, on_launcher_size_changed] { @@ -4124,6 +4124,10 @@ void UnityScreen::InitUnityComponents() check_launchers_size(); }); + Settings::Instance().launcher_position.changed.connect([this, check_launchers_size] (LauncherPosition const&) { + check_launchers_size(); + }); + check_launchers_size(); launcher_controller_->options()->scroll_inactive_icons = optionGetScrollInactiveIcons(); -- cgit v1.2.3 From 3ba274ede9e1c557523df2c00f35067ee3390f0c Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Tue, 26 Apr 2016 12:34:18 +0200 Subject: Properly calculate array indexes to avoid crashes. Fixes LP: #1570843 (bzr r4105.3.1) --- plugins/unityshell/src/inputremover.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/inputremover.cpp b/plugins/unityshell/src/inputremover.cpp index c24639c81..de675ee05 100644 --- a/plugins/unityshell/src/inputremover.cpp +++ b/plugins/unityshell/src/inputremover.cpp @@ -354,7 +354,7 @@ compiz::WindowInputRemover::writeProperty (XRectangle *input, for (int i = 0; i < nInput; ++i) { - const unsigned int position = dataSize + (i * 4); + const unsigned int position = headerSize + (i * 4); data[position + 0] = input[i].x; data[position + 1] = input[i].y; -- cgit v1.2.3 From d38a15cb3392fde6a0d849769ce97ecb4e632898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 30 Apr 2016 20:12:56 +0200 Subject: UnityScreen, UnityWindow: cleanup a little the code, and ensure overridden CompositeWindow functions get actually called There would be still a lot to do in this scenario, but still a start... (bzr r4105.7.1) --- plugins/unityshell/src/unityshell.cpp | 35 ++-- plugins/unityshell/src/unityshell.h | 322 ++++++++++++++++------------------ 2 files changed, 167 insertions(+), 190 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 5070f37da..2237706fa 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -203,8 +203,7 @@ UnityScreen::UnityScreen(CompScreen* screen) , doShellRepaint(false) , didShellRepaint(false) , allowWindowPaint(false) - , _key_nav_mode_requested(false) - , _last_output(nullptr) + , last_output_(nullptr) , force_draw_countdown_(0) , firstWindowAboveShell(nullptr) , onboard_(nullptr) @@ -215,12 +214,13 @@ UnityScreen::UnityScreen(CompScreen* screen) , first_menu_keypress_time_(0) , paint_panel_under_dash_(false) , scale_just_activated_(false) - , big_tick_(0) , screen_introspection_(screen) , ignore_redraw_request_(false) , dirty_helpers_on_this_frame_(false) - , back_buffer_age_(0) , is_desktop_active_(false) + , key_nav_mode_requested_(false) + , big_tick_(0) + , back_buffer_age_(0) { Timer timer; #ifndef USE_GLES @@ -341,7 +341,7 @@ UnityScreen::UnityScreen(CompScreen* screen) tick_source_.reset(new na::TickSource); animation_controller_.reset(new na::AnimationController(*tick_source_)); - wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::onRedrawRequested)); + wt->RedrawRequested.connect(sigc::mem_fun(this, &UnityScreen::OnRedrawRequested)); unity_a11y_init(wt.get()); @@ -692,7 +692,7 @@ void UnityScreen::nuxEpilogue() /* In some unknown place inside nux drawing we change the viewport without * setting it back to the default one, so we need to restore it before allowing * compiz to take the scene */ - auto* o = _last_output; + auto* o = last_output_; glViewport(o->x(), screen->height() - o->y2(), o->width(), o->height()); glDepthRange(0, 1); @@ -748,7 +748,7 @@ void UnityScreen::paintPanelShadow(CompRegion const& clip) if (WM.IsExpoActive()) return; - CompOutput* output = _last_output; + CompOutput* output = last_output_; if (fullscreenRegion.contains(*output)) return; @@ -863,7 +863,7 @@ void UnityScreen::DamageBlurUpdateRegion(nux::Geometry const& blur_update) void UnityScreen::paintDisplay() { - CompOutput *output = _last_output; + CompOutput *output = last_output_; DrawPanelUnderDash(); @@ -990,7 +990,7 @@ void UnityScreen::DrawPanelUnderDash() auto const& output_dev = screen->currentOutputDev(); - if (_last_output->id() != output_dev.id()) + if (last_output_->id() != output_dev.id()) return; auto graphics_engine = nux::GetGraphicsDisplay()->GetGraphicsEngine(); @@ -1485,7 +1485,7 @@ bool UnityScreen::glPaintOutput(const GLScreenPaintAttrib& attrib, ); allowWindowPaint = true; - _last_output = output; + last_output_ = output; paint_panel_under_dash_ = false; // CompRegion has no clear() method. So this is the fastest alternative. @@ -1522,7 +1522,7 @@ void UnityScreen::glPaintTransformedOutput(const GLScreenPaintAttrib& attrib, * this output. * * However, damaging nux has a side effect of notifying compiz - * through onRedrawRequested that we need to queue another frame. + * through OnRedrawRequested that we need to queue another frame. * In most cases that would be desirable, and in the case where * we did that in damageCutoff, it would not be a problem as compiz * does not queue up new frames for damage that can be processed @@ -1687,7 +1687,7 @@ void UnityScreen::donePaint() wt->ForeignFrameEnded(); if (animation_controller_->HasRunningAnimations()) - onRedrawRequested(); + OnRedrawRequested(); for (auto it = ShowdesktopHandler::animating_windows.begin(); it != ShowdesktopHandler::animating_windows.end();) { @@ -1813,7 +1813,7 @@ void UnityScreen::handleEvent(XEvent* event) else if (!screen->grabbed() && event->xfocus.mode == NotifyWhileGrabbed) wm.OnScreenGrabbed(); - if (_key_nav_mode_requested) + if (key_nav_mode_requested_) { // Close any overlay that is open. if (launcher_controller_->IsOverlayOpen()) @@ -1821,7 +1821,7 @@ void UnityScreen::handleEvent(XEvent* event) dash_controller_->HideDash(); hud_controller_->HideHud(); } - _key_nav_mode_requested = false; + key_nav_mode_requested_ = false; launcher_controller_->KeyNavGrab(); } break; @@ -2343,7 +2343,7 @@ bool UnityScreen::setKeyboardFocusKeyInitiate(CompAction* action, else if (WM.IsExpoActive()) WM.TerminateExpo(); - _key_nav_mode_requested = true; + key_nav_mode_requested_ = true; return true; } @@ -3542,7 +3542,7 @@ void UnityScreen::InitNuxThread(nux::NThread* thread, void* data) LOG_INFO(logger) << "UnityScreen::InitNuxThread: " << timer.ElapsedSeconds() << "s"; } -void UnityScreen::onRedrawRequested() +void UnityScreen::OnRedrawRequested() { if (!ignore_redraw_request_) cScreen->damagePending(); @@ -4243,6 +4243,7 @@ UnityWindow::UnityWindow(CompWindow* window) { WindowInterface::setHandler(window); GLWindowInterface::setHandler(gWindow); + CompositeWindowInterface::setHandler(cWindow); ScaleWindowInterface::setHandler(ScaleWindow::get(window)); PluginAdapter::Default().OnLeaveDesktop(); @@ -4608,7 +4609,7 @@ void UnityWindow::paintInnerGlow(nux::Geometry glow_geo, GLMatrix const& matrix, void UnityWindow::paintThumbnail(nux::Geometry const& geo, float alpha, float parent_alpha, float scale_ratio, unsigned deco_height, bool selected) { GLMatrix matrix; - matrix.toScreenSpace(uScreen->_last_output, -DEFAULT_Z_CAMERA); + matrix.toScreenSpace(uScreen->last_output_, -DEFAULT_Z_CAMERA); last_bound = geo; GLWindowPaintAttrib attrib = gWindow->lastPaintAttrib(); diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index cc714b37d..b63814999 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -2,12 +2,12 @@ /* Compiz unity plugin * unity.h * - * Copyright (c) 2010-11 Canonical Ltd. + * Copyright(c) 2010-11 Canonical Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 - * of the License, or (at your option) any later version. + * of the License, or(at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -120,61 +120,69 @@ public: UnityScreen(CompScreen* s); ~UnityScreen(); - /* We store these to avoid unecessary calls to ::get */ - CompScreen* screen; - CompositeScreen* cScreen; - GLScreen* gScreen; - ScaleScreen* sScreen; - - /* prepares nux for drawing */ - void nuxPrologue(); - /* pops nux draw stack */ - void nuxEpilogue(); - - /* nux draw wrapper */ - void paintDisplay(); - void paintPanelShadow(CompRegion const& clip); - void setPanelShadowMatrix(const GLMatrix& matrix); - - void updateBlurDamage(); - void damageCutoff(); - void preparePaint (int ms); - void donePaint (); + switcher::Controller::Ptr switcher_controller(); + launcher::Controller::Ptr launcher_controller(); + lockscreen::Controller::Ptr lockscreen_controller(); - void RaiseInputWindows(); + void SetUpAndShowSwitcher(switcher::ShowMode show_mode = switcher::ShowMode::CURRENT_VIEWPORT); - void - handleCompizEvent (const char *pluginName, - const char *eventName, - CompOption::Vector &o); +protected: + void damageCutoff() override; + void preparePaint(int ms) override; + void donePaint() override; - void damageRegion(const CompRegion ®ion); + void handleCompizEvent(const char *pluginName, const char *eventName, CompOption::Vector &o) override; + void damageRegion(const CompRegion ®ion) override; /* paint on top of all windows if we could not find a window * to paint underneath */ - bool glPaintOutput(const GLScreenPaintAttrib&, - const GLMatrix&, - const CompRegion&, - CompOutput*, - unsigned int); + bool glPaintOutput(const GLScreenPaintAttrib&, const GLMatrix&, const CompRegion&, CompOutput*, unsigned int) override; /* paint in the special case that the output is transformed */ - void glPaintTransformedOutput(const GLScreenPaintAttrib&, - const GLMatrix&, - const CompRegion&, - CompOutput*, - unsigned int); + void glPaintTransformedOutput(const GLScreenPaintAttrib&, const GLMatrix&, const CompRegion&, CompOutput*, unsigned int) override; /* handle X11 events */ - void handleEvent(XEvent*); - void addSupportedAtoms(std::vector&); + void handleEvent(XEvent*) override; + void addSupportedAtoms(std::vector&) override; /* handle showdesktop */ - void enterShowDesktopMode (); - void leaveShowDesktopMode (CompWindow *w); + void enterShowDesktopMode() override; + void leaveShowDesktopMode(CompWindow *w) override; /* window scaling */ - bool layoutSlotsAndAssignWindows(); + bool layoutSlotsAndAssignWindows() override; + bool getMipmap() override { return false; } + + /* Handle changes in the number of workspaces by showing the switcher + * or not showing the switcher */ + bool setOptionForPlugin(const char* plugin, const char* name, CompOption::Value& v) override; + + /* init plugin actions for screen */ + bool initPluginForScreen(CompPlugin* p) override; + + void outputChangeNotify() override; + + CompAction::Vector& getActions() override; + + std::string GetName() const override; + void AddProperties(debug::IntrospectionData&) override; + +private: + static void InitNuxThread(nux::NThread* thread, void* data); + void InitUnityComponents(); + bool InitPluginActions(); + void InitAltTabNextWindow(); + + /* prepares nux for drawing */ + void nuxPrologue(); + /* pops nux draw stack */ + void nuxEpilogue(); + + /* nux draw wrapper */ + void paintDisplay(); + void paintPanelShadow(CompRegion const& clip); + void setPanelShadowMatrix(const GLMatrix& matrix); + void updateBlurDamage(); bool showMenuBarInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool showMenuBarTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options); @@ -190,9 +198,7 @@ public: bool setKeyboardFocusKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabInitiateCommon(CompAction* action, switcher::ShowMode mode); - bool altTabTerminateCommon(CompAction* action, - CompAction::State state, - CompOption::Vector& options); + bool altTabTerminateCommon(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabForwardInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabPrevInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); @@ -201,10 +207,9 @@ public: bool altTabNextWindowInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool altTabPrevWindowInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); - bool ShowHud(); - /* handle hud key activations */ bool ShowHudInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); bool ShowHudTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options); + 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); @@ -214,56 +219,28 @@ public: /* handle option changes and change settings inside of the * panel and dock views */ void optionChanged(CompOption*, Options num); + void OnMinimizeDurationChanged(); - /* Handle changes in the number of workspaces by showing the switcher - * or not showing the switcher */ - bool setOptionForPlugin(const char* plugin, const char* name, - CompOption::Value& v); - - /* init plugin actions for screen */ - bool initPluginForScreen(CompPlugin* p); - - void outputChangeNotify(); void NeedsRelayout(); void ScheduleRelayout(guint timeout); - bool forcePaintOnTop (); - - void SetUpAndShowSwitcher(switcher::ShowMode show_mode = switcher::ShowMode::CURRENT_VIEWPORT); - - void OnMinimizeDurationChanged(); + bool forcePaintOnTop(); void OnLockScreenRequested(); void OnScreenLocked(); void OnScreenUnlocked(); void SaveLockStamp(bool); - switcher::Controller::Ptr switcher_controller(); - launcher::Controller::Ptr launcher_controller(); - lockscreen::Controller::Ptr lockscreen_controller(); - bool DoesPointIntersectUnityGeos(nux::Point const& pt); ui::LayoutWindow::Ptr GetSwitcherDetailLayoutWindow(Window window) const; - CompAction::Vector& getActions(); - -protected: - std::string GetName() const; - void AddProperties(debug::IntrospectionData&); - -private: enum CancelActionTarget { LAUNCHER_SWITCHER, SHORTCUT_HINT }; - static void InitNuxThread(nux::NThread* thread, void* data); - void InitUnityComponents(); - bool InitPluginActions(); - void InitAltTabNextWindow(); - void SendExecuteCommand(); void EnsureSuperKeybindings(); @@ -273,21 +250,22 @@ private: void compizDamageNux(CompRegion const& region); void determineNuxDamage(CompRegion &nux_damage); - void onRedrawRequested(); void Relayout(); + void RaiseInputWindows(); static void OnStartKeyNav(GVariant* data, void* value); static void OnExitKeyNav(GVariant* data, void* value); void restartLauncherKeyNav(); - void OnDashRealized (); - + bool ShowHud(); void RaiseOSK(); + void OnDashRealized(); void OnLauncherStartKeyNav(GVariant* data); void OnLauncherEndKeyNav(GVariant* data); void OnSwitcherDetailChanged(bool detail); + void OnRedrawRequested(); void OnInitiateSpread(); void OnTerminateSpread(); @@ -307,20 +285,24 @@ private: void DrawPanelUnderDash(); - void FillShadowRectForOutput(CompRect &shadowRect, - CompOutput const &output); + void FillShadowRectForOutput(CompRect &shadowRect, CompOutput const &output); unsigned CompizModifiersToNux(unsigned input) const; unsigned XModifiersToNux(unsigned input) const; void UpdateCloseWindowKey(CompAction::KeyBinding const&); void UpdateActivateIndicatorsKey(); - bool getMipmap () override { return false; } - void DamageBlurUpdateRegion(nux::Geometry const&); void ShowFirstRunHints(); void SpreadAppWindows(bool anywhere); + bool queryForShader(); + + /* We store these to avoid unecessary calls to ::get */ + CompScreen* screen; + CompositeScreen* cScreen; + GLScreen* gScreen; + ScaleScreen* sScreen; std::unique_ptr tick_source_; std::unique_ptr animation_controller_; @@ -365,8 +347,8 @@ private: /* Subscription for gestures that manipulate windows. */ std::unique_ptr gestures_sub_windows_; - bool needsRelayout; - bool super_keypressed_; + bool needsRelayout; + bool super_keypressed_; typedef std::shared_ptr CompActionPtr; typedef std::vector ShortcutActions; ShortcutActions _shortcut_actions; @@ -380,11 +362,10 @@ private: GLTexture::List _shadow_texture; /* handle paint order */ - bool doShellRepaint; - bool didShellRepaint; - bool allowWindowPaint; - bool _key_nav_mode_requested; - CompOutput* _last_output; + bool doShellRepaint; + bool didShellRepaint; + bool allowWindowPaint; + CompOutput* last_output_; /* a small count-down work-a-around * to force full redraws of the shell @@ -400,16 +381,14 @@ private: ::GLFramebufferObject *oldFbo; - bool queryForShader (); - int overlay_monitor_; CompScreen::GrabHandle grab_index_; - CompWindowList fullscreen_windows_; - bool painting_tray_; - unsigned int tray_paint_mask_; - unsigned int last_scroll_event_; - int hud_keypress_time_; - int first_menu_keypress_time_; + CompWindowList fullscreen_windows_; + bool painting_tray_; + unsigned int tray_paint_mask_; + unsigned int last_scroll_event_; + int hud_keypress_time_; + int first_menu_keypress_time_; GLMatrix panel_shadow_matrix_; @@ -418,9 +397,6 @@ private: bool scale_just_activated_; WindowMinimizeSpeedController minimize_speed_controller_; - - uint64_t big_tick_; - debug::ScreenIntrospection screen_introspection_; UBusManager ubus_manager_; @@ -430,12 +406,12 @@ private: CompRegion buffered_compiz_damage_this_frame_; CompRegion buffered_compiz_damage_last_frame_; - bool ignore_redraw_request_; - bool dirty_helpers_on_this_frame_; - - unsigned int back_buffer_age_; - + bool ignore_redraw_request_; + bool dirty_helpers_on_this_frame_; bool is_desktop_active_; + bool key_nav_mode_requested_; + uint64_t big_tick_; + unsigned int back_buffer_age_; friend class UnityWindow; friend class debug::ScreenIntrospection; @@ -445,6 +421,7 @@ private: class UnityWindow : public WindowInterface, public GLWindowInterface, + public CompositeWindowInterface, public ShowdesktopHandlerWindowInterface, public compiz::WindowInputRemoverLockAcquireInterface, public WrapableHandler, @@ -457,98 +434,91 @@ public: UnityWindow(CompWindow*); ~UnityWindow(); - CompWindow* window; - CompositeWindow* cWindow; - GLWindow* gWindow; - - nux::Geometry last_bound; + void minimize() override; + void unminimize() override; + bool minimized() const override; + bool focus() override; + void activate() override; - void minimize(); - void unminimize(); - bool minimized() const; - bool focus(); - void activate(); + //! Emited when CompWindowNotifyBeforeDestroy is received + sigc::signal being_destroyed; - void updateFrameRegion(CompRegion ®ion); - void getOutputExtents(CompWindowExtents& output); +protected: + void updateFrameRegion(CompRegion ®ion) override; + void getOutputExtents(CompWindowExtents& output) override; /* occlusion detection * and window hiding */ - bool glPaint(GLWindowPaintAttrib const&, GLMatrix const&, CompRegion const&, unsigned mask); + bool glPaint(GLWindowPaintAttrib const&, GLMatrix const&, CompRegion const&, unsigned mask) override; /* basic window draw function */ - bool glDraw(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask); + bool glDraw(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask) override; + bool damageRect(bool initial, CompRect const&) override; - bool damageRect(bool initial, CompRect const&); + void updateIconPos(int &wx, int &wy, int x, int y, float width, float height) override; + void windowNotify(CompWindowNotify n) override; + void moveNotify(int x, int y, bool immediate) override; + void resizeNotify(int x, int y, int w, int h) override; + void stateChangeNotify(unsigned int lastState) override; - void updateIconPos (int &wx, int &wy, int x, int y, float width, float height); - void windowNotify(CompWindowNotify n); - void moveNotify(int x, int y, bool immediate); - void resizeNotify(int x, int y, int w, int h); - void stateChangeNotify(unsigned int lastState); + bool place(CompPoint& pos) override; + void scalePaintDecoration(GLWindowPaintAttrib const&, GLMatrix const&, CompRegion const&, unsigned mask) override; - bool place(CompPoint& pos); - CompPoint tryNotIntersectUI(CompPoint& pos); - nux::Geometry GetScaledGeometry(); - nux::Geometry GetLayoutWindowGeometry(); - - void paintThumbnail(nux::Geometry const& bounding, float parent_alpha, float alpha, float scale_ratio, unsigned deco_height, bool selected); - - void enterShowDesktop(); - void leaveShowDesktop(); - bool HandleAnimations(unsigned int ms); - - bool handleEvent(XEvent *event); - void scalePaintDecoration(GLWindowPaintAttrib const&, GLMatrix const&, CompRegion const&, unsigned mask); - - //! Emited when CompWindowNotifyBeforeDestroy is received - sigc::signal being_destroyed; - - -protected: - std::string GetName() const; - void AddProperties(debug::IntrospectionData&); + std::string GetName() const override; + void AddProperties(debug::IntrospectionData&) override; private: typedef compiz::CompizMinimizedWindowHandler UnityMinimizedHandler; typedef std::shared_ptr PixmapTexturePtr; - void DoEnableFocus (); - void DoDisableFocus (); - - bool IsOverrideRedirect (); - bool IsManaged (); - bool IsGrabbed (); - bool IsDesktopOrDock (); - bool IsSkipTaskbarOrPager (); - bool IsHidden (); - bool IsInShowdesktopMode (); - bool IsShaded (); - bool IsMinimized (); + void DoEnableFocus(); + void DoDisableFocus(); + + bool IsOverrideRedirect(); + bool IsManaged(); + bool IsGrabbed(); + bool IsDesktopOrDock(); + bool IsSkipTaskbarOrPager(); + bool IsHidden(); + bool IsInShowdesktopMode(); + bool IsShaded(); + bool IsMinimized(); bool CanBypassLockScreen() const; - void DoOverrideFrameRegion (CompRegion &r); + void DoOverrideFrameRegion(CompRegion &r); - void DoHide (); - void DoNotifyHidden (); - void DoShow (); - void DoNotifyShown (); + void DoHide(); + void DoNotifyHidden(); + void DoShow(); + void DoNotifyShown(); void OnInitiateSpread(); void OnTerminateSpread(); - void DoAddDamage (); - ShowdesktopHandlerWindowInterface::PostPaintAction DoHandleAnimations (unsigned int ms); + CompPoint tryNotIntersectUI(CompPoint& pos); + nux::Geometry GetScaledGeometry(); + nux::Geometry GetLayoutWindowGeometry(); + + void enterShowDesktop(); + void leaveShowDesktop(); + bool HandleAnimations(unsigned int ms); + + bool handleEvent(XEvent *event); + void paintThumbnail(nux::Geometry const& bounding, float parent_alpha, float alpha, float scale_ratio, unsigned deco_height, bool selected); - void DoMoveFocusAway (); + void DoAddDamage(); + ShowdesktopHandlerWindowInterface::PostPaintAction DoHandleAnimations(unsigned int ms); - void DoDeleteHandler (); + void DoMoveFocusAway(); - unsigned int GetNoCoreInstanceMask (); + void DoDeleteHandler(); - compiz::WindowInputRemoverLock::Ptr GetInputRemover (); + unsigned int GetNoCoreInstanceMask(); + + compiz::WindowInputRemoverLock::Ptr GetInputRemover(); void RenderDecoration(compiz_utils::CairoContext const&, double aspect = 1.0f); - void RenderTitle(compiz_utils::CairoContext const&, int x, int y, int width, int height, double aspect = 1.0f); + void RenderTitle(compiz_utils::CairoContext const&, int x, int y, int width, + int height, double aspect = 1.0f); void DrawTexture(GLTexture::List const& textures, GLWindowPaintAttrib const&, GLMatrix const&, unsigned mask, int x, int y, double aspect = 1.0f); @@ -565,7 +535,12 @@ public: std::unique_ptr mMinimizeHandler; private: + CompWindow* window; + CompositeWindow* cWindow; + GLWindow* gWindow; + std::unique_ptr mShowdesktopHandler; + nux::Geometry last_bound; PixmapTexturePtr decoration_tex_; PixmapTexturePtr decoration_selected_tex_; std::string decoration_title_; @@ -579,6 +554,7 @@ private: glib::Source::UniquePtr focus_desktop_timeout_; friend class UnityScreen; + friend UnityMinimizedHandler; }; -- cgit v1.2.3 From 79d587ad0d2dfc3a647a0fd4de708e2cb8279818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 11 May 2016 01:03:20 +0200 Subject: UnityShell: fix header license (bzr r4105.7.2) --- plugins/unityshell/src/unityshell.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index b63814999..8f3d89c08 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -2,12 +2,12 @@ /* Compiz unity plugin * unity.h * - * Copyright(c) 2010-11 Canonical Ltd. + * Copyright (c) 2010-16 Canonical Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 - * of the License, or(at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of -- cgit v1.2.3 From 2b37f43a9fce615b13b5f6cc5d4b876430689a70 Mon Sep 17 00:00:00 2001 From: handsome_feng <445865575@qq.com> Date: Wed, 11 May 2016 17:19:36 +0800 Subject: Added y_bottom_offset to expo and scale plugins (bzr r4105.10.2) --- plugins/unityshell/src/unityshell.cpp | 55 ++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 586c7b528..3126d5b4b 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -3623,7 +3623,17 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) int scale_offset = (launcher_options->hide_mode == LAUNCHER_HIDE_NEVER) ? 0 : launcher_controller_->launcher().GetWidth(); CompOption::Value v(scale_offset); - screen->setOptionForPlugin("scale", "x_offset", v); + CompOption::Value bv(0); + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + { + screen->setOptionForPlugin("scale", "x_offset", v); + screen->setOptionForPlugin("scale", "y_bottom_offset", bv); + } + else + { + screen->setOptionForPlugin("scale", "x_offset", bv); + screen->setOptionForPlugin("scale", "y_bottom_offset", v); + } break; } case UnityshellOptions::BacklightMode: @@ -3834,11 +3844,19 @@ bool UnityScreen::layoutSlotsAndAssignWindows() } auto max_bounds = NuxGeometryFromCompRect(output.workArea()); - if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER && Settings::Instance().launcher_position() == LauncherPosition::LEFT) + if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER) { - int monitor_width = unity_settings_.LauncherSize(monitor); - max_bounds.x += monitor_width; - max_bounds.width -= monitor_width; + if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) + { + int monitor_width = unity_settings_.LauncherSize(monitor); + max_bounds.x += monitor_width; + max_bounds.width -= monitor_width; + } + else if (Settings::Instance().launcher_position() == LauncherPosition::BOTTOM) + { + int launcher_size = unity_settings_.LauncherSize(monitor); + max_bounds.height -= launcher_size; + } } nux::Geometry final_bounds; @@ -4099,15 +4117,32 @@ void UnityScreen::InitUnityComponents() shortcut_controller_->SetAdjustment(adjustment_x, panel_style_.PanelHeight(launcher->monitor)); CompOption::Value v(launcher_size); - if (launcher_position == LauncherPosition::BOTTOM) - v.set(0); + if (launcher_position == LauncherPosition::LEFT) + { + screen->setOptionForPlugin("expo", "x_offset", v); + + if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) + v.set(0); - screen->setOptionForPlugin("expo", "x_offset", v); + screen->setOptionForPlugin("scale", "x_offset", v); - if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) v.set(0); + screen->setOptionForPlugin("expo", "y_bottom_offset", v); + screen->setOptionForPlugin("scale", "y_bottom_offset", v); + } + else + { + screen->setOptionForPlugin("expo", "y_bottom_offset", v); - screen->setOptionForPlugin("scale", "x_offset", v); + if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) + v.set(0); + + screen->setOptionForPlugin("scale", "y_bottom_offset", v); + + v.set(0); + screen->setOptionForPlugin("expo", "x_offset", v); + screen->setOptionForPlugin("scale", "x_offset", v); + } }; auto check_launchers_size = [this, on_launcher_size_changed] { -- cgit v1.2.3 From 3224e699986890e14a5f047f1ceb6fe5d2c019d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sun, 15 May 2016 03:56:11 +0200 Subject: WindowMinimizeSpeedController: last build fix for yakkety (bzr r4105.7.5) --- plugins/unityshell/src/WindowMinimizeSpeedController.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/unityshell') diff --git a/plugins/unityshell/src/WindowMinimizeSpeedController.cpp b/plugins/unityshell/src/WindowMinimizeSpeedController.cpp index 29df106fa..6d7db5bf3 100644 --- a/plugins/unityshell/src/WindowMinimizeSpeedController.cpp +++ b/plugins/unityshell/src/WindowMinimizeSpeedController.cpp @@ -19,6 +19,7 @@ * not be able to re-use it if you want to use a different licence. */ +#include #include #include -- cgit v1.2.3