Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: ui/events/platform/x11/x11_event_source.h

Issue 1892483005: SelectionOwner: add support for TIMESTAMP target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: USE_GLIB Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/x/selection_owner.cc ('k') | ui/events/platform/x11/x11_event_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "ui/events/events_export.h" 13 #include "ui/events/events_export.h"
14 #include "ui/gfx/x/x11_types.h" 14 #include "ui/gfx/x/x11_types.h"
15 15
16 typedef union _XEvent XEvent; 16 using Time = unsigned long;
17 typedef unsigned long XID; 17 using XEvent = union _XEvent;
18 using XID = unsigned long;
18 19
19 namespace ui { 20 namespace ui {
20 21
21 class X11HotplugEventHandler; 22 class X11HotplugEventHandler;
22 23
23 // Responsible for notifying X11EventSource when new XEvents are available and 24 // Responsible for notifying X11EventSource when new XEvents are available and
24 // processing/dispatching XEvents. Implementations will likely be a 25 // processing/dispatching XEvents. Implementations will likely be a
25 // PlatformEventSource. 26 // PlatformEventSource.
26 class X11EventSourceDelegate { 27 class X11EventSourceDelegate {
27 public: 28 public:
(...skipping 24 matching lines...) Expand all
52 // pulled out from the queue and dispatched out of order. 53 // pulled out from the queue and dispatched out of order.
53 // 54 //
54 // For those that know X11, this is really a wrapper around XWindowEvent 55 // For those that know X11, this is really a wrapper around XWindowEvent
55 // which still makes sure the preempted event is dispatched instead of 56 // which still makes sure the preempted event is dispatched instead of
56 // dropped on the floor. This method exists because mapping a window is 57 // dropped on the floor. This method exists because mapping a window is
57 // asynchronous (and we receive an XEvent when mapped), while there are also 58 // asynchronous (and we receive an XEvent when mapped), while there are also
58 // functions which require a mapped window. 59 // functions which require a mapped window.
59 void BlockUntilWindowMapped(XID window); 60 void BlockUntilWindowMapped(XID window);
60 61
61 XDisplay* display() { return display_; } 62 XDisplay* display() { return display_; }
63 Time last_seen_server_time() const { return last_seen_server_time_; }
62 64
63 void StopCurrentEventStream(); 65 void StopCurrentEventStream();
64 void OnDispatcherListChanged(); 66 void OnDispatcherListChanged();
65 67
66 protected: 68 protected:
67 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches 69 // Extracts cookie data from |xevent| if it's of GenericType, and dispatches
68 // the event. This function also frees up the cookie data after dispatch is 70 // the event. This function also frees up the cookie data after dispatch is
69 // complete. 71 // complete.
70 void ExtractCookieDataDispatchEvent(XEvent* xevent); 72 void ExtractCookieDataDispatchEvent(XEvent* xevent);
71 73
72 // Handles updates after event has been dispatched. 74 // Handles updates after event has been dispatched.
73 void PostDispatchEvent(XEvent* xevent); 75 void PostDispatchEvent(XEvent* xevent);
74 76
75 private: 77 private:
76 static X11EventSource* instance_; 78 static X11EventSource* instance_;
77 79
78 X11EventSourceDelegate* delegate_; 80 X11EventSourceDelegate* delegate_;
79 81
80 // The connection to the X11 server used to receive the events. 82 // The connection to the X11 server used to receive the events.
81 XDisplay* display_; 83 XDisplay* display_;
82 84
85 // The last timestamp seen in an XEvent.
86 Time last_seen_server_time_;
87
83 // Keeps track of whether this source should continue to dispatch all the 88 // Keeps track of whether this source should continue to dispatch all the
84 // available events. 89 // available events.
85 bool continue_stream_ = true; 90 bool continue_stream_ = true;
86 91
87 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_; 92 std::unique_ptr<X11HotplugEventHandler> hotplug_event_handler_;
88 93
89 DISALLOW_COPY_AND_ASSIGN(X11EventSource); 94 DISALLOW_COPY_AND_ASSIGN(X11EventSource);
90 }; 95 };
91 96
92 } // namespace ui 97 } // namespace ui
93 98
94 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_ 99 #endif // UI_EVENTS_PLATFORM_X11_X11_EVENT_SOURCE_H_
OLDNEW
« no previous file with comments | « ui/base/x/selection_owner.cc ('k') | ui/events/platform/x11/x11_event_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698