| OLD | NEW |
| 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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 gtk_window_move(gtk_window, bounds.x(), bounds.y()); | 890 gtk_window_move(gtk_window, bounds.x(), bounds.y()); |
| 891 } | 891 } |
| 892 } | 892 } |
| 893 | 893 |
| 894 void NativeWidgetGtk::SetSize(const gfx::Size& size) { | 894 void NativeWidgetGtk::SetSize(const gfx::Size& size) { |
| 895 if (child_) { | 895 if (child_) { |
| 896 GtkWidget* parent = gtk_widget_get_parent(widget_); | 896 GtkWidget* parent = gtk_widget_get_parent(widget_); |
| 897 if (GTK_IS_VIEWS_FIXED(parent)) { | 897 if (GTK_IS_VIEWS_FIXED(parent)) { |
| 898 gtk_views_fixed_set_widget_size(widget_, size.width(), size.height()); | 898 gtk_views_fixed_set_widget_size(widget_, size.width(), size.height()); |
| 899 } else { | 899 } else { |
| 900 DCHECK(GTK_IS_FIXED(parent)) | |
| 901 << "Parent of NativeWidgetGtk has to be Fixed or ViewsFixed"; | |
| 902 gtk_widget_set_size_request(widget_, size.width(), size.height()); | 900 gtk_widget_set_size_request(widget_, size.width(), size.height()); |
| 903 } | 901 } |
| 904 } else { | 902 } else { |
| 905 if (GTK_WIDGET_MAPPED(widget_)) | 903 if (GTK_WIDGET_MAPPED(widget_)) |
| 906 gdk_window_resize(widget_->window, size.width(), size.height()); | 904 gdk_window_resize(widget_->window, size.width(), size.height()); |
| 907 GtkWindow* gtk_window = GTK_WINDOW(widget_); | 905 GtkWindow* gtk_window = GTK_WINDOW(widget_); |
| 908 if (!size.IsEmpty()) | 906 if (!size.IsEmpty()) |
| 909 gtk_window_resize(gtk_window, size.width(), size.height()); | 907 gtk_window_resize(gtk_window, size.width(), size.height()); |
| 910 } | 908 } |
| 911 } | 909 } |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 | 1805 |
| 1808 // And now, notify them that they have a brand new parent. | 1806 // And now, notify them that they have a brand new parent. |
| 1809 for (NativeWidgets::iterator it = widgets.begin(); | 1807 for (NativeWidgets::iterator it = widgets.begin(); |
| 1810 it != widgets.end(); ++it) { | 1808 it != widgets.end(); ++it) { |
| 1811 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, | 1809 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, |
| 1812 new_parent); | 1810 new_parent); |
| 1813 } | 1811 } |
| 1814 } | 1812 } |
| 1815 | 1813 |
| 1816 } // namespace views | 1814 } // namespace views |
| OLD | NEW |