| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ | 5 #ifndef UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ |
| 6 #define UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ | 6 #define UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/events/events_export.h" | 9 #include "ui/events/events_export.h" |
| 10 #include "ui/events/platform/platform_event_source.h" | 10 #include "ui/events/platform/platform_event_source.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // xserver that |w| has been mapped; StructureNotifyMask events on |w| are | 36 // xserver that |w| has been mapped; StructureNotifyMask events on |w| are |
| 37 // pulled out from the queue and dispatched out of order. | 37 // pulled out from the queue and dispatched out of order. |
| 38 // | 38 // |
| 39 // For those that know X11, this is really a wrapper around XWindowEvent | 39 // For those that know X11, this is really a wrapper around XWindowEvent |
| 40 // which still makes sure the preempted event is dispatched instead of | 40 // which still makes sure the preempted event is dispatched instead of |
| 41 // dropped on the floor. This method exists because mapping a window is | 41 // dropped on the floor. This method exists because mapping a window is |
| 42 // asynchronous (and we receive an XEvent when mapped), while there are also | 42 // asynchronous (and we receive an XEvent when mapped), while there are also |
| 43 // functions which require a mapped window. | 43 // functions which require a mapped window. |
| 44 void BlockUntilWindowMapped(XID window); | 44 void BlockUntilWindowMapped(XID window); |
| 45 | 45 |
| 46 // Dispatches a given event immediately. This is to faciliate sequential |
| 47 // interaction between the gtk event loop (used for IME) and the |
| 48 // main X11 event loop. |
| 49 void DispatchEventNow(XEvent* event); |
| 50 |
| 46 protected: | 51 protected: |
| 47 XDisplay* display() { return display_; } | 52 XDisplay* display() { return display_; } |
| 48 | 53 |
| 49 private: | 54 private: |
| 50 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches | 55 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches |
| 51 // the event. This function also frees up the cookie data after dispatch is | 56 // the event. This function also frees up the cookie data after dispatch is |
| 52 // complete. | 57 // complete. |
| 53 uint32_t ExtractCookieDataDispatchEvent(XEvent* xevent); | 58 uint32_t ExtractCookieDataDispatchEvent(XEvent* xevent); |
| 54 | 59 |
| 55 // PlatformEventSource: | 60 // PlatformEventSource: |
| 56 uint32_t DispatchEvent(XEvent* xevent) override; | 61 uint32_t DispatchEvent(XEvent* xevent) override; |
| 57 void StopCurrentEventStream() override; | 62 void StopCurrentEventStream() override; |
| 58 void OnDispatcherListChanged() override; | 63 void OnDispatcherListChanged() override; |
| 59 | 64 |
| 60 // The connection to the X11 server used to receive the events. | 65 // The connection to the X11 server used to receive the events. |
| 61 XDisplay* display_; | 66 XDisplay* display_; |
| 62 | 67 |
| 63 // Keeps track of whether this source should continue to dispatch all the | 68 // Keeps track of whether this source should continue to dispatch all the |
| 64 // available events. | 69 // available events. |
| 65 bool continue_stream_; | 70 bool continue_stream_; |
| 66 | 71 |
| 67 scoped_ptr<X11HotplugEventHandler> hotplug_event_handler_; | 72 scoped_ptr<X11HotplugEventHandler> hotplug_event_handler_; |
| 68 | 73 |
| 69 DISALLOW_COPY_AND_ASSIGN(X11EventSource); | 74 DISALLOW_COPY_AND_ASSIGN(X11EventSource); |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 } // namespace ui | 77 } // namespace ui |
| 73 | 78 |
| 74 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ | 79 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ |
| OLD | NEW |