| OLD | NEW |
| 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 #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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 virtual ~MessagePumpGlibX(); | 24 virtual ~MessagePumpGlibX(); |
| 25 | 25 |
| 26 // Indicates whether a GDK event was injected by chrome (when |true|) or if it | 26 // Indicates whether a GDK event was injected by chrome (when |true|) or if it |
| 27 // was captured and being processed by GDK (when |false|). | 27 // was captured and being processed by GDK (when |false|). |
| 28 bool IsDispatchingEvent(void) { return dispatching_event_; } | 28 bool IsDispatchingEvent(void) { return dispatching_event_; } |
| 29 | 29 |
| 30 // Overridden from MessagePumpForUI: | 30 // Overridden from MessagePumpForUI: |
| 31 virtual bool RunOnce(GMainContext* context, bool block); | 31 virtual bool RunOnce(GMainContext* context, bool block); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 // Some XEvent's can't be directly read from X event queue and will go |
| 35 // through GDK's dispatching process and may get discarded. This function |
| 36 // sets up a filter to intercept those XEvent's we are interested in |
| 37 // and dispatches them so that they won't get lost. |
| 38 static GdkFilterReturn GdkEventFilter(GdkXEvent* gxevent, |
| 39 GdkEvent* gevent, |
| 40 gpointer data); |
| 41 |
| 34 static void EventDispatcherX(GdkEvent* event, gpointer data); | 42 static void EventDispatcherX(GdkEvent* event, gpointer data); |
| 35 | 43 |
| 44 // Decides whether we are interested in processing this XEvent. |
| 45 bool ShouldCaptureXEvent(XEvent* event); |
| 46 |
| 47 // Dispatches the XEvent and returns true if we should exit the current loop |
| 48 // of message processing. |
| 49 bool ProcessXEvent(XEvent* event); |
| 50 |
| 36 // Sends the event to the observers. If an observer returns true, then it does | 51 // Sends the event to the observers. If an observer returns true, then it does |
| 37 // not send the event to any other observers and returns true. Returns false | 52 // not send the event to any other observers and returns true. Returns false |
| 38 // if no observer returns true. | 53 // if no observer returns true. |
| 39 bool WillProcessXEvent(XEvent* xevent); | 54 bool WillProcessXEvent(XEvent* xevent); |
| 40 | 55 |
| 41 // Update the lookup table and flag the events that should be captured and | 56 // Update the lookup table and flag the events that should be captured and |
| 42 // processed so that GDK doesn't get to them. | 57 // processed so that GDK doesn't get to them. |
| 43 void InitializeEventsToCapture(void); | 58 void InitializeEventsToCapture(void); |
| 44 | 59 |
| 45 #if defined(HAVE_XINPUT2) | 60 #if defined(HAVE_XINPUT2) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 73 // it should be passed on to the default GDK handler. | 88 // it should be passed on to the default GDK handler. |
| 74 std::bitset<LASTEvent> capture_x_events_; | 89 std::bitset<LASTEvent> capture_x_events_; |
| 75 std::bitset<GDK_EVENT_LAST> capture_gdk_events_; | 90 std::bitset<GDK_EVENT_LAST> capture_gdk_events_; |
| 76 | 91 |
| 77 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlibX); | 92 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlibX); |
| 78 }; | 93 }; |
| 79 | 94 |
| 80 } // namespace base | 95 } // namespace base |
| 81 | 96 |
| 82 #endif // BASE_MESSAGE_PUMP_GLIB_X_H | 97 #endif // BASE_MESSAGE_PUMP_GLIB_X_H |
| OLD | NEW |