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 [email protected]
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 Unified Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXMouseEvent.c.

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
...
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
	[_windowWithMouse retain];
    }

    /*
     * Compute the mouse position in Tk screen coordinates (global) and in
     * the Tk coordinates of its containing Tk Window.
     */
    
    NSPoint global, local = [theEvent locationInWindow];

    /*
     * If the event has no NSWindow, try using the cached NSWindow from the
     * last mouse event.
     */

    if (eventWindow == NULL) {
	eventWindow == _windowWithMouse;
    }
    if (eventWindow) {
	
	/*
	 * Set the local mouse position to its NSWindow flipped coordinates,
	 * with the origin at top left, and the global mouse position to the
	 * flipped screen coordinates.
	 */

	global = [eventWindow tkConvertPointToScreen: local];
	local.y = [eventWindow frame].size.height - local.y;
	global.y = tkMacOSXZeroScreenHeight - global.y;

    } else {

	/*
	 * As a last resort, with no NSWindow to work witn, set both local and
	 * global to the screen coordinates.
	 */

	local.y = tkMacOSXZeroScreenHeight - local.y;
	global = local;
    }

................................................................................
	return theEvent;
    }

    /*
     * Convert local from NSWindow flipped coordinates to the toplevel's
     * coordinates.
     */
    
    local.x -= winPtr->wmInfoPtr->xInParent;
    local.y -= winPtr->wmInfoPtr->yInParent;

    /*
     * Find the containing Tk window, and convert local into the coordinates
     * of the Tk window.  (The converted local coordinates are only needed
     * for scrollwheel events.)
................................................................................
    tkwin = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y);
    local.x = win_x;
    local.y = win_y;

    /*
     *  Generate an XEvent for this mouse event.
     */
    
    unsigned int state = 0;
    NSInteger button = [theEvent buttonNumber];
    EventRef eventRef = (EventRef)[theEvent eventRef];
    UInt32 buttons;
    OSStatus err = GetEventParameter(eventRef, kEventParamMouseChord,
				     typeUInt32, NULL, sizeof(UInt32), NULL, &buttons);







|











|













|







 







|







 







|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
...
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
	[_windowWithMouse retain];
    }

    /*
     * Compute the mouse position in Tk screen coordinates (global) and in
     * the Tk coordinates of its containing Tk Window.
     */

    NSPoint global, local = [theEvent locationInWindow];

    /*
     * If the event has no NSWindow, try using the cached NSWindow from the
     * last mouse event.
     */

    if (eventWindow == NULL) {
	eventWindow == _windowWithMouse;
    }
    if (eventWindow) {

	/*
	 * Set the local mouse position to its NSWindow flipped coordinates,
	 * with the origin at top left, and the global mouse position to the
	 * flipped screen coordinates.
	 */

	global = [eventWindow tkConvertPointToScreen: local];
	local.y = [eventWindow frame].size.height - local.y;
	global.y = tkMacOSXZeroScreenHeight - global.y;

    } else {

	/*
	 * As a last resort, with no NSWindow to work with, set both local and
	 * global to the screen coordinates.
	 */

	local.y = tkMacOSXZeroScreenHeight - local.y;
	global = local;
    }

................................................................................
	return theEvent;
    }

    /*
     * Convert local from NSWindow flipped coordinates to the toplevel's
     * coordinates.
     */

    local.x -= winPtr->wmInfoPtr->xInParent;
    local.y -= winPtr->wmInfoPtr->yInParent;

    /*
     * Find the containing Tk window, and convert local into the coordinates
     * of the Tk window.  (The converted local coordinates are only needed
     * for scrollwheel events.)
................................................................................
    tkwin = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y);
    local.x = win_x;
    local.y = win_y;

    /*
     *  Generate an XEvent for this mouse event.
     */

    unsigned int state = 0;
    NSInteger button = [theEvent buttonNumber];
    EventRef eventRef = (EventRef)[theEvent eventRef];
    UInt32 buttons;
    OSStatus err = GetEventParameter(eventRef, kEventParamMouseChord,
				     typeUInt32, NULL, sizeof(UInt32), NULL, &buttons);