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

Side by Side Diff: base/message_pump_x.h

Issue 7904034: aura: Explicitly disable GTK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
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 10
11 #include <bitset> 11 #include <bitset>
12 12
13 #include <glib.h> 13 #include <glib.h>
14 #include <gtk/gtk.h>
15 14
16 typedef union _XEvent XEvent; 15 typedef union _XEvent XEvent;
17 typedef struct _XDisplay Display; 16 typedef struct _XDisplay Display;
18 17
19 namespace base { 18 namespace base {
20 19
21 // The documentation for this class is in message_pump_glib.h 20 // The documentation for this class is in message_pump_glib.h
22 class BASE_EXPORT MessagePumpObserver { 21 class BASE_EXPORT MessagePumpObserver {
23 public: 22 public:
24 enum EventStatus { 23 enum EventStatus {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // NativeWidgetX is enabled. 74 // NativeWidgetX is enabled.
76 static void DisableGtkMessagePump(); 75 static void DisableGtkMessagePump();
77 76
78 // Returns default X Display. 77 // Returns default X Display.
79 static Display* GetDefaultXDisplay(); 78 static Display* GetDefaultXDisplay();
80 79
81 // Returns true if the system supports XINPUT2. 80 // Returns true if the system supports XINPUT2.
82 static bool HasXInput2(); 81 static bool HasXInput2();
83 82
84 private: 83 private:
84 #if 0
85 // Some XEvent's can't be directly read from X event queue and will go 85 // Some XEvent's can't be directly read from X event queue and will go
86 // through GDK's dispatching process and may get discarded. This function 86 // through GDK's dispatching process and may get discarded. This function
87 // sets up a filter to intercept those XEvent's we are interested in 87 // sets up a filter to intercept those XEvent's we are interested in
88 // and dispatches them so that they won't get lost. 88 // and dispatches them so that they won't get lost.
89 static GdkFilterReturn GdkEventFilter(GdkXEvent* gxevent, 89 static GdkFilterReturn GdkEventFilter(GdkXEvent* gxevent,
90 GdkEvent* gevent, 90 GdkEvent* gevent,
91 gpointer data); 91 gpointer data);
92 92
93 static void EventDispatcherX(GdkEvent* event, gpointer data); 93 static void EventDispatcherX(GdkEvent* event, gpointer data);
94 #endif
94 95
95 // Decides whether we are interested in processing this XEvent. 96 // Decides whether we are interested in processing this XEvent.
96 bool ShouldCaptureXEvent(XEvent* event); 97 bool ShouldCaptureXEvent(XEvent* event);
97 98
98 // Dispatches the XEvent and returns true if we should exit the current loop 99 // Dispatches the XEvent and returns true if we should exit the current loop
99 // of message processing. 100 // of message processing.
100 bool ProcessXEvent(XEvent* event); 101 bool ProcessXEvent(XEvent* event);
101 102
102 // Sends the event to the observers. If an observer returns true, then it does 103 // Sends the event to the observers. If an observer returns true, then it does
103 // not send the event to any other observers and returns true. Returns false 104 // not send the event to any other observers and returns true. Returns false
(...skipping 12 matching lines...) Expand all
116 GSource* gdksource_; 117 GSource* gdksource_;
117 118
118 // The default GDK event dispatcher. This is stored so that it can be restored 119 // The default GDK event dispatcher. This is stored so that it can be restored
119 // when necessary during nested event dispatching. 120 // when necessary during nested event dispatching.
120 gboolean (*gdkdispatcher_)(GSource*, GSourceFunc, void*); 121 gboolean (*gdkdispatcher_)(GSource*, GSourceFunc, void*);
121 122
122 // Indicates whether a GDK event was injected by chrome (when |true|) or if it 123 // Indicates whether a GDK event was injected by chrome (when |true|) or if it
123 // was captured and being processed by GDK (when |false|). 124 // was captured and being processed by GDK (when |false|).
124 bool dispatching_event_; 125 bool dispatching_event_;
125 126
127 #if 0
126 #if ! GTK_CHECK_VERSION(2,18,0) 128 #if ! GTK_CHECK_VERSION(2,18,0)
127 // GDK_EVENT_LAST was introduced in GTK+ 2.18.0. For earlier versions, we pick a 129 // GDK_EVENT_LAST was introduced in GTK+ 2.18.0. For earlier versions, we pick a
128 // large enough value (the value of GDK_EVENT_LAST in 2.18.0) so that it works 130 // large enough value (the value of GDK_EVENT_LAST in 2.18.0) so that it works
129 // for all versions. 131 // for all versions.
130 #define GDK_EVENT_LAST 37 132 #define GDK_EVENT_LAST 37
131 #endif 133 #endif
134 #endif
132 135
133 // Ideally we would #include X.h for LASTEvent, but it brings in a lot of stupid 136 // Ideally we would #include X.h for LASTEvent, but it brings in a lot of stupid
134 // stuff (like Time, CurrentTime etc.) that messes up a lot of things. So define 137 // stuff (like Time, CurrentTime etc.) that messes up a lot of things. So define
135 // XLASTEvent here to a large enough value so that it works. 138 // XLASTEvent here to a large enough value so that it works.
136 #define XLASTEvent 40 139 #define XLASTEvent 40
137 140
138 // We do not want to process all the events ourselves. So we use a lookup 141 // We do not want to process all the events ourselves. So we use a lookup
139 // table to quickly check if a particular event should be handled by us or if 142 // table to quickly check if a particular event should be handled by us or if
140 // it should be passed on to the default GDK handler. 143 // it should be passed on to the default GDK handler.
141 std::bitset<XLASTEvent> capture_x_events_; 144 std::bitset<XLASTEvent> capture_x_events_;
142 std::bitset<GDK_EVENT_LAST> capture_gdk_events_; 145 // std::bitset<GDK_EVENT_LAST> capture_gdk_events_;
143 146
144 DISALLOW_COPY_AND_ASSIGN(MessagePumpX); 147 DISALLOW_COPY_AND_ASSIGN(MessagePumpX);
145 }; 148 };
146 149
147 typedef MessagePumpX MessagePumpForUI; 150 typedef MessagePumpX MessagePumpForUI;
148 151
149 } // namespace base 152 } // namespace base
150 153
151 #endif // BASE_MESSAGE_PUMP_X_H 154 #endif // BASE_MESSAGE_PUMP_X_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698