Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(985)

Side by Side Diff: views/widget/widget_win.cc

Issue 6756043: Consolidate Widget Event code, other cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/widget_win.h ('k') | views/window/window_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "views/widget/widget_win.h" 5 #include "views/widget/widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 WidgetWin::WidgetWin() 133 WidgetWin::WidgetWin()
134 : ALLOW_THIS_IN_INITIALIZER_LIST(delegate_(this)), 134 : ALLOW_THIS_IN_INITIALIZER_LIST(delegate_(this)),
135 close_widget_factory_(this), 135 close_widget_factory_(this),
136 active_mouse_tracking_flags_(0), 136 active_mouse_tracking_flags_(0),
137 use_layered_buffer_(false), 137 use_layered_buffer_(false),
138 layered_alpha_(255), 138 layered_alpha_(255),
139 ALLOW_THIS_IN_INITIALIZER_LIST(paint_layered_window_factory_(this)), 139 ALLOW_THIS_IN_INITIALIZER_LIST(paint_layered_window_factory_(this)),
140 delete_on_destroy_(true), 140 delete_on_destroy_(true),
141 can_update_layered_window_(true), 141 can_update_layered_window_(true),
142 last_mouse_event_was_move_(false),
143 is_mouse_down_(false),
144 is_window_(false), 142 is_window_(false),
145 restore_focus_when_enabled_(false), 143 restore_focus_when_enabled_(false),
146 accessibility_view_events_index_(-1), 144 accessibility_view_events_index_(-1),
147 accessibility_view_events_(kMaxAccessibilityViewEvents), 145 accessibility_view_events_(kMaxAccessibilityViewEvents),
148 previous_cursor_(NULL) { 146 previous_cursor_(NULL) {
149 set_native_widget(this); 147 set_native_widget(this);
150 } 148 }
151 149
152 WidgetWin::~WidgetWin() { 150 WidgetWin::~WidgetWin() {
153 DestroyRootView(); 151 DestroyRootView();
(...skipping 29 matching lines...) Expand all
183 switch (params.type) { 181 switch (params.type) {
184 case CreateParams::TYPE_WINDOW: 182 case CreateParams::TYPE_WINDOW:
185 case CreateParams::TYPE_CONTROL: 183 case CreateParams::TYPE_CONTROL:
186 break; 184 break;
187 case CreateParams::TYPE_POPUP: 185 case CreateParams::TYPE_POPUP:
188 style |= WS_POPUP; 186 style |= WS_POPUP;
189 ex_style |= WS_EX_TOOLWINDOW; 187 ex_style |= WS_EX_TOOLWINDOW;
190 break; 188 break;
191 case CreateParams::TYPE_MENU: 189 case CreateParams::TYPE_MENU:
192 style |= WS_POPUP; 190 style |= WS_POPUP;
193 is_mouse_down_ = 191 is_mouse_button_pressed_ =
194 ((GetKeyState(VK_LBUTTON) & 0x80) || 192 ((GetKeyState(VK_LBUTTON) & 0x80) ||
195 (GetKeyState(VK_RBUTTON) & 0x80) || 193 (GetKeyState(VK_RBUTTON) & 0x80) ||
196 (GetKeyState(VK_MBUTTON) & 0x80) || 194 (GetKeyState(VK_MBUTTON) & 0x80) ||
197 (GetKeyState(VK_XBUTTON1) & 0x80) || 195 (GetKeyState(VK_XBUTTON1) & 0x80) ||
198 (GetKeyState(VK_XBUTTON2) & 0x80)); 196 (GetKeyState(VK_XBUTTON2) & 0x80));
199 break; 197 break;
200 default: 198 default:
201 NOTREACHED(); 199 NOTREACHED();
202 } 200 }
203 201
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 313 }
316 314
317 TooltipManager* WidgetWin::GetTooltipManager() const { 315 TooltipManager* WidgetWin::GetTooltipManager() const {
318 return tooltip_manager_.get(); 316 return tooltip_manager_.get();
319 } 317 }
320 318
321 bool WidgetWin::IsScreenReaderActive() const { 319 bool WidgetWin::IsScreenReaderActive() const {
322 return screen_reader_active_; 320 return screen_reader_active_;
323 } 321 }
324 322
325 void WidgetWin::SetNativeCapture() { 323 void WidgetWin::SetMouseCapture() {
326 DCHECK(!HasNativeCapture()); 324 DCHECK(!HasMouseCapture());
327 SetCapture(hwnd()); 325 SetCapture(hwnd());
328 } 326 }
329 327
330 void WidgetWin::ReleaseNativeCapture() { 328 void WidgetWin::ReleaseMouseCapture() {
331 ReleaseCapture(); 329 ReleaseCapture();
332 } 330 }
333 331
334 bool WidgetWin::HasNativeCapture() const { 332 bool WidgetWin::HasMouseCapture() const {
335 return GetCapture() == hwnd(); 333 return GetCapture() == hwnd();
336 } 334 }
337 335
338 gfx::Rect WidgetWin::GetWindowScreenBounds() const { 336 gfx::Rect WidgetWin::GetWindowScreenBounds() const {
339 RECT r; 337 RECT r;
340 GetWindowRect(&r); 338 GetWindowRect(&r);
341 return gfx::Rect(r); 339 return gfx::Rect(r);
342 } 340 }
343 341
344 gfx::Rect WidgetWin::GetClientAreaScreenBounds() const { 342 gfx::Rect WidgetWin::GetClientAreaScreenBounds() const {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 LRESULT WidgetWin::OnAppCommand(HWND window, short app_command, WORD device, 557 LRESULT WidgetWin::OnAppCommand(HWND window, short app_command, WORD device,
560 int keystate) { 558 int keystate) {
561 SetMsgHandled(FALSE); 559 SetMsgHandled(FALSE);
562 return 0; 560 return 0;
563 } 561 }
564 562
565 void WidgetWin::OnCancelMode() { 563 void WidgetWin::OnCancelMode() {
566 } 564 }
567 565
568 void WidgetWin::OnCaptureChanged(HWND hwnd) { 566 void WidgetWin::OnCaptureChanged(HWND hwnd) {
569 if (is_mouse_down_) 567 delegate_->OnMouseCaptureLost();
570 GetRootView()->OnMouseCaptureLost();
571 is_mouse_down_ = false;
572 } 568 }
573 569
574 void WidgetWin::OnClose() { 570 void WidgetWin::OnClose() {
575 Close(); 571 Close();
576 } 572 }
577 573
578 void WidgetWin::OnCommand(UINT notification_code, int command_id, HWND window) { 574 void WidgetWin::OnCommand(UINT notification_code, int command_id, HWND window) {
579 SetMsgHandled(FALSE); 575 SetMsgHandled(FALSE);
580 } 576 }
581 577
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 UINT position, 707 UINT position,
712 BOOL is_system_menu) { 708 BOOL is_system_menu) {
713 SetMsgHandled(FALSE); 709 SetMsgHandled(FALSE);
714 } 710 }
715 711
716 LRESULT WidgetWin::OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param) { 712 LRESULT WidgetWin::OnKeyDown(UINT message, WPARAM w_param, LPARAM l_param) {
717 RootView* root_view = GetFocusedViewRootView(); 713 RootView* root_view = GetFocusedViewRootView();
718 if (!root_view) 714 if (!root_view)
719 root_view = GetRootView(); 715 root_view = GetRootView();
720 716
721 MSG msg; 717 MSG msg = { hwnd(), message, w_param, l_param };
722 MakeMSG(&msg, message, w_param, l_param);
723 SetMsgHandled(root_view->ProcessKeyEvent(KeyEvent(msg))); 718 SetMsgHandled(root_view->ProcessKeyEvent(KeyEvent(msg)));
724 return 0; 719 return 0;
725 } 720 }
726 721
727 LRESULT WidgetWin::OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param) { 722 LRESULT WidgetWin::OnKeyUp(UINT message, WPARAM w_param, LPARAM l_param) {
728 RootView* root_view = GetFocusedViewRootView(); 723 RootView* root_view = GetFocusedViewRootView();
729 if (!root_view) 724 if (!root_view)
730 root_view = GetRootView(); 725 root_view = GetRootView();
731 726
732 MSG msg; 727 MSG msg = { hwnd(), message, w_param, l_param };
733 MakeMSG(&msg, message, w_param, l_param);
734 SetMsgHandled(root_view->ProcessKeyEvent(KeyEvent(msg))); 728 SetMsgHandled(root_view->ProcessKeyEvent(KeyEvent(msg)));
735 return 0; 729 return 0;
736 } 730 }
737 731
738 void WidgetWin::OnKillFocus(HWND focused_window) { 732 void WidgetWin::OnKillFocus(HWND focused_window) {
739 delegate_->OnNativeBlur(focused_window); 733 delegate_->OnNativeBlur(focused_window);
740 SetMsgHandled(FALSE); 734 SetMsgHandled(FALSE);
741 } 735 }
742 736
743 LRESULT WidgetWin::OnMouseActivate(UINT message, 737 LRESULT WidgetWin::OnMouseActivate(UINT message,
744 WPARAM w_param, 738 WPARAM w_param,
745 LPARAM l_param) { 739 LPARAM l_param) {
746 if (GetWindowLong(GWL_EXSTYLE) & WS_EX_NOACTIVATE) 740 if (GetWindowLong(GWL_EXSTYLE) & WS_EX_NOACTIVATE)
747 return MA_NOACTIVATE; 741 return MA_NOACTIVATE;
748 SetMsgHandled(FALSE); 742 SetMsgHandled(FALSE);
749 return MA_ACTIVATE; 743 return MA_ACTIVATE;
750 } 744 }
751 745
752 LRESULT WidgetWin::OnMouseLeave(UINT message, WPARAM w_param, LPARAM l_param) { 746 LRESULT WidgetWin::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) {
753 tooltip_manager_->OnMouseLeave(); 747 if (message == WM_MOUSEWHEEL)
754 ProcessMouseExited(message, w_param, l_param); 748 return 0;
749
750 MSG msg = { hwnd(), message, w_param, l_param, 0,
751 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } };
752 MouseEvent event(msg);
753
754 if (!(event.flags() & ui::EF_IS_NON_CLIENT))
755 tooltip_manager_->OnMouse(message, w_param, l_param);
756
757 if (event.type() == ui::ET_MOUSE_MOVED && !HasMouseCapture()) {
758 // Windows only fires WM_MOUSELEAVE events if the application begins
759 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
760 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
761 TrackMouseEvents((message == WM_NCMOUSEMOVE) ?
762 TME_NONCLIENT | TME_LEAVE : TME_LEAVE);
763 } else if (event.type() == ui::ET_MOUSE_EXITED) {
764 // Reset our tracking flags so future mouse movement over this WidgetWin
765 // results in a new tracking session. Fall through for OnMouseEvent.
766 active_mouse_tracking_flags_ = 0;
767 }
768
769 SetMsgHandled(delegate_->OnMouseEvent(event));
755 return 0; 770 return 0;
756 } 771 }
757 772
758 LRESULT WidgetWin::OnMouseMove(UINT message, WPARAM w_param, LPARAM l_param) {
759 ProcessMouseMoved(message, w_param, l_param);
760 return 0;
761 }
762
763 LRESULT WidgetWin::OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param) {
764 tooltip_manager_->OnMouse(message, w_param, l_param);
765
766 switch (message) {
767 case WM_LBUTTONDBLCLK:
768 case WM_LBUTTONDOWN:
769 case WM_MBUTTONDBLCLK:
770 case WM_MBUTTONDOWN:
771 case WM_RBUTTONDBLCLK:
772 case WM_RBUTTONDOWN:
773 SetMsgHandled(ProcessMousePressed(message, w_param, l_param));
774 break;
775 case WM_LBUTTONUP:
776 case WM_MBUTTONUP:
777 case WM_RBUTTONUP:
778 SetMsgHandled(ProcessMouseReleased(message, w_param, l_param));
779 break;
780 default:
781 SetMsgHandled(FALSE);
782 }
783
784 return 0;
785 }
786
787 LRESULT WidgetWin::OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param) { 773 LRESULT WidgetWin::OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param) {
788 // Reroute the mouse-wheel to the window under the mouse pointer if 774 // Reroute the mouse-wheel to the window under the mouse pointer if
789 // applicable. 775 // applicable.
790 if (message == WM_MOUSEWHEEL && 776 if (message == WM_MOUSEWHEEL &&
791 views::RerouteMouseWheel(hwnd(), w_param, l_param)) { 777 views::RerouteMouseWheel(hwnd(), w_param, l_param)) {
792 return 0; 778 return 0;
793 } 779 }
794 780
795 MSG msg; 781 MSG msg = { hwnd(), message, w_param, l_param, 0,
796 MakeMSG(&msg, message, w_param, l_param, 0, 782 { GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param) } };
797 GET_X_LPARAM(l_param), GET_Y_LPARAM(l_param));
798 return GetRootView()->OnMouseWheel(MouseWheelEvent(msg)) ? 0 : 1; 783 return GetRootView()->OnMouseWheel(MouseWheelEvent(msg)) ? 0 : 1;
799 } 784 }
800 785
801 void WidgetWin::OnMove(const CPoint& point) { 786 void WidgetWin::OnMove(const CPoint& point) {
802 if (widget_delegate()) 787 if (widget_delegate())
803 widget_delegate()->OnWidgetMove(); 788 widget_delegate()->OnWidgetMove();
804 SetMsgHandled(FALSE); 789 SetMsgHandled(FALSE);
805 } 790 }
806 791
807 void WidgetWin::OnMoving(UINT param, const LPRECT new_bounds) { 792 void WidgetWin::OnMoving(UINT param, const LPRECT new_bounds) {
808 if (widget_delegate()) 793 if (widget_delegate())
809 widget_delegate()->OnWidgetMove(); 794 widget_delegate()->OnWidgetMove();
810 } 795 }
811 796
812 LRESULT WidgetWin::OnNCActivate(BOOL active) { 797 LRESULT WidgetWin::OnNCActivate(BOOL active) {
813 SetMsgHandled(FALSE); 798 SetMsgHandled(FALSE);
814 return 0; 799 return 0;
815 } 800 }
816 801
817 LRESULT WidgetWin::OnNCCalcSize(BOOL w_param, LPARAM l_param) { 802 LRESULT WidgetWin::OnNCCalcSize(BOOL w_param, LPARAM l_param) {
818 SetMsgHandled(FALSE); 803 SetMsgHandled(FALSE);
819 return 0; 804 return 0;
820 } 805 }
821 806
822 LRESULT WidgetWin::OnNCHitTest(const CPoint& pt) { 807 LRESULT WidgetWin::OnNCHitTest(const CPoint& pt) {
823 SetMsgHandled(FALSE); 808 SetMsgHandled(FALSE);
824 return 0; 809 return 0;
825 } 810 }
826 811
827 LRESULT WidgetWin::OnNCMouseLeave(UINT message,
828 WPARAM w_param,
829 LPARAM l_param) {
830 ProcessMouseExited(message, w_param, l_param);
831 return 0;
832 }
833
834 LRESULT WidgetWin::OnNCMouseMove(UINT message, WPARAM w_param, LPARAM l_param) {
835 tooltip_manager_->OnMouse(message, w_param, l_param);
836 ProcessMouseMoved(message, w_param, l_param);
837
838 // We need to process this message to stop Windows from drawing the window
839 // controls as the mouse moves over the title bar area when the window is
840 // maximized.
841 return 0;
842 }
843
844 LRESULT WidgetWin::OnNCMouseRange(UINT message,
845 WPARAM w_param,
846 LPARAM l_param) {
847 switch (message) {
848 case WM_NCLBUTTONDBLCLK:
849 case WM_NCLBUTTONDOWN:
850 case WM_NCMBUTTONDBLCLK:
851 case WM_NCMBUTTONDOWN:
852 case WM_NCRBUTTONDBLCLK:
853 case WM_NCRBUTTONDOWN:
854 SetMsgHandled(ProcessMousePressed(message, w_param, l_param));
855 break;
856 case WM_NCLBUTTONUP:
857 case WM_NCMBUTTONUP:
858 case WM_NCRBUTTONUP:
859 default:
860 SetMsgHandled(FALSE);
861 }
862
863 return 0;
864 }
865
866 void WidgetWin::OnNCPaint(HRGN rgn) { 812 void WidgetWin::OnNCPaint(HRGN rgn) {
867 SetMsgHandled(FALSE); 813 SetMsgHandled(FALSE);
868 } 814 }
869 815
870 LRESULT WidgetWin::OnNCUAHDrawCaption(UINT msg, 816 LRESULT WidgetWin::OnNCUAHDrawCaption(UINT msg,
871 WPARAM w_param, 817 WPARAM w_param,
872 LPARAM l_param) { 818 LPARAM l_param) {
873 SetMsgHandled(FALSE); 819 SetMsgHandled(FALSE);
874 return 0; 820 return 0;
875 } 821 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 tme.dwFlags = mouse_tracking_flags; 932 tme.dwFlags = mouse_tracking_flags;
987 tme.hwndTrack = hwnd(); 933 tme.hwndTrack = hwnd();
988 tme.dwHoverTime = 0; 934 tme.dwHoverTime = 0;
989 TrackMouseEvent(&tme); 935 TrackMouseEvent(&tme);
990 } else if (mouse_tracking_flags != active_mouse_tracking_flags_) { 936 } else if (mouse_tracking_flags != active_mouse_tracking_flags_) {
991 TrackMouseEvents(active_mouse_tracking_flags_ | TME_CANCEL); 937 TrackMouseEvents(active_mouse_tracking_flags_ | TME_CANCEL);
992 TrackMouseEvents(mouse_tracking_flags); 938 TrackMouseEvents(mouse_tracking_flags);
993 } 939 }
994 } 940 }
995 941
996 bool WidgetWin::ProcessMousePressed(UINT message,
997 WPARAM w_param,
998 LPARAM l_param) {
999 last_mouse_event_was_move_ = false;
1000
1001 MSG msg;
1002 MakeMSG(&msg, message, w_param, l_param, 0, GET_X_LPARAM(l_param),
1003 GET_Y_LPARAM(l_param));
1004 if (GetRootView()->OnMousePressed(MouseEvent(msg))) {
1005 is_mouse_down_ = true;
1006 if (!HasNativeCapture())
1007 SetNativeCapture();
1008 return true;
1009 }
1010 return false;
1011 }
1012
1013 bool WidgetWin::ProcessMouseReleased(UINT message,
1014 WPARAM w_param,
1015 LPARAM l_param) {
1016 last_mouse_event_was_move_ = false;
1017 is_mouse_down_ = false;
1018
1019 // Release the capture first, that way we don't get confused if
1020 // OnMouseReleased blocks.
1021 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased())
1022 ReleaseNativeCapture();
1023
1024 MSG msg;
1025 MakeMSG(&msg, message, w_param, l_param, 0, GET_X_LPARAM(l_param),
1026 GET_Y_LPARAM(l_param));
1027 GetRootView()->OnMouseReleased(MouseEvent(msg));
1028 return true;
1029 }
1030
1031 bool WidgetWin::ProcessMouseMoved(UINT message,
1032 WPARAM w_param,
1033 LPARAM l_param) {
1034 // Windows only fires WM_MOUSELEAVE events if the application begins
1035 // "tracking" mouse events for a given HWND during WM_MOUSEMOVE events.
1036 // We need to call |TrackMouseEvents| to listen for WM_MOUSELEAVE.
1037 if (!HasNativeCapture())
1038 TrackMouseEvents((message == WM_NCMOUSEMOVE) ?
1039 TME_NONCLIENT | TME_LEAVE : TME_LEAVE);
1040 MSG msg;
1041 MakeMSG(&msg, message, w_param, l_param, 0, GET_X_LPARAM(l_param),
1042 GET_Y_LPARAM(l_param));
1043 if (HasNativeCapture() && is_mouse_down_)
1044 GetRootView()->OnMouseDragged(MouseEvent(msg));
1045 else if (!last_mouse_event_was_move_ ||
1046 (last_mouse_move_x_ != GET_X_LPARAM(l_param) ||
1047 last_mouse_move_y_ != GET_Y_LPARAM(l_param))) {
1048 last_mouse_move_x_ = GET_X_LPARAM(l_param);
1049 last_mouse_move_y_ = GET_Y_LPARAM(l_param);
1050 last_mouse_event_was_move_ = true;
1051 GetRootView()->OnMouseMoved(MouseEvent(msg));
1052 }
1053 return true;
1054 }
1055
1056 void WidgetWin::ProcessMouseExited(UINT message,
1057 WPARAM w_param,
1058 LPARAM l_param) {
1059 last_mouse_event_was_move_ = false;
1060 MSG msg;
1061 MakeMSG(&msg, message, w_param, l_param, 0, GET_X_LPARAM(l_param),
1062 GET_Y_LPARAM(l_param));
1063 GetRootView()->OnMouseExited(MouseEvent(msg));
1064 // Reset our tracking flag so that future mouse movement over this WidgetWin
1065 // results in a new tracking session.
1066 active_mouse_tracking_flags_ = 0;
1067 }
1068
1069 void WidgetWin::OnScreenReaderDetected() { 942 void WidgetWin::OnScreenReaderDetected() {
1070 screen_reader_active_ = true; 943 screen_reader_active_ = true;
1071 } 944 }
1072 945
1073 bool WidgetWin::ReleaseCaptureOnMouseReleased() {
1074 return true;
1075 }
1076
1077 //////////////////////////////////////////////////////////////////////////////// 946 ////////////////////////////////////////////////////////////////////////////////
1078 // WidgetWin, private: 947 // WidgetWin, private:
1079 948
1080 // static 949 // static
1081 Window* WidgetWin::GetWindowImpl(HWND hwnd) { 950 Window* WidgetWin::GetWindowImpl(HWND hwnd) {
1082 // NOTE: we can't use GetAncestor here as constrained windows are a Window, 951 // NOTE: we can't use GetAncestor here as constrained windows are a Window,
1083 // but not a top level window. 952 // but not a top level window.
1084 HWND parent = hwnd; 953 HWND parent = hwnd;
1085 while (parent) { 954 while (parent) {
1086 WidgetWin* widget = 955 WidgetWin* widget =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 // again. 998 // again.
1130 if (!IsWindowEnabled(widget->GetNativeView())) { 999 if (!IsWindowEnabled(widget->GetNativeView())) {
1131 DCHECK(!widget->restore_focus_when_enabled_); 1000 DCHECK(!widget->restore_focus_when_enabled_);
1132 widget->restore_focus_when_enabled_ = true; 1001 widget->restore_focus_when_enabled_ = true;
1133 return; 1002 return;
1134 } 1003 }
1135 focus_manager->RestoreFocusedView(); 1004 focus_manager->RestoreFocusedView();
1136 } 1005 }
1137 } 1006 }
1138 1007
1139 void WidgetWin::MakeMSG(MSG* msg, UINT message, WPARAM w_param, LPARAM l_param,
1140 DWORD time, LONG x, LONG y) const {
1141 msg->hwnd = hwnd();
1142 msg->message = message;
1143 msg->wParam = w_param;
1144 msg->lParam = l_param;
1145 msg->time = time;
1146 msg->pt.x = x;
1147 msg->pt.y = y;
1148 }
1149
1150 void WidgetWin::RedrawInvalidRect() { 1008 void WidgetWin::RedrawInvalidRect() {
1151 if (!use_layered_buffer_) { 1009 if (!use_layered_buffer_) {
1152 RECT r = { 0, 0, 0, 0 }; 1010 RECT r = { 0, 0, 0, 0 };
1153 if (GetUpdateRect(hwnd(), &r, FALSE) && !IsRectEmpty(&r)) { 1011 if (GetUpdateRect(hwnd(), &r, FALSE) && !IsRectEmpty(&r)) {
1154 RedrawWindow(hwnd(), &r, NULL, 1012 RedrawWindow(hwnd(), &r, NULL,
1155 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); 1013 RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
1156 } 1014 }
1157 } 1015 }
1158 } 1016 }
1159 1017
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 return; 1121 return;
1264 1122
1265 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); 1123 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view);
1266 if (native_widget) 1124 if (native_widget)
1267 children->insert(native_widget); 1125 children->insert(native_widget);
1268 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets, 1126 EnumChildWindows(native_view, EnumerateChildWindowsForNativeWidgets,
1269 reinterpret_cast<LPARAM>(children)); 1127 reinterpret_cast<LPARAM>(children));
1270 } 1128 }
1271 1129
1272 } // namespace views 1130 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/widget_win.h ('k') | views/window/window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698