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

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

Issue 7790010: Revert 98679 - Restoring a session should restore window minimization state on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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::GetWindowPlacement( 1007 void NativeWidgetGtk::GetWindowBoundsAndMaximizedState(gfx::Rect* bounds,
1008 gfx::Rect* bounds, 1008 bool* maximized) const {
1009 ui::WindowShowState* show_state) const {
1010 // Do nothing for now. ChromeOS isn't yet saving window placement. 1009 // Do nothing for now. ChromeOS isn't yet saving window placement.
1011 } 1010 }
1012 1011
1013 void NativeWidgetGtk::SetWindowTitle(const std::wstring& title) { 1012 void NativeWidgetGtk::SetWindowTitle(const std::wstring& title) {
1014 // We don't have a window title on ChromeOS (right now). 1013 // We don't have a window title on ChromeOS (right now).
1015 } 1014 }
1016 1015
1017 void NativeWidgetGtk::SetWindowIcons(const SkBitmap& window_icon, 1016 void NativeWidgetGtk::SetWindowIcons(const SkBitmap& window_icon,
1018 const SkBitmap& app_icon) { 1017 const SkBitmap& app_icon) {
1019 // We don't have window icons on ChromeOS. 1018 // We don't have window icons on ChromeOS.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 delegate_->OnNativeWidgetVisibilityChanged(false); 1179 delegate_->OnNativeWidgetVisibilityChanged(false);
1181 } 1180 }
1182 } 1181 }
1183 1182
1184 void NativeWidgetGtk::ShowMaximizedWithBounds( 1183 void NativeWidgetGtk::ShowMaximizedWithBounds(
1185 const gfx::Rect& restored_bounds) { 1184 const gfx::Rect& restored_bounds) {
1186 // TODO: when we add maximization support update this. 1185 // TODO: when we add maximization support update this.
1187 Show(); 1186 Show();
1188 } 1187 }
1189 1188
1190 void NativeWidgetGtk::ShowWithWindowState(ui::WindowShowState show_state) { 1189 void NativeWidgetGtk::ShowWithState(ShowState state) {
1191 // No concept of maximization (yet) on ChromeOS. 1190 // No concept of maximization (yet) on ChromeOS.
1192 if (show_state == ui::SHOW_STATE_INACTIVE) 1191 if (state == internal::NativeWidgetPrivate::SHOW_INACTIVE)
1193 gtk_window_set_focus_on_map(GetNativeWindow(), false); 1192 gtk_window_set_focus_on_map(GetNativeWindow(), false);
1194 gtk_widget_show(GetNativeView()); 1193 gtk_widget_show(GetNativeView());
1195 } 1194 }
1196 1195
1197 bool NativeWidgetGtk::IsVisible() const { 1196 bool NativeWidgetGtk::IsVisible() const {
1198 return GTK_WIDGET_VISIBLE(GetNativeView()); 1197 return GTK_WIDGET_VISIBLE(GetNativeView());
1199 } 1198 }
1200 1199
1201 void NativeWidgetGtk::Activate() { 1200 void NativeWidgetGtk::Activate() {
1202 gtk_window_present(GetNativeWindow()); 1201 gtk_window_present(GetNativeWindow());
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 gdk_cairo_region(cr, event->region); 2069 gdk_cairo_region(cr, event->region);
2071 cairo_fill(cr); 2070 cairo_fill(cr);
2072 cairo_destroy(cr); 2071 cairo_destroy(cr);
2073 } 2072 }
2074 2073
2075 void NativeWidgetGtk::SaveWindowPosition() { 2074 void NativeWidgetGtk::SaveWindowPosition() {
2076 // The delegate may have gone away on us. 2075 // The delegate may have gone away on us.
2077 if (!GetWidget()->widget_delegate()) 2076 if (!GetWidget()->widget_delegate())
2078 return; 2077 return;
2079 2078
2080 ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; 2079 bool maximized = window_state_ & GDK_WINDOW_STATE_MAXIMIZED;
2081 if (IsMaximized())
2082 show_state = ui::SHOW_STATE_MAXIMIZED;
2083 else if (IsMinimized())
2084 show_state = ui::SHOW_STATE_MINIMIZED;
2085 GetWidget()->widget_delegate()->SaveWindowPlacement( 2080 GetWidget()->widget_delegate()->SaveWindowPlacement(
2086 GetWidget()->GetWindowScreenBounds(), 2081 GetWidget()->GetWindowScreenBounds(),
2087 show_state); 2082 maximized);
2088 } 2083 }
2089 2084
2090 //////////////////////////////////////////////////////////////////////////////// 2085 ////////////////////////////////////////////////////////////////////////////////
2091 // Widget, public: 2086 // Widget, public:
2092 2087
2093 // static 2088 // static
2094 void Widget::NotifyLocaleChanged() { 2089 void Widget::NotifyLocaleChanged() {
2095 GList *window_list = gtk_window_list_toplevels(); 2090 GList *window_list = gtk_window_list_toplevels();
2096 for (GList* element = window_list; element; element = g_list_next(element)) { 2091 for (GList* element = window_list; element; element = g_list_next(element)) {
2097 Widget* widget = 2092 Widget* widget =
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 button_pressed = event->type == GDK_BUTTON_PRESS || 2244 button_pressed = event->type == GDK_BUTTON_PRESS ||
2250 event->type == GDK_2BUTTON_PRESS || 2245 event->type == GDK_2BUTTON_PRESS ||
2251 event->type == GDK_3BUTTON_PRESS; 2246 event->type == GDK_3BUTTON_PRESS;
2252 gdk_event_free(event); 2247 gdk_event_free(event);
2253 } 2248 }
2254 return button_pressed; 2249 return button_pressed;
2255 } 2250 }
2256 2251
2257 } // namespace internal 2252 } // namespace internal
2258 } // namespace views 2253 } // 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