diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-22 02:01:57 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-22 02:01:57 +0000 |
commit | 365632b6511797f47983a1bbae1dc4fd84e0ba1b (patch) | |
tree | 1f765e845fb917886a8338a29478738645fbeed0 /chrome/browser/autocomplete/autocomplete_edit_view_win.h | |
parent | 69ac9dc297cdf825abc78d1b097580fafea8ea40 (diff) | |
download | chromium_src-365632b6511797f47983a1bbae1dc4fd84e0ba1b.zip chromium_src-365632b6511797f47983a1bbae1dc4fd84e0ba1b.tar.gz chromium_src-365632b6511797f47983a1bbae1dc4fd84e0ba1b.tar.bz2 |
Make right-clicking the omnibox with nothing selected select all (just like left-clicking).
Eat middle-mouse clicks on the omnibox to avoid tripping a CRichEditCtrl bug.
Original patch by Jared Wein (see http://codereview.chromium.org/2241003 ), r=me.
BUG=6873, 30134
TEST=Middle-click the omnibox, then try to click it (or any other UI element), and make sure the click has an effect. Select a portion of the URL and right-click on the omnibox. Notice that the selection does not change. Clear the selection and right-click on the omnibox and notice that the URL is automatically selected.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_win.h')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_win.h | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h index 4f3e51e..8157706 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h @@ -170,15 +170,17 @@ class AutocompleteEditViewWin MSG_WM_LBUTTONDBLCLK(OnLButtonDblClk) MSG_WM_LBUTTONDOWN(OnLButtonDown) MSG_WM_LBUTTONUP(OnLButtonUp) - MSG_WM_MBUTTONDOWN(OnNonLButtonDown) - MSG_WM_MBUTTONUP(OnNonLButtonUp) + MSG_WM_MBUTTONDBLCLK(OnMButtonDblClk) + MSG_WM_MBUTTONDOWN(OnMButtonDown) + MSG_WM_MBUTTONUP(OnMButtonUp) MSG_WM_MOUSEACTIVATE(OnMouseActivate) MSG_WM_MOUSEMOVE(OnMouseMove) MSG_WM_MOUSEWHEEL(OnMouseWheel) MSG_WM_PAINT(OnPaint) MSG_WM_PASTE(OnPaste) - MSG_WM_RBUTTONDOWN(OnNonLButtonDown) - MSG_WM_RBUTTONUP(OnNonLButtonUp) + MSG_WM_RBUTTONDBLCLK(OnRButtonDblClk) + MSG_WM_RBUTTONDOWN(OnRButtonDown) + MSG_WM_RBUTTONUP(OnRButtonUp) MSG_WM_SETFOCUS(OnSetFocus) MSG_WM_SETTEXT(OnSetText) MSG_WM_SYSCHAR(OnSysChar) // WM_SYSxxx == WM_xxx with ALT down @@ -198,6 +200,11 @@ class AutocompleteEditViewWin virtual void ExecuteCommand(int command_id); private: + enum MouseButton { + kLeft = 0, + kRight = 1, + }; + // This object freezes repainting of the edit until the object is destroyed. // Some methods of the CRichEditCtrl draw synchronously to the screen. If we // don't freeze, the user will see a rapid series of calls to these as @@ -256,13 +263,17 @@ class AutocompleteEditViewWin void OnLButtonDblClk(UINT keys, const CPoint& point); void OnLButtonDown(UINT keys, const CPoint& point); void OnLButtonUp(UINT keys, const CPoint& point); + void OnMButtonDblClk(UINT keys, const CPoint& point); + void OnMButtonDown(UINT keys, const CPoint& point); + void OnMButtonUp(UINT keys, const CPoint& point); LRESULT OnMouseActivate(HWND window, UINT hit_test, UINT mouse_message); void OnMouseMove(UINT keys, const CPoint& point); BOOL OnMouseWheel(UINT flags, short delta, CPoint point); - void OnNonLButtonDown(UINT keys, const CPoint& point); - void OnNonLButtonUp(UINT keys, const CPoint& point); void OnPaint(HDC bogus_hdc); void OnPaste(); + void OnRButtonDblClk(UINT keys, const CPoint& point); + void OnRButtonDown(UINT keys, const CPoint& point); + void OnRButtonUp(UINT keys, const CPoint& point); void OnSetFocus(HWND focus_wnd); LRESULT OnSetText(const wchar_t* text); void OnSysChar(TCHAR ch, UINT repeat_count, UINT flags); @@ -361,10 +372,6 @@ class AutocompleteEditViewWin // user moves the mouse far enough to start a drag. void OnPossibleDrag(const CPoint& point); - // Invoked when a mouse button is released. If none of the buttons are still - // down, this sets possible_drag_ to false. - void UpdateDragDone(UINT keys); - // Redraws the necessary region for a drop highlight at the specified // position. This does nothing if position is beyond the bounds of the // text. @@ -373,6 +380,9 @@ class AutocompleteEditViewWin // Generates the context menu for the edit field. void BuildContextMenu(); + void SelectAllIfNecessary(MouseButton button, const CPoint& point); + void TrackMousePosition(MouseButton button, const CPoint& point); + scoped_ptr<AutocompleteEditModel> model_; scoped_ptr<AutocompletePopupView> popup_view_; @@ -412,12 +422,13 @@ class AutocompleteEditViewWin // When the user clicks to give us focus, we watch to see if they're clicking // or dragging. When they're clicking, we select nothing until mouseup, then - // select all the text in the edit. During this process, tracking_click_ is - // true and mouse_down_point_ holds the original click location. At other - // times, tracking_click_ is false, and the contents of mouse_down_point_ - // should be ignored. - bool tracking_click_; - CPoint mouse_down_point_; + // select all the text in the edit. During this process, tracking_click_[X] + // is true and click_point_[X] holds the original click location. + // At other times, tracking_click_[X] is false, and the contents of + // click_point_[X] should be ignored. The arrays hold the state for the + // left and right mouse buttons, and are indexed using the MouseButton enum. + bool tracking_click_[2]; + CPoint click_point_[2]; // We need to know if the user triple-clicks, so track double click points // and times so we can see if subsequent clicks are actually triple clicks. |