Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: views/widget/native_widget_gtk.cc

Issue 8021009: Consolidate message observer API for win and aura (and touch). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed msw's comments Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // have no way to tell the difference between a normal drag leave and a drop. 253 // have no way to tell the difference between a normal drag leave and a drop.
254 // To work around that we listen for DROP_START, then ignore the subsequent 254 // To work around that we listen for DROP_START, then ignore the subsequent
255 // drag-leave that GTK generates. 255 // drag-leave that GTK generates.
256 class NativeWidgetGtk::DropObserver : public MessageLoopForUI::Observer { 256 class NativeWidgetGtk::DropObserver : public MessageLoopForUI::Observer {
257 public: 257 public:
258 DropObserver() {} 258 DropObserver() {}
259 259
260 static DropObserver* GetInstance() { 260 static DropObserver* GetInstance() {
261 return Singleton<DropObserver>::get(); 261 return Singleton<DropObserver>::get();
262 } 262 }
263 #if defined(TOUCH_UI)
264 virtual base::EventStatus WillProcessEvent(
265 const base::NativeEvent& event) OVERRIDE {
266 return base::EVENT_CONTINUE;
267 }
263 268
269 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
270 }
271 #else
264 virtual void WillProcessEvent(GdkEvent* event) { 272 virtual void WillProcessEvent(GdkEvent* event) {
265 if (event->type == GDK_DROP_START) { 273 if (event->type == GDK_DROP_START) {
266 NativeWidgetGtk* widget = GetNativeWidgetGtkForEvent(event); 274 NativeWidgetGtk* widget = GetNativeWidgetGtkForEvent(event);
267 if (widget) 275 if (widget)
268 widget->ignore_drag_leave_ = true; 276 widget->ignore_drag_leave_ = true;
269 } 277 }
270 } 278 }
271 279
272 virtual void DidProcessEvent(GdkEvent* event) { 280 virtual void DidProcessEvent(GdkEvent* event) {
273 } 281 }
282 #endif
274 283
275 private: 284 private:
276 NativeWidgetGtk* GetNativeWidgetGtkForEvent(GdkEvent* event) { 285 NativeWidgetGtk* GetNativeWidgetGtkForEvent(GdkEvent* event) {
277 GtkWidget* gtk_widget = gtk_get_event_widget(event); 286 GtkWidget* gtk_widget = gtk_get_event_widget(event);
278 if (!gtk_widget) 287 if (!gtk_widget)
279 return NULL; 288 return NULL;
280 289
281 return static_cast<NativeWidgetGtk*>( 290 return static_cast<NativeWidgetGtk*>(
282 internal::NativeWidgetPrivate::GetNativeWidgetForNativeView( 291 internal::NativeWidgetPrivate::GetNativeWidgetForNativeView(
283 gtk_widget)); 292 gtk_widget));
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 button_pressed = event->type == GDK_BUTTON_PRESS || 2280 button_pressed = event->type == GDK_BUTTON_PRESS ||
2272 event->type == GDK_2BUTTON_PRESS || 2281 event->type == GDK_2BUTTON_PRESS ||
2273 event->type == GDK_3BUTTON_PRESS; 2282 event->type == GDK_3BUTTON_PRESS;
2274 gdk_event_free(event); 2283 gdk_event_free(event);
2275 } 2284 }
2276 return button_pressed; 2285 return button_pressed;
2277 } 2286 }
2278 2287
2279 } // namespace internal 2288 } // namespace internal
2280 } // namespace views 2289 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698