Check-in [7c76bac0d4]
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:7c76bac0d45fbb48b4ab082f157ac6e35e8f666a
User & Date: chw 2019-04-13 06:51:27
Context
2019-04-14
04:08
fix jvm detection in tclJBlend (aarch64/arm64) check-in: a018dd4b5a user: chw tags: trunk
2019-04-13
06:53
merge with trunk check-in: a7259ebe61 user: chw tags: wtf-8-experiment
06:51
add tk upstream changes check-in: 7c76bac0d4 user: chw tags: trunk
2019-04-12
21:10
handle auto_path setup proper when info nameofexecutable is empty check-in: 3f0769cc0a user: chw tags: trunk
Changes

Changes to jni/sdl2tk/doc/ttk_frame.n.

54
55
56
57
58
59
60




61
62
63
64
65
66
67
.PP
\fB\-background\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.




.SH "SEE ALSO"
ttk::widget(n), ttk::labelframe(n), frame(n)
.SH "KEYWORDS"
widget, frame, container
'\" Local Variables:
'\" mode: nroff
'\" End:







>
>
>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.PP
\fB\-background\fP \fIcolor\fP
.PP
Some options are only available for specific themes.
.PP
See the \fBttk::style\fP manual page for information on how to configure
ttk styles.
.SH BINDINGS
.PP
When a new \fBttk::frame\fR is created, it has no default event bindings;
\fBttk::frame\fRs are not intended to be interactive.
.SH "SEE ALSO"
ttk::widget(n), ttk::labelframe(n), frame(n)
.SH "KEYWORDS"
widget, frame, container
'\" Local Variables:
'\" mode: nroff
'\" End:

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

253
254
255
256
257
258
259


260
261
262
263
264
265
266
267
268
269
270
271

272
273







274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
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
...
348
349
350
351
352
353
354
355

356
357
358
359
360
361
362
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */



