Overview
Artifact ID: | 61082efdcf028914b0dcb3bbbc19f3549143732a |
---|---|
Ticket: | bc4552d0bb8d4489b1d9675bbf7e0873d32bdb0c
Tcl_SetServiceMode in nextEventMatchingMask can be removed |
User & Date: | anonymous 2014-01-23 14:08:43 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
In the nextEventMatchingMask method in macosx/tkMacOSXNotify.c, in this section: @implementation TKApplication(TKNotify) - (NSEvent *) nextEventMatchingMask: (NSUInteger) mask untilDate: (NSDate *) expiration inMode: (NSString *) mode dequeue: (BOOL) deqFlag { ... int oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); NSEvent *event = [[super nextEventMatchingMask:mask untilDate:expiration inMode:mode dequeue:deqFlag] retain]; Tcl_SetServiceMode(oldMode); ... } we first set the service mode using Tcl_SetServiceMode, then we call the nextEventMatchingMask method of the superclass, and then we restore the original service mode. The Tcl_SetServiceMode function (in generic/tclNotify.c) is the following: int Tcl_SetServiceMode(int mode) { int oldMode; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); oldMode = tsdPtr->serviceMode; tsdPtr->serviceMode = mode; Tcl_ServiceModeHook(mode); return oldMode; } Now the superclass nextEventMatchingMask method simply gets the next available event, but does not invoke any Tcl/Tk code. So setting tsdPtr->serviceMode has no consequences. The Tcl_ServiceModeHook function (in macosx/tclMacOSXNotify.c) creates the runloop timer if it doesn’t already exist. But since we also call Tcl_SetServiceMode from Tk_MacOSXSetupTkNotifier during Tk initialization, the runloop timer already exist by the time we call nextEventMatchingMask. So I think the two calls to Tcl_SetServiceMode in the nextEventMatchingMask method can be removed. The patch does just that. This patch was made relative to this patch which I submitted previously: https://core.tcl.tk/tcl/tktview?name=883155fb98 However, these two patches can be applied independently of each other.
- foundin changed to: "trunk"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "500c9a7a4e11b3ea0441850610e04006941c0cf3"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "70. Event Loop"
- title changed to:
Tcl_SetServiceMode in nextEventMatchingMask can be removed
- type changed to: "Patch"