diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/window/window_gtk.cc | 22 | ||||
-rw-r--r-- | views/window/window_gtk.h | 10 |
2 files changed, 28 insertions, 4 deletions
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index 8363a66..5455239 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -105,13 +105,11 @@ bool WindowGtk::IsVisible() const { } bool WindowGtk::IsMaximized() const { - NOTIMPLEMENTED(); - return false; + return window_maximized_; } bool WindowGtk::IsMinimized() const { - NOTIMPLEMENTED(); - return false; + return window_minimized_; } void WindowGtk::SetFullscreen(bool fullscreen) { @@ -208,6 +206,12 @@ void WindowGtk::Init(const gfx::Rect& bounds) { UpdateWindowTitle(); + GtkWindow* gtk_window = GetNativeWindow(); + g_signal_connect(G_OBJECT(gtk_window), + "window-state-event", + G_CALLBACK(CallWindowStateEvent), + NULL); + // SetInitialBounds(bounds); // if (!IsAppWindow()) { @@ -228,4 +232,14 @@ void WindowGtk::SaveWindowPosition() { NOTIMPLEMENTED(); } +// static +void WindowGtk::CallWindowStateEvent(GtkWidget* widget, + GdkEventWindowState* window_state) { + WindowGtk* window_gtk = GetWindowForNative(widget); + window_gtk->window_maximized_ = + window_state->new_window_state & GDK_WINDOW_STATE_MAXIMIZED; + window_gtk->window_minimized_ = + window_state->new_window_state & GDK_WINDOW_STATE_ICONIFIED; +} + } // namespace views diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index d38ce62..18b9210 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -71,6 +71,10 @@ class WindowGtk : public WidgetGtk, public Window { void Init(const gfx::Rect& bounds); private: + // Used to track window state changes + static void CallWindowStateEvent(GtkWidget* widget, + GdkEventWindowState* window_state); + // Asks the delegate if any to save the window's location and size. void SaveWindowPosition(); @@ -91,6 +95,12 @@ class WindowGtk : public WidgetGtk, public Window { // Set to true if the window is in the process of closing. bool window_closed_; + // Set to true if the window is maximized + bool window_maximized_; + + // Set to true of the window is minimized + bool window_minimized_; + DISALLOW_COPY_AND_ASSIGN(WindowGtk); }; |