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

Unified Diff: ui/base/x/x11_scoped_event_selector.h

Issue 2319933002: X11: Remove calls to XSelectInput (Closed)
Patch Set: Remove XWindowEventManager Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/x/x11_scoped_event_selector.h
diff --git a/ui/base/x/x11_window_event_manager.h b/ui/base/x/x11_scoped_event_selector.h
similarity index 55%
rename from ui/base/x/x11_window_event_manager.h
rename to ui/base/x/x11_scoped_event_selector.h
index 0ac5a5f96c7b5517ca3c7947bc9911ef74b72189..7c3ce009dd8f3a055338903843e37caedd5e37af 100644
--- a/ui/base/x/x11_window_event_manager.h
+++ b/ui/base/x/x11_scoped_event_selector.h
@@ -2,56 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_BASE_X_X11_WINDOW_EVENT_MANAGER_H_
-#define UI_BASE_X_X11_WINDOW_EVENT_MANAGER_H_
+#ifndef UI_BASE_X_X11_SCOPED_EVENT_SELECTOR_H_
+#define UI_BASE_X_X11_SCOPED_EVENT_SELECTOR_H_
#include <map>
-#include <vector>
-#include "base/compiler_specific.h"
#include "base/macros.h"
#include "ui/base/x/ui_base_x_export.h"
#include "ui/gfx/x/x11_types.h"
-// A process wide singleton for selecting events on X windows which were not
-// created by Chrome.
-namespace base {
-template <typename T>
-struct DefaultSingletonTraits;
-}
-
namespace ui {
// Ensures events in |event_mask| are selected on |xid| for the duration of this
-// object's lifetime.
+// object's lifetime. This class allows multiple clients within Chrome to
+// select events on the same X window.
class UI_BASE_X_EXPORT XScopedEventSelector {
public:
XScopedEventSelector(XID xid, uint32_t event_mask);
~XScopedEventSelector();
private:
- XID xid_;
- uint32_t event_mask_;
-
- DISALLOW_COPY_AND_ASSIGN(XScopedEventSelector);
-};
-
-// Manages the events that Chrome has selected on X windows which were not
-// created by Chrome. This class allows multiple clients within Chrome to select
-// events on the same X window.
-class UI_BASE_X_EXPORT XWindowEventManager {
- public:
- static XWindowEventManager* GetInstance();
-
- private:
- friend struct base::DefaultSingletonTraits<XWindowEventManager>;
- friend class XScopedEventSelector;
-
- class MultiMask;
-
- XWindowEventManager();
- ~XWindowEventManager();
-
// Guarantees that events in |event_mask| will be reported to Chrome.
void SelectEvents(XID xid, uint32_t event_mask);
@@ -63,11 +33,16 @@ class UI_BASE_X_EXPORT XWindowEventManager {
// Updates the event mask with respect to the server, if necessary.
void AfterMaskChanged(XID xid, uint32_t old_mask);
- std::map<XID, std::unique_ptr<MultiMask>> mask_map_;
+ class MultiMask;
- DISALLOW_COPY_AND_ASSIGN(XWindowEventManager);
+ XID xid_;
+ uint32_t event_mask_;
+
+ static std::map<XID, std::unique_ptr<MultiMask>> mask_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(XScopedEventSelector);
};
} // namespace ui
-#endif // UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
+#endif // UI_BASE_X_X11_SCOPED_EVENT_SELECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698