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

Side by Side Diff: ui/views/widget/desktop_aura/x11_desktop_handler.cc

Issue 2319933002: X11: Remove calls to XSelectInput (Closed)
Patch Set: Comments 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" 5 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
13 #include "ui/aura/window_event_dispatcher.h" 13 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/base/x/x11_menu_list.h" 14 #include "ui/base/x/x11_menu_list.h"
15 #include "ui/base/x/x11_util.h" 15 #include "ui/base/x/x11_util.h"
16 #include "ui/base/x/x11_window_event_manager.h"
16 #include "ui/events/platform/platform_event_source.h" 17 #include "ui/events/platform/platform_event_source.h"
17 #include "ui/gfx/x/x11_error_tracker.h" 18 #include "ui/gfx/x/x11_error_tracker.h"
18 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" 19 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
19 20
20 namespace { 21 namespace {
21 22
22 const char* const kAtomsToCache[] = { 23 const char* const kAtomsToCache[] = {
23 "_NET_CURRENT_DESKTOP", 24 "_NET_CURRENT_DESKTOP",
24 nullptr 25 nullptr
25 }; 26 };
(...skipping 14 matching lines...) Expand all
40 } 41 }
41 42
42 X11DesktopHandler::X11DesktopHandler() 43 X11DesktopHandler::X11DesktopHandler()
43 : xdisplay_(gfx::GetXDisplay()), 44 : xdisplay_(gfx::GetXDisplay()),
44 x_root_window_(DefaultRootWindow(xdisplay_)), 45 x_root_window_(DefaultRootWindow(xdisplay_)),
45 atom_cache_(xdisplay_, kAtomsToCache) { 46 atom_cache_(xdisplay_, kAtomsToCache) {
46 if (ui::PlatformEventSource::GetInstance()) 47 if (ui::PlatformEventSource::GetInstance())
47 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); 48 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
48 aura::Env::GetInstance()->AddObserver(this); 49 aura::Env::GetInstance()->AddObserver(this);
49 50
50 XWindowAttributes attr; 51 x_root_window_events_.reset(new ui::XScopedEventSelector(
51 XGetWindowAttributes(xdisplay_, x_root_window_, &attr); 52 x_root_window_,
52 XSelectInput(xdisplay_, x_root_window_, 53 PropertyChangeMask | StructureNotifyMask | SubstructureNotifyMask));
53 attr.your_event_mask | PropertyChangeMask |
54 StructureNotifyMask | SubstructureNotifyMask);
55 } 54 }
56 55
57 X11DesktopHandler::~X11DesktopHandler() { 56 X11DesktopHandler::~X11DesktopHandler() {
58 aura::Env::GetInstance()->RemoveObserver(this); 57 aura::Env::GetInstance()->RemoveObserver(this);
59 if (ui::PlatformEventSource::GetInstance()) 58 if (ui::PlatformEventSource::GetInstance())
60 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); 59 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
61 } 60 }
62 61
63 void X11DesktopHandler::AddObserver(X11DesktopHandlerObserver* observer) { 62 void X11DesktopHandler::AddObserver(X11DesktopHandlerObserver* observer) {
64 observers_.AddObserver(observer); 63 observers_.AddObserver(observer);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // The window might be destroyed if the message pump did not get a chance to 134 // The window might be destroyed if the message pump did not get a chance to
136 // run but we can safely ignore the X error. 135 // run but we can safely ignore the X error.
137 gfx::X11ErrorTracker error_tracker; 136 gfx::X11ErrorTracker error_tracker;
138 ui::XMenuList::GetInstance()->MaybeRegisterMenu(window); 137 ui::XMenuList::GetInstance()->MaybeRegisterMenu(window);
139 } else { 138 } else {
140 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); 139 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window);
141 } 140 }
142 } 141 }
143 142
144 } // namespace views 143 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/x11_desktop_handler.h ('k') | ui/views/widget/desktop_aura/x11_whole_screen_move_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698