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

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

Issue 8477019: Adds Window::MoveChildToFront, with surrounding changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 9 years, 1 month 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 gint parent_h = 0; 1021 gint parent_h = 0;
1022 gtk_window_get_size(parent, &parent_w, &parent_h); 1022 gtk_window_get_size(parent, &parent_w, &parent_h);
1023 center_rect = gfx::Rect(parent_x, parent_y, parent_w, parent_h); 1023 center_rect = gfx::Rect(parent_x, parent_y, parent_w, parent_h);
1024 } else { 1024 } else {
1025 // We have no parent window, center over the screen. 1025 // We have no parent window, center over the screen.
1026 center_rect = gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView()); 1026 center_rect = gfx::Screen::GetMonitorWorkAreaNearestWindow(GetNativeView());
1027 } 1027 }
1028 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, 1028 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2,
1029 center_rect.y() + (center_rect.height() - size.height()) / 2, 1029 center_rect.y() + (center_rect.height() - size.height()) / 2,
1030 size.width(), size.height()); 1030 size.width(), size.height());
1031 SetBoundsConstrained(bounds, NULL); 1031 widget_->SetBoundsConstrained(bounds);
1032 } 1032 }
1033 1033
1034 void NativeWidgetGtk::GetWindowPlacement( 1034 void NativeWidgetGtk::GetWindowPlacement(
1035 gfx::Rect* bounds, 1035 gfx::Rect* bounds,
1036 ui::WindowShowState* show_state) const { 1036 ui::WindowShowState* show_state) const {
1037 // Do nothing for now. ChromeOS isn't yet saving window placement. 1037 // Do nothing for now. ChromeOS isn't yet saving window placement.
1038 } 1038 }
1039 1039
1040 void NativeWidgetGtk::SetWindowTitle(const string16& title) { 1040 void NativeWidgetGtk::SetWindowTitle(const string16& title) {
1041 // We don't have a window title on ChromeOS (right now). 1041 // We don't have a window title on ChromeOS (right now).
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 } 1137 }
1138 } else { 1138 } else {
1139 if (GTK_WIDGET_MAPPED(widget_)) 1139 if (GTK_WIDGET_MAPPED(widget_))
1140 gdk_window_resize(widget_->window, size.width(), size.height()); 1140 gdk_window_resize(widget_->window, size.width(), size.height());
1141 GtkWindow* gtk_window = GTK_WINDOW(widget_); 1141 GtkWindow* gtk_window = GTK_WINDOW(widget_);
1142 if (!size.IsEmpty()) 1142 if (!size.IsEmpty())
1143 gtk_window_resize(gtk_window, size.width(), size.height()); 1143 gtk_window_resize(gtk_window, size.width(), size.height());
1144 } 1144 }
1145 } 1145 }
1146 1146
1147 void NativeWidgetGtk::SetBoundsConstrained(const gfx::Rect& bounds,
1148 Widget* other_widget) {
1149 // We apparently don't care about |other_widget|.
1150 SetBounds(bounds);
1151 }
1152
1153 void NativeWidgetGtk::MoveAbove(gfx::NativeView native_view) { 1147 void NativeWidgetGtk::MoveAbove(gfx::NativeView native_view) {
1154 ui::StackPopupWindow(GetNativeView(), native_view); 1148 ui::StackPopupWindow(GetNativeView(), native_view);
1155 } 1149 }
1156 1150
1157 void NativeWidgetGtk::MoveToTop() { 1151 void NativeWidgetGtk::MoveToTop() {
1158 DCHECK(GTK_IS_WINDOW(GetNativeView())); 1152 DCHECK(GTK_IS_WINDOW(GetNativeView()));
1159 gtk_window_present(GTK_WINDOW(GetNativeView())); 1153 gtk_window_present(GTK_WINDOW(GetNativeView()));
1160 } 1154 }
1161 1155
1162 void NativeWidgetGtk::SetShape(gfx::NativeRegion region) { 1156 void NativeWidgetGtk::SetShape(gfx::NativeRegion region) {
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 button_pressed = event->type == GDK_BUTTON_PRESS || 2301 button_pressed = event->type == GDK_BUTTON_PRESS ||
2308 event->type == GDK_2BUTTON_PRESS || 2302 event->type == GDK_2BUTTON_PRESS ||
2309 event->type == GDK_3BUTTON_PRESS; 2303 event->type == GDK_3BUTTON_PRESS;
2310 gdk_event_free(event); 2304 gdk_event_free(event);
2311 } 2305 }
2312 return button_pressed; 2306 return button_pressed;
2313 } 2307 }
2314 2308
2315 } // namespace internal 2309 } // namespace internal
2316 } // namespace views 2310 } // 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