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

Side by Side Diff: base/message_pump_x.h

Issue 8931009: Revert "Refactor MessagePumpX to dispatch events inside of the source Dispatch function." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
48 // Returns default X Display. 51 // Returns default X Display.
49 static Display* GetDefaultXDisplay(); 52 static Display* GetDefaultXDisplay();
50 53
51 // Returns true if the system supports XINPUT2. 54 // Returns true if the system supports XINPUT2.
52 static bool HasXInput2(); 55 static bool HasXInput2();
53 56
54 // Sets the default dispatcher to process native events. 57 // Sets the default dispatcher to process native events.
55 static void SetDefaultDispatcher(MessagePumpDispatcher* dispatcher); 58 static void SetDefaultDispatcher(MessagePumpDispatcher* dispatcher);
56 59
57 // Internal function. Called by the glib source dispatch function. Processes
58 // all available X events.
59 gboolean DispatchXEvents();
60
61 private: 60 private:
62 // Initializes the glib event source for X. 61 // Initializes the glib event source for X.
63 void InitXSource(); 62 void InitXSource();
64 63
65 // Dispatches the XEvent and returns true if we should exit the current loop 64 // Dispatches the XEvent and returns true if we should exit the current loop
66 // of message processing. 65 // of message processing.
67 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event); 66 bool ProcessXEvent(MessagePumpDispatcher* dispatcher, XEvent* event);
68 67
69 // Sends the event to the observers. If an observer returns true, then it does 68 // Sends the event to the observers. If an observer returns true, then it does
70 // not send the event to any other observers and returns true. Returns false 69 // not send the event to any other observers and returns true. Returns false
71 // if no observer returns true. 70 // if no observer returns true.
72 bool WillProcessXEvent(XEvent* xevent); 71 bool WillProcessXEvent(XEvent* xevent);
73 void DidProcessXEvent(XEvent* xevent); 72 void DidProcessXEvent(XEvent* xevent);
74 73
75 // The event source for X events. 74 // The event source for X events.
76 GSource* x_source_; 75 GSource* x_source_;
77 76
78 DISALLOW_COPY_AND_ASSIGN(MessagePumpX); 77 DISALLOW_COPY_AND_ASSIGN(MessagePumpX);
79 }; 78 };
80 79
81 typedef MessagePumpX MessagePumpForUI; 80 typedef MessagePumpX MessagePumpForUI;
82 81
83 } // namespace base 82 } // namespace base
84 83
85 #endif // BASE_MESSAGE_PUMP_X_H 84 #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