Tk Source Code

View Ticket
Login
2010-08-18
07:51 Closed ticket [3009998fff]: Binding procedure reform plus 2 other changes artifact: 0c1d29bba7 user: jenglish
07:51 Ticket [3009998fff]: 4 changes artifact: f39c1eb497 user: jenglish
2010-08-12
00:09 Open ticket [3009998fff]. artifact: b4336333fc user: dgp
2010-06-19
23:19 Closed ticket [3009998fff]. artifact: ed5c4c1f91 user: jenglish
2010-06-16
23:39 Ticket [3009998fff]: 5 changes artifact: 76a9748cc6 user: jenglish
23:37 Ticket [3009998fff]: 4 changes artifact: e3f7f46b0b user: jenglish
2010-06-02
00:05 Ticket [3009998fff]: 4 changes artifact: 389c1f422d user: jenglish
2010-06-01
23:55 Ticket [3009998fff]: 4 changes artifact: dcb3f27b8b user: jenglish
23:50 Add attachment carbonscrollbar-bindproc.patch to ticket [3009998fff] artifact: 9c9a346c2d user: jenglish
23:50 Ticket [3009998fff] Binding procedure reform status still Open with 4 other changes artifact: 8f00729d37 user: jenglish
23:48 Ticket [3009998fff]: 4 changes artifact: cae4e39c23 user: jenglish
23:38 Ticket [3009998fff]: 5 changes artifact: 4e4564dfdb user: jenglish
23:31 Ticket [3009998fff]: 4 changes artifact: eccfcd7626 user: jenglish
23:31 Add attachment winscrollbar-bindproc.patch to ticket [3009998fff] artifact: b74bb568d8 user: jenglish
16:31 New ticket [3009998fff] Binding procedure reform. artifact: 504ca2a07b user: jenglish

Ticket UUID: 3009998
Title: Binding procedure reform
Type: Patch Version: None
Submitter: jenglish Created on: 2010-06-01 16:31:19
Subsystem: 01. Bindings Assigned To: jenglish
Priority: 8 Severity:
Status: Closed Last Modified: 2010-08-18 07:51:09
Resolution: Accepted Closed By: jenglish
    Closed on: 2010-08-18 00:51:09
Description:
Attached patch winscrollbar-bindproc replaces the TkBindEvalProc ScrollbarBindProc with an ordinary event handler.

(Description to follow).
User Comments: jenglish added on 2010-08-18 07:51:08:
> backport candidate?

Not really.  A simpler and much less intrusive workaround for the bug that prompted it  has already been committed (#3006842, see below), this patch series was more for cleanup moving forward.

dgp added on 2010-08-12 00:09:55:
backport candidate?

jenglish added on 2010-06-19 23:19:12:
Patch committed; closing.

jenglish added on 2010-06-16 23:39:09:
... and if there are no further comments in the next day or two I plan to commit the patch, before it goes stale.

jenglish added on 2010-06-16 23:37:17:
Notes from tcl-core mailing list: 

[ ~2 Jun 2010]
Jeff Hobbs asked:
> I read the comments, but I wanted to just check that in testing of this
> patch, should we expect/see _any_ difference in UX?

Confirmed: the patch should cause _no_ discernable difference in
user interaction with Tk scrollbars.

(There may be some program-visible differences, but -- I believe --
only under very unusual circumstances.)

[ ~7 Jun 2010]:

One programmer-visible change I thought of:

At present, under Unix and Windows -- but not Cocoa --
it's possible to completely override scrollbar behavior
by changing [bindtag]s.  With the patch, this will no
longer be possible under Windows or Carbon either,
since the built-in behavior is more deeply baked in.

(I don't think this is _too_ big a deal; as above, this
is already how things work under Cocoa, and if anyone needs this
type of thing it's still possible with the ttk::scrollbar.)

jenglish added on 2010-06-02 00:05:41:
For further background, see Tk bug#3006842.   A workaround for that bug has been committed, but the intent of this patch series is to fix the underlying problem by removing the internal routine TkCreateBindingProcedure() altogether.  It's quirky (see e.g. header comment in Tk_DeleteAllBindings()), little-used, and adds significant hairiness to tkBind.c.

jenglish added on 2010-06-01 23:55:58:
Second patch in series carbonscrollbar-bindproc.patch does something similar for the obsolete Carbon-native scrollbar: it replaces TkCreateBindingProcedure() with an ordinary event handler.

This is the last place in the Tk core (besides the test suite) that calls the internal routine TkCreateBindingProcedure().  

The only other place it has ever been used in the core was in win/tkWinMenu.c starting in release 8.0; that usage has since been replaced with ordinary binding scripts:

2003-04-14  Mo DeJong  <mdejong@users.sourceforge.net>
        * win/tkWinMenu.c (MenuKeyBindProc, TkWinMenuKeyObjCmd)
        (TkpInitializeMenuBindings): Rename MenuKeyBindProc to
        TkWinMenuKeyObjCmd and convert it into a Tcl command named
        tk::tkWinMenuKey. Bind keyboard accelerator actions to this Tcl command
        instead of using a native C binding. This makes it possible to extend
        the existing binding with Tcl code and makes the Windows version work
        just like the unix version.

jenglish added on 2010-06-01 23:50:31:

File Added - 375876: carbonscrollbar-bindproc.patch

jenglish added on 2010-06-01 23:48:17:
Notes: win/tkWinScrlbr.c is the only place where the TK_DEFER_MODAL / ClassProcs.modalLoopProc() machinery has ever been used in Tk.   carbon/tkMacOSXScrlbr.c (formerly macosx/tkMacOSXScrlbr,c, formerly mac/tkMacScrlbr.c) has similar environmental constraints as the Windows-native scrollbar, but it calls the tracking loop directly from ScrollbarBindProc.

I can't tell what the current macosx scrollbar implementation is doing, but all of the other Windows and Carbon native controls that require a modal loop enter it directly from a command procedure, event handler, or (in one case, see next patch) a binding procedure.

jenglish added on 2010-06-01 23:38:51:
Current control flow in response to a ButtonPress event is:

- Tk_HandleEvent() calls TkBindEventProc calls Tk_BindEvent,
- which queues and later calls ScrollbarBindProc (binding procedure on "Scrollbar" bindtag)
- which sets the TK_DEFER_MODAL flag and returns.
- Later, Tk_BindEvent sees that TK_DEFER_MODAL has been set 
- and calls winPtr->classProcsPtr->modalProc()
- which is ModalLoopProc in win/tkWinScrlbar.c,
- which passes (what it assumes is a) ButtonPress event to TkWinResendEvent
- which reformats it as a Windows message and passes it to the Windows L"ScrollBar" WndProc,
- which enters a modal loop.


After the patch, the control flow is:

- Tk_HandleEvent() calls WinScrollbarEventProc (registered event handler),
- which calls ModalLoop() directly
- which passes the ButtonPress event to TkWinResentEvent ...
- which proceeds as before.

jenglish added on 2010-06-01 23:31:20:

File Added - 375874: winscrollbar-bindproc.patch

Attachments: