diff options
author | fvogel <fvogelnew1@free.fr> | 2024-03-15 02:00:31 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2024-03-15 02:00:31 (GMT) |
commit | b0e011f103229b421bc2b1c2d2f65e51bd4ebe87 (patch) | |
tree | a9d6545b42d52fc1cfe41cec85da65c8bed30ae5 | |
parent | d769a99306bdee4395fbfbb4a5d5992e64cf05eb (diff) | |
parent | 99731c885b94164b6957e5e8ea7d9c24121b4eda (diff) | |
download | tk-b0e011f103229b421bc2b1c2d2f65e51bd4ebe87.zip tk-b0e011f103229b421bc2b1c2d2f65e51bd4ebe87.tar.gz tk-b0e011f103229b421bc2b1c2d2f65e51bd4ebe87.tar.bz2 |
Complement to the fix for [47d4f29159]: Ignored binding scripts for events with detail field NotifyInferior.
-rw-r--r-- | doc/ttk_panedwindow.n | 4 | ||||
-rw-r--r-- | generic/tkCanvas.c | 14 | ||||
-rw-r--r-- | generic/tkTextTag.c | 14 | ||||
-rw-r--r-- | generic/ttk/ttkPanedwindow.c | 14 | ||||
-rw-r--r-- | generic/ttk/ttkWidget.c | 2 | ||||
-rw-r--r-- | library/ttk/panedwindow.tcl | 2 |
6 files changed, 31 insertions, 19 deletions
diff --git a/doc/ttk_panedwindow.n b/doc/ttk_panedwindow.n index 695f668..1514944 100644 --- a/doc/ttk_panedwindow.n +++ b/doc/ttk_panedwindow.n @@ -128,9 +128,7 @@ Returns the new position of sash number \fIindex\fR. .SH "VIRTUAL EVENTS" .PP The panedwindow widget generates an \fB<<EnteredChild>>\fR virtual event on -LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts -for <Leave> events when the pointer crosses from a parent to a child. The -panedwindow widget needs to know when that happens. +LeaveNotify/NotifyInferior events. .SH "STYLING OPTIONS" .PP The class name for a \fBttk::panedwindow\fP is \fBTPanedwindow\fP. The diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 34d6845..ef14f09 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -5275,9 +5275,17 @@ PickCurrentItem( event.type = LeaveNotify; /* - * If the event's detail happens to be NotifyInferior the binding - * mechanism will discard the event. To be consistent, always use - * NotifyAncestor. + * Behaviour before ticket #47d4f29159: + * If the event's detail happens to be NotifyInferior the binding + * mechanism will discard the event. To be consistent, always use + * NotifyAncestor. + * + * Behaviour after ticket #47d4f29159: + * The binding mechanism doesn't discard events with detail field + * NotifyInferior anymore. It would be best to base the detail + * field on the ancestry relationship between the old and new + * canvas items. For the time being, retain the choice from before + * ticket #47d4f29159, which doesn't harm. */ event.xcrossing.detail = NotifyAncestor; diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 97235b6..d679d30 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1596,9 +1596,17 @@ TkTextPickCurrent( event.type = LeaveNotify; /* - * Always use a detail of NotifyAncestor. Besides being - * consistent, this avoids problems where the binding code will - * discard NotifyInferior events. + * Behaviour before ticket #47d4f29159: + * Always use a detail of NotifyAncestor. Besides being + * consistent, this avoids problems where the binding code will + * discard NotifyInferior events. + * + * Behaviour after ticket #47d4f29159: + * The binding mechanism doesn't discard events with detail field + * NotifyInferior anymore. It would be best to base the detail + * field on the ancestry relationship between the old and new + * tags. For the time being, retain the choice from before + * ticket #47d4f29159, which doesn't harm. */ event.xcrossing.detail = NotifyAncestor; diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 62b11a4..7cd2fd9 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -469,14 +469,16 @@ static const Ttk_ManagerSpec PanedManagerSpec = { /*------------------------------------------------------------------------ * +++ Event handler. * - * <<NOTE-PW-LEAVE-NOTIFYINFERIOR>> - * Tk does not execute binding scripts for <Leave> events when - * the pointer crosses from a parent to a child. This widget - * needs to know when that happens, though, so it can reset - * the cursor. - * * This event handler generates an <<EnteredChild>> virtual event * on LeaveNotify/NotifyInferior. + * This was originally introduced because Tk used to discard events with + * detail field NotifyInferior. The <<EnteredChild>> event was then used + * to reset the cursor when the pointer crosses from a parent to a child. + * Since ticket #47d4f29159, LeaveNotify/NotifyInferior are no longer + * discarded: the <Leave> event will trigger even with NotifyInferior + * detail field. The generated <<EnteredChild>> is nevertheless kept for + * backwards compatibility purpose since it is publicly documented, + * meaning that someone could bind to it. */ static const unsigned PanedEventMask = LeaveWindowMask; diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 8fcde07..5790cc3 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -247,8 +247,6 @@ DestroyWidget(WidgetCore *corePtr) * For Destroy events, handle the cleanup process. * * For Focus events, set/clear the focus bit in the state field. - * It turns out this is impossible to do correctly in a binding script, - * because Tk filters out focus events with detail == NotifyInferior. * * For Deactivate/Activate pseudo-events, set/clear the background state * flag. diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index 877f486..d5e25cd 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -22,8 +22,6 @@ bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y } bind TPanedwindow <Motion> { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow <Enter> { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow <Leave> { ttk::panedwindow::ResetCursor %W } -# See <<NOTE-PW-LEAVE-NOTIFYINFERIOR>> -bind TPanedwindow <<EnteredChild>> { ttk::panedwindow::ResetCursor %W } ## Sash movement: # |