| Index: views/window/window_win.cc
|
| diff --git a/views/window/window_win.cc b/views/window/window_win.cc
|
| index 239226d86d1f913f7d08d6605e89683e8c3a1713..8258061939961911a28d0adc3344d53cbc69e74c 100644
|
| --- a/views/window/window_win.cc
|
| +++ b/views/window/window_win.cc
|
| @@ -658,7 +658,7 @@ WindowWin::WindowWin(WindowDelegate* window_delegate)
|
| set_window_ex_style(0);
|
| }
|
|
|
| -void WindowWin::Init(HWND parent, const gfx::Rect& bounds) {
|
| +void WindowWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
|
| // We need to save the parent window, since later calls to GetParent() will
|
| // return NULL.
|
| owning_hwnd_ = parent;
|
| @@ -824,12 +824,12 @@ void WindowWin::OnInitMenu(HMENU menu) {
|
| window_delegate_->CanMaximize() && !is_minimized);
|
| }
|
|
|
| -void WindowWin::OnMouseLeave() {
|
| +LRESULT WindowWin::OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param) {
|
| // We only need to manually track WM_MOUSELEAVE messages between the client
|
| // and non-client area when we're not using the native frame.
|
| if (non_client_view_->UseNativeFrame()) {
|
| SetMsgHandled(FALSE);
|
| - return;
|
| + return 0;
|
| }
|
|
|
| bool process_mouse_exited = true;
|
| @@ -849,6 +849,7 @@ void WindowWin::OnMouseLeave() {
|
|
|
| if (process_mouse_exited)
|
| ProcessMouseExited();
|
| + return 0;
|
| }
|
|
|
| LRESULT WindowWin::OnNCActivate(BOOL active) {
|
| @@ -975,11 +976,13 @@ void WindowWin::OnNCPaint(HRGN rgn) {
|
| SetMsgHandled(!non_client_view_->UseNativeFrame());
|
| }
|
|
|
| -void WindowWin::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
|
| +LRESULT WindowWin::OnNCLButtonDown(UINT message,
|
| + WPARAM w_param,
|
| + LPARAM l_param) {
|
| // When we're using a native frame, window controls work without us
|
| // interfering.
|
| if (!non_client_view_->UseNativeFrame()) {
|
| - switch (ht_component) {
|
| + switch (w_param) {
|
| case HTCLOSE:
|
| case HTMINBUTTON:
|
| case HTMAXBUTTON: {
|
| @@ -995,13 +998,13 @@ void WindowWin::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
|
| // our view! Ick! By handling this message we prevent Windows from
|
| // doing this undesirable thing, but that means we need to roll the
|
| // sys-command handling ourselves.
|
| - ProcessNCMousePress(point, MK_LBUTTON);
|
| - return;
|
| + ProcessNCMousePress(message, w_param, l_param);
|
| + return 0;
|
| }
|
| }
|
| }
|
|
|
| - WidgetWin::OnNCLButtonDown(ht_component, point);
|
| + WidgetWin::OnNCLButtonDown(message, w_param, l_param);
|
|
|
| /* TODO(beng): Fix the standard non-client over-painting bug. This code
|
| doesn't work but identifies the problem.
|
| @@ -1012,15 +1015,17 @@ void WindowWin::OnNCLButtonDown(UINT ht_component, const CPoint& point) {
|
| // non-client painting, so we need to call it directly here inside a
|
| // scoped update lock.
|
| ScopedRedrawLock lock(this);
|
| - DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, ht_component,
|
| - MAKELPARAM(point.x, point.y));
|
| + DefWindowProc(GetNativeView(), WM_NCLBUTTONDOWN, w_param, l_param);
|
| SetMsgHandled(TRUE);
|
| }
|
| */
|
| + return 0;
|
| }
|
|
|
| -void WindowWin::OnNCRButtonDown(UINT ht_component, const CPoint& point) {
|
| - if (ht_component == HTCAPTION || ht_component == HTSYSMENU) {
|
| +LRESULT WindowWin::OnNCRButtonDown(UINT message,
|
| + WPARAM w_param,
|
| + LPARAM l_param) {
|
| + if (w_param == HTCAPTION || w_param == HTSYSMENU) {
|
| is_right_mouse_pressed_on_caption_ = true;
|
| // We SetCapture() to ensure we only show the menu when the button down and
|
| // up are both on the caption. Note: this causes the button up to be
|
| @@ -1028,20 +1033,21 @@ void WindowWin::OnNCRButtonDown(UINT ht_component, const CPoint& point) {
|
| SetCapture();
|
| }
|
|
|
| - WidgetWin::OnNCRButtonDown(ht_component, point);
|
| + WidgetWin::OnNCRButtonDown(message, w_param, l_param);
|
| + return 0;
|
| }
|
|
|
| -void WindowWin::OnRButtonUp(UINT ht_component, const CPoint& point) {
|
| +LRESULT WindowWin::OnRButtonUp(UINT message, WPARAM w_param, LPARAM l_param) {
|
| if (is_right_mouse_pressed_on_caption_) {
|
| is_right_mouse_pressed_on_caption_ = false;
|
| ReleaseCapture();
|
| // |point| is in window coordinates, but WM_NCHITTEST and TrackPopupMenu()
|
| // expect screen coordinates.
|
| - CPoint screen_point(point);
|
| + CPoint screen_point(GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param));
|
| MapWindowPoints(GetNativeView(), HWND_DESKTOP, &screen_point, 1);
|
| - ht_component = SendMessage(GetNativeView(), WM_NCHITTEST, 0,
|
| - MAKELPARAM(screen_point.x, screen_point.y));
|
| - if (ht_component == HTCAPTION || ht_component == HTSYSMENU) {
|
| + w_param = SendMessage(GetNativeView(), WM_NCHITTEST, 0,
|
| + MAKELPARAM(screen_point.x, screen_point.y));
|
| + if (w_param == HTCAPTION || w_param == HTSYSMENU) {
|
| UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD;
|
| if (base::i18n::IsRTL())
|
| flags |= TPM_RIGHTALIGN;
|
| @@ -1049,11 +1055,12 @@ void WindowWin::OnRButtonUp(UINT ht_component, const CPoint& point) {
|
| int id = TrackPopupMenu(system_menu, flags, screen_point.x,
|
| screen_point.y, 0, GetNativeView(), NULL);
|
| ExecuteSystemMenuCommand(id);
|
| - return;
|
| + return 0;
|
| }
|
| }
|
|
|
| - WidgetWin::OnRButtonUp(ht_component, point);
|
| + WidgetWin::OnRButtonUp(message, w_param, l_param);
|
| + return 0;
|
| }
|
|
|
| LRESULT WindowWin::OnNCUAHDrawCaption(UINT msg, WPARAM w_param,
|
| @@ -1475,16 +1482,22 @@ void WindowWin::UpdateAccessibleState() {
|
| }
|
| }
|
|
|
| -void WindowWin::ProcessNCMousePress(const CPoint& point, int flags) {
|
| - CPoint temp = point;
|
| - MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1);
|
| - UINT message_flags = 0;
|
| - if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80)
|
| - message_flags |= MK_CONTROL;
|
| - if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80)
|
| - message_flags |= MK_SHIFT;
|
| - message_flags |= flags;
|
| - ProcessMousePressed(temp, message_flags, false, false);
|
| +// TODO(msw): ProcessNCMousePress could be made class/file private (or inlined in OnNCLButtonDown).
|
| +void WindowWin::ProcessNCMousePress(UINT message,
|
| + WPARAM w_param,
|
| + LPARAM l_param) {
|
| + // TODO(msw): Ensure point translation is correct. Move into ProcessMouseMoved???
|
| + CPoint point(GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param));
|
| + MapWindowPoints(HWND_DESKTOP, GetNativeView(), &point, 1);
|
| + l_param = MAKELPARAM(point.x, point.y);
|
| + // TODO(msw): Consolidate code with new Event processing?
|
| + w_param |= ((GetKeyState(VK_CONTROL) & 0x80) == 0x80)? MK_CONTROL : 0;
|
| + w_param |= ((GetKeyState(VK_SHIFT) & 0x80) == 0x80)? MK_SHIFT : 0;
|
| + // TODO(msw): Why did this send non_client:=false to ProcessMousePressed???
|
| + // Because this already did the xform? Can this be cleaned up?
|
| + DCHECK(message == WM_NCLBUTTONDOWN);
|
| + message = WM_LBUTTONDOWN;
|
| + ProcessMousePressed(message, w_param, l_param);
|
| }
|
|
|
| LRESULT WindowWin::CallDefaultNCActivateHandler(BOOL active) {
|
|
|