Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: views/widget/native_widget_gtk.cc

Issue 7748036: Restoring a session should restore window minimization state on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/native_widget_gtk.h ('k') | views/widget/native_widget_private.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/widget/native_widget_gtk.h" 5 #include "views/widget/native_widget_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <X11/extensions/shape.h> 9 #include <X11/extensions/shape.h>
10 #include <X11/Xatom.h> 10 #include <X11/Xatom.h>
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 } else { 997 } else {
998 // We have no parent window, center over the screen. 998 // We have no parent window, center over the screen.
999 center_rect = gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); 999 center_rect = gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView());
1000 } 1000 }
1001 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, 1001 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2,
1002 center_rect.y() + (center_rect.height() - size.height()) / 2, 1002 center_rect.y() + (center_rect.height() - size.height()) / 2,
1003 size.width(), size.height()); 1003 size.width(), size.height());
1004 SetBoundsConstrained(bounds, NULL); 1004 SetBoundsConstrained(bounds, NULL);
1005 } 1005 }
1006 1006
1007 void NativeWidgetGtk::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, 1007 void NativeWidgetGtk::GetWindowPlacement(
1008 bool* maximized) const { 1008 gfx::Rect* bounds,
1009 ui::WindowShowState* show_state) const {
1009 // Do nothing for now. ChromeOS isn't yet saving window placement. 1010 // Do nothing for now. ChromeOS isn't yet saving window placement.
1010 } 1011 }
1011 1012
1012 void NativeWidgetGtk::SetWindowTitle(const std::wstring& title) { 1013 void NativeWidgetGtk::SetWindowTitle(const std::wstring& title) {
1013 // We don't have a window title on ChromeOS (right now). 1014 // We don't have a window title on ChromeOS (right now).
1014 } 1015 }
1015 1016
1016 void NativeWidgetGtk::SetWindowIcons(const SkBitmap& window_icon, 1017 void NativeWidgetGtk::SetWindowIcons(const SkBitmap& window_icon,
1017 const SkBitmap& app_icon) { 1018 const SkBitmap& app_icon) {
1018 // We don't have window icons on ChromeOS. 1019 // We don't have window icons on ChromeOS.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 delegate_->OnNativeWidgetVisibilityChanged(false); 1180 delegate_->OnNativeWidgetVisibilityChanged(false);
1180 } 1181 }
1181 } 1182 }
1182 1183
1183 void NativeWidgetGtk::ShowMaximizedWithBounds( 1184 void NativeWidgetGtk::ShowMaximizedWithBounds(
1184 const gfx::Rect& restored_bounds) { 1185 const gfx::Rect& restored_bounds) {
1185 // TODO: when we add maximization support update this. 1186 // TODO: when we add maximization support update this.
1186 Show(); 1187 Show();
1187 } 1188 }
1188 1189
1189 void NativeWidgetGtk::ShowWithState(ShowState state) { 1190 void NativeWidgetGtk::ShowWithWindowState(ui::WindowShowState show_state) {
1190 // No concept of maximization (yet) on ChromeOS. 1191 // No concept of maximization (yet) on ChromeOS.
1191 if (state == internal::NativeWidgetPrivate::SHOW_INACTIVE) 1192 if (show_state == ui::SHOW_STATE_INACTIVE)
1192 gtk_window_set_focus_on_map(GetNativeWindow(), false); 1193 gtk_window_set_focus_on_map(GetNativeWindow(), false);
1193 gtk_widget_show(GetNativeView()); 1194 gtk_widget_show(GetNativeView());
1194 } 1195 }
1195 1196
1196 bool NativeWidgetGtk::IsVisible() const { 1197 bool NativeWidgetGtk::IsVisible() const {
1197 return GTK_WIDGET_VISIBLE(GetNativeView()); 1198 return GTK_WIDGET_VISIBLE(GetNativeView());
1198 } 1199 }
1199 1200
1200 void NativeWidgetGtk::Activate() { 1201 void NativeWidgetGtk::Activate() {
1201 gtk_window_present(GetNativeWindow()); 1202 gtk_window_present(GetNativeWindow());
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 gdk_cairo_region(cr, event->region); 2070 gdk_cairo_region(cr, event->region);
2070 cairo_fill(cr); 2071 cairo_fill(cr);
2071 cairo_destroy(cr); 2072 cairo_destroy(cr);
2072 } 2073 }
2073 2074
2074 void NativeWidgetGtk::SaveWindowPosition() { 2075 void NativeWidgetGtk::SaveWindowPosition() {
2075 // The delegate may have gone away on us. 2076 // The delegate may have gone away on us.
2076 if (!GetWidget()->widget_delegate()) 2077 if (!GetWidget()->widget_delegate())
2077 return; 2078 return;
2078 2079
2079 bool maximized = window_state_ & GDK_WINDOW_STATE_MAXIMIZED; 2080 ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL;
2081 if (IsMaximized())
2082 show_state = ui::SHOW_STATE_MAXIMIZED;
2083 else if (IsMinimized())
2084 show_state = ui::SHOW_STATE_MINIMIZED;
2080 GetWidget()->widget_delegate()->SaveWindowPlacement( 2085 GetWidget()->widget_delegate()->SaveWindowPlacement(
2081 GetWidget()->GetWindowScreenBounds(), 2086 GetWidget()->GetWindowScreenBounds(),
2082 maximized); 2087 show_state);
2083 } 2088 }
2084 2089
2085 //////////////////////////////////////////////////////////////////////////////// 2090 ////////////////////////////////////////////////////////////////////////////////
2086 // Widget, public: 2091 // Widget, public:
2087 2092
2088 // static 2093 // static
2089 void Widget::NotifyLocaleChanged() { 2094 void Widget::NotifyLocaleChanged() {
2090 GList *window_list = gtk_window_list_toplevels(); 2095 GList *window_list = gtk_window_list_toplevels();
2091 for (GList* element = window_list; element; element = g_list_next(element)) { 2096 for (GList* element = window_list; element; element = g_list_next(element)) {
2092 Widget* widget = 2097 Widget* widget =
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 button_pressed = event->type == GDK_BUTTON_PRESS || 2249 button_pressed = event->type == GDK_BUTTON_PRESS ||
2245 event->type == GDK_2BUTTON_PRESS || 2250 event->type == GDK_2BUTTON_PRESS ||
2246 event->type == GDK_3BUTTON_PRESS; 2251 event->type == GDK_3BUTTON_PRESS;
2247 gdk_event_free(event); 2252 gdk_event_free(event);
2248 } 2253 }
2249 return button_pressed; 2254 return button_pressed;
2250 } 2255 }
2251 2256
2252 } // namespace internal 2257 } // namespace internal
2253 } // namespace views 2258 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/native_widget_gtk.h ('k') | views/widget/native_widget_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698