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

Side by Side Diff: base/message_pump_x.h

Issue 8872055: Refactor MessagePumpX to dispatch events inside of the source Dispatch function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: allow recurse Created 9 years 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
« no previous file with comments | « base/message_pump_wayland.cc ('k') | base/message_pump_x.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 (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 27 matching lines...) Expand all
38 protected: 38 protected:
39 virtual ~MessagePumpDispatcher() {} 39 virtual ~MessagePumpDispatcher() {}
40 }; 40 };
41 41
42 // This class implements a message-pump for dispatching X events. 42 // This class implements a message-pump for dispatching X events.
43 class BASE_EXPORT MessagePumpX : public MessagePumpGlib { 43 class BASE_EXPORT MessagePumpX : public MessagePumpGlib {
44 public: 44 public:
45 MessagePumpX(); 45 MessagePumpX();
46 virtual ~MessagePumpX(); 46 virtual ~MessagePumpX();
47 47
48 // Overridden from MessagePumpGlib:
49 virtual bool RunOnce(GMainContext* context, bool block) OVERRIDE;
50
51 // Returns default X Display. 48 // Returns default X Display.
52 static Display* GetDefaultXDisplay(); 49 static Display* GetDefaultXDisplay();
53 50
54 // Returns true if the system supports XINPUT2. 51 // Returns true if the system supports XINPUT2.
55 static bool HasXInput2(); 52 static bool HasXInput2();
56 53
57 // Sets the default dispatcher to process native events. 54 // Sets the default dispatcher to process native events.
58 static void SetDefaultDispatcher(MessagePumpDispatcher* dispatcher); 55 static void SetDefaultDispatcher(MessagePumpDispatcher* dispatcher);
59 56
57 // Internal function. Called by the glib source dispatch function. Processes
58 // all available X events.
59 gboolean DispatchXEvents();
60
60 private: 61 private:
61 // Initializes the glib event source for X. 62 // Initializes the glib event source for X.
62 void InitXSource(); 63 void InitXSource();
63 64
64 // Dispatches the XEvent and returns true if we should exit the current loop 65 // Dispatches the XEvent and returns true if we should exit the current loop
65 // of message processing. 66 // of message processing.
66 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); 67 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event);
67 68
68 // Sends the event to the observers. If an observer returns true, then it does 69 // Sends the event to the observers. If an observer returns true, then it does
69 // not send the event to any other observers and returns true. Returns false 70 // not send the event to any other observers and returns true. Returns false
70 // if no observer returns true. 71 // if no observer returns true.
71 bool WillProcessXEvent(XEvent* xevent); 72 bool WillProcessXEvent(XEvent* xevent);
72 void DidProcessXEvent(XEvent* xevent); 73 void DidProcessXEvent(XEvent* xevent);
73 74
74 // The event source for X events. 75 // The event source for X events.
75 GSource* x_source_; 76 GSource* x_source_;
76 77
77 DISALLOW_COPY_AND_ASSIGN(MessagePumpX); 78 DISALLOW_COPY_AND_ASSIGN(MessagePumpX);
78 }; 79 };
79 80
80 typedef MessagePumpX MessagePumpForUI; 81 typedef MessagePumpX MessagePumpForUI;
81 82
82 } // namespace base 83 } // namespace base
83 84
84 #endif // BASE_MESSAGE_PUMP_X_H 85 #endif // BASE_MESSAGE_PUMP_X_H
OLDNEW
« no previous file with comments | « base/message_pump_wayland.cc ('k') | base/message_pump_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698