OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BASE_MESSAGE_PUMP_GLIB_X_DISPATCH_H | |
6 #define BASE_MESSAGE_PUMP_GLIB_X_DISPATCH_H | |
7 | |
8 #include "base/base_api.h" | |
9 #include "base/message_pump.h" | |
10 #include "base/message_pump_glib.h" | |
11 | |
12 typedef union _XEvent XEvent; | |
13 | |
14 namespace base { | |
15 | |
16 // The message pump used for TOUCH_UI on linux is MessagePumpGlibX, which can | |
17 // dispatch both GdkEvents* and XEvents* captured directly from X. | |
18 // MessagePumpForUI::Dispatcher provides the mechanism for dispatching | |
19 // GdkEvents. This class provides additional mechanism for dispatching XEvents. | |
20 class MessagePumpGlibXDispatcher : public MessagePumpForUI::Dispatcher { | |
21 public: | |
22 enum DispatchStatus { | |
23 EVENT_IGNORED, // The event was not processed. | |
24 EVENT_PROCESSED, // The event has been processed. | |
25 EVENT_QUIT // The event was processed and the message-loop should | |
26 // terminate. | |
27 }; | |
28 | |
29 // Dispatches the event. EVENT_IGNORED is returned if the event was ignored | |
30 // (i.e. not processed). EVENT_PROCESSED is returned if the event was | |
31 // processed. The nested loop exits immediately if EVENT_QUIT is returned. | |
32 virtual DispatchStatus DispatchX(XEvent* xevent) = 0; | |
33 }; | |
34 | |
35 class BASE_API MessagePumpXObserver : public MessagePumpForUI::Observer { | |
36 public: | |
37 // This method is called before processing an XEvent. If the method returns | |
38 // true, it indicates the event has already been handled, so the event is not | |
39 // processed any farther. If the method returns false, the event dispatching | |
40 // proceeds as normal. | |
41 virtual bool WillProcessXEvent(XEvent* xevent); | |
42 }; | |
43 | |
44 } // namespace base | |
45 | |
46 #endif // BASE_MESSAGE_PUMP_GLIB_X_DISPATCH_H | |
OLD | NEW |