| 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 <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/shape.h> | 9 #include <X11/extensions/shape.h> |
| 10 #include <gdk/gdk.h> | 10 #include <gdk/gdk.h> |
| 11 #include <gdk/gdkx.h> | 11 #include <gdk/gdkx.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/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "ui/base/dragdrop/drag_drop_types.h" | 21 #include "ui/base/dragdrop/drag_drop_types.h" |
| 22 #include "ui/base/dragdrop/os_exchange_data.h" | 22 #include "ui/base/dragdrop/os_exchange_data.h" |
| 23 #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h" | 23 #include "ui/base/dragdrop/os_exchange_data_provider_gtk.h" |
| 24 #include "ui/base/gtk/g_object_destructor_filo.h" | 24 #include "ui/base/gtk/g_object_destructor_filo.h" |
| 25 #include "ui/base/gtk/gtk_signal_registrar.h" | 25 #include "ui/base/gtk/gtk_signal_registrar.h" |
| 26 #include "ui/base/gtk/gtk_windowing.h" | 26 #include "ui/base/gtk/gtk_windowing.h" |
| 27 #include "ui/base/gtk/scoped_handle_gtk.h" | 27 #include "ui/base/gtk/scoped_handle_gtk.h" |
| 28 #include "ui/base/hit_test.h" | 28 #include "ui/base/hit_test.h" |
| 29 #include "ui/base/x/active_window_watcher_x.h" |
| 29 #include "ui/base/x/x11_util.h" | 30 #include "ui/base/x/x11_util.h" |
| 30 #include "ui/gfx/canvas_skia_paint.h" | 31 #include "ui/gfx/canvas_skia_paint.h" |
| 31 #include "ui/gfx/compositor/compositor.h" | 32 #include "ui/gfx/compositor/compositor.h" |
| 32 #include "ui/gfx/gtk_util.h" | 33 #include "ui/gfx/gtk_util.h" |
| 33 #include "ui/gfx/path.h" | 34 #include "ui/gfx/path.h" |
| 34 #include "ui/gfx/screen.h" | 35 #include "ui/gfx/screen.h" |
| 35 #include "ui/views/bubble/bubble_delegate.h" | 36 #include "ui/views/bubble/bubble_delegate.h" |
| 36 #include "ui/views/focus/view_storage.h" | 37 #include "ui/views/focus/view_storage.h" |
| 37 #include "ui/views/ime/input_method_gtk.h" | 38 #include "ui/views/ime/input_method_gtk.h" |
| 38 #include "views/controls/textfield/native_textfield_views.h" | 39 #include "views/controls/textfield/native_textfield_views.h" |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 gtk_views_fixed_get_widget_size(GetNativeView(), &width, &height)) { | 554 gtk_views_fixed_get_widget_size(GetNativeView(), &width, &height)) { |
| 554 out->SetSize(width, height); | 555 out->SetSize(width, height); |
| 555 } else { | 556 } else { |
| 556 GtkRequisition requisition; | 557 GtkRequisition requisition; |
| 557 gtk_widget_get_child_requisition(GetNativeView(), &requisition); | 558 gtk_widget_get_child_requisition(GetNativeView(), &requisition); |
| 558 out->SetSize(requisition.width, requisition.height); | 559 out->SetSize(requisition.width, requisition.height); |
| 559 } | 560 } |
| 560 } | 561 } |
| 561 | 562 |
| 562 //////////////////////////////////////////////////////////////////////////////// | 563 //////////////////////////////////////////////////////////////////////////////// |
| 563 // NativeWidgetGtk, ActiveWindowWatcherX::Observer implementation: | 564 // NativeWidgetGtk, ActiveWindowWatcherXObserver implementation: |
| 564 | 565 |
| 565 void NativeWidgetGtk::ActiveWindowChanged(GdkWindow* active_window) { | 566 void NativeWidgetGtk::ActiveWindowChanged(GdkWindow* active_window) { |
| 566 if (!GetNativeView()) | 567 if (!GetNativeView()) |
| 567 return; | 568 return; |
| 568 | 569 |
| 569 bool was_active = IsActive(); | 570 bool was_active = IsActive(); |
| 570 is_active_ = (active_window == GTK_WIDGET(GetNativeView())->window); | 571 is_active_ = (active_window == GTK_WIDGET(GetNativeView())->window); |
| 571 if (!is_active_ && active_window && !child_) { | 572 if (!is_active_ && active_window && !child_) { |
| 572 // We're not active, but the force the window to be rendered as active if | 573 // We're not active, but the force the window to be rendered as active if |
| 573 // a child window is transient to us. | 574 // a child window is transient to us. |
| (...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2303 button_pressed = event->type == GDK_BUTTON_PRESS || | 2304 button_pressed = event->type == GDK_BUTTON_PRESS || |
| 2304 event->type == GDK_2BUTTON_PRESS || | 2305 event->type == GDK_2BUTTON_PRESS || |
| 2305 event->type == GDK_3BUTTON_PRESS; | 2306 event->type == GDK_3BUTTON_PRESS; |
| 2306 gdk_event_free(event); | 2307 gdk_event_free(event); |
| 2307 } | 2308 } |
| 2308 return button_pressed; | 2309 return button_pressed; |
| 2309 } | 2310 } |
| 2310 | 2311 |
| 2311 } // namespace internal | 2312 } // namespace internal |
| 2312 } // namespace views | 2313 } // namespace views |
| OLD | NEW |