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/views/widget/desktop_aura/desktop_screen_x11.cc

Issue 2924343002: Move ui::GetAtom to gfx::GetAtom (Closed)
Patch Set: fix CrOs build Created 3 years, 6 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/desktop_screen_x11.h" 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h"
6 6
7 #include <X11/extensions/Xrandr.h> 7 #include <X11/extensions/Xrandr.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // It clashes with out RootWindow. 10 // It clashes with out RootWindow.
11 #undef RootWindow 11 #undef RootWindow
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/aura/window_event_dispatcher.h" 16 #include "ui/aura/window_event_dispatcher.h"
17 #include "ui/aura/window_tree_host.h" 17 #include "ui/aura/window_tree_host.h"
18 #include "ui/base/layout.h" 18 #include "ui/base/layout.h"
19 #include "ui/display/display.h" 19 #include "ui/display/display.h"
20 #include "ui/display/display_finder.h" 20 #include "ui/display/display_finder.h"
21 #include "ui/display/screen.h" 21 #include "ui/display/screen.h"
22 #include "ui/display/util/display_util.h" 22 #include "ui/display/util/display_util.h"
23 #include "ui/display/util/x11/edid_parser_x11.h" 23 #include "ui/display/util/x11/edid_parser_x11.h"
24 #include "ui/events/platform/platform_event_source.h" 24 #include "ui/events/platform/platform_event_source.h"
25 #include "ui/events/platform/x11/x11_event_source.h" 25 #include "ui/events/platform/x11/x11_event_source.h"
26 #include "ui/gfx/font_render_params.h" 26 #include "ui/gfx/font_render_params.h"
27 #include "ui/gfx/geometry/point_conversions.h" 27 #include "ui/gfx/geometry/point_conversions.h"
28 #include "ui/gfx/geometry/size_conversions.h" 28 #include "ui/gfx/geometry/size_conversions.h"
29 #include "ui/gfx/native_widget_types.h" 29 #include "ui/gfx/native_widget_types.h"
30 #include "ui/gfx/x/x11_atom_cache.h"
30 #include "ui/gfx/x/x11_types.h" 31 #include "ui/gfx/x/x11_types.h"
31 #include "ui/views/linux_ui/linux_ui.h" 32 #include "ui/views/linux_ui/linux_ui.h"
32 #include "ui/views/widget/desktop_aura/desktop_screen.h" 33 #include "ui/views/widget/desktop_aura/desktop_screen.h"
33 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" 34 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
34 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" 35 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
35 36
36 namespace { 37 namespace {
37 38
38 // The delay to perform configuration after RRNotify. See the comment 39 // The delay to perform configuration after RRNotify. See the comment
39 // in |Dispatch()|. 40 // in |Dispatch()|.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 229
229 void DesktopScreenX11::RemoveObserver(display::DisplayObserver* observer) { 230 void DesktopScreenX11::RemoveObserver(display::DisplayObserver* observer) {
230 change_notifier_.RemoveObserver(observer); 231 change_notifier_.RemoveObserver(observer);
231 } 232 }
232 233
233 bool DesktopScreenX11::CanDispatchEvent(const ui::PlatformEvent& event) { 234 bool DesktopScreenX11::CanDispatchEvent(const ui::PlatformEvent& event) {
234 return event->type - xrandr_event_base_ == RRScreenChangeNotify || 235 return event->type - xrandr_event_base_ == RRScreenChangeNotify ||
235 event->type - xrandr_event_base_ == RRNotify || 236 event->type - xrandr_event_base_ == RRNotify ||
236 (event->type == PropertyNotify && 237 (event->type == PropertyNotify &&
237 event->xproperty.window == x_root_window_ && 238 event->xproperty.window == x_root_window_ &&
238 event->xproperty.atom == ui::GetAtom("_NET_WORKAREA")); 239 event->xproperty.atom == gfx::GetAtom("_NET_WORKAREA"));
239 } 240 }
240 241
241 uint32_t DesktopScreenX11::DispatchEvent(const ui::PlatformEvent& event) { 242 uint32_t DesktopScreenX11::DispatchEvent(const ui::PlatformEvent& event) {
242 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) { 243 if (event->type - xrandr_event_base_ == RRScreenChangeNotify) {
243 // Pass the event through to xlib. 244 // Pass the event through to xlib.
244 XRRUpdateConfiguration(event); 245 XRRUpdateConfiguration(event);
245 } else if (event->type - xrandr_event_base_ == RRNotify || 246 } else if (event->type - xrandr_event_base_ == RRNotify ||
246 (event->type == PropertyNotify && 247 (event->type == PropertyNotify &&
247 event->xproperty.atom == ui::GetAtom("_NET_WORKAREA"))) { 248 event->xproperty.atom == gfx::GetAtom("_NET_WORKAREA"))) {
248 // There's some sort of observer dispatch going on here, but I don't think 249 // There's some sort of observer dispatch going on here, but I don't think
249 // it's the screen's? 250 // it's the screen's?
250 if (configure_timer_.get() && configure_timer_->IsRunning()) { 251 if (configure_timer_.get() && configure_timer_->IsRunning()) {
251 configure_timer_->Reset(); 252 configure_timer_->Reset();
252 } else { 253 } else {
253 configure_timer_.reset(new base::OneShotTimer()); 254 configure_timer_.reset(new base::OneShotTimer());
254 configure_timer_->Start( 255 configure_timer_->Start(
255 FROM_HERE, 256 FROM_HERE,
256 base::TimeDelta::FromMilliseconds(kConfigureDelayMs), 257 base::TimeDelta::FromMilliseconds(kConfigureDelayMs),
257 this, 258 this,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 GetPrimaryDisplay().device_scale_factor()); 397 GetPrimaryDisplay().device_scale_factor());
397 } 398 }
398 399
399 //////////////////////////////////////////////////////////////////////////////// 400 ////////////////////////////////////////////////////////////////////////////////
400 401
401 display::Screen* CreateDesktopScreen() { 402 display::Screen* CreateDesktopScreen() {
402 return new DesktopScreenX11; 403 return new DesktopScreenX11;
403 } 404 }
404 405
405 } // namespace views 406 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698