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

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: sync 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
« no previous file with comments | « views/mouse_watcher.cc ('k') | views/widget/native_widget_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
Ben Goodger (Google) 2011/09/30 20:50:51 Why are these two branches incompatible? Does GdkE
oshima 2011/09/30 21:17:22 aura/touch has different signature (returns base::
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 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 button_pressed = event->type == GDK_BUTTON_PRESS || 2285 button_pressed = event->type == GDK_BUTTON_PRESS ||
2277 event->type == GDK_2BUTTON_PRESS || 2286 event->type == GDK_2BUTTON_PRESS ||
2278 event->type == GDK_3BUTTON_PRESS; 2287 event->type == GDK_3BUTTON_PRESS;
2279 gdk_event_free(event); 2288 gdk_event_free(event);
2280 } 2289 }
2281 return button_pressed; 2290 return button_pressed;
2282 } 2291 }
2283 2292
2284 } // namespace internal 2293 } // namespace internal
2285 } // namespace views 2294 } // namespace views
OLDNEW
« no previous file with comments | « views/mouse_watcher.cc ('k') | views/widget/native_widget_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698