Tk Source Code

Check-in [bec7565d]
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:In Aqua, make XUnmapWindow also redraw the toplevel. Edit a comment in tkTest.c
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bec7565d00b993ea473aed85082d7468456d1cbb94d9e802d92c3b842017e2f9
User & Date: culler 2019-05-20 21:26:09
Context
2019-05-24
22:06
Improve image testing for Aqua check-in: e49ebc82 user: culler tags: trunk
2019-05-22
20:19
TIP545: remove image photo svg option "-unit" check-in: 389f9b0b user: oehhar tags: tip-545-svg-options
2019-05-20
21:26
In Aqua, make XUnmapWindow also redraw the toplevel. Edit a comment in tkTest.c check-in: bec7565d user: culler tags: trunk
21:23
In Aqua, make XUnmapWindow also redraw the toplevel. Edit a comment in tkTest.c. check-in: 78a3bdc4 user: culler tags: core-8-6-branch
2019-05-19
08:17
General cleanup of frame.test check-in: 5b36e643 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkTest.c.

1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580

1581
1582
1583
1584
1585
1586
1587
    int width, int height,	/* Dimensions of area to redraw. */
    int drawableX, int drawableY)
				/* Coordinates in drawable corresponding to
				 * imageX and imageY. */
{
    TImageInstance *instPtr = clientData;
    char buffer[200 + TCL_INTEGER_SPACE * 6];

    /*
     * The purpose of the test image type is to track the calls to an image
     * display proc and record the parameters passed in each call.  On macOS
     * these tests will fail because of the asynchronous drawing.  The low
     * 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);






|











|
|
|
|
>







1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
    int width, int height,	/* Dimensions of area to redraw. */
    int drawableX, int drawableY)
				/* Coordinates in drawable corresponding to
				 * imageX and imageY. */
{
    TImageInstance *instPtr = clientData;
    char buffer[200 + TCL_INTEGER_SPACE * 6];
    
    /*
     * The purpose of the test image type is to track the calls to an image
     * display proc and record the parameters passed in each call.  On macOS
     * these tests will fail because of the asynchronous drawing.  The low
     * 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 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 --
 *