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

Unified Diff: views/controls/native_control_win.cc

Issue 113991: Make Combobox portable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/native_control_win.h ('k') | views/views.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/native_control_win.cc
===================================================================
--- views/controls/native_control_win.cc (revision 17310)
+++ views/controls/native_control_win.cc (working copy)
@@ -114,13 +114,20 @@
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 @@
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,
« no previous file with comments | « views/controls/native_control_win.h ('k') | views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698