Check-in [71e9d472c8]
Not logged in

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

Overview
Comment:merge with trunk
Timelines: family | ancestors | descendants | both | wtf-8-experiment
Files: files | file ages | folders
SHA1: 71e9d472c8921dd14822a2863829da8e57b6cd24
User & Date: chw 2019-05-21 05:03:08
Context
2019-05-22
05:13
merge with trunk check-in: c90839e680 user: chw tags: wtf-8-experiment
2019-05-21
05:03
merge with trunk check-in: 71e9d472c8 user: chw tags: wtf-8-experiment
04:54
add tk upstream changes check-in: 789cb8b5d8 user: chw tags: trunk
2019-05-19
05:37
merge with trunk check-in: ec9ba40b00 user: chw tags: wtf-8-experiment
Changes

Changes to jni/sdl2tk/generic/tkTest.c.

1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573

1574
1575
1576
1577
1578
1579
1580
     * level graphics calls below which are supposed to draw a rectangle will
     * not draw anything to the screen because the idle task will not be
     * processed inside of the drawRect method and hence will not be able to
     * obtain a valid graphics context. Instead, the window will be marked as
     * needing display, and will be redrawn during a future asynchronous call
     * to drawRect.  This will generate an other call to this display proc,
     * and the recorded data will show extra calls, causing the test to fail.
     * To avoid this, we can set the [NSApp simulateDrawing] flag, which will
     * cause all low level drawing routines to return immediately and not
     * schedule the window for drawing later.  This flag is cleared by the
     * next call to XSync, which is called by the update command.

     */

    sprintf(buffer, "%s display %d %d %d %d",
	    instPtr->masterPtr->imageName, imageX, imageY, width, height);
    if (!APP_IS_DRAWING) {
	Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
	    NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);







|
|
|
|
>







1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
     * level graphics calls below which are supposed to draw a rectangle will
     * not draw anything to the screen because the idle task will not be
     * processed inside of the drawRect method and hence will not be able to
     * obtain a valid graphics context. Instead, the window will be marked as
     * needing display, and will be redrawn during a future asynchronous call
     * to drawRect.  This will generate an other call to this display proc,
     * and the recorded data will show extra calls, causing the test to fail.
     * To avoid this, we only log the call when the call occurs outside of the
     * drawRect method.  We expect this to happen the first time the display
     * proc is called and the second time, when the actual drawing occurs nothing
     * will be logged.  (In fact, this second call may be after the test has
     * finished.)
     */

    sprintf(buffer, "%s display %d %d %d %d",
	    instPtr->masterPtr->imageName, imageX, imageY, width, height);
    if (!APP_IS_DRAWING) {
	Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
	    NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);

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

205
206
207
208
209
210
211


212
213
214
215
216
217
218
219
220
221
222
223
...
282
283
284
285
286
287
288

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
...
310
311
312
313
314
315
316
317

318
319
320
321
322
323
324
325
326
327
328





329
330
331
332
333
334
335

	/*
	 * For non-toplevel windows, rebuild the parent's clipping region
	 * and redisplay the window.
	 */

	TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr);


	if ([NSApp isDrawing]) {
	    [[win contentView] setNeedsRedisplay:YES];
	} else {
	    [[win contentView] setNeedsDisplay:YES];
	}
    }

    /*
     * Generate VisibilityNotify events for window and all mapped children.
     */

    event.xany.send_event = False;
