| 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/remote_window_tree_host_win.h" | 5 #include "ui/aura/remote_window_tree_host_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 DestroyCompositor(); | 176 DestroyCompositor(); |
| 177 DestroyDispatcher(); | 177 DestroyDispatcher(); |
| 178 g_instance = NULL; | 178 g_instance = NULL; |
| 179 } | 179 } |
| 180 | 180 |
| 181 // static | 181 // static |
| 182 bool RemoteWindowTreeHostWin::IsValid() { | 182 bool RemoteWindowTreeHostWin::IsValid() { |
| 183 return Instance()->remote_window_ != NULL; | 183 return Instance()->remote_window_ != NULL; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void RemoteWindowTreeHostWin::SetRemoteWindowHandle(HWND remote_window) { | 186 void RemoteWindowTreeHostWin::InitializeRemoteWindowAndScaleFactor( |
| 187 HWND remote_window, |
| 188 float device_scale) { |
| 187 remote_window_ = remote_window; | 189 remote_window_ = remote_window; |
| 190 gfx::InitDeviceScaleFactor(device_scale); |
| 188 // Do not create compositor here, but in Connected() below. | 191 // Do not create compositor here, but in Connected() below. |
| 189 // See http://crbug.com/330179 and http://crbug.com/334380. | 192 // See http://crbug.com/330179 and http://crbug.com/334380. |
| 190 } | 193 } |
| 191 | 194 |
| 192 void RemoteWindowTreeHostWin::Connected(IPC::Sender* host) { | 195 void RemoteWindowTreeHostWin::Connected(IPC::Sender* host) { |
| 193 CHECK(host_ == NULL); | 196 CHECK(host_ == NULL); |
| 194 DCHECK(remote_window_); | 197 DCHECK(remote_window_); |
| 195 host_ = host; | 198 host_ = host; |
| 196 // Recreate the compositor for the target surface represented by the | 199 // Recreate the compositor for the target surface represented by the |
| 197 // remote_window HWND. | 200 // remote_window HWND. |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 bounds.top = rect.y(); | 485 bounds.top = rect.y(); |
| 483 bounds.right = rect.right(); | 486 bounds.right = rect.right(); |
| 484 bounds.bottom = rect.bottom(); | 487 bounds.bottom = rect.bottom(); |
| 485 character_bounds.push_back(bounds); | 488 character_bounds.push_back(bounds); |
| 486 } | 489 } |
| 487 host_->Send(new MetroViewerHostMsg_ImeTextInputClientUpdated( | 490 host_->Send(new MetroViewerHostMsg_ImeTextInputClientUpdated( |
| 488 input_scopes, character_bounds)); | 491 input_scopes, character_bounds)); |
| 489 } | 492 } |
| 490 | 493 |
| 491 gfx::Point PointFromNativeEvent(int32 x, int32 y) { | 494 gfx::Point PointFromNativeEvent(int32 x, int32 y) { |
| 492 static float scale_factor = gfx::GetModernUIScale(); | 495 static float scale_factor = gfx::GetDPIScale(); |
| 493 gfx::Point result( x * scale_factor, y * scale_factor); | 496 gfx::Point result( x * scale_factor, y * scale_factor); |
| 494 return result; | 497 return result; |
| 495 } | 498 } |
| 496 | 499 |
| 497 void RemoteWindowTreeHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) { | 500 void RemoteWindowTreeHostWin::OnMouseMoved(int32 x, int32 y, int32 flags) { |
| 498 if (ignore_mouse_moves_until_set_cursor_ack_) | 501 if (ignore_mouse_moves_until_set_cursor_ack_) |
| 499 return; | 502 return; |
| 500 | 503 |
| 501 gfx::Point location = PointFromNativeEvent(x, y); | 504 gfx::Point location = PointFromNativeEvent(x, y); |
| 502 ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, flags, 0); | 505 ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location, flags, 0); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 742 } |
| 740 | 743 |
| 741 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { | 744 void RemoteWindowTreeHostWin::SetEventFlags(uint32 flags) { |
| 742 if (flags == event_flags_) | 745 if (flags == event_flags_) |
| 743 return; | 746 return; |
| 744 event_flags_ = flags; | 747 event_flags_ = flags; |
| 745 SetVirtualKeyStates(event_flags_); | 748 SetVirtualKeyStates(event_flags_); |
| 746 } | 749 } |
| 747 | 750 |
| 748 } // namespace aura | 751 } // namespace aura |
| OLD | NEW |