Tk Source Code

View Ticket
Login
Ticket UUID: 220354
Title: On Windows, don't let the mouse timer interfere with a size/move
Type: Bug Version: obsolete: 8.0p2
Submitter: welch Created on: 2000-10-31 23:17:11
Subsystem: 68. Win Window Operations Assigned To: nobody
Priority: 2 Severity:
Status: Closed Last Modified: 2001-03-23 02:22:43
Resolution: Fixed Closed By: dgp
    Closed on: 2001-03-22 19:22:43
Description:
OriginalBugID: 592 Bug
Version: 8.0p2
SubmitDate: '1998-05-21'
LastModified: '1999-08-15'
Severity: SER
Status: Released
Submitter: hershey
ChangedBy: hobbs
OS: All
OSVersion: NA
Machine: NA
FixedDate: '1999-08-15'
FixedInVersion: 8.2


Tk8.0p2 on Windows uses a timer procedure to keep track of the mouse.

This interacts badly with the Windows size or move commands.  A

Windows size or move uses a Windows mouse capture.  If the Tk mouse

timer fires, it will release the capture, which look bizarre.



This does not normally affect Tk programs, since normally when a size

or move command is started, the mouse is not actually inside the Tk

window, and so Tk does not have a timer procedure running.  However,

if you write C code to create a resize box inside your Tk window, and

thus invoke the resizing from C, the Tk mouse timer may be running.



The appended patch fixes this problem by turning off any pending mouse

timer during a size or move operation.



Tk8.1a2 appears to have the same problem.



Ian Taylor

[email protected]



*** /5g/ian/tk8.0p2/win/tkWinPointer.c  Fri Oct 31 11:40:05 1997

--- tkWinPointer.c      Wed Apr 15 14:59:42 1998

*************** MouseTimerProc(clientData)

*** 237,242 ****

--- 237,267 ----

      GetCursorPos(&pos);

      Tk_PointerEvent(NULL, pos.x, pos.y);

  }

+ 

+ /*

+  *----------------------------------------------------------------------

+  *

+  * TkWinCancelMouseTimer --

+  *

+  *    If the mouse timer is set, cancel it.

+  *

+  * Results:

+  *    None.

+  *

+  * Side effects:

+  *    May cancel the mouse timer.

+  *

+  *----------------------------------------------------------------------

+  */

+ 

+ void

+ TkWinCancelMouseTimer()

+ {

+     if (mouseTimerSet) {

+       Tcl_DeleteTimerHandler(mouseTimer);

+       mouseTimerSet = 0;

+     }

+ }

  

  /*

   *----------------------------------------------------------------------

*** /5g/ian/tk8.0p2/win/tkWinWm.c       Fri Oct 31 12:57:07 1997

--- tkWinWm.c   Wed Apr 15 15:01:23 1998

*************** WmProc(hwnd, message, wParam, lParam)

*** 3929,3934 ****

--- 3929,3942 ----

  

        case WM_ENTERSIZEMOVE:

            inMoveSize = 1;

+ 

+           /*

+            * Cancel any current mouse timer.  If the mouse timer

+            * fires during the size/move mouse capture, it will

+            * release the capture, which is wrong.

+            */

+           TkWinCancelMouseTimer();

+ 

            oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL);

            break;

  





This patch was integrated sometime before 8.2.0. 
-- 08/15/1999 hobbs