................................................................................
XUnmapWindow(
    Display *display,		/* Display. */
    Window window)		/* Window. */
{
    MacDrawable *macWin = (MacDrawable *) window;
    TkWindow *winPtr = macWin->winPtr;
    TkWindow *parentPtr = winPtr->parentPtr;

    XEvent event;

    display->request++;
    if (Tk_IsTopLevel(winPtr)) {
	if (!Tk_IsEmbedded(winPtr) &&
		winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
	    NSWindow *win = TkMacOSXDrawableWindow(window);

	    [win orderOut:nil];
	}
	TkMacOSXInvalClipRgns((Tk_Window) winPtr);

	/*
	 * We only need to send the UnmapNotify event for toplevel windows.
	 */
................................................................................
	event.xunmap.window = window;
	event.xunmap.event = window;
	event.xunmap.from_configure = false;
	Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
    } else {
	/*
	 * Rebuild the visRgn clip region for the parent so it will be allowed
	 * to draw in the space from which this subwindow was removed.

	 */

	if (parentPtr && parentPtr->privatePtr->visRgn) {
	    TkMacOSXInvalidateViewRegion(
		    TkMacOSXDrawableView(parentPtr->privatePtr),
		    parentPtr->privatePtr->visRgn);
	}
	TkMacOSXInvalClipRgns((Tk_Window) parentPtr);
	TkMacOSXUpdateClipRgn(parentPtr);
    }
    winPtr->flags &= ~TK_MAPPED;





}
 
/*
 *----------------------------------------------------------------------
 *
 * XResizeWindow --
 *







>
>
|
|
|
|
<







 







>






<
<







 







|
>











>
>
>
>
>







205
206
207
208
209
210
211
212
213
214
215
216
217

218
219
220
221
222
223
224
...
283
284
285
286
287
288
289
290
291
292
293
294
295
296


297
298
299
300
301
302
303
...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341

	/*
	 * For non-toplevel windows, rebuild the parent's clipping region
	 * and redisplay the window.
	 */

	TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr);
    }

    if ([NSApp isDrawing]) {
	[[win contentView] setNeedsRedisplay:YES];
    } else {
	[[win contentView] setNeedsDisplay:YES];

    }

    /*
     * Generate VisibilityNotify events for window and all mapped children.
     */

    event.xany.send_event = False;
