| OLD | NEW |
| 1 // Copyright (c) 2010 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 #ifndef BASE_MESSAGE_PUMP_GLIB_X_H | 5 #ifndef BASE_MESSAGE_PUMP_GLIB_X_H |
| 6 #define BASE_MESSAGE_PUMP_GLIB_X_H | 6 #define BASE_MESSAGE_PUMP_GLIB_X_H |
| 7 | 7 |
| 8 #include "base/message_pump.h" | 8 #include "base/message_pump.h" |
| 9 #include "base/message_pump_glib.h" | 9 #include "base/message_pump_glib.h" |
| 10 | 10 |
| 11 #include <bitset> | 11 #include <bitset> |
| 12 #include <set> | 12 #include <set> |
| 13 | 13 |
| 14 #include <glib.h> | 14 #include <glib.h> |
| 15 #include <gtk/gtk.h> | 15 #include <gtk/gtk.h> |
| 16 #include <X11/X.h> | 16 #include <X11/X.h> |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 | 19 |
| 20 class MessagePumpGlibX : public MessagePumpForUI { | 20 class MessagePumpGlibX : public MessagePumpForUI { |
| 21 public: | 21 public: |
| 22 MessagePumpGlibX(); | 22 MessagePumpGlibX(); |
| 23 virtual ~MessagePumpGlibX(); | 23 virtual ~MessagePumpGlibX(); |
| 24 | 24 |
| 25 // MessagePumpForUI implementation. | |
| 26 virtual bool RunOnce(GMainContext* context, bool block); | |
| 27 | |
| 28 // Indicates whether a GDK event was injected by chrome (when |true|) or if it | 25 // Indicates whether a GDK event was injected by chrome (when |true|) or if it |
| 29 // was captured and being processed by GDK (when |false|). | 26 // was captured and being processed by GDK (when |false|). |
| 30 bool IsDispatchingEvent(void) { return dispatching_event_; } | 27 bool IsDispatchingEvent(void) { return dispatching_event_; } |
| 31 | 28 |
| 32 #if defined(HAVE_XINPUT2) | 29 #if defined(HAVE_XINPUT2) |
| 33 // Setup an X Window for XInput2 events. | 30 // Setup an X Window for XInput2 events. |
| 34 void SetupXInput2ForXWindow(Window xid); | 31 void SetupXInput2ForXWindow(Window xid); |
| 35 #endif | 32 #endif |
| 36 | 33 |
| 34 // Overridden from MessagePumpForUI: |
| 35 virtual bool RunOnce(GMainContext* context, bool block); |
| 36 |
| 37 private: | 37 private: |
| 38 static void EventDispatcherX(GdkEvent* event, gpointer data); | 38 static void EventDispatcherX(GdkEvent* event, gpointer data); |
| 39 | 39 |
| 40 // Update the lookup table and flag the events that should be captured and | 40 // Update the lookup table and flag the events that should be captured and |
| 41 // processed so that GDK doesn't get to them. | 41 // processed so that GDK doesn't get to them. |
| 42 void InitializeEventsToCapture(void); | 42 void InitializeEventsToCapture(void); |
| 43 | 43 |
| 44 #if defined(HAVE_XINPUT2) | 44 #if defined(HAVE_XINPUT2) |
| 45 // Initialize X2 input. | 45 // Initialize X2 input. |
| 46 void InitializeXInput2(void); | 46 void InitializeXInput2(void); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // it should be passed on to the default GDK handler. | 80 // it should be passed on to the default GDK handler. |
| 81 std::bitset<LASTEvent> capture_x_events_; | 81 std::bitset<LASTEvent> capture_x_events_; |
| 82 std::bitset<GDK_EVENT_LAST> capture_gdk_events_; | 82 std::bitset<GDK_EVENT_LAST> capture_gdk_events_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlibX); | 84 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlibX); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace base | 87 } // namespace base |
| 88 | 88 |
| 89 #endif // BASE_MESSAGE_PUMP_GLIB_X_H | 89 #endif // BASE_MESSAGE_PUMP_GLIB_X_H |
| OLD | NEW |