Tk Source Code

Check-in [77baa1f7]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix typo
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-609e0045f5
Files: files | file ages | folders
SHA3-256:77baa1f7a496aaac2ffebac3045c71cd5656f58abbf46c929e7cd2de5195bfab
User & Date: fvogel 2019-03-14 20:59:55
Context
2019-03-14
21:01
Fix [609e0045f5]: MouseWheel binding for canvas on MacOS provides wrong values for %x %y check-in: d0405802 user: fvogel tags: core-8-6-branch
20:59
Fix typo Closed-Leaf check-in: 77baa1f7 user: fvogel tags: bug-609e0045f5
2019-03-04
23:30
Fix bug [609e0045f5]: Aqua scrollwheel events have incorrect mouse coordinates. check-in: cb6302a6 user: culler tags: bug-609e0045f5
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXMouseEvent.c.

    90     90   	[_windowWithMouse retain];
    91     91       }
    92     92   
    93     93       /*
    94     94        * Compute the mouse position in Tk screen coordinates (global) and in
    95     95        * the Tk coordinates of its containing Tk Window.
    96     96        */
    97         -    
           97  +
    98     98       NSPoint global, local = [theEvent locationInWindow];
    99     99   
   100    100       /*
   101    101        * If the event has no NSWindow, try using the cached NSWindow from the
   102    102        * last mouse event.
   103    103        */
   104    104   
   105    105       if (eventWindow == NULL) {
   106    106   	eventWindow == _windowWithMouse;
   107    107       }
   108    108       if (eventWindow) {
   109         -	
          109  +
   110    110   	/*
   111    111   	 * Set the local mouse position to its NSWindow flipped coordinates,
   112    112   	 * with the origin at top left, and the global mouse position to the
   113    113   	 * flipped screen coordinates.
   114    114   	 */
   115    115   
   116    116   	global = [eventWindow tkConvertPointToScreen: local];
   117    117   	local.y = [eventWindow frame].size.height - local.y;
   118    118   	global.y = tkMacOSXZeroScreenHeight - global.y;
   119    119   
   120    120       } else {
   121    121   
   122    122   	/*
   123         -	 * As a last resort, with no NSWindow to work witn, set both local and
          123  +	 * As a last resort, with no NSWindow to work with, set both local and
   124    124   	 * global to the screen coordinates.
   125    125   	 */
   126    126   
   127    127   	local.y = tkMacOSXZeroScreenHeight - local.y;
   128    128   	global = local;
   129    129       }
   130    130   
................................................................................
   156    156   	return theEvent;
   157    157       }
   158    158   
   159    159       /*
   160    160        * Convert local from NSWindow flipped coordinates to the toplevel's
   161    161        * coordinates.
   162    162        */
   163         -    
          163  +
   164    164       local.x -= winPtr->wmInfoPtr->xInParent;
   165    165       local.y -= winPtr->wmInfoPtr->yInParent;
   166    166   
   167    167       /*
   168    168        * Find the containing Tk window, and convert local into the coordinates
   169    169        * of the Tk window.  (The converted local coordinates are only needed
   170    170        * for scrollwheel events.)
................................................................................
   174    174       tkwin = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y);
   175    175       local.x = win_x;
   176    176       local.y = win_y;
   177    177   
   178    178       /*
   179    179        *  Generate an XEvent for this mouse event.
   180    180        */
   181         -    
          181  +
   182    182       unsigned int state = 0;
   183    183       NSInteger button = [theEvent buttonNumber];
   184    184       EventRef eventRef = (EventRef)[theEvent eventRef];
   185    185       UInt32 buttons;
   186    186       OSStatus err = GetEventParameter(eventRef, kEventParamMouseChord,
   187    187   				     typeUInt32, NULL, sizeof(UInt32), NULL, &buttons);
   188    188