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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 case ui::ET_MOUSE_ENTERED: | 249 case ui::ET_MOUSE_ENTERED: |
250 case ui::ET_MOUSE_EXITED: | 250 case ui::ET_MOUSE_EXITED: |
251 case ui::ET_MOUSE_PRESSED: | 251 case ui::ET_MOUSE_PRESSED: |
252 case ui::ET_MOUSE_RELEASED: { | 252 case ui::ET_MOUSE_RELEASED: { |
253 ui::MouseEvent mouse_event(xev); | 253 ui::MouseEvent mouse_event(xev); |
254 if (xev->type == EnterNotify) { | 254 if (xev->type == EnterNotify) { |
255 aura::Window* root_window = window(); | 255 aura::Window* root_window = window(); |
256 client::CursorClient* cursor_client = | 256 client::CursorClient* cursor_client = |
257 client::GetCursorClient(root_window); | 257 client::GetCursorClient(root_window); |
258 if (cursor_client) { | 258 if (cursor_client) { |
259 const gfx::Display display = gfx::Screen::GetScreenFor( | 259 const gfx::Display display = |
260 root_window)->GetDisplayNearestWindow(root_window); | 260 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_window); |
261 cursor_client->SetDisplay(display); | 261 cursor_client->SetDisplay(display); |
262 } | 262 } |
263 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is | 263 // EnterNotify creates ET_MOUSE_MOVE. Mark as synthesized as this is |
264 // not a real mouse move event. | 264 // not a real mouse move event. |
265 mouse_event.set_flags(mouse_event.flags() | ui::EF_IS_SYNTHESIZED); | 265 mouse_event.set_flags(mouse_event.flags() | ui::EF_IS_SYNTHESIZED); |
266 } | 266 } |
267 | 267 |
268 TranslateAndDispatchLocatedEvent(&mouse_event); | 268 TranslateAndDispatchLocatedEvent(&mouse_event); |
269 break; | 269 break; |
270 } | 270 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 391 } |
392 | 392 |
393 gfx::Rect WindowTreeHostX11::GetBounds() const { | 393 gfx::Rect WindowTreeHostX11::GetBounds() const { |
394 return bounds_; | 394 return bounds_; |
395 } | 395 } |
396 | 396 |
397 void WindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { | 397 void WindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { |
398 // Even if the host window's size doesn't change, aura's root window | 398 // Even if the host window's size doesn't change, aura's root window |
399 // size, which is in DIP, changes when the scale changes. | 399 // size, which is in DIP, changes when the scale changes. |
400 float current_scale = compositor()->device_scale_factor(); | 400 float current_scale = compositor()->device_scale_factor(); |
401 float new_scale = gfx::Screen::GetScreenFor(window())-> | 401 float new_scale = gfx::Screen::GetScreen() |
402 GetDisplayNearestWindow(window()).device_scale_factor(); | 402 ->GetDisplayNearestWindow(window()) |
| 403 .device_scale_factor(); |
403 bool origin_changed = bounds_.origin() != bounds.origin(); | 404 bool origin_changed = bounds_.origin() != bounds.origin(); |
404 bool size_changed = bounds_.size() != bounds.size(); | 405 bool size_changed = bounds_.size() != bounds.size(); |
405 XWindowChanges changes = {0}; | 406 XWindowChanges changes = {0}; |
406 unsigned value_mask = 0; | 407 unsigned value_mask = 0; |
407 | 408 |
408 if (size_changed) { | 409 if (size_changed) { |
409 changes.width = bounds.width(); | 410 changes.width = bounds.width(); |
410 changes.height = bounds.height(); | 411 changes.height = bounds.height(); |
411 value_mask = CWHeight | CWWidth; | 412 value_mask = CWHeight | CWWidth; |
412 } | 413 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 } | 558 } |
558 | 559 |
559 namespace test { | 560 namespace test { |
560 | 561 |
561 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { | 562 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { |
562 default_override_redirect = override_redirect; | 563 default_override_redirect = override_redirect; |
563 } | 564 } |
564 | 565 |
565 } // namespace test | 566 } // namespace test |
566 } // namespace aura | 567 } // namespace aura |
OLD | NEW |