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: ui/base/x/x11_window_manager.h

Issue 2313033002: Refactor X11ForeignWindowManager (Reland) (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « ui/base/x/x11_foreign_window_manager.cc ('k') | ui/base/x/x11_window_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
6 #define UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
7
8 #include <map>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "base/macros.h"
13 #include "ui/base/x/ui_base_x_export.h"
14 #include "ui/gfx/x/x11_types.h"
15
16 // A process wide singleton for selecting events on X windows which were not
17 // created by Chrome.
18 namespace base {
19 template <typename T> struct DefaultSingletonTraits;
20 }
21
22 namespace ui {
23
24 // Manages the events that Chrome has selected on X windows which were not
25 // created by Chrome. This class allows several clients to select events
26 // on the same X window.
27 class UI_BASE_X_EXPORT XWindowManager {
Elliot Glaysher 2016/09/06 20:11:56 The name XWindowManager is a bit deceptive for any
Tom (Use chromium acct) 2016/09/06 22:08:29 Done. Renamed to XWindowEventManager
28 public:
29 static XWindowManager* GetInstance();
30
31 // Guarantees that events on |event_mask| will be reported to Chrome.
32 void SelectEvents(XID xid, uint32_t event_mask);
33
34 // Deselects events on |event_mask|. Chrome will stop receiving events for
35 // any set bit in |event_mask| only if no other client has selected that bit.
36 void DeselectEvents(XID xid, uint32_t event_mask);
37
38 private:
39 friend struct base::DefaultSingletonTraits<XWindowManager>;
40
41 struct MultiMask {
42 MultiMask();
43 ~MultiMask();
44
45 void AddMask(uint32_t mask);
46 void RemoveMask(uint32_t mask);
47 uint32_t ToMask() const;
48
49 static constexpr auto kMaskSize = 25;
50
51 unsigned int mask_bits[kMaskSize];
52 };
53
54 XWindowManager();
55 ~XWindowManager();
56
57 void BeforeMaskChanged(XID xid);
58 void AfterMaskChanged(XID xid);
59
60 // State for [Before|After]MaskChanged
61 uint32_t old_mask_;
62
63 std::map<XID, MultiMask> mask_map_;
64
65 DISALLOW_COPY_AND_ASSIGN(XWindowManager);
66 };
67
68 } // namespace ui
69
70 #endif // UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/base/x/x11_foreign_window_manager.cc ('k') | ui/base/x/x11_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698