| 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_X_H | 5 #ifndef BASE_MESSAGE_PUMP_X_H |
| 6 #define BASE_MESSAGE_PUMP_X_H | 6 #define BASE_MESSAGE_PUMP_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 #include "base/message_pump_observer.h" | 10 #include "base/message_pump_observer.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Overridden from MessagePumpGlib: | 48 // Overridden from MessagePumpGlib: |
| 49 virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE; | 49 virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE; |
| 50 | 50 |
| 51 // Returns default X Display. | 51 // Returns default X Display. |
| 52 static Display* GetDefaultXDisplay(); | 52 static Display* GetDefaultXDisplay(); |
| 53 | 53 |
| 54 // Returns true if the system supports XINPUT2. | 54 // Returns true if the system supports XINPUT2. |
| 55 static bool HasXInput2(); | 55 static bool HasXInput2(); |
| 56 | 56 |
| 57 // Sets the default dispatcher to process native events. |
| 58 static void SetDefaultDispatcher(MessagePumpDispatcher* dispatcher); |
| 59 |
| 57 private: | 60 private: |
| 58 // Initializes the glib event source for X. | 61 // Initializes the glib event source for X. |
| 59 void InitXSource(); | 62 void InitXSource(); |
| 60 | 63 |
| 61 // Dispatches the XEvent and returns true if we should exit the current loop | 64 // Dispatches the XEvent and returns true if we should exit the current loop |
| 62 // of message processing. | 65 // of message processing. |
| 63 bool ProcessXEvent(XEvent* event); | 66 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); |
| 64 | 67 |
| 65 // Sends the event to the observers. If an observer returns true, then it does | 68 // Sends the event to the observers. If an observer returns true, then it does |
| 66 // not send the event to any other observers and returns true. Returns false | 69 // not send the event to any other observers and returns true. Returns false |
| 67 // if no observer returns true. | 70 // if no observer returns true. |
| 68 bool WillProcessXEvent(XEvent* xevent); | 71 bool WillProcessXEvent(XEvent* xevent); |
| 69 void DidProcessXEvent(XEvent* xevent); | 72 void DidProcessXEvent(XEvent* xevent); |
| 70 | 73 |
| 71 // The event source for X events. | 74 // The event source for X events. |
| 72 GSource* x_source_; | 75 GSource* x_source_; |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(MessagePumpX); | 77 DISALLOW_COPY_AND_ASSIGN(MessagePumpX); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 typedef MessagePumpX MessagePumpForUI; | 80 typedef MessagePumpX MessagePumpForUI; |
| 78 | 81 |
| 79 } // namespace base | 82 } // namespace base |
| 80 | 83 |
| 81 #endif // BASE_MESSAGE_PUMP_X_H | 84 #endif // BASE_MESSAGE_PUMP_X_H |
| OLD | NEW |