Tk Source Code

Artifact [b0b458df]
Login

Artifact b0b458df9e0c55d6db4818f58df511e4801b423a:

Attachment "patch.txt" to ticket [564897ff] added by davygrvy 2002-06-05 23:39:01.
Index: tkWinWm.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/win/tkWinWm.c,v
retrieving revision 1.38
diff -c -r1.38 tkWinWm.c
*** tkWinWm.c	27 May 2002 22:54:42 -0000	1.38
--- tkWinWm.c	5 Jun 2002 16:36:37 -0000
***************
*** 5494,5500 ****
  	    ActivateEvent *eventPtr;
  	    winPtr = GetTopLevel((HWND) wParam);
  
! 	    if (winPtr && (TkGrabState(winPtr) != TK_GRAB_EXCLUDED)) {
  		/*
  		 * This allows us to pass the message onto the
  		 * native menus [Bug: 2272]
--- 5494,5513 ----
  	    ActivateEvent *eventPtr;
  	    winPtr = GetTopLevel((HWND) wParam);
  
! 	    /* 
! 	     * If you have Tk embedded in a C application, your Windows'
! 	     * windows may be above your Tcl windows in the window
! 	     * hierarchy. In this case, the message goes to the main
! 	     * application window.  Since the application window is above
! 	     * all the Tk windows, and isn't a Tk window itself, when we
! 	     * try to "get its toplevel" we get a null pointer.  The
! 	     * result is that the application doesn't activate if we
! 	     * click a widget in the application.  The !winPtr || portion
! 	     * ensures that the message is passed through and the
! 	     * application activates.
! 	     */ 
! 	    if (!winPtr || (winPtr && (TkGrabState(winPtr) !=
! 		    TK_GRAB_EXCLUDED))) {
  		/*
  		 * This allows us to pass the message onto the
  		 * native menus [Bug: 2272]