summaryrefslogtreecommitdiffstats
path: root/views/controls/native_control_win.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-02 04:47:36 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-02 04:47:36 +0000
commita0d0d38b5d45d7be151bad91a2231d3679432d13 (patch)
tree65866dc75a0ca59d3bd51804db05560e41b9ebf2 /views/controls/native_control_win.cc
parent73c8cb87ca07481b24f7823c1f2f99f0b530ef11 (diff)
downloadchromium_src-a0d0d38b5d45d7be151bad91a2231d3679432d13.zip
chromium_src-a0d0d38b5d45d7be151bad91a2231d3679432d13.tar.gz
chromium_src-a0d0d38b5d45d7be151bad91a2231d3679432d13.tar.bz2
Make Combobox portable
BUG=none TEST=none Review URL: http://codereview.chromium.org/113991 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/native_control_win.cc')
-rw-r--r--views/controls/native_control_win.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/views/controls/native_control_win.cc b/views/controls/native_control_win.cc
index eb188af..2d53f28 100644
--- a/views/controls/native_control_win.cc
+++ b/views/controls/native_control_win.cc
@@ -114,13 +114,20 @@ void NativeControlWin::ShowContextMenu(const gfx::Point& location) {
void NativeControlWin::NativeControlCreated(HWND native_control) {
// Associate this object with the control's HWND so that WidgetWin can find
// this object when it receives messages from it.
+ // Note that we never unset this property. We don't have to.
SetProp(native_control, kNativeControlWinKey, this);
- // Subclass the window so we can monitor for key presses.
- original_wndproc_ =
- win_util::SetWindowProc(native_control,
- &NativeControlWin::NativeControlWndProc);
- SetProp(native_control, kNativeControlOriginalWndProcKey, original_wndproc_);
+ // Subclass the window so we can monitor for key presses. It's important that
+ // we *only* do this if the derived class wants to intercept keypresses,
+ // because otherwise the subclass can mysteriously interfere with certain
+ // other controls, like the combobox, and cause weird effects.
+ if (NotifyOnKeyDown()) {
+ original_wndproc_ =
+ win_util::SetWindowProc(native_control,
+ &NativeControlWin::NativeControlWndProc);
+ SetProp(native_control, kNativeControlOriginalWndProcKey,
+ original_wndproc_);
+ }
Attach(native_control);
// native_view() is now valid.
@@ -188,7 +195,6 @@ LRESULT NativeControlWin::NativeControlWndProc(HWND window,
return 0;
} else if (message == WM_DESTROY) {
win_util::SetWindowProc(window, native_control->original_wndproc_);
- RemoveProp(window, kNativeControlWinKey);
}
return CallWindowProc(native_control->original_wndproc_, window, message,