summaryrefslogtreecommitdiff
path: root/plugins/unityshell
diff options
authorEleni Maria Stea <elenimaria.stea@canonical.com>2016-05-30 09:48:32 +0300
committerEleni Maria Stea <elenimaria.stea@canonical.com>2016-05-30 09:48:32 +0300
commitaa7839f9905353fbec2d4573cc9bc47468cf284d (patch)
treebce95a2c10f92246d5b738d5f4cfbf376c159db6 /plugins/unityshell
parent6f6f04108d401cb6374859a52964f49c5217a7b2 (diff)
parent1b50bc472726ded1db2db5d747be168a6867d2ca (diff)
merged to trunk
[ Eleni Maria Stea ] * PanelView: Don't draw it if the geo doesn't intersect the monitor geo (as in ezoom) [ Marco Trevisan (Treviño) ] * Bumping version to 7.5.0, as per 7.4 release [ Andrea Azzarone ] * Do not reset the shortcut for icons that have their own shortcut. (LP: #1562847) * Fallback to "background" class in case no background is specified for title bars and top panel. (LP: #1575527) * GnomeKeyGrabber: do not activate an action if it's a repeated one. (LP: #1572241) * Properly calculate array indexes to avoid crashes. (LP: #1570843) * Properly remove SoftwareCenterLauncherIcon in case of failure. (LP: #1553165) * Update ExpoLauncherIcon in case the quicklist is used to switch vp. (LP: #1525685) [ Marco Trevisan (Treviño) ] * DashStyle: ensure LazyLoadTexture disconnects from signals on destruction (LP: #1580212) * Releasing Unity 7.4.0 * SwitcherController: don't try to get a window from empty selections (LP: #1580211) * SwitcherView: close the mouse-selected application on middle-click (LP: #1574689) * UnityScreen, UnityWindow: cleanup a little the code, and ensure overridden CompositeWindow functions get actually called [ handsome_feng ] * Change the x_offset of expo when launcher position changed. (LP: #1573897, #1562348) [ Andrea Azzarone ] * Do not use pointers to LazyLoadTextures. (LP: #1569100) * Fix unity script crash. (LP: #1566565) * LockscreenController: Don't use SetActivate(False) for gnome- screensaver to prevent unlocking on tty switch. It will not only deactivate the screensaver but also unlock the screen. (LP: #1552537) * unityshell.xml: Fix typo (LP: #1559427) [ Andrea Azzarone ] * Improve the "lock on suspend" logic to always keep in sync the inhibitor with the lockscreen. [ Marco Trevisan (Treviño) ] * DecoratedWindow: Just send estimated extents on _NET_REQUEST_FRAME_EXTENTS (LP: #1368118) * TextureCache: add support for loading themed textures (LP: #903179, #1208790) * Unity: stop unity7 upstart instance if needed and restart it if not clearly requested (LP: #1555633) * ForceQuitDialog: set client leader [ Andrea Azzarone ] * ApplicationLauncherIcon: use the starting property to show an icon when launched (LP: #676457) [ Marco Trevisan (Treviño) ] * UserPromptView: don't hide local scale property (LP: #1551820) [ Sebastien Bacher ] * set the gettext domain directly in CMakeLists rather than using refering to the project name, the translation template is updated during the build by dh_translations which is not clever enough to understand the variable (LP: #1557081) [ handsome_feng ] * Dash: move it down when the launcher is positioned at the bottom. (LP: #1552630) * Launcher: add Bottom mode, so that the launcher can be positioned horisontally (LP: #1552630) [ Andrea Azzarone ] * Add a "Format..." option to volume icons. (LP: #1057008) [ Marco Trevisan (Treviño) ] * DashView: ensure that we update scaling when monitor changes (LP: #1546690) * DecoratedWindow: move the shadow under the window if we've a client- side decorated window with corners (LP: #1516403) * LauncherController: add overlay shortcut to all the WindowedLauncherIcon's we have * ThemeSettings: add small class for reading gtk settings for theming (LP: #1543757, #1288998) [ Andrea Azzarone, Didier Roche ] * Gnome-software launcher integration. [ Marco Trevisan (Treviño) ] * GnomeFileManager: use *WithTimestamp file operations instead of using Activate workaround (LP: #1445595) * unity.migrations: add 04_unity_update_software_center_desktop_file [ Robert Ancell ] * Drop unused build-dependency on libgee-dev. * Switch from Ubuntu Software Center to GNOME Software. (LP: #1547129) [ Didier Roche ] * debian: Recommends session-shortcuts, prodiving easy way to shutdown, reboot and logout from dash [ Marco Trevisan (Treviño) ] * CMake: use GNUInstallDirs with native multi-arch support (LP: #1508635, #1485668) * Launcher: add FileManager, Trash and Volume icons integration (LP: #1524721, #1161323, #1063838, #1063823) * SwitcherModel: avoid to access to invalid selection or to divide by zero (LP: #1537524) [ handsome_feng ] * Extend the lockscreen theme for kylin. * Multiarchify the library packages. (bzr r4067.7.11)
Diffstat (limited to 'plugins/unityshell')
-rw-r--r--plugins/unityshell/CMakeLists.txt7
-rw-r--r--plugins/unityshell/src/WindowMinimizeSpeedController.cpp1
-rw-r--r--plugins/unityshell/src/inputremover.cpp24
-rw-r--r--plugins/unityshell/src/inputremover.h1
-rw-r--r--plugins/unityshell/src/unityshell.cpp161
-rw-r--r--plugins/unityshell/src/unityshell.h321
-rw-r--r--plugins/unityshell/unityshell.xml.in2
7 files changed, 288 insertions, 229 deletions
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)
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 <cmath>
#include <gio/gio.h>
#include <NuxCore/Logger.h>
diff --git a/plugins/unityshell/src/inputremover.cpp b/plugins/unityshell/src/inputremover.cpp
index b28e7a1e2..de675ee05 100644
--- a/plugins/unityshell/src/inputremover.cpp
+++ b/plugins/unityshell/src/inputremover.cpp
@@ -19,12 +19,12 @@
* Sam Spilsbury <sam.spilsbury@canonical.com>
*/
-#include <cstdlib>
-#include <boost/scoped_array.hpp>
#include "inputremover.h"
+#include <cstdlib>
#include <X11/Xregion.h>
#include <cstdio>
#include <cstring>
+#include <vector>
namespace
{
@@ -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;
@@ -347,15 +347,14 @@ compiz::WindowInputRemover::writeProperty (XRectangle *input,
*/
const size_t dataSize = headerSize + (nInput * 4);
- boost::scoped_array<unsigned long> data(new unsigned long[dataSize]);
-
+ std::vector<unsigned long> data(dataSize);
data[0] = propVersion;
data[1] = nInput;
data[2] = inputOrdering;
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;
@@ -366,11 +365,11 @@ compiz::WindowInputRemover::writeProperty (XRectangle *input,
/* No need to check return code, always returns 0 */
XChangeProperty(mDpy,
mPropWindow,
- prop,
+ mProperty,
type,
fmt,
PropModeReplace,
- reinterpret_cast<unsigned char*>(data.get()),
+ reinterpret_cast<unsigned char*>(data.data()),
dataSize);
return true;
@@ -382,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;
@@ -400,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,
@@ -439,7 +437,7 @@ compiz::WindowInputRemover::queryProperty(XRectangle **input,
if (!XGetWindowProperty(mDpy,
mPropWindow,
- prop,
+ mProperty,
0L,
fullLength,
FALSE,
@@ -487,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;
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 8e7809346..207b7a11b 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 "ThemeSettings.h"
#include "Timer.h"
#include "XKeyboardUtil.h"
#include "unityshell.h"
@@ -77,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 */
@@ -175,6 +177,13 @@ 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_SHELL = 0;
+Atom _UNITY_SAVED_WINDOW_SHAPE = 0;
+}
+
} // anon namespace
UnityScreen::UnityScreen(CompScreen* screen)
@@ -194,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)
@@ -206,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
@@ -311,6 +320,9 @@ UnityScreen::UnityScreen(CompScreen* screen)
CompositeScreenInterface::setHandler(cScreen);
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();
nux::NuxInitialize(0);
@@ -329,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());
@@ -435,10 +447,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)
{
@@ -504,8 +514,10 @@ UnityScreen::~UnityScreen()
QuicklistManager::Destroy();
decoration::DataPool::Reset();
SaveLockStamp(false);
-
reset_glib_logging();
+
+ screen->addSupportedAtomsSetEnabled(this, false);
+ screen->updateSupportedWmHints();
}
void UnityScreen::InitAltTabNextWindow()
@@ -680,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);
@@ -694,6 +706,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;
@@ -701,15 +721,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<float>(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);
}
@@ -728,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;
@@ -843,7 +863,7 @@ void UnityScreen::DamageBlurUpdateRegion(nux::Geometry const& blur_update)
void UnityScreen::paintDisplay()
{
- CompOutput *output = _last_output;
+ CompOutput *output = last_output_;
DrawPanelUnderDash();
@@ -970,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();
@@ -1465,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.
@@ -1502,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
@@ -1667,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();)
{
@@ -1768,6 +1788,8 @@ void UnityScreen::determineNuxDamage(CompRegion& nux_damage)
void UnityScreen::addSupportedAtoms(std::vector<Atom>& atoms)
{
screen->addSupportedAtoms(atoms);
+ atoms.push_back(atom::_UNITY_SHELL);
+ atoms.push_back(atom::_UNITY_SAVED_WINDOW_SHAPE);
deco_manager_->AddSupportedAtoms(atoms);
}
@@ -1791,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())
@@ -1799,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;
@@ -2321,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;
}
@@ -3520,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();
@@ -3601,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:
@@ -3814,9 +3846,17 @@ bool UnityScreen::layoutSlotsAndAssignWindows()
auto max_bounds = NuxGeometryFromCompRect(output.workArea());
if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER)
{
- int monitor_width = unity_settings_.LauncherWidth(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;
@@ -4057,22 +4097,52 @@ void UnityScreen::InitUnityComponents()
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<Launcher*>(area);
- int launcher_width = 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
+ 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 (launcher_position == LauncherPosition::LEFT)
+ adjustment_x = launcher_size;
+ shortcut_controller_->SetAdjustment(adjustment_x, panel_style_.PanelHeight(launcher->monitor));
+
+ CompOption::Value v(launcher_size);
+ if (launcher_position == LauncherPosition::LEFT)
+ {
+ screen->setOptionForPlugin("expo", "x_offset", v);
- unity::Settings::Instance().SetLauncherWidth(launcher_width, launcher->monitor);
- shortcut_controller_->SetAdjustment(launcher_width, panel_style_.PanelHeight(launcher->monitor));
+ if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER)
+ v.set(0);
- CompOption::Value v(launcher_width);
- 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);
+
+ if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER)
+ v.set(0);
+
+ screen->setOptionForPlugin("scale", "y_bottom_offset", v);
- screen->setOptionForPlugin("scale", "x_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] {
@@ -4089,6 +4159,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();
@@ -4180,13 +4254,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;
}
}
@@ -4204,6 +4282,7 @@ UnityWindow::UnityWindow(CompWindow* window)
{
WindowInterface::setHandler(window);
GLWindowInterface::setHandler(gWindow);
+ CompositeWindowInterface::setHandler(cWindow);
ScaleWindowInterface::setHandler(ScaleWindow::get(window));
PluginAdapter::Default().OnLeaveDesktop();
@@ -4569,7 +4648,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 7235ac118..8f3d89c08 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -2,7 +2,7 @@
/* 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
@@ -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 &region);
+ void handleCompizEvent(const char *pluginName, const char *eventName, CompOption::Vector &o) override;
+ void damageRegion(const CompRegion &region) 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<Atom>&);
+ void handleEvent(XEvent*) override;
+ void addSupportedAtoms(std::vector<Atom>&) 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,25 +250,27 @@ 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();
+ void LoadPanelShadowTexture();
void DamagePanelShadow();
void OnViewHidden(nux::BaseWindow *bw);
@@ -306,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<na::TickSource> tick_source_;
std::unique_ptr<na::AnimationController> animation_controller_;
@@ -364,8 +347,8 @@ private:
/* Subscription for gestures that manipulate windows. */
std::unique_ptr<nux::GesturesSubscription> gestures_sub_windows_;
- bool needsRelayout;
- bool super_keypressed_;
+ bool needsRelayout;
+ bool super_keypressed_;
typedef std::shared_ptr<CompAction> CompActionPtr;
typedef std::vector<CompActionPtr> ShortcutActions;
ShortcutActions _shortcut_actions;
@@ -379,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
@@ -399,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_;
@@ -417,9 +397,6 @@ private:
bool scale_just_activated_;
WindowMinimizeSpeedController minimize_speed_controller_;
-
- uint64_t big_tick_;
-
debug::ScreenIntrospection screen_introspection_;
UBusManager ubus_manager_;
@@ -429,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;
@@ -444,6 +421,7 @@ private:
class UnityWindow :
public WindowInterface,
public GLWindowInterface,
+ public CompositeWindowInterface,
public ShowdesktopHandlerWindowInterface,
public compiz::WindowInputRemoverLockAcquireInterface,
public WrapableHandler<ScaleWindowInterface, 4>,
@@ -456,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<void> being_destroyed;
- void updateFrameRegion(CompRegion &region);
- void getOutputExtents(CompWindowExtents& output);
+protected:
+ void updateFrameRegion(CompRegion &region) 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<void> 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<UnityScreen, UnityWindow> UnityMinimizedHandler;
typedef std::shared_ptr<compiz_utils::PixmapTexture> 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);
@@ -564,7 +535,12 @@ public:
std::unique_ptr <UnityMinimizedHandler> mMinimizeHandler;
private:
+ CompWindow* window;
+ CompositeWindow* cWindow;
+ GLWindow* gWindow;
+
std::unique_ptr <ShowdesktopHandler> mShowdesktopHandler;
+ nux::Geometry last_bound;
PixmapTexturePtr decoration_tex_;
PixmapTexturePtr decoration_selected_tex_;
std::string decoration_title_;
@@ -578,6 +554,7 @@ private:
glib::Source::UniquePtr focus_desktop_timeout_;
friend class UnityScreen;
+ friend UnityMinimizedHandler;
};
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 @@
<option name="spread_app_windows_anywhere" type="key">
<_short>Key to spread the current application windows in any workspace</_short>
- <_long>Initiate the window Spread for the current application windows, for the all the windows.</_long>
+ <_long>Initiate the window Spread for the current application windows, for all the windows.</_long>
<default>&lt;Control&gt;&lt;Super&gt;&lt;Shift&gt;w</default>
</option>