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

Side by Side Diff: views/widget/widget_gtk.h

Issue 3704005: Hijack mouse-related events for TOUCH_UI builds (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Refactoring to accomodate both Gtk and X11 easily Created 10 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
« no previous file with comments | « views/views.gyp ('k') | views/widget/widget_gtk.cc » ('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) 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 #ifndef VIEWS_WIDGET_WIDGET_GTK_H_ 5 #ifndef VIEWS_WIDGET_WIDGET_GTK_H_
6 #define VIEWS_WIDGET_WIDGET_GTK_H_ 6 #define VIEWS_WIDGET_WIDGET_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 virtual FocusTraversable* GetFocusTraversableParent(); 201 virtual FocusTraversable* GetFocusTraversableParent();
202 virtual View* GetFocusTraversableParentView(); 202 virtual View* GetFocusTraversableParentView();
203 203
204 // Clears the focus on the native widget having the focus. 204 // Clears the focus on the native widget having the focus.
205 virtual void ClearNativeFocus(); 205 virtual void ClearNativeFocus();
206 206
207 // Handles a keyboard event by sending it to our focus manager. 207 // Handles a keyboard event by sending it to our focus manager.
208 // Returns true if it's handled by the focus manager. 208 // Returns true if it's handled by the focus manager.
209 bool HandleKeyboardEvent(GdkEventKey* event); 209 bool HandleKeyboardEvent(GdkEventKey* event);
210 210
211 // Returns the view::Event::flags for a GdkEventButton.
212 static int GetFlagsForEventButton(const GdkEventButton& event);
213
211 protected: 214 protected:
212 // If widget containes another widget, translates event coordinates to the 215 // If widget containes another widget, translates event coordinates to the
213 // contained widget's coordinates, else returns original event coordinates. 216 // contained widget's coordinates, else returns original event coordinates.
214 template<class Event> bool GetContainedWidgetEventCoordinates(Event* event, 217 template<class Event> bool GetContainedWidgetEventCoordinates(Event* event,
215 int* x, 218 int* x,
216 int* y) { 219 int* y) {
217 if (event == NULL || x == NULL || y == NULL) 220 if (event == NULL || x == NULL || y == NULL)
218 return false; 221 return false;
219 *x = event->x; 222 *x = event->x;
220 *y = event->y; 223 *y = event->y;
221 GdkWindow* dest = GTK_WIDGET(window_contents_)->window; 224 GdkWindow* dest = GTK_WIDGET(window_contents_)->window;
222 if (event->window != dest) { 225 if (event->window != dest) {
223 int dest_x, dest_y; 226 int dest_x, dest_y;
224 gdk_window_get_root_origin(dest, &dest_x, &dest_y); 227 gdk_window_get_root_origin(dest, &dest_x, &dest_y);
225 *x = event->x_root - dest_x; 228 *x = event->x_root - dest_x;
226 *y = event->y_root - dest_y; 229 *y = event->y_root - dest_y;
227 return true; 230 return true;
228 } 231 }
229 return false; 232 return false;
230 } 233 }
231 234
232 // Returns the view::Event::flags for a GdkEventButton.
233 static int GetFlagsForEventButton(const GdkEventButton& event);
234
235 // Event handlers: 235 // Event handlers:
236 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnButtonPress, GdkEventButton*); 236 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnButtonPress, GdkEventButton*);
237 CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnSizeRequest, GtkRequisition*); 237 CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnSizeRequest, GtkRequisition*);
238 CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnSizeAllocate, GtkAllocation*); 238 CHROMEGTK_CALLBACK_1(WidgetGtk, void, OnSizeAllocate, GtkAllocation*);
239 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnPaint, GdkEventExpose*); 239 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnPaint, GdkEventExpose*);
240 CHROMEGTK_CALLBACK_4(WidgetGtk, void, OnDragDataGet, 240 CHROMEGTK_CALLBACK_4(WidgetGtk, void, OnDragDataGet,
241 GdkDragContext*, GtkSelectionData*, guint, guint); 241 GdkDragContext*, GtkSelectionData*, guint, guint);
242 CHROMEGTK_CALLBACK_6(WidgetGtk, void, OnDragDataReceived, 242 CHROMEGTK_CALLBACK_6(WidgetGtk, void, OnDragDataReceived,
243 GdkDragContext*, gint, gint, GtkSelectionData*, 243 GdkDragContext*, gint, gint, GtkSelectionData*,
244 guint, guint); 244 guint, guint);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 447
448 // Indicates if we should handle the upcoming Alt key release event. 448 // Indicates if we should handle the upcoming Alt key release event.
449 bool should_handle_menu_key_release_; 449 bool should_handle_menu_key_release_;
450 450
451 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); 451 DISALLOW_COPY_AND_ASSIGN(WidgetGtk);
452 }; 452 };
453 453
454 } // namespace views 454 } // namespace views
455 455
456 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ 456 #endif // VIEWS_WIDGET_WIDGET_GTK_H_
OLDNEW
« no previous file with comments | « views/views.gyp ('k') | views/widget/widget_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698