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/widget_gtk.h" | 5 #include "views/widget/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> |
11 #include <X11/Xlib.h> | 11 #include <X11/Xlib.h> |
12 | 12 |
13 #include <set> | 13 #include <set> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/auto_reset.h" | 16 #include "base/auto_reset.h" |
17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "ui/base/dragdrop/drag_drop_types.h" | 20 #include "ui/base/dragdrop/drag_drop_types.h" |
21 #include "ui/base/dragdrop/os_exchange_data.h" | 21 #include "ui/base/dragdrop/os_exchange_data.h" |
22 #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h" | 22 #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h" |
23 #include "ui/base/gtk/gtk_windowing.h" | 23 #include "ui/base/gtk/gtk_windowing.h" |
24 #include "ui/base/x/x11_util.h" | 24 #include "ui/base/x/x11_util.h" |
25 #include "ui/gfx/canvas_skia_paint.h" | 25 #include "ui/gfx/canvas_skia_paint.h" |
26 #include "ui/gfx/path.h" | 26 #include "ui/gfx/path.h" |
27 #include "views/views_delegate.h" | 27 #include "views/views_delegate.h" |
| 28 #include "views/controls/textfield/native_textfield_views.h" |
28 #include "views/focus/view_storage.h" | 29 #include "views/focus/view_storage.h" |
29 #include "views/widget/drop_target_gtk.h" | 30 #include "views/widget/drop_target_gtk.h" |
30 #include "views/widget/gtk_views_fixed.h" | 31 #include "views/widget/gtk_views_fixed.h" |
31 #include "views/widget/gtk_views_window.h" | 32 #include "views/widget/gtk_views_window.h" |
32 #include "views/widget/root_view.h" | 33 #include "views/widget/root_view.h" |
33 #include "views/widget/tooltip_manager_gtk.h" | 34 #include "views/widget/tooltip_manager_gtk.h" |
34 #include "views/widget/widget_delegate.h" | 35 #include "views/widget/widget_delegate.h" |
35 #include "views/window/window_gtk.h" | 36 #include "views/window/window_gtk.h" |
36 | 37 |
37 #if defined(TOUCH_UI) | 38 #if defined(TOUCH_UI) |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 static bool installed_message_loop_observer = false; | 288 static bool installed_message_loop_observer = false; |
288 if (!installed_message_loop_observer) { | 289 if (!installed_message_loop_observer) { |
289 installed_message_loop_observer = true; | 290 installed_message_loop_observer = true; |
290 MessageLoopForUI* loop = MessageLoopForUI::current(); | 291 MessageLoopForUI* loop = MessageLoopForUI::current(); |
291 if (loop) | 292 if (loop) |
292 loop->AddObserver(DropObserver::GetInstance()); | 293 loop->AddObserver(DropObserver::GetInstance()); |
293 } | 294 } |
294 } | 295 } |
295 | 296 |
296 WidgetGtk::~WidgetGtk() { | 297 WidgetGtk::~WidgetGtk() { |
| 298 // We need to delete the input method before calling DestroyRootView(), |
| 299 // because it'll set focus_manager_ to NULL. |
| 300 input_method_.reset(); |
297 DestroyRootView(); | 301 DestroyRootView(); |
298 DCHECK(delete_on_destroy_ || widget_ == NULL); | 302 DCHECK(delete_on_destroy_ || widget_ == NULL); |
299 if (type_ != TYPE_CHILD) | 303 if (type_ != TYPE_CHILD) |
300 ActiveWindowWatcherX::RemoveObserver(this); | 304 ActiveWindowWatcherX::RemoveObserver(this); |
301 } | 305 } |
302 | 306 |
303 void WidgetGtk::SetCreateParams(const CreateParams& params) { | 307 void WidgetGtk::SetCreateParams(const CreateParams& params) { |
304 // Set non-style attributes. | 308 // Set non-style attributes. |
305 set_delete_on_destroy(params.delete_on_destroy); | 309 set_delete_on_destroy(params.delete_on_destroy); |
306 | 310 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 void WidgetGtk::Init(GtkWidget* parent, | 513 void WidgetGtk::Init(GtkWidget* parent, |
510 const gfx::Rect& bounds) { | 514 const gfx::Rect& bounds) { |
511 Widget::Init(parent, bounds); | 515 Widget::Init(parent, bounds); |
512 if (type_ != TYPE_CHILD) | 516 if (type_ != TYPE_CHILD) |
513 ActiveWindowWatcherX::AddObserver(this); | 517 ActiveWindowWatcherX::AddObserver(this); |
514 | 518 |
515 // Make container here. | 519 // Make container here. |
516 CreateGtkWidget(parent, bounds); | 520 CreateGtkWidget(parent, bounds); |
517 delegate_->OnNativeWidgetCreated(); | 521 delegate_->OnNativeWidgetCreated(); |
518 | 522 |
| 523 // Creates input method for toplevel widget after calling |
| 524 // delegate_->OnNativeWidgetCreated(), to make sure that focus manager is |
| 525 // already created at this point. |
| 526 // TODO(suzhe): Always enable input method when we start to use |
| 527 // RenderWidgetHostViewViews in normal ChromeOS. |
| 528 #if !defined(TOUCH_UI) |
| 529 if (type_ != TYPE_CHILD && NativeTextfieldViews::IsTextfieldViewsEnabled()) { |
| 530 #else |
| 531 if (type_ != TYPE_CHILD) { |
| 532 #endif |
| 533 input_method_.reset(new InputMethodGtk(this)); |
| 534 input_method_->Init(GetWidget()); |
| 535 } |
| 536 |
519 if (opacity_ != 255) | 537 if (opacity_ != 255) |
520 SetOpacity(opacity_); | 538 SetOpacity(opacity_); |
521 | 539 |
522 // Make sure we receive our motion events. | 540 // Make sure we receive our motion events. |
523 | 541 |
524 // In general we register most events on the parent of all widgets. At a | 542 // In general we register most events on the parent of all widgets. At a |
525 // minimum we need painting to happen on the parent (otherwise painting | 543 // minimum we need painting to happen on the parent (otherwise painting |
526 // doesn't work at all), and similarly we need mouse release events on the | 544 // doesn't work at all), and similarly we need mouse release events on the |
527 // parent as windows don't get mouse releases. | 545 // parent as windows don't get mouse releases. |
528 gtk_widget_add_events(window_contents_, | 546 gtk_widget_add_events(window_contents_, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 | 676 |
659 void WidgetGtk::ClearNativeFocus() { | 677 void WidgetGtk::ClearNativeFocus() { |
660 DCHECK(type_ != TYPE_CHILD); | 678 DCHECK(type_ != TYPE_CHILD); |
661 if (!GetNativeView()) { | 679 if (!GetNativeView()) { |
662 NOTREACHED(); | 680 NOTREACHED(); |
663 return; | 681 return; |
664 } | 682 } |
665 gtk_window_set_focus(GTK_WINDOW(GetNativeView()), NULL); | 683 gtk_window_set_focus(GTK_WINDOW(GetNativeView()), NULL); |
666 } | 684 } |
667 | 685 |
668 bool WidgetGtk::HandleKeyboardEvent(GdkEventKey* event) { | 686 bool WidgetGtk::HandleKeyboardEvent(const KeyEvent& key) { |
669 if (!GetFocusManager()) | 687 if (!GetFocusManager()) |
670 return false; | 688 return false; |
671 | 689 |
672 KeyEvent key(reinterpret_cast<NativeEvent>(event)); | 690 const int key_code = key.key_code(); |
673 int key_code = key.key_code(); | |
674 bool handled = false; | 691 bool handled = false; |
675 | 692 |
676 // Always reset |should_handle_menu_key_release_| unless we are handling a | 693 // Always reset |should_handle_menu_key_release_| unless we are handling a |
677 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only | 694 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only |
678 // be activated when handling a VKEY_MENU key release event which is preceded | 695 // be activated when handling a VKEY_MENU key release event which is preceded |
679 // by an un-handled VKEY_MENU key press event. | 696 // by an un-handled VKEY_MENU key press event. |
680 if (key_code != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE) | 697 if (key_code != ui::VKEY_MENU || key.type() != ui::ET_KEY_RELEASED) |
681 should_handle_menu_key_release_ = false; | 698 should_handle_menu_key_release_ = false; |
682 | 699 |
683 if (event->type == GDK_KEY_PRESS) { | 700 if (key.type() == ui::ET_KEY_PRESSED) { |
684 // VKEY_MENU is triggered by key release event. | 701 // VKEY_MENU is triggered by key release event. |
685 // FocusManager::OnKeyEvent() returns false when the key has been consumed. | 702 // FocusManager::OnKeyEvent() returns false when the key has been consumed. |
686 if (key_code != ui::VKEY_MENU) | 703 if (key_code != ui::VKEY_MENU) |
687 handled = !GetFocusManager()->OnKeyEvent(key); | 704 handled = !GetFocusManager()->OnKeyEvent(key); |
688 else | 705 else |
689 should_handle_menu_key_release_ = true; | 706 should_handle_menu_key_release_ = true; |
690 } else if (key_code == ui::VKEY_MENU && should_handle_menu_key_release_ && | 707 } else if (key_code == ui::VKEY_MENU && should_handle_menu_key_release_ && |
691 (key.flags() & ~ui::EF_ALT_DOWN) == 0) { | 708 (key.flags() & ~ui::EF_ALT_DOWN) == 0) { |
692 // Trigger VKEY_MENU when only this key is pressed and released, and both | 709 // Trigger VKEY_MENU when only this key is pressed and released, and both |
693 // press and release events are not handled by others. | 710 // press and release events are not handled by others. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 if (HasMouseCapture()) | 778 if (HasMouseCapture()) |
762 gtk_grab_remove(window_contents_); | 779 gtk_grab_remove(window_contents_); |
763 } | 780 } |
764 | 781 |
765 bool WidgetGtk::HasMouseCapture() const { | 782 bool WidgetGtk::HasMouseCapture() const { |
766 // TODO(beng): Should be able to use gtk_widget_has_grab() here but the | 783 // TODO(beng): Should be able to use gtk_widget_has_grab() here but the |
767 // trybots don't have Gtk 2.18. | 784 // trybots don't have Gtk 2.18. |
768 return GTK_WIDGET_HAS_GRAB(window_contents_); | 785 return GTK_WIDGET_HAS_GRAB(window_contents_); |
769 } | 786 } |
770 | 787 |
| 788 InputMethod* WidgetGtk::GetInputMethodNative() { |
| 789 return input_method_.get(); |
| 790 } |
| 791 |
| 792 void WidgetGtk::ReplaceInputMethod(InputMethod* input_method) { |
| 793 input_method_.reset(input_method); |
| 794 if (input_method) { |
| 795 input_method->set_delegate(this); |
| 796 input_method->Init(GetWidget()); |
| 797 } |
| 798 } |
| 799 |
771 gfx::Rect WidgetGtk::GetWindowScreenBounds() const { | 800 gfx::Rect WidgetGtk::GetWindowScreenBounds() const { |
772 // Client == Window bounds on Gtk. | 801 // Client == Window bounds on Gtk. |
773 return GetClientAreaScreenBounds(); | 802 return GetClientAreaScreenBounds(); |
774 } | 803 } |
775 | 804 |
776 gfx::Rect WidgetGtk::GetClientAreaScreenBounds() const { | 805 gfx::Rect WidgetGtk::GetClientAreaScreenBounds() const { |
777 // Due to timing we can get a request for bounds after Close(). | 806 // Due to timing we can get a request for bounds after Close(). |
778 // TODO(beng): Figure out if this is bogus. | 807 // TODO(beng): Figure out if this is bogus. |
779 if (!widget_) | 808 if (!widget_) |
780 return gfx::Rect(size_); | 809 return gfx::Rect(size_); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 if (close_widget_factory_.empty()) { | 880 if (close_widget_factory_.empty()) { |
852 // And we delay the close just in case we're on the stack. | 881 // And we delay the close just in case we're on the stack. |
853 MessageLoop::current()->PostTask(FROM_HERE, | 882 MessageLoop::current()->PostTask(FROM_HERE, |
854 close_widget_factory_.NewRunnableMethod( | 883 close_widget_factory_.NewRunnableMethod( |
855 &WidgetGtk::CloseNow)); | 884 &WidgetGtk::CloseNow)); |
856 } | 885 } |
857 } | 886 } |
858 | 887 |
859 void WidgetGtk::CloseNow() { | 888 void WidgetGtk::CloseNow() { |
860 if (widget_) { | 889 if (widget_) { |
| 890 input_method_.reset(); |
861 gtk_widget_destroy(widget_); // Triggers OnDestroy(). | 891 gtk_widget_destroy(widget_); // Triggers OnDestroy(). |
862 } | 892 } |
863 } | 893 } |
864 | 894 |
865 void WidgetGtk::Show() { | 895 void WidgetGtk::Show() { |
866 if (widget_) { | 896 if (widget_) { |
867 gtk_widget_show(widget_); | 897 gtk_widget_show(widget_); |
868 if (widget_->window) | 898 if (widget_->window) |
869 gdk_window_raise(widget_->window); | 899 gdk_window_raise(widget_->window); |
870 } | 900 } |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 gboolean WidgetGtk::OnFocusIn(GtkWidget* widget, GdkEventFocus* event) { | 1218 gboolean WidgetGtk::OnFocusIn(GtkWidget* widget, GdkEventFocus* event) { |
1189 if (has_focus_) | 1219 if (has_focus_) |
1190 return false; // This is the second focus-in event in a row, ignore it. | 1220 return false; // This is the second focus-in event in a row, ignore it. |
1191 has_focus_ = true; | 1221 has_focus_ = true; |
1192 | 1222 |
1193 should_handle_menu_key_release_ = false; | 1223 should_handle_menu_key_release_ = false; |
1194 | 1224 |
1195 if (type_ == TYPE_CHILD) | 1225 if (type_ == TYPE_CHILD) |
1196 return false; | 1226 return false; |
1197 | 1227 |
| 1228 // Only top-level Widget should have an InputMethod instance. |
| 1229 if (input_method_.get()) |
| 1230 input_method_->OnFocus(); |
| 1231 |
1198 // See description of got_initial_focus_in_ for details on this. | 1232 // See description of got_initial_focus_in_ for details on this. |
1199 if (!got_initial_focus_in_) { | 1233 if (!got_initial_focus_in_) { |
1200 got_initial_focus_in_ = true; | 1234 got_initial_focus_in_ = true; |
1201 SetInitialFocus(); | 1235 SetInitialFocus(); |
1202 } else { | 1236 } else { |
1203 GetFocusManager()->RestoreFocusedView(); | 1237 GetFocusManager()->RestoreFocusedView(); |
1204 } | 1238 } |
1205 return false; | 1239 return false; |
1206 } | 1240 } |
1207 | 1241 |
1208 gboolean WidgetGtk::OnFocusOut(GtkWidget* widget, GdkEventFocus* event) { | 1242 gboolean WidgetGtk::OnFocusOut(GtkWidget* widget, GdkEventFocus* event) { |
1209 if (!has_focus_) | 1243 if (!has_focus_) |
1210 return false; // This is the second focus-out event in a row, ignore it. | 1244 return false; // This is the second focus-out event in a row, ignore it. |
1211 has_focus_ = false; | 1245 has_focus_ = false; |
1212 | 1246 |
1213 if (type_ == TYPE_CHILD) | 1247 if (type_ == TYPE_CHILD) |
1214 return false; | 1248 return false; |
1215 | 1249 |
| 1250 // Only top-level Widget should have an InputMethod instance. |
| 1251 if (input_method_.get()) |
| 1252 input_method_->OnBlur(); |
| 1253 |
1216 // The top-level window lost focus, store the focused view. | 1254 // The top-level window lost focus, store the focused view. |
1217 GetFocusManager()->StoreFocusedView(); | 1255 GetFocusManager()->StoreFocusedView(); |
1218 return false; | 1256 return false; |
1219 } | 1257 } |
1220 | 1258 |
1221 gboolean WidgetGtk::OnKeyEvent(GtkWidget* widget, GdkEventKey* event) { | 1259 gboolean WidgetGtk::OnKeyEvent(GtkWidget* widget, GdkEventKey* event) { |
1222 KeyEvent key(reinterpret_cast<NativeEvent>(event)); | 1260 KeyEvent key(reinterpret_cast<NativeEvent>(event)); |
| 1261 if (input_method_.get()) |
| 1262 input_method_->DispatchKeyEvent(key); |
| 1263 else |
| 1264 DispatchKeyEventPostIME(key); |
1223 | 1265 |
1224 // Always reset |should_handle_menu_key_release_| unless we are handling a | 1266 // Returns true to prevent GtkWindow's default key event handler. |
1225 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only | 1267 return true; |
1226 // be activated when handling a VKEY_MENU key release event which is preceded | |
1227 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent(). | |
1228 if (key.key_code() != ui::VKEY_MENU || event->type != GDK_KEY_RELEASE) | |
1229 should_handle_menu_key_release_ = false; | |
1230 | |
1231 bool handled = false; | |
1232 | |
1233 // Dispatch the key event to View hierarchy first. | |
1234 handled = GetRootView()->ProcessKeyEvent(key); | |
1235 | |
1236 // Dispatch the key event to native GtkWidget hierarchy. | |
1237 // To prevent GtkWindow from handling the key event as a keybinding, we need | |
1238 // to bypass GtkWindow's default key event handler and dispatch the event | |
1239 // here. | |
1240 if (!handled && GTK_IS_WINDOW(widget)) | |
1241 handled = gtk_window_propagate_key_event(GTK_WINDOW(widget), event); | |
1242 | |
1243 // On Linux, in order to handle VKEY_MENU (Alt) accelerator key correctly and | |
1244 // avoid issues like: http://crbug.com/40966 and http://crbug.com/49701, we | |
1245 // should only send the key event to the focus manager if it's not handled by | |
1246 // any View or native GtkWidget. | |
1247 // The flow is different when the focus is in a RenderWidgetHostViewGtk, which | |
1248 // always consumes the key event and send it back to us later by calling | |
1249 // HandleKeyboardEvent() directly, if it's not handled by webkit. | |
1250 if (!handled) | |
1251 handled = HandleKeyboardEvent(event); | |
1252 | |
1253 // Dispatch the key event for bindings processing. | |
1254 if (!handled && GTK_IS_WINDOW(widget)) | |
1255 handled = gtk_bindings_activate_event(GTK_OBJECT(widget), event); | |
1256 | |
1257 // Always return true for toplevel window to prevents GtkWindow's default key | |
1258 // event handler. | |
1259 return GTK_IS_WINDOW(widget) ? true : handled; | |
1260 } | 1268 } |
1261 | 1269 |
1262 gboolean WidgetGtk::OnQueryTooltip(GtkWidget* widget, | 1270 gboolean WidgetGtk::OnQueryTooltip(GtkWidget* widget, |
1263 gint x, | 1271 gint x, |
1264 gint y, | 1272 gint y, |
1265 gboolean keyboard_mode, | 1273 gboolean keyboard_mode, |
1266 GtkTooltip* tooltip) { | 1274 GtkTooltip* tooltip) { |
1267 return tooltip_manager_->ShowTooltip(x, y, keyboard_mode, tooltip); | 1275 return tooltip_manager_->ShowTooltip(x, y, keyboard_mode, tooltip); |
1268 } | 1276 } |
1269 | 1277 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 | 1335 |
1328 RootView* WidgetGtk::CreateRootView() { | 1336 RootView* WidgetGtk::CreateRootView() { |
1329 return new RootView(this); | 1337 return new RootView(this); |
1330 } | 1338 } |
1331 | 1339 |
1332 gfx::AcceleratedWidget WidgetGtk::GetAcceleratedWidget() { | 1340 gfx::AcceleratedWidget WidgetGtk::GetAcceleratedWidget() { |
1333 DCHECK(window_contents_ && window_contents_->window); | 1341 DCHECK(window_contents_ && window_contents_->window); |
1334 return GDK_WINDOW_XID(window_contents_->window); | 1342 return GDK_WINDOW_XID(window_contents_->window); |
1335 } | 1343 } |
1336 | 1344 |
| 1345 void WidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { |
| 1346 // Always reset |should_handle_menu_key_release_| unless we are handling a |
| 1347 // VKEY_MENU key release event. It ensures that VKEY_MENU accelerator can only |
| 1348 // be activated when handling a VKEY_MENU key release event which is preceded |
| 1349 // by an unhandled VKEY_MENU key press event. See also HandleKeyboardEvent(). |
| 1350 if (key.key_code() != ui::VKEY_MENU || key.type() != ui::ET_KEY_RELEASED) |
| 1351 should_handle_menu_key_release_ = false; |
| 1352 |
| 1353 bool handled = false; |
| 1354 |
| 1355 // Dispatch the key event to View hierarchy first. |
| 1356 handled = GetRootView()->ProcessKeyEvent(key); |
| 1357 |
| 1358 if (key.key_code() == ui::VKEY_PROCESSKEY || handled) |
| 1359 return; |
| 1360 |
| 1361 // Dispatch the key event to native GtkWidget hierarchy. |
| 1362 // To prevent GtkWindow from handling the key event as a keybinding, we need |
| 1363 // to bypass GtkWindow's default key event handler and dispatch the event |
| 1364 // here. |
| 1365 GdkEventKey* event = reinterpret_cast<GdkEventKey*>(key.native_event()); |
| 1366 if (!handled && event && GTK_IS_WINDOW(widget_)) |
| 1367 handled = gtk_window_propagate_key_event(GTK_WINDOW(widget_), event); |
| 1368 |
| 1369 // On Linux, in order to handle VKEY_MENU (Alt) accelerator key correctly and |
| 1370 // avoid issues like: http://crbug.com/40966 and http://crbug.com/49701, we |
| 1371 // should only send the key event to the focus manager if it's not handled by |
| 1372 // any View or native GtkWidget. |
| 1373 // The flow is different when the focus is in a RenderWidgetHostViewGtk, which |
| 1374 // always consumes the key event and send it back to us later by calling |
| 1375 // HandleKeyboardEvent() directly, if it's not handled by webkit. |
| 1376 if (!handled) |
| 1377 handled = HandleKeyboardEvent(key); |
| 1378 |
| 1379 // Dispatch the key event for bindings processing. |
| 1380 if (!handled && event && GTK_IS_WINDOW(widget_)) |
| 1381 gtk_bindings_activate_event(GTK_OBJECT(widget_), event); |
| 1382 } |
| 1383 |
1337 gboolean WidgetGtk::OnWindowPaint(GtkWidget* widget, GdkEventExpose* event) { | 1384 gboolean WidgetGtk::OnWindowPaint(GtkWidget* widget, GdkEventExpose* event) { |
1338 // Clear the background to be totally transparent. We don't need to | 1385 // Clear the background to be totally transparent. We don't need to |
1339 // paint the root view here as that is done by OnPaint. | 1386 // paint the root view here as that is done by OnPaint. |
1340 DCHECK(transparent_); | 1387 DCHECK(transparent_); |
1341 DrawTransparentBackground(widget, event); | 1388 DrawTransparentBackground(widget, event); |
1342 return false; | 1389 return false; |
1343 } | 1390 } |
1344 | 1391 |
1345 // static | 1392 // static |
1346 Window* WidgetGtk::GetWindowImpl(GtkWidget* widget) { | 1393 Window* WidgetGtk::GetWindowImpl(GtkWidget* widget) { |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 | 1683 |
1637 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); | 1684 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); |
1638 if (native_widget) | 1685 if (native_widget) |
1639 children->insert(native_widget); | 1686 children->insert(native_widget); |
1640 gtk_container_foreach(GTK_CONTAINER(native_view), | 1687 gtk_container_foreach(GTK_CONTAINER(native_view), |
1641 EnumerateChildWidgetsForNativeWidgets, | 1688 EnumerateChildWidgetsForNativeWidgets, |
1642 reinterpret_cast<gpointer>(children)); | 1689 reinterpret_cast<gpointer>(children)); |
1643 } | 1690 } |
1644 | 1691 |
1645 } // namespace views | 1692 } // namespace views |
OLD | NEW |