OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "aura/desktop_host_win.h" | 5 #include "aura/desktop_host_win.h" |
6 | 6 |
7 #include "aura/desktop.h" | 7 #include "aura/desktop.h" |
8 #include "aura/event.h" | 8 #include "aura/event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 void DesktopHostWin::Show() { | 40 void DesktopHostWin::Show() { |
41 ShowWindow(hwnd(), SW_SHOWNORMAL); | 41 ShowWindow(hwnd(), SW_SHOWNORMAL); |
42 } | 42 } |
43 | 43 |
44 gfx::Size DesktopHostWin::GetSize() { | 44 gfx::Size DesktopHostWin::GetSize() { |
45 RECT r; | 45 RECT r; |
46 GetClientRect(hwnd(), &r); | 46 GetClientRect(hwnd(), &r); |
47 return gfx::Rect(r).size(); | 47 return gfx::Rect(r).size(); |
48 } | 48 } |
49 | 49 |
50 void DesktopHostWin::SetSize(const gfx::Size& size) { | |
51 SetWindowPos( | |
52 hwnd(), | |
53 NULL, | |
54 0, | |
55 0, | |
56 size.width(), | |
57 size.height(), | |
58 SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOREDRAW | SWP_NOREPOSITION); | |
59 } | |
60 | |
61 void DesktopHostWin::OnClose() { | 50 void DesktopHostWin::OnClose() { |
62 // TODO: this obviously shouldn't be here. | 51 // TODO: this obviously shouldn't be here. |
63 MessageLoopForUI::current()->Quit(); | 52 MessageLoopForUI::current()->Quit(); |
64 } | 53 } |
65 | 54 |
66 LRESULT DesktopHostWin::OnMouseRange(UINT message, | 55 LRESULT DesktopHostWin::OnMouseRange(UINT message, |
67 WPARAM w_param, | 56 WPARAM w_param, |
68 LPARAM l_param) { | 57 LPARAM l_param) { |
69 MSG msg = { hwnd(), message, w_param, l_param, 0, | 58 MSG msg = { hwnd(), message, w_param, l_param, 0, |
70 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; | 59 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } }; |
71 MouseEvent event(msg); | 60 MouseEvent event(msg); |
72 bool handled = false; | 61 bool handled = false; |
73 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) | 62 if (!(event.flags() & ui::EF_IS_NON_CLIENT)) |
74 handled = desktop_->OnMouseEvent(event); | 63 handled = desktop_->OnMouseEvent(event); |
75 SetMsgHandled(handled); | 64 SetMsgHandled(handled); |
76 return 0; | 65 return 0; |
77 } | 66 } |
78 | 67 |
79 void DesktopHostWin::OnPaint(HDC dc) { | 68 void DesktopHostWin::OnPaint(HDC dc) { |
80 if (desktop_) | 69 if (desktop_) |
81 desktop_->Draw(); | 70 desktop_->Draw(); |
82 ValidateRect(hwnd(), NULL); | 71 ValidateRect(hwnd(), NULL); |
83 } | 72 } |
84 | 73 |
85 } // namespace aura | 74 } // namespace aura |
OLD | NEW |