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

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

Issue 125087: Make WidgetGtk::SetBounds use a single call if it can. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/widget_gtk.h" 5 #include "views/widget/widget_gtk.h"
6 6
7 #include "app/gfx/path.h" 7 #include "app/gfx/path.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "views/fill_layout.h" 9 #include "views/fill_layout.h"
10 #include "views/widget/default_theme_provider.h" 10 #include "views/widget/default_theme_provider.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 return out->SetRect(x, y, w, h); 257 return out->SetRect(x, y, w, h);
258 } 258 }
259 259
260 void WidgetGtk::SetBounds(const gfx::Rect& bounds) { 260 void WidgetGtk::SetBounds(const gfx::Rect& bounds) {
261 if (type_ == TYPE_CHILD) { 261 if (type_ == TYPE_CHILD) {
262 WidgetGtk* parent_widget = GetViewForNative(gtk_widget_get_parent(widget_)); 262 WidgetGtk* parent_widget = GetViewForNative(gtk_widget_get_parent(widget_));
263 parent_widget->PositionChild(widget_, bounds.x(), bounds.y(), 263 parent_widget->PositionChild(widget_, bounds.x(), bounds.y(),
264 bounds.width(), bounds.height()); 264 bounds.width(), bounds.height());
265 } else if (GTK_WIDGET_MAPPED(widget_)) {
266 // If the widget is mapped (on screen), we can move and resize with one
267 // call, which avoids two separate window manager steps.
268 gdk_window_move_resize(widget_->window, bounds.x(), bounds.y(),
269 bounds.width(), bounds.height());
265 } else { 270 } else {
266 GtkWindow* gtk_window = GTK_WINDOW(widget_); 271 GtkWindow* gtk_window = GTK_WINDOW(widget_);
267 // TODO: this may need to set an initial size if not showing. 272 // TODO: this may need to set an initial size if not showing.
268 // TODO: need to constrain based on screen size. 273 // TODO: need to constrain based on screen size.
269 gtk_window_resize(gtk_window, bounds.width(), bounds.height()); 274 gtk_window_resize(gtk_window, bounds.width(), bounds.height());
270 gtk_window_move(gtk_window, bounds.x(), bounds.y()); 275 gtk_window_move(gtk_window, bounds.x(), bounds.y());
271 } 276 }
272 } 277 }
273 278
274 void WidgetGtk::SetShape(const gfx::Path& shape) { 279 void WidgetGtk::SetShape(const gfx::Path& shape) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 void WidgetGtk::HandleGrabBroke() { 796 void WidgetGtk::HandleGrabBroke() {
792 if (has_capture_) { 797 if (has_capture_) {
793 if (is_mouse_down_) 798 if (is_mouse_down_)
794 root_view_->ProcessMouseDragCanceled(); 799 root_view_->ProcessMouseDragCanceled();
795 is_mouse_down_ = false; 800 is_mouse_down_ = false;
796 has_capture_ = false; 801 has_capture_ = false;
797 } 802 }
798 } 803 }
799 804
800 } // namespace views 805 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698