From ab8853473fe40d1a41ef3f9c43bae7d7ecb230b2 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 13 Mar 2024 20:09:28 +0000 Subject: Adjust comments in PickCurrentItem(), TkTextPickCurrent() and CoreEventProc(). --- generic/tkCanvas.c | 14 +++++++++++--- generic/tkTextTag.c | 14 +++++++++++--- generic/ttk/ttkWidget.c | 2 -- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index aaac122..ccd3cac 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -4963,9 +4963,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 400b2d1..9275bb1 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1803,9 +1803,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 + * 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/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 75ca39c..37cc5ed 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -242,8 +242,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. -- cgit v0.12 From 4a474d3f289ebb54ebe74f6a23b490fa84b864f0 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 13 Mar 2024 20:50:14 +0000 Subject: Don't use the <> event anymore internally in Tk. Eradicate the <>. --- doc/ttk_panedwindow.n | 4 +--- generic/ttk/ttkPanedwindow.c | 14 ++++++++------ library/ttk/panedwindow.tcl | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/doc/ttk_panedwindow.n b/doc/ttk_panedwindow.n index d6b3ea3..5b6f728 100644 --- a/doc/ttk_panedwindow.n +++ b/doc/ttk_panedwindow.n @@ -117,9 +117,7 @@ widget subcommands (see \fIttk::widget(n)\fR for details): .SH "VIRTUAL EVENTS" .PP The panedwindow widget generates an \fB<>\fR virtual event on -LeaveNotify/NotifyInferior events, because Tk does not execute binding scripts -for 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/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index ab67377..133de96 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -469,14 +469,16 @@ static Ttk_ManagerSpec PanedManagerSpec = { /*------------------------------------------------------------------------ * +++ Event handler. * - * <> - * Tk does not execute binding scripts for 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 <> virtual event * on LeaveNotify/NotifyInferior. + * This was originally introduced because Tk used to discard events with + * detail field NotifyInferior. The <> 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 event will trigger even with NotifyInferior + * detail field. The generated <> 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/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index 1989b89..e2682f1 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -22,8 +22,6 @@ bind TPanedwindow { ttk::panedwindow::Release %W %x %y } bind TPanedwindow { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow { ttk::panedwindow::ResetCursor %W } -# See <> -bind TPanedwindow <> { ttk::panedwindow::ResetCursor %W } ## Sash movement: # -- cgit v0.12 From fe3c077e83e86f17c990af8770be23ed02bf41d0 Mon Sep 17 00:00:00 2001 From: fvogel Date: Thu, 14 Mar 2024 19:38:16 +0000 Subject: Fix mistake in comment. --- generic/tkTextTag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 9275bb1..d734b8d 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1812,7 +1812,7 @@ TkTextPickCurrent( * 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 + * tags. For the time being, retain the choice from before * ticket #47d4f29159, which doesn't harm. */ -- cgit v0.12