From d03621adc46c864cc9d1ba6bec738a16b50404d0 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 14 May 2009 07:44:26 +0000 Subject: [PATCH] gtk2: stop motion-notify-event propagation (fixes bug #0013708) git-svn-id: trunk@19959 - --- lcl/interfaces/gtk/gtkcallback.inc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index 359ef7f012..2da18cb01c 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -1177,20 +1177,22 @@ begin {$ENDIF} end; - if not (csDesigning in TComponent(Data).ComponentState) then begin - DesignOnlySignal:=GetDesignOnlySignalFlag(Widget,dstMouseMotion); + if not (csDesigning in TComponent(Data).ComponentState) then + begin + DesignOnlySignal := GetDesignOnlySignalFlag(Widget, dstMouseMotion); if DesignOnlySignal then exit; if not ControlGetsMouseMoveBefore(TControl(Data)) then exit; - end else begin + end else + begin // stop the signal, so that the widget does not auto react - g_signal_stop_emission_by_name(PGTKObject(Widget),'motion-notify-event'); - Result:=CallBackDefaultReturn; + g_signal_stop_emission_by_name(PGTKObject(Widget), 'motion-notify-event'); + Result := CallBackDefaultReturn; // why not True if we want to stop it? end; DeliverMouseMoveMessage(Widget,Event,TWinControl(Data)); {$IFDEF gtk2} if TControl(Data).FCompStyle = csWinControl then - Result := not CallBackDefaultReturn; // stop signal + Result := True; // stop signal {$ENDIF} end; @@ -1204,8 +1206,8 @@ end; function GTKMotionNotifyAfter(widget:PGTKWidget; event: PGDKEventMotion; data: gPointer): GBoolean; cdecl; begin - Result := CallBackDefaultReturn; - MousePositionValid:=false; + Result := True; // stop event propagation + MousePositionValid := False; {$IFDEF VerboseMouseBugfix} DebugLn('[GTKMotionNotifyAfter] ', @@ -1220,7 +1222,7 @@ begin if (csDesigning in TComponent(Data).ComponentState) then exit; if ControlGetsMouseMoveBefore(TControl(Data)) then exit; - DeliverMouseMoveMessage(Widget,Event,TWinControl(Data)); + DeliverMouseMoveMessage(Widget,Event, TWinControl(Data)); end; {-------------------------------------------------------------------------------