Tk Source Code

Check-in [78a3bdc4]
Login
Bounty program for improvements to Tcl and certain Tcl packages.

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 | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 78a3bdc4454f57b635a7c4a6edcaabbab85078e9931e91c0e6835aa329d856c7
User & Date: culler 2019-05-20 21:23:53
Original Comment: Make XUnmapWindow also redraw the toplevel. Edit a comment in tkTest.c.
Context
2019-05-24
21:18
Improve image testing for Aqua check-in: d326a1b3 user: culler tags: core-8-6-branch
12:55
Fix bug [67384bce7d]: make winfo-13.2 expect the container to be destroyed in aqua and unix. Also disable unixEmbed-7.1a in aqua since TkpRedirectKeyEvent is not implemented. Closed-Leaf check-in: eb06c63e user: culler tags: bug-67384bce7d
2019-05-21
14:47
Rework image testing to better deal with Aqua check-in: d8b251e8 user: culler tags: aqua_image_tests
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-18
15:44
Fix [eb29967e88]: Add horizontal scrolling support for Windows. Patch from Christopher Chavez. check-in: d1b3d2ac user: fvogel tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkTest.c.

1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570

1571
1572
1573
1574
1575
1576
1577
    int width, int height,	/* Dimensions of area to redraw. */
    int drawableX, int drawableY)
				/* Coordinates in drawable corresponding to
				 * imageX and imageY. */
{
    TImageInstance *instPtr = (TImageInstance *) 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);






|











|
|
|
|
>







1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
    int width, int height,	/* Dimensions of area to redraw. */
    int drawableX, int drawableY)
				/* Coordinates in drawable corresponding to
				 * imageX and imageY. */
{
    TImageInstance *instPtr = (TImageInstance *) 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 --
 *