OLD | NEW |
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/aura/window_tree_host_x11.h" | 5 #include "ui/aura/window_tree_host_x11.h" |
6 | 6 |
7 #include <strings.h> | 7 #include <strings.h> |
8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 #include <X11/extensions/Xrandr.h> | 10 #include <X11/extensions/Xrandr.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
31 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
32 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
33 #include "ui/base/cursor/cursor.h" | 33 #include "ui/base/cursor/cursor.h" |
34 #include "ui/base/ui_base_switches.h" | 34 #include "ui/base/ui_base_switches.h" |
35 #include "ui/base/view_prop.h" | 35 #include "ui/base/view_prop.h" |
36 #include "ui/base/x/x11_util.h" | 36 #include "ui/base/x/x11_util.h" |
37 #include "ui/compositor/compositor.h" | 37 #include "ui/compositor/compositor.h" |
38 #include "ui/compositor/dip_util.h" | 38 #include "ui/compositor/dip_util.h" |
39 #include "ui/compositor/layer.h" | 39 #include "ui/compositor/layer.h" |
| 40 #include "ui/display/screen.h" |
40 #include "ui/events/devices/x11/device_data_manager_x11.h" | 41 #include "ui/events/devices/x11/device_data_manager_x11.h" |
41 #include "ui/events/devices/x11/device_list_cache_x11.h" | 42 #include "ui/events/devices/x11/device_list_cache_x11.h" |
42 #include "ui/events/devices/x11/touch_factory_x11.h" | 43 #include "ui/events/devices/x11/touch_factory_x11.h" |
43 #include "ui/events/event.h" | 44 #include "ui/events/event.h" |
44 #include "ui/events/event_switches.h" | 45 #include "ui/events/event_switches.h" |
45 #include "ui/events/event_utils.h" | 46 #include "ui/events/event_utils.h" |
46 #include "ui/events/keycodes/keyboard_codes.h" | 47 #include "ui/events/keycodes/keyboard_codes.h" |
47 #include "ui/events/platform/platform_event_observer.h" | 48 #include "ui/events/platform/platform_event_observer.h" |
48 #include "ui/events/platform/platform_event_source.h" | 49 #include "ui/events/platform/platform_event_source.h" |
49 #include "ui/events/platform/x11/x11_event_source.h" | 50 #include "ui/events/platform/x11/x11_event_source.h" |
50 #include "ui/gfx/screen.h" | |
51 | 51 |
52 using std::max; | 52 using std::max; |
53 using std::min; | 53 using std::min; |
54 | 54 |
55 namespace aura { | 55 namespace aura { |
56 | 56 |
57 namespace { | 57 namespace { |
58 | 58 |
59 const char* kAtomsToCache[] = { | 59 const char* kAtomsToCache[] = { |
60 "WM_DELETE_WINDOW", | 60 "WM_DELETE_WINDOW", |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 case ui::ET_MOUSE_ENTERED: | 250 case ui::ET_MOUSE_ENTERED: |
251 case ui::ET_MOUSE_EXITED: | 251 case ui::ET_MOUSE_EXITED: |
252 case ui::ET_MOUSE_PRESSED: | 252 case ui::ET_MOUSE_PRESSED: |
253 case ui::ET_MOUSE_RELEASED: { | 253 case ui::ET_MOUSE_RELEASED: { |
254 ui::MouseEvent mouse_event(xev); | 254 ui::MouseEvent mouse_event(xev); |
255 if (xev->type == EnterNotify) { | 255 if (xev->type == EnterNotify) { |
256 aura::Window* root_window = window(); | 256 aura::Window* root_window = window(); |
257 client::CursorClient* cursor_client = | 257 client::CursorClient* cursor_client = |
258 client::GetCursorClient(root_window); | 258 client::GetCursorClient(root_window); |
259 if (cursor_client) { | 259 if (cursor_client) { |
260 const gfx::Display display = | 260 const display::Display display = |
261 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_window); | 261 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 262 root_window); |
262 cursor_client->SetDisplay(display); | 263 cursor_client->SetDisplay(display); |
263 } | 264 } |
264 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is | 265 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is |
265 // not a real mouse move event. | 266 // not a real mouse move event. |
266 mouse_event.set_flags(mouse_event.flags() | ui::EF_IS_SYNTHESIZED); | 267 mouse_event.set_flags(mouse_event.flags() | ui::EF_IS_SYNTHESIZED); |
267 } | 268 } |
268 | 269 |
269 TranslateAndDispatchLocatedEvent(&mouse_event); | 270 TranslateAndDispatchLocatedEvent(&mouse_event); |
270 break; | 271 break; |
271 } | 272 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 393 } |
393 | 394 |
394 gfx::Rect WindowTreeHostX11::GetBounds() const { | 395 gfx::Rect WindowTreeHostX11::GetBounds() const { |
395 return bounds_; | 396 return bounds_; |
396 } | 397 } |
397 | 398 |
398 void WindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { | 399 void WindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { |
399 // Even if the host window's size doesn't change, aura's root window | 400 // Even if the host window's size doesn't change, aura's root window |
400 // size, which is in DIP, changes when the scale changes. | 401 // size, which is in DIP, changes when the scale changes. |
401 float current_scale = compositor()->device_scale_factor(); | 402 float current_scale = compositor()->device_scale_factor(); |
402 float new_scale = gfx::Screen::GetScreen() | 403 float new_scale = display::Screen::GetScreen() |
403 ->GetDisplayNearestWindow(window()) | 404 ->GetDisplayNearestWindow(window()) |
404 .device_scale_factor(); | 405 .device_scale_factor(); |
405 bool origin_changed = bounds_.origin() != bounds.origin(); | 406 bool origin_changed = bounds_.origin() != bounds.origin(); |
406 bool size_changed = bounds_.size() != bounds.size(); | 407 bool size_changed = bounds_.size() != bounds.size(); |
407 XWindowChanges changes = {0}; | 408 XWindowChanges changes = {0}; |
408 unsigned value_mask = 0; | 409 unsigned value_mask = 0; |
409 | 410 |
410 if (size_changed) { | 411 if (size_changed) { |
411 changes.width = bounds.width(); | 412 changes.width = bounds.width(); |
412 changes.height = bounds.height(); | 413 changes.height = bounds.height(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } | 560 } |
560 | 561 |
561 namespace test { | 562 namespace test { |
562 | 563 |
563 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 564 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
564 default_override_redirect = override_redirect; | 565 default_override_redirect = override_redirect; |
565 } | 566 } |
566 | 567 |
567 } // namespace test | 568 } // namespace test |
568 } // namespace aura | 569 } // namespace aura |
OLD | NEW |