Check-in [15c0773415]
Not logged in

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

Overview
Comment:add selected tk upstream changes
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 15c077341538b7fa6d13de30aa4d78f3d32be651
User & Date: chw 2016-11-09 17:04:15
Context
2016-11-09
18:00
update SDL2 to version 2.0.5 (with patches) check-in: b46b660d5e user: chw tags: trunk
17:04
add selected tk upstream changes check-in: 15c0773415 user: chw tags: trunk
2016-11-08
06:21
freetype compile fixes for Android platform check-in: f33cd260bb user: chw tags: trunk
Changes

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

1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
	dc.portBounds.origin.y += macDraw->yOff;
	if (!dc.focusLocked) {
	    CGContextSaveGState(dc.context);
	}
	CGContextSetTextDrawingMode(dc.context, kCGTextFill);
	CGContextConcatCTM(dc.context, t);
	if (dc.clipRgn) {
	    #ifdef TK_MAC_DEBUG_DRAWING
	    CGContextSaveGState(dc.context);
	    ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
	    CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1);
	    CGContextEOFillPath(dc.context);
	    CGContextRestoreGState(dc.context);
	    #endif /* TK_MAC_DEBUG_DRAWING */
	    CGRect r;
	    if (!HIShapeIsRectangular(dc.clipRgn) || !CGRectContainsRect(
		    *HIShapeGetBounds(dc.clipRgn, &r),
		    CGRectApplyAffineTransform(clipBounds, t))) {
		ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
		CGContextEOClip(dc.context);
	    }







|





|







1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
	dc.portBounds.origin.y += macDraw->yOff;
	if (!dc.focusLocked) {
	    CGContextSaveGState(dc.context);
	}
	CGContextSetTextDrawingMode(dc.context, kCGTextFill);
	CGContextConcatCTM(dc.context, t);
	if (dc.clipRgn) {
#ifdef TK_MAC_DEBUG_DRAWING
	    CGContextSaveGState(dc.context);
	    ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
	    CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1);
	    CGContextEOFillPath(dc.context);
	    CGContextRestoreGState(dc.context);
#endif /* TK_MAC_DEBUG_DRAWING */
	    CGRect r;
	    if (!HIShapeIsRectangular(dc.clipRgn) || !CGRectContainsRect(
		    *HIShapeGetBounds(dc.clipRgn, &r),
		    CGRectApplyAffineTransform(clipBounds, t))) {
		ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context);
		CGContextEOClip(dc.context);
	    }

Changes to jni/sdl2tk/macosx/tkMacOSXPort.h.

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include <X11/Xutil.h>
#include "tkIntXlibDecls.h"

/*
 * The following macro defines the type of the mask arguments to
 * select:
 */

#ifndef NO_FD_SET







<







49
50
51
52
53
54
55

56
57
58
59
60
61
62
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include <X11/Xutil.h>


/*
 * The following macro defines the type of the mask arguments to
 * select:
 */

#ifndef NO_FD_SET

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

