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

Side by Side Diff: ui/base/x/x11_foreign_window_manager.h

Issue 2313033002: Refactor X11ForeignWindowManager (Reland) (Closed)
Patch Set: Rebase 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/selection_owner.cc ('k') | ui/base/x/x11_foreign_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 XForeignWindowManager {
28 public:
29 static XForeignWindowManager* GetInstance();
30
31 // Requests that events associated with |event_mask| on |xid| be reported to
32 // Chrome. Returns an id to use for canceling the request.
33 int RequestEvents(XID xid, long event_mask) WARN_UNUSED_RESULT;
34
35 // Cancels the request with |request_id|. Unless there is another request for
36 // events on the X window associated with |request_id|, this stops Chrome from
37 // getting events for the X window.
38 void CancelRequest(int request_id);
39
40 // Called by X11DesktopHandler when |xid| is destroyed.
41 void OnWindowDestroyed(XID xid);
42
43 private:
44 friend struct base::DefaultSingletonTraits<XForeignWindowManager>;
45
46 struct Request {
47 Request(int request_id, long entry_event_mask);
48 ~Request();
49
50 int request_id;
51 long event_mask;
52 };
53
54 XForeignWindowManager();
55 ~XForeignWindowManager();
56
57 // Updates which events are selected on |xid|.
58 void UpdateSelectedEvents(XID xid);
59
60 // The id of the next request.
61 int next_request_id_;
62
63 typedef std::vector<Request> RequestVector;
64 std::map<XID, RequestVector> request_map_;
65
66 DISALLOW_COPY_AND_ASSIGN(XForeignWindowManager);
67 };
68
69 } // namespace ui
70
71 #endif // UI_BASE_X_X11_FOREIGN_WINDOW_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/base/x/selection_owner.cc ('k') | ui/base/x/x11_foreign_window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698