diff options
| author | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-12-16 13:42:29 +0000 |
|---|---|---|
| committer | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-12-16 13:42:29 +0000 |
| commit | e9d3f4190ba6bd565fb96bd19cff5b813717ca76 (patch) | |
| tree | 9940808ddd9f919dc73c998038c01fb9b82e3163 /src | |
| parent | 544df0c05ed7ae719548d6af2c7ca1cb6a48d285 (diff) | |
Make window state changes work
(bzr r669.3.18)
Diffstat (limited to 'src')
| -rw-r--r-- | src/PanelIndicatorObjectEntryView.cpp | 3 | ||||
| -rw-r--r-- | src/PanelIndicatorObjectEntryView.h | 4 | ||||
| -rw-r--r-- | src/PanelMenuView.cpp | 64 | ||||
| -rw-r--r-- | src/PanelMenuView.h | 4 | ||||
| -rw-r--r-- | src/unity.cpp | 6 |
5 files changed, 59 insertions, 22 deletions
diff --git a/src/PanelIndicatorObjectEntryView.cpp b/src/PanelIndicatorObjectEntryView.cpp index db3b73993..a43f0dadd 100644 --- a/src/PanelIndicatorObjectEntryView.cpp +++ b/src/PanelIndicatorObjectEntryView.cpp @@ -31,9 +31,6 @@ #include <gtk/gtk.h> #include <time.h> -#define PANEL_HEIGHT 24 -#define PADDING 6 -#define SPACING 3 static void draw_menu_bg (cairo_t *cr, int width, int height); diff --git a/src/PanelIndicatorObjectEntryView.h b/src/PanelIndicatorObjectEntryView.h index ebcf48991..2bc8971f8 100644 --- a/src/PanelIndicatorObjectEntryView.h +++ b/src/PanelIndicatorObjectEntryView.h @@ -28,6 +28,10 @@ #include "Introspectable.h" +#define PANEL_HEIGHT 24 +#define PADDING 6 +#define SPACING 3 + class PanelIndicatorObjectEntryView : public nux::TextureArea, public Introspectable { public: diff --git a/src/PanelMenuView.cpp b/src/PanelMenuView.cpp index fc7fefd33..72abdc39b 100644 --- a/src/PanelMenuView.cpp +++ b/src/PanelMenuView.cpp @@ -70,6 +70,11 @@ PanelMenuView::PanelMenuView () _window_buttons->minimize_clicked.connect (sigc::mem_fun (this, &PanelMenuView::OnMinimizeClicked)); _window_buttons->restore_clicked.connect (sigc::mem_fun (this, &PanelMenuView::OnRestoreClicked)); + WindowManager::Default ()->window_maximized.connect (sigc::mem_fun (this, + &PanelMenuView::OnWindowMaximized)); + WindowManager::Default ()->window_restored.connect (sigc::mem_fun (this, + &PanelMenuView::OnWindowRestored)); + Refresh (); } @@ -82,6 +87,14 @@ PanelMenuView::~PanelMenuView () } void +PanelMenuView::FullRedraw () +{ + _menu_layout->NeedRedraw (); + _window_buttons->NeedRedraw (); + NeedRedraw (); +} + +void PanelMenuView::SetProxy (IndicatorObjectProxy *proxy) { _proxy = proxy; @@ -103,9 +116,7 @@ PanelMenuView::ProcessEvent (nux::IEvent &ievent, long TraverseInfo, long Proces if (_is_inside != true) { _is_inside = true; - _menu_layout->NeedRedraw (); - _window_buttons->NeedRedraw (); - NeedRedraw (); + FullRedraw (); } } else @@ -113,9 +124,7 @@ PanelMenuView::ProcessEvent (nux::IEvent &ievent, long TraverseInfo, long Proces if (_is_inside != false) { _is_inside = false; - _menu_layout->NeedRedraw (); - _window_buttons->NeedRedraw (); - NeedRedraw (); + FullRedraw (); } } @@ -383,10 +392,7 @@ PanelMenuView::OnActiveChanged (PanelIndicatorObjectEntryView *view, _last_active_view = NULL; } } - - _menu_layout->NeedRedraw (); - _window_buttons->NeedRedraw (); - NeedRedraw (); + FullRedraw (); } void @@ -439,9 +445,7 @@ PanelMenuView::AllMenusClosed () _is_inside = false; _last_active_view = false; - _menu_layout->NeedRedraw (); - _window_buttons->NeedRedraw (); - NeedRedraw (); + FullRedraw (); } void @@ -457,9 +461,37 @@ PanelMenuView::OnActiveWindowChanged (BamfView *old_view, } Refresh (); - _menu_layout->NeedRedraw (); - _window_buttons->NeedRedraw (); - NeedRedraw (); + FullRedraw (); +} + +void +PanelMenuView::OnWindowMaximized (guint xid) +{ + BamfWindow *window; + + window = bamf_matcher_get_active_window (_matcher); + if (BAMF_IS_WINDOW (window) && bamf_window_get_xid (window) == xid) + { + _is_maximized = true; + + Refresh (); + FullRedraw (); + } +} + +void +PanelMenuView::OnWindowRestored (guint xid) +{ + BamfWindow *window; + + window = bamf_matcher_get_active_window (_matcher); + if (BAMF_IS_WINDOW (window) && bamf_window_get_xid (window) == xid) + { + _is_maximized = false; + + Refresh (); + FullRedraw (); + } } void diff --git a/src/PanelMenuView.h b/src/PanelMenuView.h index 9722a56c4..82dbb4981 100644 --- a/src/PanelMenuView.h +++ b/src/PanelMenuView.h @@ -35,6 +35,8 @@ public: PanelMenuView (); ~PanelMenuView (); + void FullRedraw (); + virtual long ProcessEvent (nux::IEvent &ievent, long TraverseInfo, long ProcessEventInfo); virtual void Draw (nux::GraphicsEngine& GfxContext, bool force_draw); virtual void DrawContent (nux::GraphicsEngine &GfxContext, bool force_draw); @@ -47,6 +49,8 @@ public: void OnEntryRemoved (IndicatorObjectEntryProxy *proxy); void OnActiveChanged (PanelIndicatorObjectEntryView *view, bool is_active); void OnActiveWindowChanged (BamfView *old_view, BamfView *new_view); + void OnWindowMaximized (guint32 xid); + void OnWindowRestored (guint32 xid); void Refresh (); void AllMenusClosed (); diff --git a/src/unity.cpp b/src/unity.cpp index 9fa7535cb..2a92909a9 100644 --- a/src/unity.cpp +++ b/src/unity.cpp @@ -426,6 +426,9 @@ UnityScreen::UnityScreen (CompScreen *screen) : CompositeScreenInterface::setHandler (cScreen); GLScreenInterface::setHandler (gScreen); + PluginAdapter::Initialize (screen); + WindowManager::SetDefault (PluginAdapter::Default ()); + StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ()); nux::NuxInitialize (0); @@ -441,9 +444,6 @@ 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)); |