360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
    event.xexpose.x = damageBounds.origin.x - bounds.origin.x;
    event.xexpose.y = damageBounds.origin.y - bounds.origin.y;
    event.xexpose.width = damageBounds.size.width;
    event.xexpose.height = damageBounds.size.height;
    event.xexpose.count = 0;
    Tk_HandleEvent(&event);

    #ifdef TK_MAC_DEBUG_DRAWING
    NSLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x,
	event.xexpose.y, event.xexpose.width, event.xexpose.height);
    #endif

    /*
     * Generate updates for the children of this window
     */

    for (childPtr = winPtr->childList; childPtr != NULL;
	    childPtr = childPtr->nextPtr) {







|


|







360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
    event.xexpose.x = damageBounds.origin.x - bounds.origin.x;
    event.xexpose.y = damageBounds.origin.y - bounds.origin.y;
    event.xexpose.width = damageBounds.size.width;
    event.xexpose.height = damageBounds.size.height;
    event.xexpose.count = 0;
    Tk_HandleEvent(&event);

#ifdef TK_MAC_DEBUG_DRAWING
    NSLog(@"Expose %p {{%d, %d}, {%d, %d}}", event.xany.window, event.xexpose.x,
	event.xexpose.y, event.xexpose.width, event.xexpose.height);
#endif

    /*
     * Generate updates for the children of this window
     */

    for (childPtr = winPtr->childList; childPtr != NULL;
	    childPtr = childPtr->nextPtr) {

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

524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
XClearWindow(
    Display* display,
    Window w)
{
}

/*
void
XDrawPoint(
    Display* display,
    Drawable d,
    GC gc,
    int x,
    int y)
{
}

void
XDrawPoints(
    Display* display,
    Drawable d,
    GC gc,
    XPoint* points,
    int npoints,
    int mode)







|









|







524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
XClearWindow(
    Display* display,
    Window w)
{
}

/*
int
XDrawPoint(
    Display* display,
    Drawable d,
    GC gc,
    int x,
    int y)
{
}

int
XDrawPoints(
    Display* display,
    Drawable d,
    GC gc,
    XPoint* points,
    int npoints,
    int mode)

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

820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
    return $result
} -cleanup {
    deleteWindows
} -result {4 A 4 A}

test event-8 {event generate with keysyms corresponding to
              multi-byte virtual keycodes - bug 
              e36963bfe8df9f5e528134707a91b9c0051de723} -setup {
    deleteWindows
    set res [list ]
} -body {
    set t [toplevel .t]
    set e [entry $t.e]
    pack $e
    tkwait visibility $e







|







820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
    return $result
} -cleanup {
    deleteWindows
} -result {4 A 4 A}

test event-8 {event generate with keysyms corresponding to
              multi-byte virtual keycodes - bug 
              e36963bfe8df9f5e528134707a91b9c0051de723} -constraints nonPortable -setup {
    deleteWindows
    set res [list ]
} -body {
    set t [toplevel .t]
    set e [entry $t.e]
    pack $e
    tkwait visibility $e

Changes to jni/sdl2tk/win/tkWinDraw.c.

636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
...
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702

703
704
705
706
707
708
709
710
711
712
713
714
715
716

717
718
719
720
721
722
723
724
725
726

727
728
729
730
731
732
733
....
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019

1020
1021
1022
1023
1024
1025
1026
....
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072

1073
1074
1075
1076
1077
1078
1079
....
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125

1126
1127
1128
1129
1130
1131
1132
    Display *display,
    Drawable d,
    GC gc,
    XRectangle *rectangles,
    int nrectangles)
{
    HDC dc;
    int i;
    RECT rect;
    TkWinDCState state;
    HBRUSH brush, oldBrush;

    if (d == None) {
	return BadDrawable;
    }
................................................................................

	/*
	 * For each rectangle, create a drawing surface which is the size of
	 * the rectangle and fill it with the background color. Then merge the
	 * result with the stipple pattern.
	 */

	for (i = 0; i < nrectangles; i++) {
	    bitmap = CreateCompatibleBitmap(dc, rectangles[i].width,
		    rectangles[i].height);
	    oldBitmap = SelectObject(dcMem, bitmap);
	    rect.left = 0;
	    rect.top = 0;
	    rect.right = rectangles[i].width;
	    rect.bottom = rectangles[i].height;
	    FillRect(dcMem, &rect, brush);
	    BitBlt(dc, rectangles[i].x, rectangles[i].y, rectangles[i].width,
		    rectangles[i].height, dcMem, 0, 0, COPYFG);
	    if (gc->fill_style == FillOpaqueStippled) {
		FillRect(dcMem, &rect, bgBrush);
		BitBlt(dc, rectangles[i].x, rectangles[i].y,
			rectangles[i].width, rectangles[i].height, dcMem,
			0, 0, COPYBG);
	    }
	    SelectObject(dcMem, oldBitmap);
	    DeleteObject(bitmap);

	}

	DeleteDC(dcMem);
	SelectObject(dc, oldBrush);
	DeleteObject(stipple);
	DeleteObject(bgBrush);
    } else {
	if (gc->function == GXcopy) {
	    for (i = 0; i < nrectangles; i++) {
		rect.left = rectangles[i].x;
		rect.right = rect.left + rectangles[i].width;
		rect.top = rectangles[i].y;
		rect.bottom = rect.top + rectangles[i].height;
		FillRect(dc, &rect, brush);

	    }
	} else {
	    HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
	    HPEN oldPen = SelectObject(dc, newPen);
	    oldBrush = SelectObject(dc, brush);

	    for (i = 0; i < nrectangles; i++) {
		Rectangle(dc, rectangles[i].x, rectangles[i].y,
		    rectangles[i].x + rectangles[i].width + 1,
		    rectangles[i].y + rectangles[i].height + 1);

	    }

	    SelectObject(dc, oldBrush);
	    SelectObject(dc, oldPen);
	    DeleteObject(newPen);
	}
    }
................................................................................
XDrawRectangles(
    Display *display,
    Drawable d,
    GC gc,
    XRectangle rects[],
    int nrects)
{
    int n, ret;

    for (n = 0; n < nrects; n++) {
	ret = XDrawRectangle(display, d, gc, rects[n].x, rects[n].y,
		    rects[n].width, rects[n].height);
	if (ret != Success) {
	    break;
	}

    }
    return ret;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
XDrawArcs(
    Display *display,
    Drawable d,
    GC gc,
    XArc *arcs,
    int narcs)
{
    int n, ret;

    display->request++;

    for (n = 0; n < narcs; n++) {
	ret = DrawOrFillArc(display, d, gc, arcs[n].x, arcs[n].y,
		    arcs[n].width, arcs[n].height,
		    arcs[n].angle1, arcs[n].angle2, 0);
	if (ret != Success) {
	    break;
	}

    }
    return ret;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
XFillArcs(
    Display *display,
    Drawable d,
    GC gc,
    XArc *arcs,
    int narcs)
{
    int n, ret;

    display->request++;

    for (n = 0; n < narcs; n++) {
	ret = DrawOrFillArc(display, d, gc, arcs[n].x, arcs[n].y,
		    arcs[n].width, arcs[n].height,
		    arcs[n].angle1, arcs[n].angle2, 1);
	if (ret != Success) {
	    break;
	}

    }
    return ret;
}
 
/*
 *----------------------------------------------------------------------
 *







<







 







|
|
|



|
|

|
|


|
|




>








|
|
|
|
|

>






|
|
|
|
>







 







|

|
|
|



>







 







|



|
|
|
|



>







 







|



|
|
|
|



>







636
637
638
639
640
641
642

643
644
645
646
647
648
649
...
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
....
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
....
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
....
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
    Display *display,
    Drawable d,
    GC gc,
    XRectangle *rectangles,
    int nrectangles)
{
    HDC dc;

    RECT rect;
    TkWinDCState state;
    HBRUSH brush, oldBrush;

    if (d == None) {
	return BadDrawable;
    }
................................................................................

	/*
	 * For each rectangle, create a drawing surface which is the size of
	 * the rectangle and fill it with the background color. Then merge the
	 * result with the stipple pattern.
	 */

	while (nrectangles-- > 0) {
	    bitmap = CreateCompatibleBitmap(dc, rectangles[0].width,
		    rectangles[0].height);
	    oldBitmap = SelectObject(dcMem, bitmap);
	    rect.left = 0;
	    rect.top = 0;
	    rect.right = rectangles[0].width;
	    rect.bottom = rectangles[0].height;
	    FillRect(dcMem, &rect, brush);
	    BitBlt(dc, rectangles[0].x, rectangles[0].y, rectangles[0].width,
		    rectangles[0].height, dcMem, 0, 0, COPYFG);
	    if (gc->fill_style == FillOpaqueStippled) {
		FillRect(dcMem, &rect, bgBrush);
		BitBlt(dc, rectangles[0].x, rectangles[0].y,
			rectangles[0].width, rectangles[0].height, dcMem,
			0, 0, COPYBG);
	    }
	    SelectObject(dcMem, oldBitmap);
	    DeleteObject(bitmap);
	    ++rectangles;
	}

	DeleteDC(dcMem);
	SelectObject(dc, oldBrush);
	DeleteObject(stipple);
	DeleteObject(bgBrush);
    } else {
	if (gc->function == GXcopy) {
	    while (nrectangles-- > 0) {
		rect.left = rectangles[0].x;
		rect.right = rect.left + rectangles[0].width;
		rect.top = rectangles[0].y;
		rect.bottom = rect.top + rectangles[0].height;
		FillRect(dc, &rect, brush);
		++rectangles;
	    }
	} else {
	    HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
	    HPEN oldPen = SelectObject(dc, newPen);
	    oldBrush = SelectObject(dc, brush);

	    while (nrectangles-- > 0) {
		Rectangle(dc, rectangles[0].x, rectangles[0].y,
		    rectangles[0].x + rectangles[0].width + 1,
		    rectangles[0].y + rectangles[0].height + 1);
		++rectangles;
	    }

	    SelectObject(dc, oldBrush);
	    SelectObject(dc, oldPen);
	    DeleteObject(newPen);
	}
    }
................................................................................
XDrawRectangles(
    Display *display,
    Drawable d,
    GC gc,
    XRectangle rects[],
    int nrects)
{
    int ret = Success;

    while (nrects-- > 0) {
	ret = XDrawRectangle(display, d, gc, rects[0].x, rects[0].y,
		    rects[0].width, rects[0].height);
	if (ret != Success) {
	    break;
	}
	++rects;
    }
    return ret;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
XDrawArcs(
    Display *display,
    Drawable d,
    GC gc,
    XArc *arcs,
    int narcs)
{
    int ret = Success;

    display->request++;

    while (narcs-- > 0) {
	ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
		    arcs[0].width, arcs[0].height,
		    arcs[0].angle1, arcs[0].angle2, 0);
	if (ret != Success) {
	    break;
	}
	++arcs;
    }
    return ret;
}
 
/*
 *----------------------------------------------------------------------
 *
................................................................................
XFillArcs(
    Display *display,
    Drawable d,
    GC gc,
    XArc *arcs,
    int narcs)
{
    int ret = Success;

    display->request++;

    while (narcs-- > 0) {
	ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
		    arcs[0].width, arcs[0].height,
		    arcs[0].angle1, arcs[0].angle2, 1);
	if (ret != Success) {
	    break;
	}
	++arcs;
    }
    return ret;
}
 
/*
 *----------------------------------------------------------------------
 *

Changes to jni/sdl2tk/xlib/xgc.c.

536
537
538
539
540
541
542
543
544
545
546

547

548

549
550
551
552
553
554
555
556
557
    Display *display,
    Drawable d,
    GC gc,
    XPoint *points,
    int npoints,
    int mode)
{
    int i;
    int result = Success;

    for (i=0; (i<npoints) && (result == Success); i++) {

	result = XDrawLine(display, d, gc,

		points[i].x, points[i].y, points[i].x, points[i].y);

    }
    return result;
}

#if !defined(MAC_OSX_TK)
int
XDrawSegments(
    Display *display,
    Drawable d,







<
|

<
>
|
>
|
>

|







536
537
538
539
540
541
542

543
544

545
546
547
548
549
550
551
552
553
554
555
556
557
558
    Display *display,
    Drawable d,
    GC gc,
    XPoint *points,
    int npoints,
    int mode)
{

    int res = Success;


    while (npoints-- > 0) {
	res = XDrawLine(display, d, gc,
		points[0].x, points[0].y, points[0].x, points[0].y);
	if (res != Success) break;
	++points;
    }
    return res;
}

#if !defined(MAC_OSX_TK)
int
XDrawSegments(
    Display *display,
    Drawable d,

Changes to jni/sdl2tk/xlib/xutil.c.

8
9
10
11
12
13
14

15
16
17
18
19
20
21
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <stdlib.h>
#include <tk.h>


#include <X11/Xutil.h>
#include <X11/Xatom.h>
 
/*
 *----------------------------------------------------------------------
 *
 * XInternAtom --







>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */

#include <stdlib.h>
#include <tk.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
 
/*
 *----------------------------------------------------------------------
 *
 * XInternAtom --