................................................................................
XUnmapWindow(
    Display *display,		/* Display. */
    Window window)		/* Window. */
{
    MacDrawable *macWin = (MacDrawable *) window;
    TkWindow *winPtr = macWin->winPtr;
    TkWindow *parentPtr = winPtr->parentPtr;
    NSWindow *win = TkMacOSXDrawableWindow(window);
    XEvent event;

    display->request++;
    if (Tk_IsTopLevel(winPtr)) {
	if (!Tk_IsEmbedded(winPtr) &&
		winPtr->wmInfoPtr->hints.initial_state!=IconicState) {


	    [win orderOut:nil];
	}
	TkMacOSXInvalClipRgns((Tk_Window) winPtr);

	/*
	 * We only need to send the UnmapNotify event for toplevel windows.
	 */
................................................................................
	event.xunmap.window = window;
	event.xunmap.event = window;
	event.xunmap.from_configure = false;
	Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
    } else {
	/*
	 * Rebuild the visRgn clip region for the parent so it will be allowed
	 * to draw in the space from which this subwindow was removed and then
	 * redraw the window.
	 */

	if (parentPtr && parentPtr->privatePtr->visRgn) {
	    TkMacOSXInvalidateViewRegion(
		    TkMacOSXDrawableView(parentPtr->privatePtr),
		    parentPtr->privatePtr->visRgn);
	}
	TkMacOSXInvalClipRgns((Tk_Window) parentPtr);
	TkMacOSXUpdateClipRgn(parentPtr);
    }
    winPtr->flags &= ~TK_MAPPED;
    if ([NSApp isDrawing]) {
	[[win contentView] setNeedsRedisplay:YES];
    } else {
	[[win contentView] setNeedsDisplay:YES];
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * XResizeWindow --
 *

Changes to jni/sdl2tk/sdl/SdlTkInt.c.

3366
3367
3368
3369
3370
3371
3372












































































3373
3374
3375
3376
3377
3378
3379
....
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412

3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
....
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544




3545
3546
3547
3548
3549
3550
3551
    prev->next = _w;
    _w->next = sibling;
}

/*
 *----------------------------------------------------------------------
 *












































































 * SdlTkRestackWindow --
 *
 *	Put a window above or below a sibling. This is the main
 *	window-restacking function.
 *
 * Results:
 *
................................................................................
	return;
    }

    for (child = parent->child; child != _w; child = child->next) {
	oldPos++;
    }

    if (sibling == NULL && stack_mode == Above && !_w->topmost) {
	/* Special handling for non-topmost windows. */
	int lastPos[2] = { -1, -1};

	for (child = parent->child; child != NULL; child = child->next) {
	     lastPos[0]++;
	     if (child->topmost) {
		lastPos[1] = lastPos[0];
	     }
	}
	if (lastPos[1] >= 0) {

	    stack_mode = Below;
	    lastPos[0] = 0;
	    for (sibling = parent->child; sibling != NULL;
		    sibling = sibling->next) {
		if (lastPos[0] >= lastPos[1]) {
		    break;
		}
		lastPos[0]++;
	    }
	}
    }

    SdlTkRemoveFromParent(_w);

    if (sibling == NULL) {
	switch (stack_mode) {
................................................................................
    _Window *sibling, *master;

    _w = SdlTkToplevelForWindow(_w, NULL, NULL);
    if (_w == NULL) {
	return;
    }

    sibling = _w->parent->child;
    while ((sibling != _w) &&
	(SdlTkIsTransientOf(sibling, _w) ||
	 (!_w->topmost &&
	  (sibling->topmost || (sibling->child && sibling->child->topmost)
	 )))) {




	sibling = sibling->next;
    }

    if (sibling != _w) {
	SdlTkRestackWindow(_w, sibling, Above);
	SdlTkRestackTransients(_w);
    }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







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

<
<
<
<
<
<
<
<







 







|
|
|
|
|
|
>
>
>
>







3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
....
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480



3481




3482
3483








3484
3485
3486
3487
3488
3489
3490
....
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
    prev->next = _w;
    _w->next = sibling;
}

/*
 *----------------------------------------------------------------------
 *
 * SdlTkIsTopmost --
 *
 *	Return true if _Window is topmost or transient of topmost.
 *
 *----------------------------------------------------------------------
 */

static int
SdlTkIsTopmost(_Window *_w)
{
    _Window *master;
    int count;

    if (_w->topmost) {
	return 1;
    }
    count = 0;
    master = SdlTkWrapperForWindow(_w);
    while (master != NULL) {
	master = master->master;
	if (master == NULL) {
	    break;
	}
	if (master->topmost) {
	    count++;
	}
	master = SdlTkWrapperForWindow(master);
    }
    return count;
}

/*
 *----------------------------------------------------------------------
 *
 * SdlTkBottomTopmost --
 *
 *	Return bottom _Window with topmost flag set or NULL.
 *
 *----------------------------------------------------------------------
 */

_Window *
SdlTkBottomTopmost(_Window *parent, _Window *sibling)
{
    _Window *child;
    int count, last, pos;

    last = pos = -1;
    count = 0;
    for (child = parent->child; child != NULL; child = child->next) {
	if (child->topmost) {
	    last = count;
	}
	if (child == sibling) {
	    pos = count;
	}
	count++;
    }
    if (last >= 0) {
	count = 0;
	for (child = parent->child; child != NULL; child = child->next) {
	    if (count >= last) {
		break;
	    }
	    count++;
	}
    }
    if ((last >= 0) && (pos > last)) {
	return sibling;
    }
    return child;
}

/*
 *----------------------------------------------------------------------
 *
 * SdlTkRestackWindow --
 *
 *	Put a window above or below a sibling. This is the main
 *	window-restacking function.
 *
 * Results:
 *
................................................................................
	return;
    }

    for (child = parent->child; child != _w; child = child->next) {
	oldPos++;
    }

    if ((stack_mode == Above) &&
	    !SdlTkIsTopmost(_w) && !_w->atts.override_redirect) {
	child = SdlTkBottomTopmost(parent, sibling);



	if (child != NULL) {




	    sibling = child;
	    stack_mode = Below;








	}
    }

    SdlTkRemoveFromParent(_w);

    if (sibling == NULL) {
	switch (stack_mode) {
................................................................................
    _Window *sibling, *master;

    _w = SdlTkToplevelForWindow(_w, NULL, NULL);
    if (_w == NULL) {
	return;
    }

    if (SdlTkIsTopmost(_w)) {
	sibling = _w->parent->child;
    } else {
	sibling = SdlTkBottomTopmost(_w->parent, NULL);
	if (sibling == NULL) {
	    sibling = _w->parent->child;
	}
    }

    while ((sibling != _w) && SdlTkIsTransientOf(sibling, _w)) {
	sibling = sibling->next;
    }

    if (sibling != _w) {
	SdlTkRestackWindow(_w, sibling, Above);
	SdlTkRestackTransients(_w);
    }

Changes to jni/sdl2tk/sdl/SdlTkInt.h.

300
301
302
303
304
305
306

307
308
309
310
311
312
313
extern _Window *SdlTkWrapperForWindow(_Window *_w);
extern _Window *SdlTkTopVisibleWrapper(void);
extern SDL_Surface *SdlTkGetDrawableSurface(Drawable d, int *x, int *y,
    int *format);
extern _Window *SdlTkPointToWindow(_Window *_w, int x, int y,
    Bool mapped, Bool depth);
extern void SdlTkRemoveFromParent(_Window *_w);

extern void SdlTkRestackWindow(_Window *_w, _Window *sibling, int stack_mode);
extern void SdlTkRestackTransients(_Window *_w);
extern void SdlTkBringToFrontIfNeeded(_Window *_w);
extern int SdlTkIsTransientOf(_Window *_w, _Window *other);
extern void SdlTkCalculateVisibleRegion(_Window *_w);
extern Region SdlTkGetVisibleRegion(_Window *_w);
#define VRC_DO_PARENT 0x0001







>







300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
extern _Window *SdlTkWrapperForWindow(_Window *_w);
extern _Window *SdlTkTopVisibleWrapper(void);
extern SDL_Surface *SdlTkGetDrawableSurface(Drawable d, int *x, int *y,
    int *format);
extern _Window *SdlTkPointToWindow(_Window *_w, int x, int y,
    Bool mapped, Bool depth);
extern void SdlTkRemoveFromParent(_Window *_w);
extern _Window *SdlTkBottomTopmost(_Window *parent, _Window *sibling);
extern void SdlTkRestackWindow(_Window *_w, _Window *sibling, int stack_mode);
extern void SdlTkRestackTransients(_Window *_w);
extern void SdlTkBringToFrontIfNeeded(_Window *_w);
extern int SdlTkIsTransientOf(_Window *_w, _Window *other);
extern void SdlTkCalculateVisibleRegion(_Window *_w);
extern Region SdlTkGetVisibleRegion(_Window *_w);
#define VRC_DO_PARENT 0x0001

Changes to jni/sdl2tk/sdl/SdlTkX.c.

1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
....
1382
1383
1384
1385
1386
1387
1388


1389









1390
1391
1392
1393
1394
1395
1396
....
7804
7805
7806
7807
7808
7809
7810








7811
7812
7813
7814
7815
7816
7817

    _w->visRgn = SdlTkRgnPoolGet();
    _w->visRgnInParent = SdlTkRgnPoolGet();
    _w->dirtyRgn = SdlTkRgnPoolGet();

    _w->clazz = (clazz == InputOnly) ? InputOnly : InputOutput;

    /* Make first child of parent except for topmost children. */
    if (IS_ROOT(_parent)) {
	_Window *prev = NULL, *next = _parent->child;

	while (next != NULL) {
	    if (!next->topmost) {
		break;
	    }
	    prev = next;
	    next = next->next;
	}
	if (prev != NULL) {
	    _w->next = prev->next;
	    prev->next = _w;
	} else {
	    _w->next = _parent->child;
	    _parent->child = _w;
	}
    } else {
	_w->next = _parent->child;
	_parent->child = _w;
................................................................................

    SdlTkLock(display);
    display->request++;
    if (_w->display == NULL) {
	goto done;
    }
    if (property == XA_WM_TRANSIENT_FOR) {


	_w->master = NULL;









	goto done;
    }
    if (!prop_initialized) {
	Tcl_InitHashTable(&prop_table,
			  sizeof (struct prop_key) / sizeof (int));
	prop_initialized = 1;
    }
................................................................................
			       RevertToParent, CurrentTime);
	    /* Frames need redrawing if the focus changed. */
	    SdlTkScreenChanged();
	}
    }
    if ((_w->master != NULL) && (_w->master != oldMaster)) {
	SdlTkRestackTransients(_w->master);








    }

    SdlTkUnlock(display);
