Tk Source Code

Changes On Branch bug-9ebc6fd168
Login

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

Changes In Branch bug-9ebc6fd168 Excluding Merge-Ins

This is equivalent to a diff from 55f9f7b5 to 6ebb742a

2019-06-05
19:39
Fix bug [9ebc6fd168]: Aqua can report incorrect mouse coordinates. check-in: abfc728e user: culler tags: core-8-6-branch
07:23
Use single-argument "expr" as much as possible. Not complete yet, but most trivial places are done. check-in: f7ecfdcb user: jan.nijtmans tags: core-8-6-branch
2019-06-03
18:59
Fix bug [9ebc6fd168]: Aqua can report incorrect mouse coordinates. Closed-Leaf check-in: 6ebb742a user: culler tags: bug-9ebc6fd168
2019-06-01
18:11
In aqua, add contrasting field backgrounds and focus rings to dark mode ttk::entry widgets. check-in: 56e8b684 user: culler tags: trunk
18:11
In aqua, add contrasting field backgrounds and focus rings to dark mode ttk::entry widgets. check-in: 55f9f7b5 user: culler tags: core-8-6-branch
03:30
Fix bug [817d3ef132]: Aqua ttk::entry needs contrasting field background and focus ring in dark mode. Closed-Leaf check-in: b5497be5 user: culler tags: bug-817d3ef132
2019-05-27
21:13
Merge 8.5 check-in: d7d2f71f user: jan.nijtmans tags: core-8-6-branch

Changes to macosx/tkMacOSXMouseEvent.c.
49
50
51
52
53
54
55

56
57
58
59
60
61
62
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63







+