static OSStatus
SetCGColorComponents(
    struct SystemColorMapEntry entry,
    unsigned long pixel,
    CGColorRef *c)
{
    OSStatus err = noErr;
    NSColor *bgColor, *color;
    CGFloat rgba[4] = {0, 0, 0, 1};
    static CGColorSpaceRef deviceRGBSpace = NULL;
    if (!deviceRGBSpace) {
	deviceRGBSpace = CGColorSpaceCreateDeviceRGB();

    }








    switch (entry.type) {
    case HIBrush:
	err = ChkErr(HIThemeBrushCreateCGColor, entry.value, c);
	return err;
    case rgbColor:
	rgba[0] = ((pixel >> 16) & 0xff) / 255.0;
	rgba[1] = ((pixel >>  8) & 0xff) / 255.0;
	rgba[2] = ((pixel      ) & 0xff) / 255.0;
	break;
    case ttkBackground:
	bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:
			   [NSColorSpace deviceRGBColorSpace]];
	[bgColor getComponents: rgba];
	for (int i=0; i<3; i++) {
	    rgba[i] -= entry.value*(8.0/255.0);
	}
	break;
    case semantic:
	switch (entry.value) {
	case 0:
	    color = [[NSColor textColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
	    break;
	case 1:
	    color = [[NSColor selectedTextColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
	    break;
	case 2:
#if MAC_OS_X_VERSION_MIN_REQUIRED > 101000
	    color = [[NSColor labelColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
#else
	    color = [[NSColor textColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
#endif
	    break;
	case 3:
	    color = [[NSColor controlTextColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
	    break;
	case 4:
	    color = [[NSColor disabledControlTextColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
	    break;
	case 5:
	    color = [[NSColor textBackgroundColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
	    break;
	case 6:
	    color = [[NSColor selectedTextBackgroundColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
	    break;
	default:
	    if ([NSApp macMinorVersion] < 10) {
	    color = [[NSColor textColor] colorUsingColorSpace:
			  [NSColorSpace deviceRGBColorSpace]];
	    } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
		color = [[NSColor labelColor] colorUsingColorSpace:
			      [NSColorSpace deviceRGBColorSpace]];
#endif
		break;
	    }
	}
	[color getComponents: rgba];
	break;
    case clearColor:
................................................................................
     */

    case HIText:
    case HIBackground:
    default:
	break;
    }
    *c = CGColorCreate(deviceRGBSpace, rgba );

    return err;
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXInDarkMode --







>
>









<
|
<
>


>
>
>
>
>
>
>











|









|



|




|


|




|



|



|



|




|



|







 







|
>







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270

271

272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
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
342
343
344
345
346
347
348
...
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

static NSColorSpace* deviceRGB = NULL;

static OSStatus
SetCGColorComponents(
    struct SystemColorMapEntry entry,
    unsigned long pixel,
    CGColorRef *c)
{
    OSStatus err = noErr;
    NSColor *bgColor, *color;
    CGFloat rgba[4] = {0, 0, 0, 1};

    if (!deviceRGB) {

	deviceRGB = [NSColorSpace deviceRGBColorSpace];
    }

    /*
     *  This function is called before our autorelease pool is set up,
     *  so it needs its own pool.
     */

    NSAutoreleasePool *pool = [NSAutoreleasePool new];

    switch (entry.type) {
    case HIBrush:
	err = ChkErr(HIThemeBrushCreateCGColor, entry.value, c);
	return err;
    case rgbColor:
	rgba[0] = ((pixel >> 16) & 0xff) / 255.0;
	rgba[1] = ((pixel >>  8) & 0xff) / 255.0;
	rgba[2] = ((pixel      ) & 0xff) / 255.0;
	break;
    case ttkBackground:
	bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace:
			   deviceRGB];
	[bgColor getComponents: rgba];
	for (int i=0; i<3; i++) {
	    rgba[i] -= entry.value*(8.0/255.0);
	}
	break;
    case semantic:
	switch (entry.value) {
	case 0:
	    color = [[NSColor textColor] colorUsingColorSpace:
			  deviceRGB];
	    break;
	case 1:
	    color = [[NSColor selectedTextColor] colorUsingColorSpace:
			  deviceRGB];
	    break;
	case 2:
#if MAC_OS_X_VERSION_MIN_REQUIRED > 101000
	    color = [[NSColor labelColor] colorUsingColorSpace:
			  deviceRGB];
#else
	    color = [[NSColor textColor] colorUsingColorSpace:
			  deviceRGB];
#endif
	    break;
	case 3:
	    color = [[NSColor controlTextColor] colorUsingColorSpace:
			  deviceRGB];
	    break;
	case 4:
	    color = [[NSColor disabledControlTextColor] colorUsingColorSpace:
			  deviceRGB];
	    break;
	case 5:
	    color = [[NSColor textBackgroundColor] colorUsingColorSpace:
			  deviceRGB];
	    break;
	case 6:
	    color = [[NSColor selectedTextBackgroundColor] colorUsingColorSpace:
			  deviceRGB];
	    break;
	default:
	    if ([NSApp macMinorVersion] < 10) {
	    color = [[NSColor textColor] colorUsingColorSpace:
			  deviceRGB];
	    } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
		color = [[NSColor labelColor] colorUsingColorSpace:
			      deviceRGB];
#endif
		break;
	    }
	}
	[color getComponents: rgba];
	break;
    case clearColor:
................................................................................
     */

    case HIText:
    case HIBackground:
    default:
	break;
    }
    *c = CGColorCreate(deviceRGB.CGColorSpace, rgba );
    [pool drain];
    return err;
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkMacOSXInDarkMode --

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

5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
....
5899
5900
5901
5902
5903
5904
5905

5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917



5918
5919
5920
5921
5922
5923
5924
static int
WmWinAppearance(
    Tcl_Interp *interp,		/* Current interpreter. */
    TkWindow *winPtr,		/* Window to be manipulated. */
    int objc,			/* Number of arguments. */
    Tcl_Obj * const objv[])	/* Argument objects. */
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1090
    static const char *const appearanceStrings[] = {
	"aqua", "darkaqua", "auto", NULL
    };
    enum appearances {
	APPEARANCE_AQUA, APPEARANCE_DARKAQUA, APPEARANCE_AUTO
    };
    Tcl_Obj *result = NULL;
................................................................................
    NSAppearanceName appearance;
#else
    NSString *appearance;
#endif
    const char *resultString;
    NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
    if (win) {

	appearance = win.appearance.name;
	if (appearance == nil) {
	    resultString = appearanceStrings[APPEARANCE_AUTO];
	} else if (appearance == NSAppearanceNameAqua) {
	    resultString = appearanceStrings[APPEARANCE_AQUA];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
	} else if (appearance == NSAppearanceNameDarkAqua) {
	    resultString = appearanceStrings[APPEARANCE_DARKAQUA];
#endif
	} else {
	    resultString = "unrecognized";
	}



	result = Tcl_NewStringObj(resultString, strlen(resultString));
    }
    if (result == NULL) {
	Tcl_Panic("Failed to read appearance name.");
    }
    if (objc == 4) {
	int index;







|







 







>












>
>
>







5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
....
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
static int
WmWinAppearance(
    Tcl_Interp *interp,		/* Current interpreter. */
    TkWindow *winPtr,		/* Window to be manipulated. */
    int objc,			/* Number of arguments. */
    Tcl_Obj * const objv[])	/* Argument objects. */
{
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
    static const char *const appearanceStrings[] = {
	"aqua", "darkaqua", "auto", NULL
    };
    enum appearances {
	APPEARANCE_AQUA, APPEARANCE_DARKAQUA, APPEARANCE_AUTO
    };
    Tcl_Obj *result = NULL;
................................................................................
    NSAppearanceName appearance;
#else
    NSString *appearance;
#endif
    const char *resultString;
    NSWindow *win = TkMacOSXDrawableWindow(winPtr->window);
    if (win) {
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090
	appearance = win.appearance.name;
	if (appearance == nil) {
	    resultString = appearanceStrings[APPEARANCE_AUTO];
	} else if (appearance == NSAppearanceNameAqua) {
	    resultString = appearanceStrings[APPEARANCE_AQUA];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
	} else if (appearance == NSAppearanceNameDarkAqua) {
	    resultString = appearanceStrings[APPEARANCE_DARKAQUA];
#endif
	} else {
	    resultString = "unrecognized";
	}
#else
    resultString = appearanceStrings[APPEARANCE_AQUA];
#endif
	result = Tcl_NewStringObj(resultString, strlen(resultString));
    }
    if (result == NULL) {
	Tcl_Panic("Failed to read appearance name.");
    }
    if (objc == 4) {
	int index;

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

1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
....
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
....
1529
1530
1531
1532
1533
1534
1535

1536



1537
1538
1539
1540
1541
1542
1543
....
2555
2556
2557
2558
2559
2560
2561

2562
2563
2564
2565
2566
2567
2568
2569
2570

2571
2572
2573
2574

2575
2576

2577
2578
2579
2580
2581
2582
2583
    *paddingPtr = Ttk_MakePadding(9, 5, 9, 9);
}

static void PaneElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, Ttk_State state)
{
    TkWindow *winPtr = (TkWindow *)tkwin;
    MacDrawable *macWin = winPtr->privatePtr;
    CGRect bounds = BoxToRect(d, b);
    bounds.origin.y -= kThemeMetricTabFrameOverlap;
    bounds.size.height += kThemeMetricTabFrameOverlap;
    BEGIN_DRAWING(d)
#if MAC_OS_X_VERSION_MIN_REQUIRED > 10800
    DrawGroupBox(bounds, dc.context, tkwin);
#else
................................................................................
	.direction = kThemeTabNorth,
	.size = kHIThemeTabSizeNormal,
	.kind = kHIThemeTabKindNormal,
	.adornment = kHIThemeTabPaneAdornmentNormal,
    };
    bounds.origin.y -= kThemeMetricTabFrameOverlap;
    bounds.size.height += kThemeMetricTabFrameOverlap;
    ChkErr(HIThemeDrawTabPane, &bounds, &info, dc.context, HIOrieRectntation);
#endif
    END_DRAWING
}

static Ttk_ElementSpec PaneElementSpec = {
    TK_STYLE_VERSION_2,
    sizeof(NullElement),
................................................................................
	    XFillRectangle(Tk_Display(tkwin), d,
		    Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
		    inner.x, inner.y, inner.width, inner.height);
	}
	BEGIN_DRAWING(d)
	if (backgroundPtr == NULL) {
	    background = [NSColor textBackgroundColor];

	    CGContextSetFillColorWithColor(dc.context, background.CGColor);



	    CGContextFillRect(dc.context, bounds);
	}
	ChkErr(HIThemeDrawFrame, &bounds, &info, dc.context, HIOrientation);
	END_DRAWING
    }
    /*if (state & TTK_STATE_FOCUS) {
	ChkErr(DrawThemeFocusRect, &bounds, 1);
................................................................................
	.kind = params->kind,
	.value = Ttk_StateTableLookup(TreeHeaderValueTable, state),
	.adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state),
    };

    BEGIN_DRAWING(d)
    if ([NSApp macMinorVersion] > 8) {


	/*
	 * Compensate for the padding added in TreeHeaderElementSize, so
	 * the larger heading will be drawn at the top of the widget.
	 */
	
	bounds.origin.y -= 4;
#if MAC_OS_X_VERSION_MIN_REQUIRED > 101300
	if (TkMacOSXInDarkMode(tkwin)) {

	    DrawDarkListHeader(bounds, dc.context, tkwin, state);
	} else
#endif
	{

	    DrawListHeader(bounds, dc.context, tkwin, state);
	}

    } else {
	ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
    }
    END_DRAWING
}

static Ttk_ElementSpec TreeHeaderElementSpec = {







<
<







 







|







 







>

>
>
>







 







>







<

>

<

<
>


>







1368
1369
1370
1371
1372
1373
1374


1375
1376
1377
1378
1379
1380
1381
....
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
....
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
....
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571

2572
2573
2574

2575

2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
    *paddingPtr = Ttk_MakePadding(9, 5, 9, 9);
}

static void PaneElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, Ttk_State state)
{


    CGRect bounds = BoxToRect(d, b);
    bounds.origin.y -= kThemeMetricTabFrameOverlap;
    bounds.size.height += kThemeMetricTabFrameOverlap;
    BEGIN_DRAWING(d)
#if MAC_OS_X_VERSION_MIN_REQUIRED > 10800
    DrawGroupBox(bounds, dc.context, tkwin);
#else
................................................................................
	.direction = kThemeTabNorth,
	.size = kHIThemeTabSizeNormal,
	.kind = kHIThemeTabKindNormal,
	.adornment = kHIThemeTabPaneAdornmentNormal,
    };
    bounds.origin.y -= kThemeMetricTabFrameOverlap;
    bounds.size.height += kThemeMetricTabFrameOverlap;
    ChkErr(HIThemeDrawTabPane, &bounds, &info, dc.context, HIOrientation);
#endif
    END_DRAWING
}

static Ttk_ElementSpec PaneElementSpec = {
    TK_STYLE_VERSION_2,
    sizeof(NullElement),
................................................................................
	    XFillRectangle(Tk_Display(tkwin), d,
		    Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
		    inner.x, inner.y, inner.width, inner.height);
	}
	BEGIN_DRAWING(d)
	if (backgroundPtr == NULL) {
	    background = [NSColor textBackgroundColor];
#if MAC_OS_X_VERSION_MIN_REQUIRED > 1080
	    CGContextSetFillColorWithColor(dc.context, background.CGColor);
#else
	    CGContextSetRGBFillColor(dc.context, 1.0, 1.0, 1.0, 1.0);
#endif
	    CGContextFillRect(dc.context, bounds);
	}
	ChkErr(HIThemeDrawFrame, &bounds, &info, dc.context, HIOrientation);
	END_DRAWING
    }
    /*if (state & TTK_STATE_FOCUS) {
	ChkErr(DrawThemeFocusRect, &bounds, 1);
................................................................................
	.kind = params->kind,
	.value = Ttk_StateTableLookup(TreeHeaderValueTable, state),
	.adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state),
    };

    BEGIN_DRAWING(d)
    if ([NSApp macMinorVersion] > 8) {
#if MAC_OS_X_VERSION_MIN_REQUIRED > 1080

	/*
	 * Compensate for the padding added in TreeHeaderElementSize, so
	 * the larger heading will be drawn at the top of the widget.
	 */
	
	bounds.origin.y -= 4;

	if (TkMacOSXInDarkMode(tkwin)) {
#if MAC_OS_X_VERSION_MIN_REQUIRED > 101300
	    DrawDarkListHeader(bounds, dc.context, tkwin, state);

#endif

	} else {
	    DrawListHeader(bounds, dc.context, tkwin, state);
	}
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED > 1080 */
    } else {
	ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
    }
    END_DRAWING
}

static Ttk_ElementSpec TreeHeaderElementSpec = {

Changes to jni/sdl2tk/tests/frame.test.

658
659
660
661
662
663
664

665
666

667
668
669
670
671
672
673
...
674
675
676
677
678
679
680

681
682

683
684
685
686
687
688
689
test frame-3.9 {TkCreateFrame procedure, -use option} -constraints {
    unix
} -setup {
	deleteWindows
} -body {
    toplevel .t -container 1 -width 300 -height 120
    wm geometry .t +0+0

    toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green
    tkwait visibility .x

    list [expr {[winfo rootx .x] - [winfo rootx .t]}] \
	    [expr {[winfo rooty .x] - [winfo rooty .t]}] \
	    [winfo width .t] [winfo height .t]
} -cleanup {
    deleteWindows
} -result {0 0 140 300}
test frame-3.10 {TkCreateFrame procedure, -use option} -constraints {
................................................................................
    unix
} -setup {
    deleteWindows
} -body {
    toplevel .t -container 1 -width 300 -height 120
    wm geometry .t +0+0
    option add *x.use [winfo id .t]

    toplevel .x -width 140 -height 300 -bg green
    tkwait visibility .x

    list [expr {[winfo rootx .x] - [winfo rootx .t]}] \
	    [expr {[winfo rooty .x] - [winfo rooty .t]}] \
	    [winfo width .t] [winfo height .t]
} -cleanup {
    destroy .t
    option clear
} -result {0 0 140 300}







>


>







 







>


>







658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
...
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
test frame-3.9 {TkCreateFrame procedure, -use option} -constraints {
    unix
} -setup {
	deleteWindows
} -body {
    toplevel .t -container 1 -width 300 -height 120
    wm geometry .t +0+0
    update
    toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green
    tkwait visibility .x
    update
    list [expr {[winfo rootx .x] - [winfo rootx .t]}] \
	    [expr {[winfo rooty .x] - [winfo rooty .t]}] \
	    [winfo width .t] [winfo height .t]
} -cleanup {
    deleteWindows
} -result {0 0 140 300}
test frame-3.10 {TkCreateFrame procedure, -use option} -constraints {
................................................................................
    unix
} -setup {
    deleteWindows
} -body {
    toplevel .t -container 1 -width 300 -height 120
    wm geometry .t +0+0
    option add *x.use [winfo id .t]
    update
    toplevel .x -width 140 -height 300 -bg green
    tkwait visibility .x
    update
    list [expr {[winfo rootx .x] - [winfo rootx .t]}] \
	    [expr {[winfo rooty .x] - [winfo rooty .t]}] \
	    [winfo width .t] [winfo height .t]
} -cleanup {
    destroy .t
    option clear
} -result {0 0 140 300}