From dcb1229f413c38310ed19e222dadd4338b3ffa8c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 22 Nov 2016 02:07:44 +0100 Subject: [PATCH] Don't send mouse events to disabled windows in wxOSX Disabled controls are not supposed to accept any input, so don't send any mouse events to them. This fixes the behaviour of wxSlider which could be moved (and generated the corresponding events) even when it was disabled. Closes #17194. --- docs/changes.txt | 1 + src/osx/cocoa/window.mm | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 0b2a1f79e9..615f1927d4 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -165,6 +165,7 @@ wxOSX: - Implement wxDataViewCtrl::SetRowHeight(). - Add OSXEnableAutomaticQuoteSubstitution(), OSXEnableAutomaticDashSubstitution() and OSXDisableAllSmartSubstitutions() to control wxTextCtrl smart behavior. +- Don't allow interacting with disabled wxSlider (Andreas Falkenhahn). Unix: diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 87429a2d14..267f3942bd 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -985,7 +985,9 @@ void wxOSX_mouseEvent(NSView* self, SEL _cmd, NSEvent *event) if (impl == NULL) return; - impl->mouseEvent(event, self, _cmd); + // We shouldn't let disabled windows get mouse events. + if (impl->GetWXPeer()->IsEnabled()) + impl->mouseEvent(event, self, _cmd); } void wxOSX_cursorUpdate(NSView* self, SEL _cmd, NSEvent *event)