From: <no...@so...> - 2001-04-03 18:22:26
|
Bugs item #220948, was updated on 2000-10-31 17:33 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112997&aid=220948&group_id=12997 Category: Win Menus Group: 8.3.2 Status: Open Priority: 5 Submitted By: Brent B. Welch (welch) >Assigned to: Jeffrey Hobbs (hobbs) Summary: TkWinHandleMenuEvent sets service mode incorrectly. Initial Comment: OriginalBugID: 6238 Bug Version: 8.3.2 SubmitDate: '2000-09-08' LastModified: Severity: SER Status: UnAssn Submitter: techsupp OS: All Windows Name: Rick Hedin CVS: /cvsroot/tk/win/tkWinMenu.c,v revision 1.13 ReproducibleScript: I found that if I restored a minimized Tk window by clicking on it, it worked fine. But if I restored it by right-clicking and picking "Restore", Tk was broken. Windows didn't update, and keypresses were ignored. I am working with Tk embedded in C under Microsoft Windows. It turns out that the TkWinHandleMenuEvent routine never stores the old service mode in the case of a Windows window. When you leave the menu and TWHME restores the service mode, it restores the wrong thing. That is why it works in a Wish environment: Tk windows have their old service mode stored. I made a small code change to TkWinHandleMenuEvent. Now it works. I don't think this change will propagate through the code. I think it's isolated. ObservedBehavior: Old operation: Set oldServiceMode in the thread specific data only if it was a Tk window. Set service mode from oldServiceMode whether it was a Windows window or a Tk window. DesiredBehavior: New operation: Sets oldServiceMode in the thread specific data regardless of which kind of window it is. oldServiceMode is always valid when it is used to set the service mode. Patch: C:\Users\rhedin\work\tk>cvs diff win/tkWinMenu.c Index: win/tkWinMenu.c =================================================================== RCS file: /cvsroot/tk/win/tkWinMenu.c,v retrieving revision 1.13 diff -r1.13 tkWinMenu.c 904a905 > tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); 908d908 < tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); C:\Users\rhedin\work\tk> PatchFiles: win/tkWinMenu.c ---------------------------------------------------------------------- >Comment By: Jeffrey Hobbs (hobbs) Date: 2001-04-03 11:22 Message: Logged In: YES user_id=72656 Awaiting confirmation of one of the options from Rick. ---------------------------------------------------------------------- Comment By: Rick Hedin (rhedin) Date: 2001-04-03 06:36 Message: Logged In: YES user_id=187927 The two other solutions Jeff mentions look good to me. The only caution I would mention is that it would be good to make an environment that expresses the original problem, and then make the change, in order to test it thoroughly. The first solution was tested in the environment that gave the problem. If you prefer one of the other two solutions, maybe I could test it for you. I have the environment. ---------------------------------------------------------------------- Comment By: Jeffrey Hobbs (hobbs) Date: 2001-04-02 22:14 Message: Logged In: YES user_id=72656 This might make sense, although it seems like two other possibilities should be practical given the code: 1) Correct tkWinMenu.c:1104(cvs1.13) by placing the setting of the service mode using the oldServiceMode inside the if condition (to match the WM_INITMENU use of it), or to set oldServiceMode = Tcl_GetServiceMode() in the if branch of WM_INITMENU, thereby not setting service mode to TCL_SERVICE_ALL in any case. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=112997&aid=220948&group_id=12997 |