| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 namespace views { | 124 namespace views { |
| 125 | 125 |
| 126 // During drag and drop GTK sends a drag-leave during a drop. This means we | 126 // During drag and drop GTK sends a drag-leave during a drop. This means we |
| 127 // have no way to tell the difference between a normal drag leave and a drop. | 127 // have no way to tell the difference between a normal drag leave and a drop. |
| 128 // To work around that we listen for DROP_START, then ignore the subsequent | 128 // To work around that we listen for DROP_START, then ignore the subsequent |
| 129 // drag-leave that GTK generates. | 129 // drag-leave that GTK generates. |
| 130 class WidgetGtk::DropObserver : public MessageLoopForUI::Observer { | 130 class WidgetGtk::DropObserver : public MessageLoopForUI::Observer { |
| 131 public: | 131 public: |
| 132 DropObserver() {} | 132 DropObserver() {} |
| 133 | 133 |
| 134 static DropObserver* Get() { | 134 static DropObserver* GetInstance() { |
| 135 return Singleton<DropObserver>::get(); | 135 return Singleton<DropObserver>::get(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 virtual void WillProcessEvent(GdkEvent* event) { | 138 virtual void WillProcessEvent(GdkEvent* event) { |
| 139 if (event->type == GDK_DROP_START) { | 139 if (event->type == GDK_DROP_START) { |
| 140 WidgetGtk* widget = GetWidgetGtkForEvent(event); | 140 WidgetGtk* widget = GetWidgetGtkForEvent(event); |
| 141 if (widget) | 141 if (widget) |
| 142 widget->ignore_drag_leave_ = true; | 142 widget->ignore_drag_leave_ = true; |
| 143 } | 143 } |
| 144 } | 144 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 has_focus_(false), | 246 has_focus_(false), |
| 247 delegate_(NULL), | 247 delegate_(NULL), |
| 248 always_on_top_(false), | 248 always_on_top_(false), |
| 249 is_double_buffered_(false), | 249 is_double_buffered_(false), |
| 250 should_handle_menu_key_release_(false) { | 250 should_handle_menu_key_release_(false) { |
| 251 static bool installed_message_loop_observer = false; | 251 static bool installed_message_loop_observer = false; |
| 252 if (!installed_message_loop_observer) { | 252 if (!installed_message_loop_observer) { |
| 253 installed_message_loop_observer = true; | 253 installed_message_loop_observer = true; |
| 254 MessageLoopForUI* loop = MessageLoopForUI::current(); | 254 MessageLoopForUI* loop = MessageLoopForUI::current(); |
| 255 if (loop) | 255 if (loop) |
| 256 loop->AddObserver(DropObserver::Get()); | 256 loop->AddObserver(DropObserver::GetInstance()); |
| 257 } | 257 } |
| 258 | 258 |
| 259 if (type_ != TYPE_CHILD) | 259 if (type_ != TYPE_CHILD) |
| 260 focus_manager_ = new FocusManager(this); | 260 focus_manager_ = new FocusManager(this); |
| 261 } | 261 } |
| 262 | 262 |
| 263 WidgetGtk::~WidgetGtk() { | 263 WidgetGtk::~WidgetGtk() { |
| 264 DCHECK(delete_on_destroy_ || widget_ == NULL); | 264 DCHECK(delete_on_destroy_ || widget_ == NULL); |
| 265 if (type_ != TYPE_CHILD) | 265 if (type_ != TYPE_CHILD) |
| 266 ActiveWindowWatcherX::RemoveObserver(this); | 266 ActiveWindowWatcherX::RemoveObserver(this); |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 GtkWindow* window = GTK_WINDOW(element->data); | 1655 GtkWindow* window = GTK_WINDOW(element->data); |
| 1656 DCHECK(window); | 1656 DCHECK(window); |
| 1657 RootView *root_view = FindRootView(window); | 1657 RootView *root_view = FindRootView(window); |
| 1658 if (root_view) | 1658 if (root_view) |
| 1659 root_view->NotifyLocaleChanged(); | 1659 root_view->NotifyLocaleChanged(); |
| 1660 } | 1660 } |
| 1661 g_list_free(window_list); | 1661 g_list_free(window_list); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 } // namespace views | 1664 } // namespace views |
| OLD | NEW |