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 20 matching lines...) Expand all Loading... |
31 #include "views/ime/input_method_gtk.h" | 31 #include "views/ime/input_method_gtk.h" |
32 #include "views/views_delegate.h" | 32 #include "views/views_delegate.h" |
33 #include "views/widget/drop_target_gtk.h" | 33 #include "views/widget/drop_target_gtk.h" |
34 #include "views/widget/gtk_views_fixed.h" | 34 #include "views/widget/gtk_views_fixed.h" |
35 #include "views/widget/gtk_views_window.h" | 35 #include "views/widget/gtk_views_window.h" |
36 #include "views/widget/tooltip_manager_gtk.h" | 36 #include "views/widget/tooltip_manager_gtk.h" |
37 #include "views/widget/widget_delegate.h" | 37 #include "views/widget/widget_delegate.h" |
38 #include "views/window/native_window_gtk.h" | 38 #include "views/window/native_window_gtk.h" |
39 | 39 |
40 #if defined(TOUCH_UI) | 40 #if defined(TOUCH_UI) |
41 #if defined(HAVE_XINPUT2) | |
42 #include <gdk/gdkx.h> | 41 #include <gdk/gdkx.h> |
43 | 42 |
44 #include "ui/gfx/gtk_util.h" | 43 #include "ui/gfx/gtk_util.h" |
45 #include "views/touchui/touch_factory.h" | 44 #include "views/touchui/touch_factory.h" |
46 #endif | 45 #endif |
47 #endif | |
48 | 46 |
49 #if defined(HAVE_IBUS) | 47 #if defined(HAVE_IBUS) |
50 #include "views/ime/input_method_ibus.h" | 48 #include "views/ime/input_method_ibus.h" |
51 #endif | 49 #endif |
52 | 50 |
53 using ui::OSExchangeData; | 51 using ui::OSExchangeData; |
54 using ui::OSExchangeDataProviderGtk; | 52 using ui::OSExchangeDataProviderGtk; |
55 using ui::ActiveWindowWatcherX; | 53 using ui::ActiveWindowWatcherX; |
56 | 54 |
57 namespace views { | 55 namespace views { |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 is_active_(false), | 298 is_active_(false), |
301 transient_to_parent_(false), | 299 transient_to_parent_(false), |
302 got_initial_focus_in_(false), | 300 got_initial_focus_in_(false), |
303 has_focus_(false), | 301 has_focus_(false), |
304 focus_on_creation_(true), | 302 focus_on_creation_(true), |
305 always_on_top_(false), | 303 always_on_top_(false), |
306 is_double_buffered_(false), | 304 is_double_buffered_(false), |
307 should_handle_menu_key_release_(false), | 305 should_handle_menu_key_release_(false), |
308 dragged_view_(NULL), | 306 dragged_view_(NULL), |
309 painted_(false) { | 307 painted_(false) { |
310 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) | 308 #if defined(TOUCH_UI) |
311 // Make sure the touch factory is initialized so that it can setup XInput2 for | 309 // Make sure the touch factory is initialized so that it can setup XInput2 for |
312 // the widget. | 310 // the widget. |
313 TouchFactory::GetInstance(); | 311 TouchFactory::GetInstance(); |
314 #endif | 312 #endif |
315 static bool installed_message_loop_observer = false; | 313 static bool installed_message_loop_observer = false; |
316 if (!installed_message_loop_observer) { | 314 if (!installed_message_loop_observer) { |
317 installed_message_loop_observer = true; | 315 installed_message_loop_observer = true; |
318 MessageLoopForUI* loop = MessageLoopForUI::current(); | 316 MessageLoopForUI* loop = MessageLoopForUI::current(); |
319 if (loop) | 317 if (loop) |
320 loop->AddObserver(DropObserver::GetInstance()); | 318 loop->AddObserver(DropObserver::GetInstance()); |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 // 2) widget_ is not drawable (mapped and visible) | 1053 // 2) widget_ is not drawable (mapped and visible) |
1056 // 3) If it's never painted before. The first expose event will | 1054 // 3) If it's never painted before. The first expose event will |
1057 // paint the area that has to be painted. | 1055 // paint the area that has to be painted. |
1058 if (widget_ && GTK_WIDGET_DRAWABLE(widget_) && painted_) { | 1056 if (widget_ && GTK_WIDGET_DRAWABLE(widget_) && painted_) { |
1059 gtk_widget_queue_draw_area(widget_, rect.x(), rect.y(), rect.width(), | 1057 gtk_widget_queue_draw_area(widget_, rect.x(), rect.y(), rect.width(), |
1060 rect.height()); | 1058 rect.height()); |
1061 } | 1059 } |
1062 } | 1060 } |
1063 | 1061 |
1064 void NativeWidgetGtk::SetCursor(gfx::NativeCursor cursor) { | 1062 void NativeWidgetGtk::SetCursor(gfx::NativeCursor cursor) { |
1065 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) | 1063 #if defined(TOUCH_UI) |
1066 if (!TouchFactory::GetInstance()->is_cursor_visible() && | 1064 if (!TouchFactory::GetInstance()->is_cursor_visible() && |
1067 !TouchFactory::GetInstance()->keep_mouse_cursor()) | 1065 !TouchFactory::GetInstance()->keep_mouse_cursor()) |
1068 cursor = gfx::GetCursor(GDK_BLANK_CURSOR); | 1066 cursor = gfx::GetCursor(GDK_BLANK_CURSOR); |
1069 #endif | 1067 #endif |
1070 // |window_contents_| is placed on top of |widget_|. So the cursor needs to be | 1068 // |window_contents_| is placed on top of |widget_|. So the cursor needs to be |
1071 // set on |window_contents_| instead of |widget_|. | 1069 // set on |window_contents_| instead of |widget_|. |
1072 if (window_contents_) | 1070 if (window_contents_) |
1073 gdk_window_set_cursor(window_contents_->window, cursor); | 1071 gdk_window_set_cursor(window_contents_->window, cursor); |
1074 } | 1072 } |
1075 | 1073 |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 | 1860 |
1863 // And now, notify them that they have a brand new parent. | 1861 // And now, notify them that they have a brand new parent. |
1864 for (NativeWidgets::iterator it = widgets.begin(); | 1862 for (NativeWidgets::iterator it = widgets.begin(); |
1865 it != widgets.end(); ++it) { | 1863 it != widgets.end(); ++it) { |
1866 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, | 1864 (*it)->GetWidget()->NotifyNativeViewHierarchyChanged(true, |
1867 new_parent); | 1865 new_parent); |
1868 } | 1866 } |
1869 } | 1867 } |
1870 | 1868 |
1871 } // namespace views | 1869 } // namespace views |
OLD | NEW |