done:
    return ret;
}








|
|
|
|
|
|
|
|
|
|
|
|
|
<







 







>
>

>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>







1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319

1320
1321
1322
1323
1324
1325
1326
....
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
....
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835

    _w->visRgn = SdlTkRgnPoolGet();
    _w->visRgnInParent = SdlTkRgnPoolGet();
    _w->dirtyRgn = SdlTkRgnPoolGet();

    _w->clazz = (clazz == InputOnly) ? InputOnly : InputOutput;

    /*
     * Make first child of parent except for topmost children
     * in which case the new window is inserted after the last
     * topmost child.
     */
    if (IS_ROOT(_parent) && !_w->topmost &&
	!_w->atts.override_redirect && (_w->master == NULL)) {
	_Window *_child;

	_child = SdlTkBottomTopmost(_parent, NULL);
	if (_child != NULL) {
	    _w->next = _child->next;
	    _child->next = _w;

	} else {
	    _w->next = _parent->child;
	    _parent->child = _w;
	}
    } else {
	_w->next = _parent->child;
	_parent->child = _w;
................................................................................

    SdlTkLock(display);
    display->request++;
    if (_w->display == NULL) {
	goto done;
    }
    if (property == XA_WM_TRANSIENT_FOR) {
	_Window *oldMaster = _w->master;

	_w->master = NULL;
	if (oldMaster != NULL) {
	    if (_w->parent != NULL && _w->parent->dec != NULL) {
		if (!_w->parent->topmost && oldMaster->topmost) {
		    SdlTkRestackWindow(_w->parent, NULL, Above);
		}
	    } else if (!_w->topmost && oldMaster->topmost) {
		SdlTkRestackWindow(_w, NULL, Above);
	    }
	}
	goto done;
    }
    if (!prop_initialized) {
	Tcl_InitHashTable(&prop_table,
			  sizeof (struct prop_key) / sizeof (int));
	prop_initialized = 1;
    }
................................................................................
			       RevertToParent, CurrentTime);
	    /* Frames need redrawing if the focus changed. */
	    SdlTkScreenChanged();
	}
    }
    if ((_w->master != NULL) && (_w->master != oldMaster)) {
	SdlTkRestackTransients(_w->master);
    } else if ((_w->master == NULL) && (oldMaster != NULL)) {
	if (_w->parent != NULL && _w->parent->dec != NULL) {
	    if (!_w->parent->topmost && oldMaster->topmost) {
		SdlTkRestackWindow(_w->parent, NULL, Above);
	    }
	} else if (!_w->topmost && oldMaster->topmost) {
	    SdlTkRestackWindow(_w, NULL, Above);
	}
    }

    SdlTkUnlock(display);
done:
    return ret;
}