diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/PanelMenuView.cpp | 38 | ||||
| -rw-r--r-- | src/PanelMenuView.h | 4 | ||||
| -rw-r--r-- | src/PluginAdapter.cpp | 16 | ||||
| -rw-r--r-- | src/PluginAdapter.h | 7 | ||||
| -rw-r--r-- | src/WindowManager.cpp | 5 | ||||
| -rw-r--r-- | src/WindowManager.h | 2 | ||||
| -rw-r--r-- | src/unity.cpp | 1 |
7 files changed, 57 insertions, 16 deletions
diff --git a/src/PanelMenuView.cpp b/src/PanelMenuView.cpp index 9e4541db1..81b6dcfd6 100644 --- a/src/PanelMenuView.cpp +++ b/src/PanelMenuView.cpp @@ -50,6 +50,7 @@ PanelMenuView::PanelMenuView () _title_layer (NULL), _util_cg (CAIRO_FORMAT_ARGB32, 1, 1), _is_inside (false), + _is_maximized (false), _last_active_view (NULL) { _matcher = bamf_matcher_get_default (); @@ -160,8 +161,9 @@ PanelMenuView::Draw (nux::GraphicsEngine& GfxContext, bool force_draw) if (_is_inside || _last_active_view) geo.width = PADDING + BUTTONS_WIDTH; - - gPainter.PushDrawLayer (GfxContext, GetGeometry (), _title_layer); + + if (!_is_maximized) + gPainter.PushDrawLayer (GfxContext, GetGeometry (), _title_layer); gPainter.PopBackground (); @@ -178,9 +180,11 @@ PanelMenuView::DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw) if (_is_inside || _last_active_view) { _layout->ProcessDraw (GfxContext, force_draw); - _window_buttons->ProcessDraw (GfxContext, force_draw); } + if (_is_maximized) + _window_buttons->ProcessDraw (GfxContext, force_draw); + GfxContext.PopClippingRectangle(); } @@ -357,6 +361,7 @@ PanelMenuView::OnActiveChanged (PanelIndicatorObjectEntryView *view, } _menu_layout->NeedRedraw (); + _window_buttons->NeedRedraw (); NeedRedraw (); } @@ -411,6 +416,25 @@ PanelMenuView::AllMenusClosed () _last_active_view = false; _menu_layout->NeedRedraw (); + _window_buttons->NeedRedraw (); + NeedRedraw (); +} + +void +PanelMenuView::OnActiveWindowChanged (BamfView *old_view, + BamfView *new_view) +{ + _is_maximized = false; + + if (BAMF_IS_WINDOW (new_view)) + { + BamfWindow *window = BAMF_WINDOW (new_view); + _is_maximized = WindowManager::Default ()->IsWindowMaximized (bamf_window_get_xid (window)); + } + + Refresh (); + _menu_layout->NeedRedraw (); + _window_buttons->NeedRedraw (); NeedRedraw (); } @@ -447,11 +471,5 @@ on_active_window_changed (BamfMatcher *matcher, BamfView *new_view, PanelMenuView *self) { - bool is_maxmized = false; - bool can_maximize = false; - - WindowManager::Default ()->GetWindowMaximizedState (0, is_maxmized, can_maximize); - - self->Refresh (); - self->NeedRedraw (); + self->OnActiveWindowChanged (old_view, new_view); } diff --git a/src/PanelMenuView.h b/src/PanelMenuView.h index 7b1fa55a8..ca8f36b63 100644 --- a/src/PanelMenuView.h +++ b/src/PanelMenuView.h @@ -46,6 +46,7 @@ public: void OnEntryMoved (IndicatorObjectEntryProxy *proxy); void OnEntryRemoved (IndicatorObjectEntryProxy *proxy); void OnActiveChanged (PanelIndicatorObjectEntryView *view, bool is_active); + void OnActiveWindowChanged (BamfView *old_view, BamfView *new_view); void Refresh (); void AllMenusClosed (); @@ -64,7 +65,8 @@ private: nux::HLayout *_menu_layout; nux::CairoGraphics _util_cg; - bool _is_inside; + bool _is_inside; + bool _is_maximized; PanelIndicatorObjectEntryView *_last_active_view; WindowButtons *_window_buttons; diff --git a/src/PluginAdapter.cpp b/src/PluginAdapter.cpp index 8ccbc4c2d..a010878db 100644 --- a/src/PluginAdapter.cpp +++ b/src/PluginAdapter.cpp @@ -175,3 +175,19 @@ PluginAdapter::InitiateExpo () m_ExpoAction->initiate () (m_ExpoAction, 0, argument); } + +// WindowManager implementation +bool +PluginAdapter::IsWindowMaximized (guint xid) +{ + Window win = (Window)xid; + CompWindow *window; + + window = m_Screen->findWindow (win); + if (window) + { + return window->state () & MAXIMIZE_STATE; + } + + return false; +} diff --git a/src/PluginAdapter.h b/src/PluginAdapter.h index 6f9d3c287..f9a208e54 100644 --- a/src/PluginAdapter.h +++ b/src/PluginAdapter.h @@ -24,7 +24,9 @@ #include <sigc++/sigc++.h> -class PluginAdapter : public sigc::trackable +#include "WindowManager.h" + +class PluginAdapter : public sigc::trackable, public WindowManager { public: static PluginAdapter * Default (); @@ -46,6 +48,9 @@ public: void NotifyStateChange (CompWindow *window, unsigned int state, unsigned int last_state); void Notify (CompWindow *window, CompWindowNotify notify); + + // WindowManager implementation + bool IsWindowMaximized (guint xid); sigc::signal<void, CompWindow *> window_maximized; sigc::signal<void, CompWindow *> window_restored; diff --git a/src/WindowManager.cpp b/src/WindowManager.cpp index e935aea8b..d10b23b19 100644 --- a/src/WindowManager.cpp +++ b/src/WindowManager.cpp @@ -22,10 +22,9 @@ static WindowManager *window_manager = NULL; class WindowManagerDummy : public WindowManager { - void GetWindowMaximizedState (guint32 xid, bool& is_maxmized, bool& can_maximize) + bool IsWindowMaximized (guint32 xid) { - is_maxmized = false; - can_maximize = true; + return false; } }; diff --git a/src/WindowManager.h b/src/WindowManager.h index edb1c256f..ff413ba69 100644 --- a/src/WindowManager.h +++ b/src/WindowManager.h @@ -28,7 +28,7 @@ public: static WindowManager * Default (); static void SetDefault (WindowManager *manager); - virtual void GetWindowMaximizedState (guint32 xid, bool& is_maxmized, bool& can_maximize) = 0; + virtual bool IsWindowMaximized (guint32 xid) = 0; }; #endif // WINDOW_MANAGER_H diff --git a/src/unity.cpp b/src/unity.cpp index 7e6e38064..9fa7535cb 100644 --- a/src/unity.cpp +++ b/src/unity.cpp @@ -442,6 +442,7 @@ UnityScreen::UnityScreen (CompScreen *screen) : debugger = new IntrospectionDBusInterface (this); PluginAdapter::Initialize (screen); + WindowManager::SetDefault (PluginAdapter::Default ()); optionSetLauncherAutohideNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); optionSetLauncherFloatNotify (boost::bind (&UnityScreen::optionChanged, this, _1, _2)); |
