diff options
| -rw-r--r-- | CMakeLists.txt | 2 | ||||
| -rw-r--r-- | launcher/Launcher.h | 3 | ||||
| -rw-r--r-- | launcher/LauncherOptions.cpp | 2 | ||||
| -rw-r--r-- | launcher/MockLauncherIcon.h | 5 | ||||
| -rw-r--r-- | launcher/SwitcherController.cpp | 7 | ||||
| -rw-r--r-- | launcher/SwitcherController.h | 2 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 6 | ||||
| -rw-r--r-- | plugins/unityshell/unityshell.xml.in | 2 | ||||
| -rw-r--r-- | services/panel-service.c | 49 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_switcher.py | 16 | ||||
| -rw-r--r-- | tests/test_launcher.cpp | 64 | ||||
| -rw-r--r-- | unity-shared/PluginAdapter.h | 40 | ||||
| -rw-r--r-- | unity-shared/PluginAdapterCompiz.cpp | 44 | ||||
| -rw-r--r-- | unity-shared/PluginAdapterStandalone.cpp | 44 | ||||
| -rw-r--r-- | unity-shared/WindowManager.cpp | 40 | ||||
| -rw-r--r-- | unity-shared/WindowManager.h | 36 |
16 files changed, 232 insertions, 130 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 069f7b534..ef345f187 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ endif (DISABLE_MAINTAINER_CFLAGS) # Compiz Plugins # -set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gconf-2.0;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.93.1") +set (UNITY_PLUGIN_DEPS "compiz;nux-3.0>=3.0.0;libbamf3;dee-1.0;gio-2.0;gio-unix-2.0;dbusmenu-glib-0.4;dbus-glib-1;x11;libstartup-notification-1.0;gthread-2.0;indicator3-0.4>=0.4.90;atk;unity-misc>=0.4.0;gtk+-3.0>=3.1;sigc++-2.0;json-glib-1.0;libnotify;xfixes;unity-protocol-private>=5.93.1;libgeis") # FIXME: unity-protocol-private shouldn't be there, but building of unityshell is just broken set (UNITY_PROTOCOL_PRIVATE_DEPS "unity-protocol-private>=5.93.1") diff --git a/launcher/Launcher.h b/launcher/Launcher.h index a44671a3d..5c469cb54 100644 --- a/launcher/Launcher.h +++ b/launcher/Launcher.h @@ -24,6 +24,7 @@ #include <Nux/View.h> #include <Nux/BaseWindow.h> #include <Nux/TimerProc.h> +#include <NuxGraphics/GestureEvent.h> #include <NuxGraphics/IOpenGLAsmShader.h> #include "PointerBarrier.h" @@ -389,6 +390,8 @@ private: UBusManager ubus_; glib::SourceManager sources_; + + friend class TestLauncher; }; } diff --git a/launcher/LauncherOptions.cpp b/launcher/LauncherOptions.cpp index 58b29d36d..bee2f0dfa 100644 --- a/launcher/LauncherOptions.cpp +++ b/launcher/LauncherOptions.cpp @@ -31,7 +31,7 @@ Options::Options() , launch_animation(LAUNCH_ANIMATION_PULSE) , urgent_animation(URGENT_ANIMATION_WIGGLE) , auto_hide_animation(FADE_AND_SLIDE) - , backlight_mode(BACKLIGHT_ALWAYS_ON) + , backlight_mode(BACKLIGHT_NORMAL) , reveal_trigger(RevealTrigger::EDGE) , icon_size(48) , tile_size(54) diff --git a/launcher/MockLauncherIcon.h b/launcher/MockLauncherIcon.h index 7bdc0fa46..df00452ac 100644 --- a/launcher/MockLauncherIcon.h +++ b/launcher/MockLauncherIcon.h @@ -212,14 +212,14 @@ public: void SetQuirk(Quirk quirk, bool value) { quirks_[unsigned(quirk)] = value; + clock_gettime(CLOCK_MONOTONIC, &(quirk_times_[unsigned(quirk)])); } void ResetQuirkTime(Quirk quirk) {}; struct timespec GetQuirkTime(Quirk quirk) { - timespec tv; - return tv; + return quirk_times_[unsigned(quirk)]; } IconType GetIconType() @@ -345,6 +345,7 @@ private: int sort_priority_; IconType type_; bool quirks_[unsigned(Quirk::LAST)]; + timespec quirk_times_[unsigned(Quirk::LAST)]; }; } diff --git a/launcher/SwitcherController.cpp b/launcher/SwitcherController.cpp index 84b1fe095..d10e120e0 100644 --- a/launcher/SwitcherController.cpp +++ b/launcher/SwitcherController.cpp @@ -70,6 +70,13 @@ void Controller::OnBackgroundUpdate(GVariant* data) view_->background_color = bg_color_; } +bool Controller::CanShowSwitcher(const std::vector<AbstractLauncherIcon::Ptr>& results) const +{ + bool empty = (show_desktop_disabled_ ? results.empty() : results.size() == 1); + + return (!empty && !WindowManager::Default()->IsWallActive()); +} + void Controller::Show(ShowMode show, SortMode sort, bool reverse, std::vector<AbstractLauncherIcon::Ptr> results) { diff --git a/launcher/SwitcherController.h b/launcher/SwitcherController.h index 9083adb49..9f7bf81ce 100644 --- a/launcher/SwitcherController.h +++ b/launcher/SwitcherController.h @@ -70,6 +70,8 @@ public: void Show(ShowMode show, SortMode sort, bool reverse, std::vector<launcher::AbstractLauncherIcon::Ptr> results); void Hide(bool accept_state=true); + bool CanShowSwitcher(const std::vector<launcher::AbstractLauncherIcon::Ptr>& resutls) const; + bool Visible(); void Next(); diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 99871940a..d483ed2dd 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -1895,7 +1895,7 @@ bool UnityScreen::altTabInitiateCommon(CompAction* action, switcher::ShowMode sh auto results = launcher_controller_->GetAltTabIcons(show_mode == switcher::ShowMode::CURRENT_VIEWPORT, switcher_controller_->IsShowDesktopDisabled()); - if (!(results.size() == 1 && results[0]->GetIconType() == AbstractLauncherIcon::IconType::DESKTOP) && !results.empty()) + if (switcher_controller_->CanShowSwitcher(results)) switcher_controller_->Show(show_mode, switcher::SortMode::FOCUS_ORDER, false, results); return true; @@ -1949,7 +1949,9 @@ bool UnityScreen::altTabForwardAllInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options) { - if (switcher_controller_->Visible()) + if (WindowManager::Default()->IsWallActive()) + return false; + else if (switcher_controller_->Visible()) switcher_controller_->Next(); else altTabInitiateCommon(action, switcher::ShowMode::ALL); diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in index 5b89d6543..1f0dab978 100644 --- a/plugins/unityshell/unityshell.xml.in +++ b/plugins/unityshell/unityshell.xml.in @@ -205,7 +205,7 @@ <_long>Change how the icons are backlit</_long> <min>0</min> <max>4</max> - <default>0</default> + <default>1</default> <desc> <value>0</value> <_name>Backlight Always On</_name> diff --git a/services/panel-service.c b/services/panel-service.c index b9d77704a..1b9bf6b25 100644 --- a/services/panel-service.c +++ b/services/panel-service.c @@ -30,7 +30,6 @@ #include <string.h> #include <gtk/gtk.h> #include <gdk/gdkx.h> -#include <gconf/gconf-client.h> #include <X11/extensions/XInput2.h> #include <X11/XKBlib.h> @@ -46,8 +45,9 @@ G_DEFINE_TYPE (PanelService, panel_service, G_TYPE_OBJECT); #define N_TIMEOUT_SLOTS 50 #define MAX_INDICATOR_ENTRIES 50 -#define COMPIZ_OPTIONS_PATH "/apps/compiz-1/plugins/unityshell/screen0/options" -#define MENU_TOGGLE_KEYBINDING_PATH COMPIZ_OPTIONS_PATH"/panel_first_menu" +#define COMPIZ_OPTION_SCHEMA "org.compiz.unityshell" +#define COMPIZ_OPTION_PATH "/org/compiz/profiles/unity/plugins/" +#define MENU_TOGGLE_KEYBINDING_KEY "panel-first-menu" static PanelService *static_service = NULL; @@ -76,7 +76,7 @@ struct _PanelServicePrivate KeyCode toggle_key; guint32 toggle_modifiers; - guint32 key_monitor_id; + GSettings *gsettings; IndicatorObjectEntry *pressed_entry; gboolean use_event; @@ -135,20 +135,24 @@ static GdkFilterReturn event_filter (GdkXEvent *ev, GdkEvent *gev, PanelService *self); +static void on_keybinding_changed (GSettings *settings, + gchar *key, + gpointer data); + /* * GObject stuff */ static void -panel_service_class_dispose (GObject *object) +panel_service_class_dispose (GObject *self) { - PanelServicePrivate *priv = PANEL_SERVICE (object)->priv; + PanelServicePrivate *priv = PANEL_SERVICE (self)->priv; gint i; g_hash_table_destroy (priv->id2entry_hash); g_hash_table_destroy (priv->panel2entries_hash); - gdk_window_remove_filter (NULL, (GdkFilterFunc)event_filter, object); + gdk_window_remove_filter (NULL, (GdkFilterFunc)event_filter, self); if (GTK_IS_WIDGET (priv->menubar) && gtk_widget_get_realized (GTK_WIDGET (priv->menubar))) @@ -186,13 +190,10 @@ panel_service_class_dispose (GObject *object) } } - if (priv->key_monitor_id) - { - gconf_client_notify_remove (gconf_client_get_default(), priv->key_monitor_id); - priv->key_monitor_id = 0; - } + g_signal_handlers_disconnect_by_func (priv->gsettings, on_keybinding_changed, self); + g_object_unref (priv->gsettings); - G_OBJECT_CLASS (panel_service_parent_class)->dispose (object); + G_OBJECT_CLASS (panel_service_parent_class)->dispose (self); } static void @@ -479,8 +480,7 @@ initial_resync (PanelService *self) static void panel_service_update_menu_keybinding (PanelService *self) { - GConfClient *client = gconf_client_get_default (); - gchar *binding = gconf_client_get_string (client, MENU_TOGGLE_KEYBINDING_PATH, NULL); + gchar *binding = g_settings_get_string (self->priv->gsettings, MENU_TOGGLE_KEYBINDING_KEY); KeyCode keycode = 0; KeySym keysym = NoSymbol; @@ -535,8 +535,10 @@ panel_service_update_menu_keybinding (PanelService *self) g_free (binding); } -void -on_keybinding_changed (GConfClient* client, guint id, GConfEntry* entry, gpointer data) +static void +on_keybinding_changed (GSettings *settings, + gchar *key, + gpointer data) { PanelService *self = data; g_return_if_fail (PANEL_IS_SERVICE (data)); @@ -566,13 +568,10 @@ panel_service_init (PanelService *self) sort_indicators (self); suppress_signals = FALSE; - panel_service_update_menu_keybinding (self); + priv->gsettings = g_settings_new_with_path (COMPIZ_OPTION_SCHEMA, COMPIZ_OPTION_PATH); + g_signal_connect (priv->gsettings, "changed::"MENU_TOGGLE_KEYBINDING_KEY, G_CALLBACK(on_keybinding_changed), self); - GConfClient *client = gconf_client_get_default (); - gconf_client_add_dir (client, COMPIZ_OPTIONS_PATH, GCONF_CLIENT_PRELOAD_NONE, NULL); - priv->key_monitor_id = gconf_client_notify_add (client, MENU_TOGGLE_KEYBINDING_PATH, - on_keybinding_changed, self, - NULL, NULL); + panel_service_update_menu_keybinding (self); priv->initial_sync_id = g_idle_add ((GSourceFunc)initial_resync, self); } @@ -904,7 +903,7 @@ on_indicator_menu_show (IndicatorObject *object, PanelService *self) { gchar *entry_id; - + g_return_if_fail (PANEL_IS_SERVICE (self)); if (entry == NULL) { @@ -924,7 +923,7 @@ on_indicator_menu_show_now_changed (IndicatorObject *object, PanelService *self) { gchar *entry_id; - + g_return_if_fail (PANEL_IS_SERVICE (self)); if (entry == NULL) { diff --git a/tests/autopilot/unity/tests/test_switcher.py b/tests/autopilot/unity/tests/test_switcher.py index 8e7704e91..9e7639b8e 100644 --- a/tests/autopilot/unity/tests/test_switcher.py +++ b/tests/autopilot/unity/tests/test_switcher.py @@ -417,3 +417,19 @@ class SwitcherWorkspaceTests(SwitcherTestCase): self.switcher.select() self.assertProperty(char_win2, is_hidden=False) + + def test_switcher_is_disabled_when_wall_plugin_active(self): + """The switcher must not open when the wall plugin is active using ctrl+alt+<direction>.""" + + initial_workspace = self.workspace.current_workspace + self.addCleanup(self.workspace.switch_to, initial_workspace) + + self.workspace.switch_to(0) + sleep(1) + self.keyboard.press("Ctrl+Alt+Right") + self.addCleanup(self.keyboard.release, "Ctrl+Alt+Right") + sleep(1) + self.keybinding_hold_part_then_tap("switcher/reveal_normal") + self.addCleanup(self.switcher.terminate) + + self.assertThat(self.switcher.visible, Eventually(Equals(False))) diff --git a/tests/test_launcher.cpp b/tests/test_launcher.cpp index 634a97ea4..d5f0bb318 100644 --- a/tests/test_launcher.cpp +++ b/tests/test_launcher.cpp @@ -24,15 +24,23 @@ using namespace testing; #include <Nux/Nux.h> #include <Nux/BaseWindow.h> -#include "DNDCollectionWindow.h" -#include "MockLauncherIcon.h" -#include "Launcher.h" +#include "launcher/DNDCollectionWindow.h" +#include "launcher/MockLauncherIcon.h" +#include "launcher/Launcher.h" +#include "unity-shared/PanelStyle.h" +#include "unity-shared/UnitySettings.h" #include "test_utils.h" using namespace unity; +namespace unity +{ +namespace launcher +{ namespace { +const int STARTING_ANIMATION_DURATION = 150; + class MockMockLauncherIcon : public launcher::MockLauncherIcon { public: @@ -41,22 +49,34 @@ public: MOCK_METHOD1(ShouldHighlightOnDrag, bool(DndData const&)); }; +} + class TestLauncher : public Test { public: TestLauncher() : parent_window_(new nux::BaseWindow("TestLauncherWindow")) , dnd_collection_window_(new DNDCollectionWindow) - , model_(new launcher::LauncherModel) - , launcher_(new launcher::Launcher(parent_window_, dnd_collection_window_)) + , model_(new LauncherModel) + , options_(new Options) + , launcher_(new Launcher(parent_window_, dnd_collection_window_)) { + launcher_->options = options_; launcher_->SetModel(model_); } + float IconBackgroundIntensity(AbstractLauncherIcon::Ptr icon, timespec const& current) const + { + return launcher_->IconBackgroundIntensity(icon, current); + } + nux::BaseWindow* parent_window_; nux::ObjectPtr<DNDCollectionWindow> dnd_collection_window_; - launcher::LauncherModel::Ptr model_; - nux::ObjectPtr<launcher::Launcher> launcher_; + Settings settings; + panel::Style panel_style; + LauncherModel::Ptr model_; + Options::Ptr options_; + nux::ObjectPtr<Launcher> launcher_; }; TEST_F(TestLauncher, TestQuirksDuringDnd) @@ -89,4 +109,34 @@ TEST_F(TestLauncher, TestQuirksDuringDnd) EXPECT_TRUE(third->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT)); } + +TEST_F(TestLauncher, TestIconBackgroundIntensity) +{ + MockMockLauncherIcon::Ptr first(new MockMockLauncherIcon); + model_->AddIcon(first); + + MockMockLauncherIcon::Ptr second(new MockMockLauncherIcon); + model_->AddIcon(second); + + MockMockLauncherIcon::Ptr third(new MockMockLauncherIcon); + model_->AddIcon(third); + + options_->backlight_mode = BACKLIGHT_NORMAL; + options_->launch_animation = LAUNCH_ANIMATION_PULSE; + + first->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, true); + second->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, true); + third->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, false); + + Utils::WaitForTimeoutMSec(STARTING_ANIMATION_DURATION); + timespec current; + clock_gettime(CLOCK_MONOTONIC, ¤t); + + EXPECT_THAT(IconBackgroundIntensity(first, current), Gt(0.0f)); + EXPECT_THAT(IconBackgroundIntensity(second, current), Gt(0.0f)); + EXPECT_EQ(IconBackgroundIntensity(third, current), 0.0f); +} + +} } + diff --git a/unity-shared/PluginAdapter.h b/unity-shared/PluginAdapter.h index 70d5e433c..8c9882bd1 100644 --- a/unity-shared/PluginAdapter.h +++ b/unity-shared/PluginAdapter.h @@ -92,11 +92,13 @@ public: void OnLeaveDesktop (); void TerminateScale(); - bool IsScaleActive(); - bool IsScaleActiveForGroup(); + bool IsScaleActive() const; + bool IsScaleActiveForGroup() const; void InitiateExpo(); - bool IsExpoActive(); + bool IsExpoActive() const; + + bool IsWallActive() const; void ShowGrabHandles(CompWindow* window, bool use_timer); void HideGrabHandles(CompWindow* window); @@ -109,22 +111,22 @@ public: void NotifyCompizEvent(const char* plugin, const char* event, CompOption::Vector& option); void NotifyNewDecorationState(guint32 xid); - guint32 GetActiveWindow(); + guint32 GetActiveWindow() const; void Decorate(guint32 xid); void Undecorate(guint32 xid); // WindowManager implementation - bool IsWindowMaximized(guint xid); + bool IsWindowMaximized(guint xid) const; bool IsWindowDecorated(guint xid); - bool IsWindowOnCurrentDesktop(guint xid); - bool IsWindowObscured(guint xid); - bool IsWindowMapped(guint xid); - bool IsWindowVisible(guint32 xid); - bool IsWindowOnTop(guint32 xid); - bool IsWindowClosable(guint32 xid); - bool IsWindowMinimizable(guint32 xid); - bool IsWindowMaximizable(guint32 xid); + bool IsWindowOnCurrentDesktop(guint xid) const; + bool IsWindowObscured(guint xid) const; + bool IsWindowMapped(guint xid) const; + bool IsWindowVisible(guint32 xid) const; + bool IsWindowOnTop(guint32 xid) const; + bool IsWindowClosable(guint32 xid) const; + bool IsWindowMinimizable(guint32 xid) const; + bool IsWindowMaximizable(guint32 xid) const; void Restore(guint32 xid); void RestoreAt(guint32 xid, int x, int y); @@ -140,12 +142,12 @@ public: void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor = -1, bool only_top_win = true); bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force); - bool IsScreenGrabbed(); - bool IsViewPortSwitchStarted(); + bool IsScreenGrabbed() const; + bool IsViewPortSwitchStarted() const; - unsigned long long GetWindowActiveNumber (guint32 xid); + unsigned long long GetWindowActiveNumber (guint32 xid) const; - bool MaximizeIfBigEnough(CompWindow* window); + bool MaximizeIfBigEnough(CompWindow* window) const; int GetWindowMonitor(guint32 xid) const; nux::Geometry GetWindowGeometry(guint32 xid) const; @@ -155,7 +157,7 @@ public: void CheckWindowIntersections(nux::Geometry const& region, bool &active, bool &any); - int WorkspaceCount(); + int WorkspaceCount() const; void SetCoverageAreaBeforeAutomaximize(float area); @@ -172,7 +174,7 @@ private: std::string MatchStringForXids(std::vector<Window> *windows); void InitiateScale(std::string const& match, int state = 0); - bool CheckWindowIntersection(nux::Geometry const& region, CompWindow* window); + bool CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) const; void SetMwmWindowHints(Window xid, MotifWmHints* new_hints); CompScreen* m_Screen; diff --git a/unity-shared/PluginAdapterCompiz.cpp b/unity-shared/PluginAdapterCompiz.cpp index 057ccea0c..92ad4cea3 100644 --- a/unity-shared/PluginAdapterCompiz.cpp +++ b/unity-shared/PluginAdapterCompiz.cpp @@ -298,7 +298,7 @@ MultiActionList::TerminateAll(CompOption::Vector& extraArgs) } unsigned long long -PluginAdapter::GetWindowActiveNumber (guint32 xid) +PluginAdapter::GetWindowActiveNumber (guint32 xid) const { Window win = xid; CompWindow* window; @@ -368,23 +368,29 @@ PluginAdapter::TerminateScale() } bool -PluginAdapter::IsScaleActive() +PluginAdapter::IsScaleActive() const { return m_Screen->grabExist("scale"); } bool -PluginAdapter::IsScaleActiveForGroup() +PluginAdapter::IsScaleActiveForGroup() const { return _spread_windows_state && m_Screen->grabExist("scale"); } bool -PluginAdapter::IsExpoActive() +PluginAdapter::IsExpoActive() const { return m_Screen->grabExist("expo"); } +bool +PluginAdapter::IsWallActive() const +{ + return m_Screen->grabExist("wall"); +} + void PluginAdapter::InitiateExpo() { @@ -395,13 +401,13 @@ PluginAdapter::InitiateExpo() // WindowManager implementation guint32 -PluginAdapter::GetActiveWindow() +PluginAdapter::GetActiveWindow() const { return m_Screen->activeWindow(); } bool -PluginAdapter::IsWindowMaximized(guint xid) +PluginAdapter::IsWindowMaximized(guint xid) const { Window win = xid; CompWindow* window; @@ -456,7 +462,7 @@ PluginAdapter::IsWindowDecorated(guint32 xid) } bool -PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) +PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) const { Window win = xid; CompWindow* window; @@ -472,7 +478,7 @@ PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) } bool -PluginAdapter::IsWindowObscured(guint32 xid) +PluginAdapter::IsWindowObscured(guint32 xid) const { Window win = xid; CompWindow* window; @@ -505,7 +511,7 @@ PluginAdapter::IsWindowObscured(guint32 xid) } bool -PluginAdapter::IsWindowMapped(guint32 xid) +PluginAdapter::IsWindowMapped(guint32 xid) const { Window win = xid; CompWindow* window; @@ -517,7 +523,7 @@ PluginAdapter::IsWindowMapped(guint32 xid) } bool -PluginAdapter::IsWindowVisible(guint32 xid) +PluginAdapter::IsWindowVisible(guint32 xid) const { Window win = xid; CompWindow* window; @@ -530,7 +536,7 @@ PluginAdapter::IsWindowVisible(guint32 xid) } bool -PluginAdapter::IsWindowOnTop(guint32 xid) +PluginAdapter::IsWindowOnTop(guint32 xid) const { Window win = xid; CompWindow* window = m_Screen->findWindow(win); @@ -569,7 +575,7 @@ PluginAdapter::IsWindowOnTop(guint32 xid) } bool -PluginAdapter::IsWindowClosable(guint32 xid) +PluginAdapter::IsWindowClosable(guint32 xid) const { Window win = xid; CompWindow* window; @@ -582,7 +588,7 @@ PluginAdapter::IsWindowClosable(guint32 xid) } bool -PluginAdapter::IsWindowMinimizable(guint32 xid) +PluginAdapter::IsWindowMinimizable(guint32 xid) const { Window win = xid; CompWindow* window; @@ -595,7 +601,7 @@ PluginAdapter::IsWindowMinimizable(guint32 xid) } bool -PluginAdapter::IsWindowMaximizable(guint32 xid) +PluginAdapter::IsWindowMaximizable(guint32 xid) const { Window win = xid; CompWindow* window; @@ -965,7 +971,7 @@ PluginAdapter::GetWorkAreaGeometry(guint32 xid) const } bool -PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) +PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) const { int intersect_types = CompWindowTypeNormalMask | CompWindowTypeDialogMask | CompWindowTypeModalDialogMask | CompWindowTypeUtilMask; @@ -1022,7 +1028,7 @@ PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &acti } int -PluginAdapter::WorkspaceCount() +PluginAdapter::WorkspaceCount() const { return m_Screen->vpSize().width() * m_Screen->vpSize().height(); } @@ -1105,19 +1111,19 @@ PluginAdapter::Undecorate(guint32 xid) } bool -PluginAdapter::IsScreenGrabbed() +PluginAdapter::IsScreenGrabbed() const { return m_Screen->grabbed(); } bool -PluginAdapter::IsViewPortSwitchStarted() +PluginAdapter::IsViewPortSwitchStarted() const { return _vp_switch_started; } /* Returns true if the window was maximized */ -bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window) +bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window) const { XClassHint classHint; Status status; diff --git a/unity-shared/PluginAdapterStandalone.cpp b/unity-shared/PluginAdapterStandalone.cpp index 45d0d5723..9ba893021 100644 --- a/unity-shared/PluginAdapterStandalone.cpp +++ b/unity-shared/PluginAdapterStandalone.cpp @@ -125,7 +125,7 @@ MultiActionList::TerminateAll(CompOption::Vector& extraArgs) } unsigned long long -PluginAdapter::GetWindowActiveNumber (guint32 xid) +PluginAdapter::GetWindowActiveNumber (guint32 xid) const { return 0; } @@ -157,19 +157,19 @@ PluginAdapter::TerminateScale() } bool -PluginAdapter::IsScaleActive() +PluginAdapter::IsScaleActive() const { return false; } bool -PluginAdapter::IsScaleActiveForGroup() +PluginAdapter::IsScaleActiveForGroup() const { return false; } bool -PluginAdapter::IsExpoActive() +PluginAdapter::IsExpoActive() const { return false; } @@ -179,15 +179,21 @@ PluginAdapter::InitiateExpo() { } +bool +PluginAdapter::IsWallActive() const +{ + return false; +} + // WindowManager implementation guint32 -PluginAdapter::GetActiveWindow() +PluginAdapter::GetActiveWindow() const { return 0; } bool -PluginAdapter::IsWindowMaximized(guint xid) +PluginAdapter::IsWindowMaximized(guint xid) const { return false; } @@ -199,49 +205,49 @@ PluginAdapter::IsWindowDecorated(guint32 xid) } bool -PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) +PluginAdapter::IsWindowOnCurrentDesktop(guint32 xid) const { return false; } bool -PluginAdapter::IsWindowObscured(guint32 xid) +PluginAdapter::IsWindowObscured(guint32 xid) const { return false; } bool -PluginAdapter::IsWindowMapped(guint32 xid) +PluginAdapter::IsWindowMapped(guint32 xid) const { return false; } bool -PluginAdapter::IsWindowVisible(guint32 xid) +PluginAdapter::IsWindowVisible(guint32 xid) const { return false; } bool -PluginAdapter::IsWindowOnTop(guint32 xid) +PluginAdapter::IsWindowOnTop(guint32 xid) const { return false; } bool -PluginAdapter::IsWindowClosable(guint32 xid) +PluginAdapter::IsWindowClosable(guint32 xid) const { return false; } bool -PluginAdapter::IsWindowMinimizable(guint32 xid) +PluginAdapter::IsWindowMinimizable(guint32 xid) const { return false; } bool -PluginAdapter::IsWindowMaximizable(guint32 xid) +PluginAdapter::IsWindowMaximizable(guint32 xid) const { return false; } @@ -347,7 +353,7 @@ PluginAdapter::GetWorkAreaGeometry(guint32 xid) const } bool -PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) +PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow* window) const { return false; } @@ -358,7 +364,7 @@ PluginAdapter::CheckWindowIntersections (nux::Geometry const& region, bool &acti } int -PluginAdapter::WorkspaceCount() +PluginAdapter::WorkspaceCount() const { return 4; } @@ -379,19 +385,19 @@ PluginAdapter::Undecorate(guint32 xid) } bool -PluginAdapter::IsScreenGrabbed() +PluginAdapter::IsScreenGrabbed() const { return false; } bool -PluginAdapter::IsViewPortSwitchStarted() +PluginAdapter::IsViewPortSwitchStarted() const { return false; } /* Returns true if the window was maximized */ -bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window) +bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window) const { return true; } diff --git a/unity-shared/WindowManager.cpp b/unity-shared/WindowManager.cpp index 87d714477..5f5cd6519 100644 --- a/unity-shared/WindowManager.cpp +++ b/unity-shared/WindowManager.cpp @@ -23,22 +23,22 @@ static WindowManager* window_manager = NULL; class WindowManagerDummy : public WindowManager { - guint32 GetActiveWindow() + guint32 GetActiveWindow() const { return 0; } - unsigned long long GetWindowActiveNumber (guint32 xid) + unsigned long long GetWindowActiveNumber (guint32 xid) const { return 0; } - bool IsScreenGrabbed() + bool IsScreenGrabbed() const { return false; } - bool IsViewPortSwitchStarted() + bool IsViewPortSwitchStarted() const { return false; } @@ -48,7 +48,7 @@ class WindowManagerDummy : public WindowManager g_debug("%s", G_STRFUNC); } - bool IsWindowMaximized(guint32 xid) + bool IsWindowMaximized(guint32 xid) const { return false; } @@ -58,42 +58,42 @@ class WindowManagerDummy : public WindowManager return true; } - bool IsWindowOnCurrentDesktop(guint32 xid) + bool IsWindowOnCurrentDesktop(guint32 xid) const { return true; } - bool IsWindowObscured(guint32 xid) + bool IsWindowObscured(guint32 xid) const { return false; } - bool IsWindowMapped(guint32 xid) + bool IsWindowMapped(guint32 xid) const { return true; } - bool IsWindowVisible(guint32 xid) + bool IsWindowVisible(guint32 xid) const { return true; } - bool IsWindowOnTop(guint32 xid) + bool IsWindowOnTop(guint32 xid) const { return false; } - bool IsWindowClosable(guint32 xid) + bool IsWindowClosable(guint32 xid) const { return true; } - bool IsWindowMinimizable(guint32 xid) + bool IsWindowMinimizable(guint32 xid) const { return true; } - bool IsWindowMaximizable(guint32 xid) + bool IsWindowMaximizable(guint32 xid) const { return true; } @@ -182,7 +182,7 @@ class WindowManagerDummy : public WindowManager any = false; } - int WorkspaceCount () + int WorkspaceCount () const { return 1; } @@ -192,13 +192,13 @@ class WindowManagerDummy : public WindowManager g_debug("%s", G_STRFUNC); } - bool IsScaleActive() + bool IsScaleActive() const { g_debug("%s", G_STRFUNC); return false; } - bool IsScaleActiveForGroup() + bool IsScaleActiveForGroup() const { g_debug("%s", G_STRFUNC); return false; @@ -209,7 +209,13 @@ class WindowManagerDummy : public WindowManager g_debug("%s", G_STRFUNC); } - bool IsExpoActive() + bool IsExpoActive() const + { + g_debug("%s", G_STRFUNC); + return false; + } + + bool IsWallActive() const { g_debug("%s", G_STRFUNC); return false; diff --git a/unity-shared/WindowManager.h b/unity-shared/WindowManager.h index 1f828b45a..84ae82485 100644 --- a/unity-shared/WindowManager.h +++ b/unity-shared/WindowManager.h @@ -49,18 +49,18 @@ public: static WindowManager* Default(); static void SetDefault(WindowManager* manager); - virtual guint32 GetActiveWindow() = 0; + virtual guint32 GetActiveWindow() const = 0; - virtual bool IsWindowMaximized(guint32 xid) = 0; + virtual bool IsWindowMaximized(guint32 xid) const = 0; virtual bool IsWindowDecorated(guint32 xid) = 0; - virtual bool IsWindowOnCurrentDesktop(guint32 xid) = 0; - virtual bool IsWindowObscured(guint32 xid) = 0; - virtual bool IsWindowMapped(guint32 xid) = 0; - virtual bool IsWindowVisible(guint32 xid) = 0; - virtual bool IsWindowOnTop(guint32 xid) = 0; - virtual bool IsWindowClosable(guint32 xid) = 0; - virtual bool IsWindowMinimizable(guint32 xid) = 0; - virtual bool IsWindowMaximizable(guint32 xid) = 0; + virtual bool IsWindowOnCurrentDesktop(guint32 xid) const = 0; + virtual bool IsWindowObscured(guint32 xid) const = 0; + virtual bool IsWindowMapped(guint32 xid) const = 0; + virtual bool IsWindowVisible(guint32 xid) const = 0; + virtual bool IsWindowOnTop(guint32 xid) const = 0; + virtual bool IsWindowClosable(guint32 xid) const = 0; + virtual bool IsWindowMinimizable(guint32 xid) const = 0; + virtual bool IsWindowMaximizable(guint32 xid) const = 0; virtual void ShowDesktop() = 0; @@ -74,11 +74,13 @@ public: virtual void Lower(guint32 xid) = 0; virtual void TerminateScale() = 0; - virtual bool IsScaleActive() = 0; - virtual bool IsScaleActiveForGroup() = 0; + virtual bool IsScaleActive() const = 0; + virtual bool IsScaleActiveForGroup() const = 0; virtual void InitiateExpo() = 0; - virtual bool IsExpoActive() = 0; + virtual bool IsExpoActive() const = 0; + + virtual bool IsWallActive() const = 0; virtual void FocusWindowGroup(std::vector<Window> windows, FocusVisibility, int monitor = -1, bool only_top_win = true) = 0; virtual bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force) = 0; @@ -86,8 +88,8 @@ public: virtual void Decorate(guint32 xid) {}; virtual void Undecorate(guint32 xid) {}; - virtual bool IsScreenGrabbed() = 0; - virtual bool IsViewPortSwitchStarted() = 0; + virtual bool IsScreenGrabbed() const = 0; + virtual bool IsViewPortSwitchStarted() const = 0; virtual void MoveResizeWindow(guint32 xid, nux::Geometry geometry) = 0; void StartMove(guint32 xid, int, int); @@ -98,13 +100,13 @@ public: virtual nux::Geometry GetScreenGeometry() const = 0; virtual nux::Geometry GetWorkAreaGeometry(guint32 xid = 0) const = 0; - virtual unsigned long long GetWindowActiveNumber(guint32 xid) = 0; + virtual unsigned long long GetWindowActiveNumber(guint32 xid) const = 0; virtual void SetWindowIconGeometry(Window window, nux::Geometry const& geo) = 0; virtual void CheckWindowIntersections (nux::Geometry const& region, bool &active, bool &any) = 0; - virtual int WorkspaceCount() = 0; + virtual int WorkspaceCount() const = 0; virtual bool saveInputFocus() = 0; virtual bool restoreInputFocus() = 0; |