@implementation TKApplication(TKMouseEvent)
- (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent
{
    NSWindow *eventWindow = [theEvent window];
    NSEventType eventType = [theEvent type];
    TkWindow *winPtr, *grabWinPtr;
    Tk_Window tkwin;
    NSPoint local, global;
#if 0
    NSTrackingArea *trackingArea = nil;
    NSInteger eventNumber, clickCount, buttonNumber;
#endif

#ifdef TK_MAC_DEBUG_EVENTS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
79
80
81
82
83
84
85
86
87
88
89
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
131
132
133
134

135
136

137

138
139
140
141
142
143
144
145
146
147
148
80
81
82
83
84
85
86
87












88

89
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

131
132
133
134

135




136
137
138
139
140
141
142








-
-
-
-
-
-
-
-
-
-
-
-

-
+
+


+
-
-
+
+
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
-



+

-
-
+


+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-



-
+


+
-
+
-
-
-
-







    case NSTabletProximity:
    case NSScrollWheel:
	break;
    default: /* Unrecognized mouse event. */
	return theEvent;
    }

    /*
     * Remember the window in case we need it next time.
     */

    if (eventWindow && eventWindow != _windowWithMouse) {
	if (_windowWithMouse) {
	    [_windowWithMouse release];
	}
	_windowWithMouse = eventWindow;
	[_windowWithMouse retain];
    }

    /*
     * Compute the mouse position in Tk screen coordinates (global) and in the
     * Tk coordinates of its containing Tk Window.
     * Tk coordinates of its containing Tk Window (local). If a grab is in effect,
     * the local coordinates should be relative to the grab window.
     */

    if (eventWindow) {
    NSPoint global, local = [theEvent locationInWindow];

	local = [theEvent locationInWindow];
	global = [eventWindow tkConvertPointToScreen: local];
    /*
     * If the event has no NSWindow, try using the cached NSWindow from the
	tkwin = TkMacOSXGetCapture();
	if (tkwin) {
	    winPtr = (TkWindow *) tkwin;
     * last mouse event.
     */

    if (eventWindow == NULL) {
	eventWindow = _windowWithMouse;
    }
	    eventWindow = TkMacOSXDrawableWindow(winPtr->window);
	    if (eventWindow) {
		local = [eventWindow tkConvertPointFromScreen: global];
	    } else {
		return theEvent;
	    }
    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.
	 * If the event has no NSWindow, the location is in screen coordinates.
	 */

	global = [theEvent locationInWindow];
	tkwin = TkMacOSXGetCapture();
	if (tkwin) {
	    winPtr = (TkWindow *) tkwin;
	    eventWindow = TkMacOSXDrawableWindow(winPtr->window);
	} else {
	    eventWindow = [NSApp mainWindow];
	}
	if (!eventWindow) {
	    return theEvent;
	}
	local = [eventWindow tkConvertPointFromScreen: global];
	local.y = [eventWindow frame].size.height - local.y;
	local.y = tkMacOSXZeroScreenHeight - local.y;
	global.y = tkMacOSXZeroScreenHeight - global.y;
	global = local;
    }

    /*
     * Find the toplevel which corresponds to the event NSWindow.
     * Make sure tkwin is the toplevel which should receive the event.
     */

    if (!tkwin) {
    winPtr = TkMacOSXGetTkWindow(eventWindow);
	winPtr = TkMacOSXGetTkWindow(eventWindow);
    if (winPtr == NULL) {
	tkwin = TkMacOSXGetCapture();
	winPtr = (TkWindow *) tkwin;
    } else {
	tkwin = (Tk_Window) winPtr;
    }
    if (!tkwin) {
#ifdef TK_MAC_DEBUG_EVENTS
	TkMacOSXDbgMsg("tkwin == NULL");
#endif
	return theEvent;	/* Give up.  No window for this event. */
Changes to macosx/tkMacOSXPrivate.h.
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
259
260
261
262
263
264
265

266
267
268
269
270
271
272







-







@interface TKApplication : NSApplication {
@private
    Tcl_Interp *_eventInterp;
    NSMenu *_servicesMenu;
    TKMenu *_defaultMainMenu, *_defaultApplicationMenu;
    NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems;
    NSArray *_defaultHelpMenuItems;
    NSWindow *_windowWithMouse;
    NSAutoreleasePool *_mainPool;
#ifdef __i386__
    /* The Objective C runtime used on i386 requires this. */
    int _poolLock;
    int _macMinorVersion;
    Bool _isDrawing;
#endif
Changes to macosx/tkMacOSXWindowEvent.c.
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
194
195
196
197
198
199
200




201
202
203
204
205
206
207







-
-
-
-







#ifdef TK_MAC_DEBUG_NOTIFICATIONS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, w);
#endif
    TkWindow *winPtr = TkMacOSXGetTkWindow(w);

    if (winPtr) {
	TkGenWMDestroyEvent((Tk_Window) winPtr);
	if (_windowWithMouse == w) {
	    _windowWithMouse = nil;
	    [w release];
	}
    }

    /*
     * If necessary, TkGenWMDestroyEvent() handles [close]ing the window, so
     * can always return NO from -windowShouldClose: for a Tk window.
     */

Changes to macosx/tkMacOSXWm.c.
336
337
338
339
340
341
342
343

344
345
346
347
348
349
350
351

352
353
354
355
356
357
358
359
360
361
336
337
338
339
340
341
342

343



344
345
346
347

348



349
350
351
352
353
354
355







-
+
-
-
-




-
+
-
-
-







- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    return [self convertScreenToBase:point];
}
#else
- (NSPoint) tkConvertPointToScreen: (NSPoint) point
{
    NSRect pointrect;
    NSRect pointrect = {point, {0,0}};
    pointrect.origin = point;
    pointrect.size.width = 0;
    pointrect.size.height = 0;
    return [self convertRectToScreen:pointrect].origin;
}
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    NSRect pointrect;
    NSRect pointrect = {point, {0,0}};
    pointrect.origin = point;
    pointrect.size.width = 0;
    pointrect.size.height = 0;
    return [self convertRectFromScreen:pointrect].origin;
}
#endif

@end

#pragma mark -