Tk Source Code

Check-in [b7d0a5b9]
Login
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA

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

Overview
Comment:Remove duplicate calls to reset the cgimage backing layer.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | cgimage_with_crossing
Files: files | file ages | folders
SHA3-256: b7d0a5b932e578744e868ae510923a153fa351e803b0bd55d0e858d9021d5e87
User & Date: culler 2024-06-19 21:29:24
Context
2024-06-22
02:29
Make setFrameSize a tiny bit more efficient. check-in: b78b2657 user: culler tags: cgimage_with_crossing
2024-06-19
21:29
Remove duplicate calls to reset the cgimage backing layer. check-in: b7d0a5b9 user: culler tags: cgimage_with_crossing
18:27
A little more clean-up. check-in: a8794c73 user: culler tags: cgimage_with_crossing
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to macosx/tkMacOSXWindowEvent.c.

1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071




1072
1073
1074
1075
1076
1077
1078
    _tkNeedsDisplay = NO;
    _tkDirtyRect = NSZeroRect;
}

-(void) setFrameSize: (NSSize)newsize
{
    [super setFrameSize: newsize];
    [self resetTkLayerBitmapContext];
    NSWindow *w = [self window];
    TkWindow *winPtr = TkMacOSXGetTkWindow(w);
    Tk_Window tkwin = (Tk_Window)winPtr;

    if (winPtr) {
	unsigned int width = (unsigned int)newsize.width;
	unsigned int height=(unsigned int)newsize.height;
	void *oldArg;
    	Tk_RestrictProc *oldProc;

	/*
	 * This can be called from outside the Tk event loop.  Since it calls
	 * Tcl_DoOneEvent, we need to make sure we don't clobber the
	 * AutoreleasePool set up by the caller.
	 */

	[NSApp _lockAutoreleasePool];

	/*
	 * Disable Tk drawing until the window has been completely configured.
	 */

	//TkMacOSXSetDrawingEnabled(winPtr, 0);

	 /*
	  * Generate and handle a ConfigureNotify event for the new size.
	  */

	TkGenWMConfigureEvent(tkwin, Tk_X(tkwin), Tk_Y(tkwin), width, height,
		TK_SIZE_CHANGED | TK_MACOSX_HANDLE_EVENT_IMMEDIATELY);
    	oldProc = Tk_RestrictEvents(ConfigureRestrictProc, NULL, &oldArg);
	while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
    	Tk_RestrictEvents(oldProc, oldArg, &oldArg);






	if ([w respondsToSelector: @selector (tkLayoutChanged)]) {
	    [(TKWindow *)w tkLayoutChanged];
	}

	/*
	 * Reset the cgimage layer and redraw the entire content view.
	 */







<











<
|
|




<
<
<
<
<
<











>
>
>
>







1029
1030
1031
1032
1033
1034
1035

1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046

1047
1048
1049
1050
1051
1052






1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
    _tkNeedsDisplay = NO;
    _tkDirtyRect = NSZeroRect;
}

-(void) setFrameSize: (NSSize)newsize
{
    [super setFrameSize: newsize];

    NSWindow *w = [self window];
    TkWindow *winPtr = TkMacOSXGetTkWindow(w);
    Tk_Window tkwin = (Tk_Window)winPtr;

    if (winPtr) {
	unsigned int width = (unsigned int)newsize.width;
	unsigned int height=(unsigned int)newsize.height;
	void *oldArg;
    	Tk_RestrictProc *oldProc;

	/*

	 * This function can be re-entered.  So we need to make sure we don't
	 * clobber any AutoreleasePool set up by the caller.
	 */

	[NSApp _lockAutoreleasePool];







	 /*
	  * Generate and handle a ConfigureNotify event for the new size.
	  */

	TkGenWMConfigureEvent(tkwin, Tk_X(tkwin), Tk_Y(tkwin), width, height,
		TK_SIZE_CHANGED | TK_MACOSX_HANDLE_EVENT_IMMEDIATELY);
    	oldProc = Tk_RestrictEvents(ConfigureRestrictProc, NULL, &oldArg);
	while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
    	Tk_RestrictEvents(oldProc, oldArg, &oldArg);


	/*
	 * Update Tk's window data for the new size.
	 */
	
	if ([w respondsToSelector: @selector (tkLayoutChanged)]) {
	    [(TKWindow *)w tkLayoutChanged];
	}

	/*
	 * Reset the cgimage layer and redraw the entire content view.
	 */
1091
1092
1093
1094
1095
1096
1097


1098


1099
1100
1101
1102
1103
1104
1105
	/*
	 * Finally, unlock the main autoreleasePool.
	 */

	[NSApp _unlockAutoreleasePool];

    }


    // Schedule a redisplay of the view


    [self setNeedsDisplay:YES];

}

/*
 * Core method of this class: generates expose events for redrawing.  The
 * expose events are immediately removed from the Tcl event loop and processed.







>
>
|
>
>







1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
	/*
	 * Finally, unlock the main autoreleasePool.
	 */

	[NSApp _unlockAutoreleasePool];

    }

    /*
     * Schedule a redisplay of the view.
     */

    [self setNeedsDisplay:YES];

}

/*
 * Core method of this class: generates expose events for redrawing.  The
 * expose events are immediately removed from the Tcl event loop and processed.