Check-in [14416fb071]
Not logged in

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

Overview
Comment:add tk upstream changes
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 14416fb0711634191d7894aa276630ca2a700840
User & Date: chw 2019-06-07 04:36:33
Context
2019-06-07
08:22
update tkdnd to version 2.9.2 check-in: fc16faf3b2 user: chw tags: trunk
04:37
merge with trunk check-in: 5a8008f56a user: chw tags: wtf-8-experiment
04:36
add tk upstream changes check-in: 14416fb071 user: chw tags: trunk
2019-06-05
17:27
more tk upstream changes check-in: 18f25efcd8 user: chw tags: trunk
Changes

Changes to jni/sdl2tk/macosx/tkMacOSXMouseEvent.c.

49
50
51
52
53
54
55

56
57
58
59
60
61
62
..
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
@implementation TKApplication(TKMouseEvent)
- (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent
{
    NSWindow *eventWindow = [theEvent window];
    NSEventType eventType = [theEvent type];
    TkWindow *winPtr, *grabWinPtr;
    Tk_Window tkwin;

#if 0
    NSTrackingArea *trackingArea = nil;
    NSInteger eventNumber, clickCount, buttonNumber;
#endif

#ifdef TK_MAC_DEBUG_EVENTS
    TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent);
................................................................................
    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.

     */


    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;
    }

    /*
     * Find the toplevel which corresponds to the event NSWindow.
     */


    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. */







>







 








<
<
<
<
<
<
<
<
<
<
<
<

|
>


>
|
<
<
<
<
<
<
>
>
>
>
>
|
<
>
>
>
|
<
<
<
<
<
<
|
<



>

<
|


>
>
>
>
>
>
>
>
>
>
>
>
>
|
<



|


>
|
<
<
<
<







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
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
@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);
................................................................................
    case NSTabletProximity:
    case NSScrollWheel:
	break;
    default: /* Unrecognized mouse event. */
	return theEvent;
    }

    /*












     * Compute the mouse position in Tk screen coordinates (global) and in the
     * 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) {
	local = [theEvent locationInWindow];






	global = [eventWindow tkConvertPointToScreen: local];
	tkwin = TkMacOSXGetCapture();
	if (tkwin) {
	    winPtr = (TkWindow *) tkwin;
	    eventWindow = TkMacOSXDrawableWindow(winPtr->window);
	    if (eventWindow) {

		local = [eventWindow tkConvertPointFromScreen: global];
	    } else {
		return theEvent;
	    }






	}

	local.y = [eventWindow frame].size.height - local.y;
	global.y = tkMacOSXZeroScreenHeight - global.y;
    } else {

	/*

	 * 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;
	global.y = tkMacOSXZeroScreenHeight - global.y;

    }

    /*
     * Make sure tkwin is the toplevel which should receive the event.
     */

    if (!tkwin) {
	winPtr = TkMacOSXGetTkWindow(eventWindow);




	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 jni/sdl2tk/macosx/tkMacOSXPrivate.h.

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
@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







<







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;

    NSAutoreleasePool *_mainPool;
#ifdef __i386__
    /* The Objective C runtime used on i386 requires this. */
    int _poolLock;
    int _macMinorVersion;
    Bool _isDrawing;
#endif

Changes to jni/sdl2tk/macosx/tkMacOSXWindowEvent.c.

194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#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.
     */








<
<
<
<







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 necessary, TkGenWMDestroyEvent() handles [close]ing the window, so
     * can always return NO from -windowShouldClose: for a Tk window.
     */

Changes to jni/sdl2tk/macosx/tkMacOSXWm.c.

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
362
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    return [self convertScreenToBase:point];
}
#else
- (NSPoint) tkConvertPointToScreen: (NSPoint) point
{
    NSRect pointrect;
    pointrect.origin = point;
    pointrect.size.width = 0;
    pointrect.size.height = 0;
    return [self convertRectToScreen:pointrect].origin;
}
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    NSRect pointrect;
    pointrect.origin = point;
    pointrect.size.width = 0;
    pointrect.size.height = 0;
    return [self convertRectFromScreen:pointrect].origin;
}
#endif

@end

#pragma mark -







|
<
<
<




|
<
<
<







337
338
339
340
341
342
343
344



345
346
347
348
349



350
351
352
353
354
355
356
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    return [self convertScreenToBase:point];
}
#else
- (NSPoint) tkConvertPointToScreen: (NSPoint) point
{
    NSRect pointrect = {point, {0,0}};



    return [self convertRectToScreen:pointrect].origin;
}
- (NSPoint) tkConvertPointFromScreen: (NSPoint)point
{
    NSRect pointrect = {point, {0,0}};



    return [self convertRectFromScreen:pointrect].origin;
}
#endif

@end

#pragma mark -