Check-in [eecebaf869]
Not logged in

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

Overview
Comment:merge with trunk
Timelines: family | ancestors | descendants | both | wtf-8-experiment
Files: files | file ages | folders
SHA1: eecebaf869b9751a381fefdea46309b793d66e59
User & Date: chw 2019-05-26 13:06:17
Context
2019-05-26
21:26
merge with trunk check-in: 9825426608 user: chw tags: wtf-8-experiment
13:06
merge with trunk check-in: eecebaf869 user: chw tags: wtf-8-experiment
13:05
add tk upstream changes check-in: 8756395c9d user: chw tags: trunk
2019-05-24
22:18
merge with trunk check-in: 71cc564ed0 user: chw tags: wtf-8-experiment
Changes

Changes to jni/SDL2/android-project/src/org/libsdl/app/SDLActivity.java.

671
672
673
674
675
676
677








678
679
680
681
682
683
684
        public int x, y, w, h;

        public ShowTextInputTask(int x, int y, int w, int h) {
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;








        }

        @Override
        public void run() {
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING);
            params.leftMargin = x;
            params.topMargin = y;







>
>
>
>
>
>
>
>







671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
        public int x, y, w, h;

        public ShowTextInputTask(int x, int y, int w, int h) {
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;

            /* Minimum size of 1 pixel, so it takes focus. */
            if (this.w <= 0) {
                this.w = 1;
            }
            if (this.h + HEIGHT_PADDING <= 0) {
                this.h = 1 - HEIGHT_PADDING;
            }
        }

        @Override
        public void run() {
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING);
            params.leftMargin = x;
            params.topMargin = y;

Changes to jni/SDL2/src/events/SDL_windowevents.c.

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
        return 0;
    }
    switch (windowevent) {
    case SDL_WINDOWEVENT_SHOWN:
        if (window->flags & SDL_WINDOW_SHOWN) {
            return 0;
        }
        window->flags &= ~SDL_WINDOW_HIDDEN;
        window->flags |= SDL_WINDOW_SHOWN;
        SDL_OnWindowShown(window);
        break;
    case SDL_WINDOWEVENT_HIDDEN:
        if (!(window->flags & SDL_WINDOW_SHOWN)) {
            return 0;
        }







|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
        return 0;
    }
    switch (windowevent) {
    case SDL_WINDOWEVENT_SHOWN:
        if (window->flags & SDL_WINDOW_SHOWN) {
            return 0;
        }
        window->flags &= ~(SDL_WINDOW_HIDDEN | SDL_WINDOW_MINIMIZED);
        window->flags |= SDL_WINDOW_SHOWN;
        SDL_OnWindowShown(window);
        break;
    case SDL_WINDOWEVENT_HIDDEN:
        if (!(window->flags & SDL_WINDOW_SHOWN)) {
            return 0;
        }

Changes to jni/SDL2/src/video/cocoa/SDL_cocoawindow.m.

1747
1748
1749
1750
1751
1752
1753


1754
1755
1756
1757
1758
1759
1760
    if (data) {
        if ([data->listener isInFullscreenSpace]) {
            [NSMenu setMenuBarVisible:YES];
        }
        [data->listener close];
        [data->listener release];
        if (data->created) {


            [data->nswindow close];
        }

        NSArray *contexts = [[data->nscontexts copy] autorelease];
        for (SDLOpenGLContext *context in contexts) {
            /* Calling setWindow:NULL causes the context to remove itself from the context list. */            
            [context setWindow:NULL];







>
>







1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
    if (data) {
        if ([data->listener isInFullscreenSpace]) {
            [NSMenu setMenuBarVisible:YES];
        }
        [data->listener close];
        [data->listener release];
        if (data->created) {
            /* Release the content view to avoid further updateLayer callbacks */
            [data->nswindow setContentView:nil];
            [data->nswindow close];
        }

        NSArray *contexts = [[data->nscontexts copy] autorelease];
        for (SDLOpenGLContext *context in contexts) {
            /* Calling setWindow:NULL causes the context to remove itself from the context list. */            
            [context setWindow:NULL];

Changes to jni/SDL2/src/video/x11/SDL_x11events.c.

305
306
307
308
309
310
311














312
313
314
315
316
317
318
...
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
...
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
...
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
...
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
....
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
....
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
....
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
....
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
....
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
{
    /* event is a union, so cookie == &event, but this is type safe. */
    XGenericEventCookie *cookie = &xev->xcookie;
    if (X11_XGetEventData(videodata->display, cookie)) {
        X11_HandleXinput2Event(videodata, cookie);














        X11_XFreeEventData(videodata->display, cookie);
    }
}
#endif /* SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */

static unsigned
X11_GetNumLockModifierMask(_THIS)
................................................................................
    unsigned num_mask = 0;
    int i, j;
    XModifierKeymap *xmods;
    unsigned n;

    xmods = X11_XGetModifierMapping(display);
    n = xmods->max_keypermod;
    for(i = 3; i < 8; i++) {
        for(j = 0; j < n; j++) {
            KeyCode kc = xmods->modifiermap[i * n + j];
            if (viddata->key_layout[kc] == SDL_SCANCODE_NUMLOCKCLEAR) {
                num_mask = 1 << i;
                break;
            }
        }
    }
................................................................................
            } else {
                SDL_SendKeyboardKey(SDL_RELEASED, scancode, 0, 0);
            }
#endif
        }
        return;
    }








    /* Send a SDL_SYSWMEVENT if the application wants them */
    if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
        SDL_SysWMmsg wmmsg;

        SDL_VERSION(&wmmsg.version);
        wmmsg.subsystem = SDL_SYSWM_X11;
        wmmsg.msg.x11.event = xevent;
        SDL_SendSysWMEvent(&wmmsg);
    }

#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
    if(xevent.type == GenericEvent) {
        X11_HandleGenericEvent(videodata, &xevent);
        return;
    }
#endif

#if 0
    printf("type = %d display = %d window = %d\n",
           xevent.type, xevent.xany.display, xevent.xany.window);
#endif

    if ((videodata->clipboard_window != None) &&
        (videodata->clipboard_window == xevent.xany.window)) {
................................................................................
                X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
            }
#else
            X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
#endif

#ifdef SDL_USE_IME
            if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
                handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode);
            }
#endif
            if (!handled_by_ime) {
                /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */
                if (xevent.xkey.keycode != videodata->filter_code || xevent.xkey.time != videodata->filter_time) {
                    SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode], 0, 0);
                }
                if(*text) {
                    SDL_SendKeyboardText(text);
                }
            }

            X11_UpdateUserTime(data, xevent.xkey.time);
        }
        break;
................................................................................
                X11_XQueryTree(data->videodata->display, xevent.xconfigure.window, &Root, &Parent, &Children, &NumChildren);
                X11_XTranslateCoordinates(xevent.xconfigure.display,
                                        Parent, DefaultRootWindow(xevent.xconfigure.display),
                                        xevent.xconfigure.x, xevent.xconfigure.y,
                                        &xevent.xconfigure.x, &xevent.xconfigure.y,
                                        &ChildReturn);
            }
                
            if (xevent.xconfigure.x != data->last_xconfigure.x ||
                xevent.xconfigure.y != data->last_xconfigure.y) {
                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
                                    xevent.xconfigure.x, xevent.xconfigure.y);
#ifdef SDL_USE_IME
                if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
                    /* Update IME candidate list position */
                    SDL_IME_UpdateTextRect(NULL);
                }
#endif
            }
            if (xevent.xconfigure.width != data->last_xconfigure.width ||
                xevent.xconfigure.height != data->last_xconfigure.height) {
................................................................................
                    data->xdnd_req = X11_PickTargetFromAtoms(display, xevent.xclient.data.l[2], xevent.xclient.data.l[3], xevent.xclient.data.l[4]);
                }
            }
            else if (xevent.xclient.message_type == videodata->XdndPosition) {

#ifdef DEBUG_XEVENTS
                Atom act= videodata->XdndActionCopy;
                if(xdnd_version >= 2) {
                    act = xevent.xclient.data.l[4];
                }
                printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act));
#endif


                /* reply with status */
................................................................................
                m.data.l[2] = 0; /* specify an empty rectangle */
                m.data.l[3] = 0;
                m.data.l[4] = videodata->XdndActionCopy; /* we only accept copying anyway */

                X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
                X11_XFlush(display);
            }
            else if(xevent.xclient.message_type == videodata->XdndDrop) {
                if (data->xdnd_req == None) {
                    /* say again - not interested! */
                    memset(&m, 0, sizeof(XClientMessageEvent));
                    m.type = ClientMessage;
                    m.display = xevent.xclient.display;
                    m.window = xevent.xclient.data.l[0];
                    m.message_type = videodata->XdndFinished;
................................................................................
                    m.format=32;
                    m.data.l[0] = data->xwindow;
                    m.data.l[1] = 0;
                    m.data.l[2] = None; /* fail! */
                    X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
                } else {
                    /* convert */
                    if(xdnd_version >= 1) {
                        X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, xevent.xclient.data.l[2]);
                    } else {
                        X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, CurrentTime);
                    }
                }
            }
            else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
................................................................................
#endif
            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
        }
        break;

    case MotionNotify:{
            SDL_Mouse *mouse = SDL_GetMouse();
            if(!mouse->relative_mode || mouse->relative_mode_warp) {
#ifdef DEBUG_MOTION
                printf("window %p: X11 motion: %d,%d\n", data, xevent.xmotion.x, xevent.xmotion.y);
#endif

                SDL_SendMouseMotion(data->window, 0, 0, xevent.xmotion.x, xevent.xmotion.y);
            }
        }
................................................................................
            printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button);
#endif
            if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) {
                SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL);
            } else {
                SDL_bool ignore_click = SDL_FALSE;
                int button = xevent.xbutton.button;
                if(button == Button1) {
                    if (ProcessHitTest(_this, data, &xevent)) {
                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
                        break;  /* don't pass this event on to app. */
                    }
                }
                else if(button > 7) {
                    /* X button values 4-7 are used for scrolling, so X1 is 8, X2 is 9, ...
                       => subtract (8-SDL_BUTTON_X1) to get value SDL expects */
                    button -= (8-SDL_BUTTON_X1);
                }
                if (data->last_focus_event_time) {
                    const int X11_FOCUS_CLICK_TIMEOUT = 10;
                    if (!SDL_TICKS_PASSED(SDL_GetTicks(), data->last_focus_event_time + X11_FOCUS_CLICK_TIMEOUT)) {
................................................................................

    /* Keep processing pending events */
    while (X11_Pending(data->display)) {
        X11_DispatchEvent(_this);
    }

#ifdef SDL_USE_IME
    if(SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
        SDL_IME_PumpEvents();
    }
#endif

    /* FIXME: Only need to do this when there are pending focus changes */
    X11_HandleFocusChanges(_this);
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|







 







>
>
>
>
>
>
>











<
<
<
<
<
<
<







 







|








|







 







|





|







 







|







 







|







 







|







 







|







 







|





|







 







|







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
...
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
...
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
...
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
...
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
....
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
....
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
1080
1081
1082
1083
1084
....
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
....
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
....
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
{
    /* event is a union, so cookie == &event, but this is type safe. */
    XGenericEventCookie *cookie = &xev->xcookie;
    if (X11_XGetEventData(videodata->display, cookie)) {
        X11_HandleXinput2Event(videodata, cookie);

        /* Send a SDL_SYSWMEVENT if the application wants them.
         * Since event data is only available until XFreeEventData is called,
         * the *only* way for an application to access it is to register an event filter/watcher
         * and do all the processing on the SDL_SYSWMEVENT inside the callback. */
        if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
            SDL_SysWMmsg wmmsg;

            SDL_VERSION(&wmmsg.version);
            wmmsg.subsystem = SDL_SYSWM_X11;
            wmmsg.msg.x11.event = *xev;
            SDL_SendSysWMEvent(&wmmsg);
        }

        X11_XFreeEventData(videodata->display, cookie);
    }
}
#endif /* SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */

static unsigned
X11_GetNumLockModifierMask(_THIS)
................................................................................
    unsigned num_mask = 0;
    int i, j;
    XModifierKeymap *xmods;
    unsigned n;

    xmods = X11_XGetModifierMapping(display);
    n = xmods->max_keypermod;
    for (i = 3; i < 8; i++) {
        for (j = 0; j < n; j++) {
            KeyCode kc = xmods->modifiermap[i * n + j];
            if (viddata->key_layout[kc] == SDL_SCANCODE_NUMLOCKCLEAR) {
                num_mask = 1 << i;
                break;
            }
        }
    }
................................................................................
            } else {
                SDL_SendKeyboardKey(SDL_RELEASED, scancode, 0, 0);
            }
#endif
        }
        return;
    }

#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
    if (xevent.type == GenericEvent) {
        X11_HandleGenericEvent(videodata, &xevent);
        return;
    }
#endif

    /* Send a SDL_SYSWMEVENT if the application wants them */
    if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
        SDL_SysWMmsg wmmsg;

        SDL_VERSION(&wmmsg.version);
        wmmsg.subsystem = SDL_SYSWM_X11;
        wmmsg.msg.x11.event = xevent;
        SDL_SendSysWMEvent(&wmmsg);
    }








#if 0
    printf("type = %d display = %d window = %d\n",
           xevent.type, xevent.xany.display, xevent.xany.window);
#endif

    if ((videodata->clipboard_window != None) &&
        (videodata->clipboard_window == xevent.xany.window)) {
................................................................................
                X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
            }
#else
            X11_XLookupString(&xevent.xkey, text, sizeof(text), &keysym, NULL);
#endif

#ifdef SDL_USE_IME
            if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
                handled_by_ime = SDL_IME_ProcessKeyEvent(keysym, keycode);
            }
#endif
            if (!handled_by_ime) {
                /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */
                if (xevent.xkey.keycode != videodata->filter_code || xevent.xkey.time != videodata->filter_time) {
                    SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode], 0, 0);
                }
                if (*text) {
                    SDL_SendKeyboardText(text);
                }
            }

            X11_UpdateUserTime(data, xevent.xkey.time);
        }
        break;
................................................................................
                X11_XQueryTree(data->videodata->display, xevent.xconfigure.window, &Root, &Parent, &Children, &NumChildren);
                X11_XTranslateCoordinates(xevent.xconfigure.display,
                                        Parent, DefaultRootWindow(xevent.xconfigure.display),
                                        xevent.xconfigure.x, xevent.xconfigure.y,
                                        &xevent.xconfigure.x, &xevent.xconfigure.y,
                                        &ChildReturn);
            }

            if (xevent.xconfigure.x != data->last_xconfigure.x ||
                xevent.xconfigure.y != data->last_xconfigure.y) {
                SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MOVED,
                                    xevent.xconfigure.x, xevent.xconfigure.y);
#ifdef SDL_USE_IME
                if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
                    /* Update IME candidate list position */
                    SDL_IME_UpdateTextRect(NULL);
                }
#endif
            }
            if (xevent.xconfigure.width != data->last_xconfigure.width ||
                xevent.xconfigure.height != data->last_xconfigure.height) {
................................................................................
                    data->xdnd_req = X11_PickTargetFromAtoms(display, xevent.xclient.data.l[2], xevent.xclient.data.l[3], xevent.xclient.data.l[4]);
                }
            }
            else if (xevent.xclient.message_type == videodata->XdndPosition) {

#ifdef DEBUG_XEVENTS
                Atom act= videodata->XdndActionCopy;
                if (xdnd_version >= 2) {
                    act = xevent.xclient.data.l[4];
                }
                printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act));
#endif


                /* reply with status */
................................................................................
                m.data.l[2] = 0; /* specify an empty rectangle */
                m.data.l[3] = 0;
                m.data.l[4] = videodata->XdndActionCopy; /* we only accept copying anyway */

                X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
                X11_XFlush(display);
            }
            else if (xevent.xclient.message_type == videodata->XdndDrop) {
                if (data->xdnd_req == None) {
                    /* say again - not interested! */
                    memset(&m, 0, sizeof(XClientMessageEvent));
                    m.type = ClientMessage;
                    m.display = xevent.xclient.display;
                    m.window = xevent.xclient.data.l[0];
                    m.message_type = videodata->XdndFinished;
................................................................................
                    m.format=32;
                    m.data.l[0] = data->xwindow;
                    m.data.l[1] = 0;
                    m.data.l[2] = None; /* fail! */
                    X11_XSendEvent(display, xevent.xclient.data.l[0], False, NoEventMask, (XEvent*)&m);
                } else {
                    /* convert */
                    if (xdnd_version >= 1) {
                        X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, xevent.xclient.data.l[2]);
                    } else {
                        X11_XConvertSelection(display, videodata->XdndSelection, data->xdnd_req, videodata->PRIMARY, data->xwindow, CurrentTime);
                    }
                }
            }
            else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) &&
................................................................................
#endif
            SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0);
        }
        break;

    case MotionNotify:{
            SDL_Mouse *mouse = SDL_GetMouse();
            if (!mouse->relative_mode || mouse->relative_mode_warp) {
#ifdef DEBUG_MOTION
                printf("window %p: X11 motion: %d,%d\n", data, xevent.xmotion.x, xevent.xmotion.y);
#endif

                SDL_SendMouseMotion(data->window, 0, 0, xevent.xmotion.x, xevent.xmotion.y);
            }
        }
................................................................................
            printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button);
#endif
            if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) {
                SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL);
            } else {
                SDL_bool ignore_click = SDL_FALSE;
                int button = xevent.xbutton.button;
                if (button == Button1) {
                    if (ProcessHitTest(_this, data, &xevent)) {
                        SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0);
                        break;  /* don't pass this event on to app. */
                    }
                }
                else if (button > 7) {
                    /* X button values 4-7 are used for scrolling, so X1 is 8, X2 is 9, ...
                       => subtract (8-SDL_BUTTON_X1) to get value SDL expects */
                    button -= (8-SDL_BUTTON_X1);
                }
                if (data->last_focus_event_time) {
                    const int X11_FOCUS_CLICK_TIMEOUT = 10;
                    if (!SDL_TICKS_PASSED(SDL_GetTicks(), data->last_focus_event_time + X11_FOCUS_CLICK_TIMEOUT)) {
................................................................................

    /* Keep processing pending events */
    while (X11_Pending(data->display)) {
        X11_DispatchEvent(_this);
    }

#ifdef SDL_USE_IME
    if (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE){
        SDL_IME_PumpEvents();
    }
#endif

    /* FIXME: Only need to do this when there are pending focus changes */
    X11_HandleFocusChanges(_this);
}

Deleted jni/blt/man/stripchart.mann.orig.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
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
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
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
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
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
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
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
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
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
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
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
'\" Copyright 1991-1997 by Bell Labs Innovations for Lucent Technologies.
'\"
'\" Permission to use, copy, modify, and distribute this software and its
'\" documentation for any purpose and without fee is hereby granted, provided
'\" that the above copyright notice appear in all copies and that both that the
'\" copyright notice and warranty disclaimer appear in supporting documentation,
'\" and that the names of Lucent Technologies any of their entities not be used
'\" in advertising or publicity pertaining to distribution of the software
'\" without specific, written prior permission.
'\"
'\" Lucent Technologies disclaims all warranties with regard to this software,
'\" including all implied warranties of merchantability and fitness.  In no event
'\" shall Lucent Technologies be liable for any special, indirect or
'\" consequential damages or any damages whatsoever resulting from loss of use,
'\" data or profits, whether in an action of contract, negligence or other
'\" tortuous action, arising out of or in connection with the use or performance
'\" of this software.  
'\"
'\" Stripchart widget created by Sani Nassif and George Howlett.
'\"
.so man.macros
.TH stripchart n BLT_VERSION BLT "BLT Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
stripchart \-  2D strip chart for plotting x and y coordinate data.
.SH SYNOPSIS
\fBstripchart\fI \fIpathName \fR?\fIoption value\fR?...
.BE
.SH DESCRIPTION
The \fBstripchart\fR command creates a strip chart for plotting
two-dimensional data (x,y coordinates). It has many configurable
components: coordinate axes, elements, legend, grid lines, cross
hairs, etc.  They allow you to customize the look and feel of the
strip chart.
.PP
The \fBstripchart\fR is essentially the same as the \fBgraph\fR
widget.  It works almost exactly the very same way.  
.PP
The use of a strip chart differs in that the X-axis typically refers
to time points.  Data values are added at intervals.  The strip chart
lets you automatically maintain a view of the most recent time points.
The axis options \fB\-shiftby\fR and \fB\-autorange\fR control this.
You can specify different line styles for data points (see the 
\fB\-styles\fR option).  
.SH INTRODUCTION
The \fBstripchart\fR command creates a new window for plotting
two-dimensional data (x,y coordinates).  Data points are plotted in a
box displayed in the center of the new window.  This is the
\fIplotting area\fR.  The coordinate axes are displayed in the
margins around the plotting area.  By default, the legend is displayed
in the right margin.  The title is displayed in top margin.
.PP
A strip chart is composed of several components: coordinate axes, data
elements, legend, grid, cross hairs, pens, postscript, and annotation
markers. 
.TP 1i
\f(CWaxis\fR 
The stripchart widget can display up to four coordinate axes (two
X-coordinate and two Y-coordinate axes), but you can create and use
any number of axes. Axes control what region of data is displayed and
how the data is scaled. Each axis consists of the axis line, title,
major and minor ticks, and tick labels. Tick labels display the value
of each major tick.
.TP 1i
\f(CWcrosshairs\fR
Cross hairs are used to finely position the mouse pointer in relation
to the coordinate axes. Two perpendicular lines are drawn across the
plotting area, intersecting at the current location of the mouse
pointer.
.TP 1i
\f(CWelement\fR 
An element represents a set of data points. Elements can be plotted 
with a symbol at each data point and lines connecting the points. 
The appearance of the element, such as its symbol, line width, and 
color is configurable.
.TP 1i
\f(CWgrid\fR
Extends the major and minor ticks of the X\-axis and/or Y\-axis across the 
plotting area. 
.TP 1i
\f(CWlegend\fR 
The legend displays the name and symbol of each data element. 
The legend can be drawn in any margin or in the plotting area.
.TP 1i
\f(CWmarker\fR
Markers are used annotate or highlight areas of the graph. For 
example, you could use a polygon marker to fill an area under a 
curve, or a text marker to label a particular data point. Markers 
come in various forms: text strings, bitmaps, connected line 
segments, images, polygons, or embedded widgets.
.TP 1i
\f(CWpen\fR 
Pens define attributes (both symbol and line style) for elements. 
Data elements use pens to specify how they should be drawn.  A data 
element may use many pens at once.  Here, the particular pen 
used for a data point is determined from each element's weight 
vector (see the element's \fB\-weight\fR and \fB\-style\fR options).  
.TP 1i
\f(CWpostscript\fR
The widget can generate encapsulated PostScript output. This component
has several options to configure how the PostScript is generated.
.SH SYNTAX
.DS
\fBstripchart \fIpathName \fR?\fIoption value\fR?...
.DE
The \fBstripchart\fR command creates a new window \fIpathName\fR and makes
it into a \fBstripchart\fR widget.  At the time this command is invoked, there
must not exist a window named \fIpathName\fR, but \fIpathName\fR's
parent must exist.  Additional options may may be specified on the
command line or in the option database to configure aspects of the
strip chart such as its colors and font.  See the \fBconfigure\fR operation
below for the exact details as to what \fIoption\fR and \fIvalue\fR
pairs are valid.
.PP
If successful, \fBstripchart\fR returns the path name of the widget.  It
also creates a new Tcl command by the same name.  You can use this
command to perform various operations that query or modify the graph.
The general form is:
.DS
\fIpathName \fIoperation\fR \fR?\fIarg\fR?...
.DE
Both \fIoperation\fR and its arguments determine the exact behavior of
the command.  The operations available for the strip chart are described in 
the 
.SB "STRIPCHART OPERATIONS"
section.
.PP
The command can also be used to access components of the strip chart.
.DS
\fIpathName component operation\fR ?\fIarg\fR?...
.DE
The operation, now located after the name of the component, is the
function to be performed on that component. Each component has its own
set of operations that manipulate that component.  They will be
described below in their own sections.
.SH EXAMPLE
The \fBstripchart\fR command creates a new strip chart.  
.CS
# Create a new strip chart.  Plotting area is black.
stripchart .s -plotbackground black
.CE
A new Tcl command \f(CW.s\fR is also created.  This command can be used
to query and modify the strip chart.  For example, to change the title of
the strip chart to "My Plot", you use the new command and the widget's
\fBconfigure\fR operation.
.CS
# Change the title.
\&.s configure \-title "My Plot"
.CE
A strip chart has several components. To access a particular component you
use the component's name. For example, to add data elements, you use 
the new command and the \fBelement\fR component.
.CS
# Create a new element named "line1"
\&.s element create line1 \\
	\-xdata { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 } \\
	\-ydata { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 
		155.85 166.60 175.38 }
.CE
The element's X and Y coordinates are specified using lists of
numbers.  Alternately, BLT vectors could be used to hold the X\-Y
coordinates.
.CS
# Create two vectors and add them to the strip chart.
vector xVec yVec
xVec set { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 }
yVec set { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 155.85 
	166.60 175.38 }
\&.s element create line1 \-xdata xVec \-ydata yVec
.CE
The advantage of using vectors is that when you modify one, the graph
is automatically redrawn to display the new values.
.CS
# Change the X\-Y coordinates of the first point.
set xVec(0) 0.18
set yVec(0) 25.18
.CE
An element named \f(CWline1\fR is now created in \f(CW.s\fR.  By
default, the element's label in the legend will be also \f(CWline1\fR.
You can change the label, or specify no legend entry, again using the
element's \fBconfigure\fR operation.
.CS
# Don't display "line1" in the legend.
\&.s element configure line1 -label ""
.CE
You can configure more than just the element's label.  An element has
many attributes such as symbol type and size, dashed or solid lines,
colors, line width, etc.
.CS
\&.s element configure line1 -symbol square -color red \\
	-dashes { 2 4 2 } -linewidth 2 -pixels 2c
.CE
Four coordinate axes are automatically created: \f(CWx\fR, \f(CWx2\fR,
\f(CWy\fR, and \f(CWy2\fR.  And by default, elements are mapped onto the
axes \f(CWx\fR and \f(CWy\fR.  This can be changed with the \fB\-mapx\fR
and \fB\-mapy\fR options.
.CS
# Map "line1" on the alternate Y-axis "y2".
\&.s element configure line1 -mapy y2
.CE
Axes can be configured in many ways too.  For example, you change the
scale of the Y-axis from linear to log using the \fBaxis\fR operation.
.CS
# Y-axis is log scale.
\&.s axis configure y -logscale yes
.CE
Axis limits are reset by simply specifying new axis
limits using the \fB\-min\fR and \fB\-max\fR configuration options.
.CS
\&.s axis configure x -min 1.0 -max 1.5
\&.s axis configure y -min 12.0 -max 55.15
.CE
By default, the limits of the axis are determined from data values.
To reset back to the default limits, set the \fB\-min\fR and
\fB\-max\fR options to the empty value.
.CS
# Reset the axes to autoscale again.
\&.s axis configure x -min {} -max {}
\&.s axis configure y -min {} -max {}
.CE
It's common with strip charts to automatically maintain a view of
the most recent time points.  You can do this my setting the 
\fB\-autorange\fR option.
.CS
\&.s axis configure x -autorange 20.0
.CE
If the time points are added in X-coordinates 1.0 unit, only the last
twenty time points will be displayed.  As more data
is added, the view will march along.
.PP
Sometimes the rate of data is so high that changing the axis limits
with each additional time point is prohibitive.  You can use the
\fB\-shiftby\fR option to define an increment to shift the view
when needed.  
.CS
\&.s axis configure x -shiftby 15.0
.CE
When the view is shifted, it will allow a range of 15
new time points to be added until the axis limits are recomputed.
.PP
By default, the legend is displayed in the right margin.  You can
change this or any other legend configuration options using the
\fBlegend\fR component.
.CS
# Configure the legend font, color, and relief
\&.s legend configure -position left -relief raised \\
	-font fixed -fg blue
.CE
To prevent the legend from being displayed, turn on the \fB\-hide\fR
option.
.CS
# Don't display the legend.
\&.s legend configure -hide yes\fR
.CE
The \fBstripchart\fR widget has simple drawing procedures called markers.
They can be used to highlight or annotate data in the strip chart. The types
of markers available are bitmaps, images, polygons, lines, or windows.
Markers can be used, for example, to mark or brush points.  Here 
is a text marker which labels the data first point.  Markers
are created using the \fBmarker\fR operation.
.CS
# Create a label for the first data point of "line1".
\&.s marker create text \-name first_marker \-coords { 0.2 26.18 } \\
	\-text "start" \-anchor se \-xoffset -10 \-yoffset -10
.CE
This creates a text marker named \f(CWfirst_marker\fR.  It will display
the text "start" near the coordinates of the first data point.  The
\fB\-anchor\fR, \fB\-xoffset\fR, and \fB\-yoffset\fR options are used
to display the marker above and to the left of the data point, so that
the actual data point isn't covered by the marker.  By default,
markers are drawn last, on top of data.  You can change this with the
\fB\-under\fR option.
.CS
# Draw the label before elements are drawn.
\&.s marker configure first_marker -under yes
.CE
You can add cross hairs or grid lines using the \fBcrosshairs\fR and
\fBgrid\fR operations.
.CS
# Display both cross hairs and grid lines.
\&.s crosshairs configure \-hide no \-color red
\&.s grid configure \-hide no \-dashes { 2 2 }
.CE
Finally, to get hardcopy of the strip chart, use the \fBpostscript\fR
operation.
.CS
# Print the strip chart into file "file.ps"
\&.s postscript output file.ps \-maxpect yes \-decorations no
.CE
This generates a file \f(CWfile.ps\fR containing the encapsulated
PostScript of the strip chart.  The option \fB\-maxpect\fR says to scale the
plot to the size of the page.  Turning off the \fB\-decorations\fR
option indicates that no borders or color backgrounds should be
displayed (i.e. the background of the margins, legend, and plotting
area will be white).
.SH "STRIPCHART OPERATIONS"
.TP
\fIpathName \fBaxis \fIoperation\fR ?\fIarg\fR?...
See the 
.SB "AXIS COMPONENTS"
section.
.TP
\fIpathName \fBbar \fIelemName \fR?\fIoption value\fR?...
Creates a new barchart element \fIelemName\fR.  It's an
error if an element \fIelemName\fR already exists.  
See the manual for \fBbarchart\fR for details about
what \fIoption\fR and \fIvalue\fR pairs are valid.
.TP
\fIpathName \fBcget\fR \fIoption\fR
Returns the current value of the stripchart configuration option given by
\fIoption\fR.  \fIOption\fR may be any option described
below for the \fBconfigure\fR operation.
.TP
\fIpathName \fBconfigure \fR?\fIoption value\fR?...
Queries or modifies the configuration options of the strip chart.  If
\fIoption\fR isn't specified, a list describing all of the current
options for \fIpathName\fR is returned.  If \fIoption\fR is specified,
but not \fIvalue\fR, then a list describing \fIoption\fR is returned.
If one or more \fIoption\fR and \fIvalue\fR pairs are specified, then
for each pair, the stripchart option \fIoption\fR is set to \fIvalue\fR.
The following options are valid for the stripchart.
.RS
.TP
\fB\-background \fIcolor\fR
Sets the background color. This includes the margins and
legend, but not the plotting area.
.TP
\fB\-borderwidth \fIpixels\fR
Sets the width of the 3\-D border around the outside edge of the widget.  The
\fB\-relief\fR option determines if the border is to be drawn.  The
default is \f(CW2\fR.
.TP
\fB\-bottommargin \fIpixels\fR
Specifies the size of the margin below the X\-coordinate axis.  If
\fIpixels\fR is \f(CW0\fR, the size of the margin is selected automatically.
The default is \f(CW0\fR.
.TP
\fB\-bufferelements \fIboolean\fR
Indicates whether to draw elements into a pixmap before displaying
them on the screen.  The advantage of buffering elements is when markers
are used heavily.  Markers can be moved and redrawn without requiring
every element to be redrawn again.  The disadvantage is that it takes
slightly longer to draw the graph. If \fIboolean\fR is true, data elements are
drawn to an internal pixmap.  The option should be turned off if the plot
is updated frequently. See the
.SB "SPEED TIPS"
section.
The default is \f(CW1\fR.
.TP
\fB\-buffergraph \fIboolean\fR
Indicates whether to draw the graph into a pixmap first.
If \fIboolean\fR is true, the entire graph is drawn into a pixmap and then
copied onto the screen.  This reduces flashing.  If false, the graph is 
drawn directly into the window.  Especially under Windows, turning off the 
option can be helpful when the stripchart is updated frequently.  Turning 
off this option also turns \fB\-bufferelements\fR off. See the
.SB "SPEED TIPS"
section.
The default is \f(CW1\fR.
.TP
\fB\-cursor \fIcursor\fR
Specifies the widget's cursor.  The default
cursor is \f(CWcrosshair\fR.
.TP
\fB\-font \fIfontName\fR 
Specifies the title font. The default is
\f(CW*-Helvetica-Bold-R-Normal-*-18-180-*\fR.
.TP
\fB\-halo \fIpixels\fR 
Specifies a maximum distance to consider when searching for the
closest data point (see the element's \fBclosest\fR operation below).
Data points further than \fIpixels\fR away are ignored.  The default is
\f(CW0.5i\fR.
.TP
\fB\-height \fIpixels\fR
Specifies the requested height of widget.  The default is
\f(CW4i\fR.
.TP
\fB\-invertxy \fIboolean\fR
Indicates whether the placement X\-axis and Y\-axis should be inverted.  If
\fIboolean\fR is true, the X and Y axes are swapped.  The default is
\f(CW0\fR.
.TP
\fB\-justify \fIjustify\fR
Specifies how the title should be justified.  This matters only when
the title contains more than one line of text. \fIJustify\fR must be
\f(CWleft\fR, \f(CWright\fR, or \f(CWcenter\fR.  The default is
\f(CWcenter\fR.
.TP
\fB\-leftmargin \fIpixels\fR
Sets the size of the margin from the left edge of the window to 
the Y\-coordinate axis.  If \fIpixels\fR is \f(CW0\fR, the size is
calculated automatically.  The default is \f(CW0\fR.
.TP
\fB\-plotbackground \fIcolor\fR
Specifies the background color of the plotting area.  The default is
\f(CWwhite\fR.
.TP
\fB\-plotborderwidth \fIpixels\fR
Sets the width of the 3-D border around the plotting area.  The
\fB\-plotrelief\fR option determines if a border is drawn.  The
default is \f(CW2\fR.
.TP
\fB\-plotpadx \fIpad\fR
Sets the amount of padding to be added to the left and right sides of
the plotting area.  \fIPad\fR can be a list of one or two screen
distances.  If \fIpad\fR has two elements, the left side of the
plotting area entry is padded by the first distance and the right side
by the second.  If \fIpad\fR is just one distance, both the left and
right sides are padded evenly.  The default is \f(CW8\fR.
.TP
\fB\-plotpady \fIpad\fR
Sets the amount of padding to be added to the top and bottom of the
plotting area.  \fIPad\fR can be a list of one or two screen
distances.  If \fIpad\fR has two elements, the top of the plotting
area is padded by the first distance and the bottom by the second.  If
\fIpad\fR is just one distance, both the top and bottom are padded
evenly.  The default is \f(CW8\fR.
.TP
\fB\-plotrelief \fIrelief\fR
Specifies the 3-D effect for the plotting area.  \fIRelief\fR
indicates how the interior of the plotting area should appear relative
to rest of the strip chart; for example, \f(CWraised\fR means the plot should
appear to protrude from the strip chart, relative to the surface of the
strip chart.  The default is \f(CWsunken\fR.
.TP
\fB\-relief \fIrelief\fR
Specifies the 3-D effect for the widget.  \fIRelief\fR
indicates how the strip chart should appear relative to widget it is packed
into; for example, \f(CWraised\fR means the strip chart should
appear to protrude.  The default is \f(CWflat\fR.
.TP
\fB\-rightmargin \fIpixels\fR
Sets the size of margin from the plotting area to the right edge of
the window.  By default, the legend is displayed in this margin.  If
\fIpixels\fR is than 1, the margin size is selected automatically.
.TP
\fB\-takefocus\fR \fIfocus\fR 
Provides information used when moving the focus from window to window
via keyboard traversal (e.g., Tab and Shift-Tab).  If \fIfocus\fR is
\f(CW0\fR, this means that this window should be skipped entirely during
keyboard traversal.  \f(CW1\fR means that the this window should always
receive the input focus.  An empty value means that the traversal
scripts make the decision whether to focus on the window.
The default is \f(CW""\fR.
.TP
\fB\-tile \fIimage\fR 
Specifies a tiled background.  If \fIimage\fR isn't
\f(CW""\fR, the background is tiled using \fIimage\fR.
Otherwise, the normal background color is drawn (see the
\fB\-background\fR option).  \fIImage\fR must be an image created
using the Tk \fBimage\fR command.  The default is \f(CW""\fR.
.TP
\fB\-title \fItext\fR 
Sets the title to \fItext\fR. If \fItext\fR is \f(CW""\fR,
no title will be displayed.
.TP
\fB\-topmargin \fIpixels\fR
Specifies the size of the margin above the x2 axis.  If \fIpixels\fR
is \f(CW0\fR, the margin size is calculated automatically.
.TP
\fB\-width \fIpixels\fR
Specifies the requested width of the widget.  The default is
\f(CW5i\fR.
.RE
.TP
\fIpathName \fBcrosshairs \fIoperation \fR?\fIarg\fR?
See the 
.SB "CROSSHAIRS COMPONENT"
section.
.TP
\fIpathName \fBelement \fIoperation \fR?\fIarg\fR?...
See the 
.SB "ELEMENT COMPONENTS"
section.
.TP
\fIpathName \fBextents \fIitem\fR 
Returns the size of a particular item in the strip chart.  \fIItem\fR must
be either \f(CWleftmargin\fR, \f(CWrightmargin\fR, \f(CWtopmargin\fR,
\f(CWbottommargin\fR, \f(CWplotwidth\fR, or \f(CWplotheight\fR.
.TP
\fIpathName \fBgrid \fIoperation \fR?\fIarg\fR?...
See the 
.SB "GRID COMPONENT"
section.
.TP
\fIpathName \fBinvtransform \fIwinX winY\fR 
Performs an inverse coordinate transformation, mapping window
coordinates back to graph coordinates, using the standard X\-axis and Y\-axis.
Returns a list of containing the graph coordinates.
.TP
\fIpathName \fBlegend \fIoperation \fR?\fIarg\fR?...
See the 
.SB "LEGEND COMPONENT"
section.
.TP
\fIpathName \fBline \fIelemName\fR ?\fIoption value\fR?...
The operation is the same as \fBelement\fR.
.TP
\fIpathName \fBmarker \fIoperation \fR?\fIarg\fR?...
See the 
.SB "MARKER COMPONENTS"
section.
.TP
\fIpathName\fR \fBmetafile\fR ?\fIfileName\fR?
\fIThis operation is for Window platforms only\fR.  
Creates a Windows enhanced metafile of the stripchart.
If present, \fIfileName\fR is the file name of the new metafile.
Otherwise, the metafile is automatically added to the clipboard.
.TP
\fIpathName \fBpostscript \fIoperation \fR?\fIarg\fR?...
See the 
.SB "POSTSCRIPT COMPONENT"
section.
.TP
\fIpathName \fBsnap \fIphotoName\fR
Takes a snapshot of the strip chart and stores the contents in the photo
image \fIphotoName\fR.  \fIPhotoName\fR is the name of a Tk photo
image that must already exist.
.TP
\fIpathName \fBtransform \fIx y\fR 
Performs a coordinate transformation, mapping graph coordinates to
window coordinates, using the standard X\-axis and Y\-axis.
Returns a list containing the X\-Y screen coordinates.
.TP
\fIpathName \fBxaxis \fIoperation\fR ?\fIarg\fR?...
.TP
\fIpathName \fBx2axis \fIoperation\fR ?\fIarg\fR?... 
.TP
\fIpathName \fByaxis \fIoperation\fR ?\fIarg\fR?... 
.TP
\fIpathName \fBy2axis \fIoperation\fR ?\fIarg\fR?... 
See the 
.SB "AXIS COMPONENTS"
section.
.SH "STRIPCHART COMPONENTS"
A strip chart is composed of several components: coordinate axes, data
elements, legend, grid, cross hairs, postscript, and annotation
markers. Instead of one big set of configuration options and
operations, the strip chart is partitioned, where each component has its own
configuration options and operations that specifically control that
aspect or part of the strip chart. 
.SS "AXIS COMPONENTS"
Four coordinate axes are automatically created: two X\-coordinate axes
(\f(CWx\fR and \f(CWx2\fR) and two Y\-coordinate axes (\f(CWy\fR, and
\f(CWy2\fR).  By default, the axis \f(CWx\fR is located in the bottom
margin, \f(CWy\fR in the left margin, \f(CWx2\fR in the top margin, and
\f(CWy2\fR in the right margin.
.PP
An axis consists of the axis line, title, major and minor ticks, and
tick labels.  Major ticks are drawn at uniform intervals along the
axis.  Each tick is labeled with its coordinate value.  Minor ticks
are drawn at uniform intervals within major ticks.  
.PP
The range of the axis controls what region of data is plotted.
Data points outside the minimum and maximum limits of the axis are
not plotted.  By default, the minimum and maximum limits are
determined from the data, but you can reset either limit.
.PP
You can create and use several axes. To create an axis, invoke
the axis component and its create operation.
.CS
# Create a new axis called "temperature"
\&.s axis create temperature
.CE
You map data elements to an axis using the element's \-mapy and \-mapx
configuration options. They specify the coordinate axes an element
is mapped onto.
.CS
# Now map the temperature data to this axis.
\&.s element create "temp" \-xdata $x \-ydata $tempData \\
    \-mapy temperature
.CE
While you can have many axes, only four axes can be displayed
simultaneously.  They are drawn in each of the margins surrounding the
plotting area.  The axes x and y are drawn in the bottom and left
margins. The axes x2 and y2 are drawn in top and right margins.
Only x and y are shown by default. Note that the axes can have
different scales.
.PP
To display a different axis, you invoke one of the following
components: \fBxaxis\fR, \fByaxis\fR, \fBx2axis\fR, and \fBy2axis\fR.
The \fBuse\fR operation designates the axis to be drawn in the
corresponding margin: \fBxaxis\fR in the bottom, \fByaxis\fR in the left, 
\fBx2axis\fR in the top, and \fBy2axis\fR in the right.
.CS
# Display the axis temperature in the left margin.
\&.s yaxis use temperature
.CE
.PP
You can configure axes in many ways. The axis scale can be linear or
logarithmic.  The values along the axis can either monotonically
increase or decrease.  If you need custom tick labels, you can specify
a Tcl procedure to format the label as you wish.  You can
control how ticks are drawn, by changing the major tick interval
or the number of minor ticks.  You can define non-uniform tick intervals,
such as for time-series plots.
.PP
.TP
\fIpathName \fBaxis \fBcget \fIaxisName \fIoption\fR
Returns the current value of the option given by \fIoption\fR for
\fIaxisName\fR.  \fIOption\fR may be any option described below
for the axis \fBconfigure\fR operation.
.TP
\fIpathName \fBaxis \fBconfigure \fIaxisName \fR?\fIoption value\fR?...
Queries or modifies the configuration options of \fIaxisName\fR.  If
\fIoption\fR isn't specified, a list describing all the current
options for \fIaxisName\fR is returned.  If \fIoption\fR is specified, but
not \fIvalue\fR, then a list describing \fIoption\fR is
returned.  If one or more \fIoption\fR and \fIvalue\fR pairs are
specified, then for each pair, the axis option \fIoption\fR is set to
\fIvalue\fR.  
The following options are valid for axes.
.RS
.TP
\fB\-autorange \fIrange\fR 
Sets the range of values for the axis to \fIrange\fR.  The axis limits
are automatically reset  to display the most recent data points in this range.  
If \fIrange\fR is 0.0, the range is
determined from the limits of the data.  If \fB\-min\fR or \fB-max\fR
are specified, they override this option.  The default is \f(CW0.0\fR.
.TP
\fB\-color \fIcolor\fR
Sets the color of the axis and tick labels.
The default is \f(CWblack\fR.
.TP
\fB\-command \fIprefix\fR
Specifies a Tcl command to be invoked when formatting the axis tick
labels. \fIPrefix\fR is a string containing the name of a Tcl proc and
any extra arguments for the procedure.  This command is invoked for each
major tick on the axis.  Two additional arguments are passed to the
procedure: the pathname of the widget and the current the numeric
value of the tick.  The procedure returns the formatted tick label.  If
\f(CW""\fR is returned, no label will appear next to the tick.  You can
get the standard tick labels again by setting \fIprefix\fR to
\f(CW""\fR.  The default is \f(CW""\fR.
.sp 1
Please note that this procedure is invoked while the strip chart is redrawn.
You may query the configuration options.  But do not reset them, because 
this can have unexpected results.
.TP
\fB\-descending \fIboolean\fR 
Indicates whether the values along the axis are monotonically increasing or
decreasing.  If \fIboolean\fR is true, the axis values will be
decreasing.  The default is \f(CW0\fR.
.TP
\fB\-hide \fIboolean\fR
Indicates whether the axis is displayed. 
.TP
\fB\-justify \fIjustify\fR
Specifies how the axis title should be justified.  This matters only
when the axis title contains more than one line of text. \fIJustify\fR
must be \f(CWleft\fR, \f(CWright\fR, or \f(CWcenter\fR.  The default is
\f(CWcenter\fR.
.TP
\fB\-limits \fIformatStr\fR
Specifies a printf-like description to format the minimum and maximum
limits of the axis.  The limits are displayed at the top/bottom or
left/right sides of the plotting area.  \fIFormatStr\fR is a list of
one or two format descriptions.  If one description is supplied, both
the minimum and maximum limits are formatted in the same way.  If two,
the first designates the format for the minimum limit, the second for
the maximum.  If \f(CW""\fR is given as either description, then 
the that limit will not be displayed.  The default is \f(CW""\fR.
.TP
\fB\-linewidth \fIpixels\fR
Sets the width of the axis and tick lines.  The default is \f(CW1\fR
pixel.
.TP
\fB\-logscale \fIboolean\fR
Indicates whether the scale of the axis is logarithmic or linear.  If
\fIboolean\fR is true, the axis is logarithmic.  The default scale is
linear.
.TP
\fB\-loose \fIboolean\fR
Indicates whether the limits of the axis should fit the data points tightly,
at the outermost data points, or loosely, at the outer tick intervals.
This is relevant only when the axis limit is automatically calculated.
If \fIboolean\fR is true, the axis range is "loose".
The default is \f(CW0\fR.
.TP
\fB\-majorticks \fImajorList\fR
Specifies where to display major axis ticks.  You can use this option
to display ticks at non-uniform intervals.  \fIMajorList\fR is a list
of axis coordinates designating the location of major ticks.  No
minor ticks are drawn.  If \fImajorList\fR is \f(CW""\fR, 
major ticks will be automatically computed. The default is \f(CW""\fR.
.TP
\fB\-max \fIvalue\fR
Sets the maximum limit of \fIaxisName\fR.  Any data point greater 
than \fIvalue\fR is not displayed.  If \fIvalue\fR is \f(CW""\fR, 
the maximum limit is calculated using the largest data value.
The default is \f(CW""\fR.
.TP
\fB\-min \fIvalue\fR
Sets the minimum limit of \fIaxisName\fR. Any data point less than 
\fIvalue\fR is not displayed.  If \fIvalue\fR is \f(CW""\fR,
the minimum limit is calculated using the smallest data value.
The default is \f(CW""\fR.
.TP
\fB\-minorticks \fIminorList\fR
Specifies where to display minor axis ticks.  You can use this option
to display minor ticks at non-uniform intervals. \fIMinorList\fR is a
list of real values, ranging from 0.0 to 1.0, designating the placement of
a minor tick.  No minor ticks are drawn if the \fB\-majortick\fR
option is also set.  If \fIminorList\fR is \f(CW""\fR, minor ticks will
be automatically computed. The default is \f(CW""\fR.
.TP
\fB\-rotate \fItheta\fR
Specifies the how many degrees to rotate the axis tick labels.
\fITheta\fR is a real value representing the number of degrees
to rotate the tick labels.  The default is \f(CW0.0\fR degrees.
.TP
\fB\-shiftby \fIvalue\fR
Specifies how much to automatically shift the range of the axis.
When the new data exceeds the current axis maximum, the maximum
is increased in increments of \fIvalue\fR.  You can use this
option to prevent the axis limits from being recomputed
at each new time point. If \fIvalue\fR is 0.0, then no automatic
shifting is done. The default is \f(CW0.0\fR.
.TP
\fB\-showticks \fIboolean\fR
Indicates whether axis ticks should be drawn. If \fIboolean\fR is
true, ticks are drawn.  If false, only the
axis line is drawn. The default is \f(CW1\fR.
.TP
\fB\-stepsize \fIvalue\fR
Specifies the interval between major axis ticks.  If \fIvalue\fR isn't
a valid interval (must be less than the axis range), 
the request is ignored and the step size is automatically calculated.
.TP
\fB\-subdivisions \fInumber\fR 
Indicates how many minor axis ticks are
to be drawn.  For example, if \fInumber\fR is two, only one minor
tick is drawn.  If \fInumber\fR is one, no minor ticks are
displayed.  The default is \f(CW2\fR.
.TP
\fB\-tickfont \fIfontName\fR 
Specifies the font for axis tick labels. The default is
\f(CW*-Courier-Bold-R-Normal-*-100-*\fR.
.TP
\fB\-ticklength \fIpixels\fR
Sets the length of major and minor ticks (minor ticks are half the
length of major ticks). If \fIpixels\fR is less than zero, the axis
will be inverted with ticks drawn pointing towards the plot.  The
default is \f(CW0.1i\fR.
.TP
\fB\-title \fItext\fR
Sets the title of the axis. If \fItext\fR is 
\f(CW""\fR, no axis title will be displayed.  
.TP
\fB\-titlecolor \fIcolor\fR
Sets the color of the axis title. The default is \f(CWblack\fR.
.TP
\fB\-titlefont \fIfontName\fR 
Specifies the font for axis title. The default is
\f(CW*-Helvetica-Bold-R-Normal-*-14-140-*\fR.
.PP
Axis configuration options may be also be set by the \fBoption\fR
command.  The resource class is \f(CWAxis\fR.  The resource names
are the names of the axes (such as \f(CWx\fR or \f(CWx2\fR).
.CS
option add *Stripchart.Axis.Color  blue
option add *Stripchart.x.LogScale  true
option add *Stripchart.x2.LogScale false
.CE
.RE
.TP
\fIpathName \fBaxis \fBcreate \fIaxisName \fR?\fIoption value\fR?...
Creates a new axis by the name \fIaxisName\fR.  No axis by the same
name can already exist. \fIOption\fR and \fIvalue\fR are described 
in above in the axis \fBconfigure\fR operation.
.TP
\fIpathName \fBaxis \fBdelete \fR?\fIaxisName\fR?...
Deletes the named axes. An axis is not really
deleted until it is not longer in use, so it's safe to delete
axes mapped to elements.
.TP
\fIpathName \fBaxis invtransform \fIaxisName value\fR
Performs the inverse transformation, changing the screen coordinate
\fIvalue\fR to a graph coordinate, mapping the value mapped to
\fIaxisName\fR.  Returns the graph coordinate.
.TP
\fIpathName \fBaxis limits \fIaxisName\fR
Returns a list of the minimum and maximum limits for \fIaxisName\fR.  The order
of the list is \f(CWmin max\fR.
.TP
\fIpathName \fBaxis names \fR?\fIpattern\fR?...
Returns a list of axes matching zero or more patterns.  If no
\fIpattern\fR argument is give, the names of all axes are returned.
.TP
\fIpathName \fBaxis transform \fIaxisName value\fR
Transforms the coordinate \fIvalue\fR to a screen coordinate by mapping
the it to \fIaxisName\fR.  Returns the transformed screen coordinate.
.PP
Only four axes can be displayed simultaneously.  By default, they are
\f(CWx\fR, \f(CWy\fR, \f(CWx2\fR, and \f(CWy2\fR.  You can swap in a different
axis with \fBuse\fR operation of the special axis components:
\fBxaxis\fR, \fBx2axis\fR, \fByaxis\fR, and \fBy2axis\fR.
.CS
\&.g create axis temp
\&.g create axis time
\&...
\&.g xaxis use temp
\&.g yaxis use time
.CE
Only the axes specified for use are displayed on the screen.
.PP
The \fBxaxis\fR, \fBx2axis\fR, \fByaxis\fR, and \fBy2axis\fR
components operate on an axis location rather than a specific axis
like the more general \fBaxis\fR component does.  The \fBxaxis\fR
component manages the X-axis located in the bottom margin (whatever
axis that happens to be).  Likewise, \fByaxis\fR uses the Y-axis in
the left margin, \fBx2axis\fR the top X-axis, and \fBy2axis\fR the
right Y-axis.
.PP
They implicitly control the axis that is currently using to that
location.  By default, \fBxaxis\fR uses the \f(CWx\fR axis, \fByaxis\fR
uses \f(CWy\fR, \fBx2axis\fR uses \f(CWx2\fR, and \fBy2axis\fR uses
\f(CWy2\fR.  These components can be more convenient to use than always
determining what axes are current being displayed by the graph.
.PP
The following operations are available for axes. They mirror exactly
the operations of the \fBaxis\fR component.  The \fIaxis\fR argument
must be \fBxaxis\fR, \fBx2axis\fR, \fByaxis\fR, or \fBy2axis\fR.
.TP
\fIpathName \fIaxis \fBcget \fIoption\fR
.TP
\fIpathName \fIaxis \fBconfigure \fR?\fIoption value\fR?...
.TP
\fIpathName \fIaxis\fB invtransform \fIvalue\fR
.TP
\fIpathName \fIaxis \fBlimits\fR
.TP
\fIpathName \fIaxis\fB transform \fIvalue\fR
.TP
\fIpathName \fIaxis\fB use \fR?\fIaxisName\fR?  
Designates the axis \fIaxisName\fR is to be displayed at this
location.  \fIAxisName\fR can not be already in use at another location.  
This command returns the name of the axis currently using this location.
.SS "CROSSHAIRS COMPONENT"
Cross hairs consist of two intersecting lines (one vertical and one horizontal)
drawn completely across the plotting area.  They are used to position
the mouse in relation to the coordinate axes.  Cross hairs differ from line
markers in that they are implemented using XOR drawing primitives.
This means that they can be quickly drawn and erased without redrawing
the entire strip chart.
.PP
The following operations are available for cross hairs:
.TP
\fIpathName \fBcrosshairs cget \fIoption\fR
Returns the current value of the cross hairs configuration option
given by \fIoption\fR.  \fIOption\fR may be any option
described below for the cross hairs \fBconfigure\fR operation.
.TP
\fIpathName \fBcrosshairs configure \fR?\fIoption value\fR?...  
Queries or modifies the configuration options of the cross hairs.  If
\fIoption\fR isn't specified, a list describing all the current
options for the cross hairs is returned.  If \fIoption\fR is specified,
but not \fIvalue\fR, then a list describing \fIoption\fR is returned.
If one or more \fIoption\fR and \fIvalue\fR pairs are specified, then
for each pair, the cross hairs option \fIoption\fR is set to
\fIvalue\fR.
The following options are available for cross hairs.
.RS
.TP
\fB\-color \fIcolor\fR 
Sets the color of the cross hairs.  The default is \f(CWblack\fR.
.TP
\fB\-dashes \fIdashList\fR
Sets the dash style of the cross hairs. \fIDashList\fR is a list of up
to 11 numbers that alternately represent the lengths of the dashes
and gaps on the cross hair lines.  Each number must be between 1 and
255.  If \fIdashList\fR is \f(CW""\fR, the cross hairs will be solid
lines.
.TP
\fB\-hide \fIboolean\fR
Indicates whether cross hairs are drawn. If \fIboolean\fR is true,
cross hairs are not drawn.  The default is \f(CWyes\fR.
.TP
\fB\-linewidth \fIpixels\fR
Set the width of the cross hair lines.  The default is \f(CW1\fR.
.TP
\fB\-position \fIpos\fR 
Specifies the screen position where the cross hairs intersect.
\fIPos\fR must be in the form "\fI@x,y\fR", where \fIx\fR and \fIy\fR
are the window coordinates of the intersection.
.PP
Cross hairs configuration options may be also be set by the
\fBoption\fR command.  The resource name and class are
\f(CWcrosshairs\fR and \f(CWCrosshairs\fR respectively.
.CS
option add *Stripchart.Crosshairs.LineWidth 2
option add *Stripchart.Crosshairs.Color     red
.CE
.RE
.TP
\fIpathName \fBcrosshairs off\fR
Turns of the cross hairs. 
.TP
\fIpathName \fBcrosshairs on\fR
Turns on the display of the cross hairs.
.TP
\fIpathName \fBcrosshairs toggle\fR 
Toggles the current state of the cross hairs, alternately mapping and
unmapping the cross hairs.
.SS "ELEMENT COMPONENTS"
A data element represents a set of data.  It contains x and y vectors
containing the coordinates of the data points.  Elements can be
displayed with a symbol at each data point and lines connecting the
points.  Elements also control the appearance of the data, such as the
symbol type, line width, color etc.
.PP
When new data elements are created, they are automatically added to a
list of displayed elements.   The display list controls what elements
are drawn and in what order.  
.PP
The following operations are available for elements.
.TP
\fIpathName \fBelement activate \fIelemName \fR?\fIindex\fR?...
Specifies the data points of element \fIelemName\fR to be drawn
using active foreground and background colors.  \fIElemName\fR is the
name of the element and \fIindex\fR is a number representing the index
of the data point. If no indices are present then all data points
become active.
.TP
\fIpathName \fBelement cget \fIelemName \fIoption\fR
Returns the current value of the element configuration option given by 
\fIoption\fR.  \fIOption\fR may be any option described below
for the element \fBconfigure\fR operation.
.TP
\fIpathName \fBelement closest \fIx y\fR \fIvarName\fR ?\fIoption value\fR?... ?\fIelemName\fR?...
Finds the data point closest to the window coordinates \fIx\fR and
\fIy\fR in the element \fIelemName\fR.  \fIElemName\fR is the name of
an element, that must not be hidden.  If no elements are specified,
then all visible elements are searched.  It returns via the array
variable \fIvarName\fR the name of the closest element, the index of
its closest point, and the graph coordinates of the point. Returns
\f(CW0\fR, if no data point within the threshold distance can be found,
otherwise \f(CW1\fR is returned.  The following
\fIoption\fR\-\fIvalue\fR pairs are available.
.RS
.TP
\fB\-halo \fIpixels\fR
Specifies a threshold distance where selected data points are ignored.
\fIPixels\fR is a valid screen distance, such as \f(CW2\fR or \f(CW1.2i\fR.
If this option isn't specified, then it defaults to the value of the
stripchart's \fB\-halo\fR option.
.TP
\fB\-interpolate \fIboolean\fR
Indicates that both the data points and interpolated points along
the line segment formed should be considered.  If \fIboolean\fR 
is true, the closest line segment will be selected instead of the
closest point. If this option isn't specified, \fIboolean\fR defaults 
to \f(CW0\fR.
.RE
.TP
\fIpathName \fBelement configure \fIelemName \fR?\fIoption value\fR?...
Queries or modifies the configuration options for elements.  If
\fIoption\fR isn't specified, a list describing all the current
options for \fIelemName\fR is returned.  If \fIoption\fR is specified,
but not \fIvalue\fR, then a list describing the option \fIoption\fR is
returned.  If one or more \fIoption\fR and \fIvalue\fR pairs are
specified, then for each pair, the element option \fIoption\fR is set
to \fIvalue\fR.  The following options are valid for elements.
.RS
.TP
\fB\-activepen \fIpenName\fR
Specifies pen to use to draw active element.  If \fIpenName\fR is
\f(CW""\fR, no active elements will be drawn.  The default is 
\f(CWactiveLine\fR.
.TP
\fB\-color \fIcolor\fR 
Sets the color of the traces connecting the data points.  
.TP
\fB\-dashes \fIdashList\fR
Sets the dash style of element line. \fIDashList\fR is a list of up to
11 numbers that alternately represent the lengths of the dashes and
gaps on the element line.  Each number must be between 1 and 255.  If
\fIdashList\fR is \f(CW""\fR, the lines will be solid.
.TP
\fB\-data \fIcoordList\fR
Specifies the X\-Y coordinates of the data.  \fICoordList\fR is a
list of numeric expressions representing the X\-Y coordinate pairs
of each data point.
.TP
\fB\-fill \fIcolor\fR 
Sets the interior color of symbols.  If \fIcolor\fR is \f(CW""\fR, then
the interior of the symbol is transparent.  If \fIcolor\fR is
\f(CWdefcolor\fR, then the color will be the same as the \fB\-color\fR
option.  The default is \f(CWdefcolor\fR.
.TP
\fB\-hide \fIboolean\fR
Indicates whether the element is displayed.  The default is \f(CWno\fR.
.TP
\fB\-label \fItext\fR
Sets the element's label in the legend.  If \fItext\fR
is \f(CW""\fR, the element will have no entry in the legend.
The default label is the element's name.
.TP
\fB\-linewidth \fIpixels\fR 
Sets the width of the connecting lines between data points.  If
\fIpixels\fR is \f(CW0\fR, no connecting lines will be drawn between
symbols.  The default is \f(CW0\fR.
.TP
\fB\-mapx \fIxAxis\fR
Selects the X\-axis to map the element's X\-coordinates onto.
\fIXAxis\fR must be the name of an axis.  The default is \f(CWx\fR.
.TP
\fB\-mapy \fIyAxis\fR
Selects the Y\-axis to map the element's Y\-coordinates onto.
\fIYAxis\fR must be the name of an axis. The default is \f(CWy\fR.
.TP
\fB\-offdash \fIcolor\fR
Sets the color of the stripes when traces are dashed (see the
\fB\-dashes\fR option).  If \fIcolor\fR is \f(CW""\fR, then the "off"
pixels will represent gaps instead of stripes.  If \fIcolor\fR is
\f(CWdefcolor\fR, then the color will be the same as the \fB\-color\fR
option.  The default is \f(CWdefcolor\fR.
.TP
\fB\-outline \fIcolor\fR 
Sets the color or the outline around each symbol.  If \fIcolor\fR is
\f(CW""\fR, then no outline is drawn. If \fIcolor\fR is \f(CWdefcolor\fR,
then the color will be the same as the \fB\-color\fR option.  The
default is \f(CWdefcolor\fR.
.TP
\fB\-outlinewidth \fIpixels\fR 
Sets the width of the outline bordering each symbol.  If \fIpixels\fR
is \f(CW0\fR, no outline will be drawn. The default is \f(CW1\fR.
.TP
\fB\-pixels \fIpixels\fR
Sets the size of symbols.  If \fIpixels\fR is \f(CW0\fR, no symbols will
be drawn.  The default is \f(CW0.125i\fR.
.TP
\fB\-scalesymbols \fIboolean\fR 
If \fIboolean\fR is true, the size of the symbols
drawn for \fIelemName\fR will change with scale of the X\-axis and Y\-axis.
At the time this option is set, the current ranges of the axes are
saved as the normalized scales (i.e scale factor is 1.0) and the
element is drawn at its designated size (see the \fB\-pixels\fR
option).  As the scale of the axes change, the symbol will be scaled
according to the smaller of the X\-axis and Y\-axis scales.  If \fIboolean\fR
is false, the element's symbols are drawn at the designated size,
regardless of axis scales.  The default is \f(CW0\fR.
.TP
\fB\-smooth \fIsmooth\fR 
Specifies how connecting line segments are drawn between data points.
\fISmooth\fR can be either \f(CWlinear\fR, \f(CWstep\fR, \f(CWnatural\fR, or
\f(CWquadratic\fR.  If \fIsmooth\fR is \f(CWlinear\fR, a single line
segment is drawn, connecting both data points. When \fIsmooth\fR is
\f(CWstep\fR, two line segments are drawn. The first is a horizontal
line segment which steps the next x-coordinate.  The second is a
vertical line, moving to the next y-coordinate.  Both \fInatural\fR and
\fIquadratic\fR generate multiple segments between data points.  If
\fInatural\fR, the segments are generated using a cubic spline.  If
\fIquadratic\fR, a quadratic spline is used.  The default is
\fIlinear\fR.
.TP
\fB\-styles \fIstyleList\fR 
Specifies what pen to use based upon the range of weights given.
\fIStyleList\fR is a list of style specifications. Each style
specification, in turn, is a list consisting of a pen name, and
optionally a minimum and maximum range.  Data points whose weight (see
the \fB\-weight\fR option) falls in this range, are drawn with this
pen.  If no range is specified it defaults to the number of the pen in
the list. 
.TP
\fB\-symbol \fIsymbol\fR 
Specifies the symbol for data points.  \fISymbol\fR can be either
\f(CWsquare\fR, \f(CWcircle\fR, \f(CWdiamond\fR, \f(CWplus\fR, \f(CWcross\fR,
\f(CWsplus\fR, \f(CWscross\fR, \f(CWtriangle\fR, \f(CW""\fR (where no symbol
is drawn), or a bitmap.  Bitmaps are specified as "\fIsource\fR
?\fImask\fR?", where \fIsource\fR is the name of the bitmap, and
\fImask\fR is the bitmap's optional mask.  The default is
\f(CWcircle\fR.
.TP
\fB\-weights \fIwVec\fR 
Specifies the weights of the individual data points.  This, in
conjunction with the list pen styles (see the \fB\-styles\fR option)
controls how data points are drawn.  \fIWVec\fR is the name of a BLT
vector or a list of numeric expressions representing the weights for
each data point.
.TP
\fB\-xdata \fIxVec\fR 
Specifies the x-coordinates of the data.  \fIXVec\fR is the name of
a BLT vector or a list of numeric expressions.
.TP
\fB\-ydata \fIyVec\fR 
Specifies the y-coordinates of the data.  \fIYVec\fR is the name of
a BLT vector or a list of numeric expressions.
.PP
Element configuration options may also be set by the \fBoption\fR
command.  The resource class is \f(CWElement\fR. The resource name is
the name of the element.
.CS
option add *Stripchart.Element.symbol line
option add *Stripchart.e1.symbol line
.CE
.RE
.TP
\fIpathName \fBelement create \fIelemName\fR ?\fIoption value\fR?...
Creates a new element \fIelemName\fR.  It's an error is
an element \fIelemName\fR already exists.  If
additional arguments are present, they specify options valid for 
element \fBconfigure\fR operation.
.TP
\fIpathName \fBelement deactivate \fIelemName\fR ?\fIelemName\fR?...
Deactivates all the elements matching \fIpattern\fR.
Elements whose names match any of the patterns given are redrawn using
their normal colors.
.TP
\fIpathName \fBelement delete\fR ?\fIelemName\fR?...
Deletes all the named elements.  The graph is automatically redrawn.
.TP
\fIpathName \fBelement exists \fIelemName\fR
Returns \f(CW1\fR if an element \fIelemName\fR currently exists and \f(CW0\fR otherwise.
.TP
\fIpathName \fBelement names \fR?\fIpattern\fR?...  
Returns the elements matching one or more pattern.  If no
\fIpattern\fR is given, the names of all elements is returned.
.TP
\fIpathName \fBelement show\fR ?\fInameList\fR?  
Queries or modifies the element display list.  The element display
list designates the elements drawn and in what
order. \fINameList\fR is a list of elements to be displayed in the
order they are named.  If there is no \fInameList\fR argument,
the current display list is returned.
.TP
\fIpathName \fBelement type\fR \fIelemName\fR
Returns the type of \fIelemName\fR. 
If the element is a bar element, the commands returns the string
\f(CW"bar"\fR, otherwise it returns \f(CW"line"\fR.
.CE
.SS "GRID COMPONENT"
Grid lines extend from the major and minor ticks of each axis
horizontally or vertically across the plotting area.  The following
operations are available for grid lines.
.TP
\fIpathName \fBgrid cget \fIoption\fR
Returns the current value of the grid line configuration option given by 
\fIoption\fR.  \fIOption\fR may be any option described below
for the grid \fBconfigure\fR operation.
.TP
\fIpathName \fBgrid configure\fR ?\fIoption value\fR?...
Queries or modifies the configuration options for grid lines.  If
\fIoption\fR isn't specified, a list describing all the current
grid options for \fIpathName\fR is returned.  If \fIoption\fR is specified,
but not \fIvalue\fR, then a list describing \fIoption\fR is
returned.  If one or more \fIoption\fR and \fIvalue\fR pairs are
specified, then for each pair, the grid line option \fIoption\fR is set to
\fIvalue\fR.  The following options are valid for grid lines.
.RS
.TP
\fB\-color \fIcolor\fR 
Sets the color of the grid lines.  The default is \f(CWblack\fR.
.TP
\fB\-dashes \fIdashList\fR
Sets the dash style of the grid lines. \fIDashList\fR is a list of up
to 11 numbers that alternately represent the lengths of the dashes
and gaps on the grid lines.  Each number must be between 1 and 255.
If \fIdashList\fR is \f(CW""\fR, the grid will be solid lines.
.TP
\fB\-hide \fIboolean\fR
Indicates whether the grid should be drawn. If \fIboolean\fR
is true, grid lines are not shown. The default is \f(CWyes\fR.
.TP
\fB\-linewidth \fIpixels\fR
Sets the width of grid lines.  The default width is \f(CW1\fR.
.TP
\fB\-mapx \fIxAxis\fR
Specifies the X\-axis to display grid lines.  \fIXAxis\fR
must be the name of an axis.  The default is \f(CWx\fR.
.TP
\fB\-mapy \fIyAxis\fR
Specifies the Y\-axis to display grid lines.  \fIYAxis\fR
must be the name of an axis. The default is \f(CWy\fR.
.TP
\fB\-minor \fIboolean\fR
Indicates whether the grid lines should be drawn for minor ticks. 
If \fIboolean\fR is true, the lines will appear at
minor tick intervals.  The default is \f(CW1\fR.
.PP
Grid configuration options may also be set by the 
\fBoption\fR command.  The resource name and class are \f(CWgrid\fR and 
\f(CWGrid\fR respectively. 
.CS
option add *Stripchart.grid.LineWidth 2
option add *Stripchart.Grid.Color     black
.CE
.RE
.TP
\fIpathName \fBgrid off\fR
Turns off the display the grid lines.
.TP
\fIpathName \fBgrid on\fR
Turns on the display the grid lines.
.TP
\fIpathName \fBgrid toggle\fR
Toggles the display of the grid.  
.SS "LEGEND COMPONENT"
The legend displays a list of the data elements.  Each entry consists
of the element's symbol and label.  The legend can appear in any
margin (the default location is in the right margin).  It
can also be positioned anywhere within the plotting area.
.PP
The following operations are valid for the legend.
.TP
\fIpathName \fBlegend activate \fIpattern\fR...
Selects legend entries to be drawn using the active legend colors and relief.
All entries whose element names match \fIpattern\fR  are selected.  To
be selected, the element name must match only one \fIpattern\fR. 
.TP
\fIpathName \fBlegend cget \fIoption\fR
Returns the current value of a legend configuration option.
\fIOption\fR may be any option described below in the
legend \fBconfigure\fR operation.
.TP
\fIpathName \fBlegend configure \fR?\fIoption value\fR?...
Queries or modifies the configuration options for the legend.  If
\fIoption\fR isn't specified, a list describing the current
legend options for \fIpathName\fR is returned.  If \fIoption\fR is
specified, but not \fIvalue\fR, then a list describing \fIoption\fR is
returned.  If one or more \fIoption\fR and \fIvalue\fR pairs are
specified, then for each pair, the legend option \fIoption\fR is set
to \fIvalue\fR.  The following options are valid for the legend.
.RS
.TP
\fB\-activebackground \fIcolor\fR
Sets the background color for active legend entries.  All legend
entries marked active (see the legend \fBactivate\fR operation) are
drawn using this background color.
.TP
\fB\-activeborderwidth \fIpixels\fR
Sets the width of the 3-D border around the outside edge of the active legend
entries.  The default is \f(CW2\fR.
.TP
\fB\-activeforeground \fIcolor\fR
Sets the foreground color for active legend entries.  All legend
entries marked as active (see the legend \fBactivate\fR operation) are
drawn using this foreground color.
.TP
\fB\-activerelief \fIrelief\fR 
Specifies the 3-D effect desired for active legend entries.
\fIRelief\fR denotes how the interior of the entry should appear
relative to the legend; for example, \f(CWraised\fR means the entry
should appear to protrude from the legend, relative to the surface of
the legend.  The default is \f(CWflat\fR.
.TP
\fB\-anchor \fIanchor\fR
Tells how to position the legend relative to the positioning point for
the legend.  This is dependent on the value of the \fB\-position\fR
option.  The default is \f(CWcenter\fR.
.RS
.TP 1.25i
\f(CWleft\fR or \f(CWright\fR
The anchor describes how to position the legend vertically.  
.TP
\f(CWtop\fR or \f(CWbottom\fR
The anchor describes how to position the legend horizontally.  
.TP
\f(CW@x,y\fR
The anchor specifies how to position the legend relative to the
positioning point. For example, if \fIanchor\fR is \f(CWcenter\fR then
the legend is centered on the point; if \fIanchor\fR is \f(CWn\fR then
the legend will be drawn such that the top center point of the
rectangular region occupied by the legend will be at the positioning
point.
.TP
\f(CWplotarea\fR
The anchor specifies how to position the legend relative to the
plotting area. For example, if \fIanchor\fR is \f(CWcenter\fR then the
legend is centered in the plotting area; if \fIanchor\fR is \f(CWne\fR
then the legend will be drawn such that occupies the upper right
corner of the plotting area.
.RE
.TP
\fB\-background \fIcolor\fR
Sets the background color of the legend. If \fIcolor\fR is \f(CW""\fR,
the legend background with be transparent.
.TP
\fB\-borderwidth \fIpixels\fR
Sets the width of the 3-D border around the outside edge of the legend (if
such border is being drawn; the \fBrelief\fR option determines this).
The default is \f(CW2\fR pixels.
.TP
\fB\-font \fIfontName\fR 
\fIFontName\fR specifies a font to use when drawing the labels of each
element into the legend.  The default is
\f(CW*-Helvetica-Bold-R-Normal-*-12-120-*\fR.
.TP
\fB\-foreground \fIcolor\fR 
Sets the foreground color of the text drawn for the element's label.
The default is \f(CWblack\fR.
.TP
\fB\-hide \fIboolean\fR
Indicates whether the legend should be displayed. If \fIboolean\fR is
true, the legend will not be draw.  The default is \f(CWno\fR.
.TP
\fB\-ipadx \fIpad\fR 
Sets the amount of internal padding to be added to the width of each
legend entry.  \fIPad\fR can be a list of one or two screen distances.  If
\fIpad\fR has two elements, the left side of the legend entry is
padded by the first distance and the right side by the second.  If
\fIpad\fR is just one distance, both the left and right sides are padded
evenly.  The default is \f(CW2\fR.
.TP
\fB\-ipady \fIpad\fR
Sets an amount of internal padding to be added to the height of each
legend entry.  \fIPad\fR can be a list of one or two screen distances.  If
\fIpad\fR has two elements, the top of the entry is padded by the
first distance and the bottom by the second.  If \fIpad\fR is just
one distance, both the top and bottom of the entry are padded evenly.
The default is \f(CW2\fR.
.TP
\fB\-padx \fIpad\fR
Sets the padding to the left and right exteriors of the legend.
\fIPad\fR can be a list of one or two screen distances.  If \fIpad\fR
has two elements, the left side of the legend is padded by the first
distance and the right side by the second.  If \fIpad\fR has just one
distance, both the left and right sides are padded evenly.  The
default is \f(CW4\fR.
.TP
\fB\-pady \fIpad\fR
Sets the padding above and below the legend.  \fIPad\fR can be a list
of one or two screen distances.  If \fIpad\fR has two elements, the area above
the legend is padded by the first distance and the area below by the
second.  If \fIpad\fR is just one distance, both the top and
bottom areas are padded evenly.  The default is \f(CW0\fR.
.TP
\fB\-position \fIpos\fR
Specifies where the legend is drawn. The
\fB\-anchor\fR option also affects where the legend is positioned.  If
\fIpos\fR is \f(CWleft\fR, \f(CWleft\fR, \f(CWtop\fR, or \f(CWbottom\fR, the
legend is drawn in the specified margin.  If \fIpos\fR is
\f(CWplotarea\fR, then the legend is drawn inside the plotting area at a
particular anchor.  If \fIpos\fR is in the form "\fI@x,y\fR", where
\fIx\fR and \fIy\fR are the window coordinates, the legend is drawn in
the plotting area at the specified coordinates.  The default is
\f(CWright\fR.
.TP
\fB\-raised \fIboolean\fR
Indicates whether the legend is above or below the data elements.  This
matters only if the legend is in the plotting area.  If \fIboolean\fR
is true, the legend will be drawn on top of any elements that may
overlap it. The default is \f(CWno\fR.
.TP
\fB\-relief \fIrelief\fR
Specifies the 3-D effect for the border around the legend.
\fIRelief\fR specifies how the interior of the legend should appear
relative to the strip chart; for example, \f(CWraised\fR means the legend
should appear to protrude from the strip chart, relative to the surface of
the strip chart.  The default is \f(CWsunken\fR.
.PP
Legend configuration options may also be set by the \fBoption\fR
command.  The resource name and class are \f(CWlegend\fR and
\f(CWLegend\fR respectively.
.CS
option add *Stripchart.legend.Foreground blue
option add *Stripchart.Legend.Relief     raised
.CE
.RE
.TP
\fIpathName \fBlegend deactivate \fIpattern\fR...
Selects legend entries to be drawn using the normal legend colors and
relief.  All entries whose element names match \fIpattern\fR are
selected.  To be selected, the element name must match only one
\fIpattern\fR.
.TP
\fIpathName \fBlegend get \fIpos\fR
Returns the name of the element whose entry is at the screen position
\fIpos\fR in the legend.  \fIPos\fR must be in the form "\fI@x,y\fR",
where \fIx\fR and \fIy\fR are window coordinates.  If the given
coordinates do not lie over a legend entry, \f(CW""\fR is returned.
.SS "PEN COMPONENTS"
Pens define attributes (both symbol and line style) for elements.
Pens mirror the configuration options of data elements that pertain to
how symbols and lines are drawn.  Data elements use pens to determine
how they are drawn.  A data element may use several pens at once.  In
this case, the pen used for a particular data point is determined from
each element's weight vector (see the element's \fB\-weight\fR and
\fB\-style\fR options).
.PP
One pen, called \f(CWactiveLine\fR, is automatically created.
It's used as the default active pen for elements. So you can change
the active attributes for all elements by simply reconfiguring this
pen.
.CS
\&.s pen configure "activeLine" -color green
.CE
You can create and use any number of pens. To create a pen, invoke
the pen component and its create operation.
.CS
\&.s pen create myPen
.CE
You map pens to a data element using either the element's 
\fB\-pen\fR or \fB\-activepen\fR options.
.CS
\&.s element create "line1" -xdata $x -ydata $tempData \\
    -pen myPen
.CE
An element can use several pens at once. This is done by specifying
the name of the pen in the element's style list (see the
\fB\-styles\fR option).
.CS
\&.s element configure "line1" -styles { myPen 2.0 3.0 }
.CE
This says that any data point with a weight between 2.0 and 3.0
is to be drawn using the pen \f(CWmyPen\fR.  All other points
are drawn with the element's default attributes.
.PP
The following operations are available for pen components.
.PP
.TP
\fIpathName \fBpen \fBcget \fIpenName \fIoption\fR
Returns the current value of the option given by \fIoption\fR for
\fIpenName\fR.  \fIOption\fR may be any option described below
for the pen \fBconfigure\fR operation.
.TP
\fIpathName \fBpen \fBconfigure \fIpenName \fR?\fIoption value\fR?...
Queries or modifies the configuration options of \fIpenName\fR.  If
\fIoption\fR isn't specified, a list describing the current
options for \fIpenName\fR is returned.  If \fIoption\fR is specified, but
not \fIvalue\fR, then a list describing \fIoption\fR is
returned.  If one or more \fIoption\fR and \fIvalue\fR pairs are
specified, then for each pair, the pen option \fIoption\fR is set to
\fIvalue\fR.  
The following options are valid for pens.
.RS
.TP
\fB\-color \fIcolor\fR 
Sets the color of the traces connecting the data points.  
.TP
\fB\-dashes \fIdashList\fR
Sets the dash style of element line. \fIDashList\fR is a list of up to
11 numbers that alternately represent the lengths of the dashes and
gaps on the element line.  Each number must be between 1 and 255.  If
\fIdashList\fR is \f(CW""\fR, the lines will be solid.
.TP
\fB\-fill \fIcolor\fR 
Sets the interior color of symbols.  If \fIcolor\fR is \f(CW""\fR, then
the interior of the symbol is transparent.  If \fIcolor\fR is
\f(CWdefcolor\fR, then the color will be the same as the \fB\-color\fR
option.  The default is \f(CWdefcolor\fR.
.TP
\fB\-linewidth \fIpixels\fR 
Sets the width of the connecting lines between data points.  If
\fIpixels\fR is \f(CW0\fR, no connecting lines will be drawn between
symbols.  The default is \f(CW0\fR.
.TP
\fB\-offdash \fIcolor\fR
Sets the color of the stripes when traces are dashed (see the
\fB\-dashes\fR option).  If \fIcolor\fR is \f(CW""\fR, then the "off"
pixels will represent gaps instead of stripes.  If \fIcolor\fR is
\f(CWdefcolor\fR, then the color will be the same as the \fB\-color\fR
option.  The default is \f(CWdefcolor\fR.
.TP
\fB\-outline \fIcolor\fR 
Sets the color or the outline around each symbol.  If \fIcolor\fR is
\f(CW""\fR, then no outline is drawn. If \fIcolor\fR is \f(CWdefcolor\fR,
then the color will be the same as the \fB\-color\fR option.  The
default is \f(CWdefcolor\fR.
.TP
\fB\-outlinewidth \fIpixels\fR 
Sets the width of the outline bordering each symbol.  If \fIpixels\fR
is \f(CW0\fR, no outline will be drawn. The default is \f(CW1\fR.
.TP
\fB\-pixels \fIpixels\fR
Sets the size of symbols.  If \fIpixels\fR is \f(CW0\fR, no symbols will
be drawn.  The default is \f(CW0.125i\fR.
.TP
\fB\-symbol \fIsymbol\fR 
Specifies the symbol for data points.  \fISymbol\fR can be either
\f(CWsquare\fR, \f(CWcircle\fR, \f(CWdiamond\fR, \f(CWplus\fR, \f(CWcross\fR,
\f(CWsplus\fR, \f(CWscross\fR, \f(CWtriangle\fR, \f(CW""\fR (where no symbol
is drawn), or a bitmap.  Bitmaps are specified as "\fIsource\fR
?\fImask\fR?", where \fIsource\fR is the name of the bitmap, and
\fImask\fR is the bitmap's optional mask.  The default is
\f(CWcircle\fR.
.TP
\fB\-type \fIelemType\fR 
Specifies the type of element the pen is to be used with.
This option should only be employed when creating the pen.  This
is for those that wish to mix different types of elements (bars and
lines) on the same graph.  The default type is "line".
.PP
Pen configuration options may be also be set by the \fBoption\fR
command.  The resource class is \f(CWPen\fR.  The resource names
are the names of the pens.
.CS
option add *Stripchart.Pen.Color  blue
option add *Stripchart.activeLine.color  green
.CE
.RE
.TP
\fIpathName \fBpen \fBcreate \fIpenName \fR?\fIoption value\fR?...
Creates a new pen by the name \fIpenName\fR.  No pen by the same
name can already exist. \fIOption\fR and \fIvalue\fR are described 
in above in the pen \fBconfigure\fR operation.
.TP
\fIpathName \fBpen \fBdelete \fR?\fIpenName\fR?...
Deletes the named pens. A pen is not really
deleted until it is not longer in use, so it's safe to delete
pens mapped to elements.
.TP
\fIpathName \fBpen names \fR?\fIpattern\fR?...
Returns a list of pens matching zero or more patterns.  If no
\fIpattern\fR argument is give, the names of all pens are returned.
.SS "POSTSCRIPT COMPONENT"
The strip chart can generate encapsulated PostScript output.  There
are several configuration options you can specify to control how the
plot is generated.  You can change the page dimensions and
borders.  The plot itself can be scaled, centered, or rotated to
landscape.  The PostScript output can be written directly to a file or
returned through the interpreter.
.PP
The following postscript operations are available.
.TP
\fIpathName \fBpostscript cget \fIoption\fR 
Returns the current value of the postscript option given by
\fIoption\fR.  \fIOption\fR may be any option described
below for the postscript \fBconfigure\fR operation.
.TP
\fIpathName \fBpostscript configure \fR?\fIoption value\fR?...
Queries or modifies the configuration options for PostScript
generation.  If \fIoption\fR isn't specified, a list describing 
the current postscript options for \fIpathName\fR is returned.  If
\fIoption\fR is specified, but not \fIvalue\fR, then a list describing
\fIoption\fR is returned.  If one or more \fIoption\fR and \fIvalue\fR
pairs are specified, then for each pair, the postscript option
\fIoption\fR is set to \fIvalue\fR.  The following postscript options
are available.
.RS
.TP
\fB\-center \fIboolean\fR
Indicates whether the plot should be centered on the PostScript page.  If
\fIboolean\fR is false, the plot will be placed in the upper left
corner of the page.  The default is \f(CW1\fR.
.TP
\fB\-colormap \fIvarName\fR
\fIVarName\fR must be the name of a global array variable that
specifies a color mapping from the X color name to PostScript.  Each
element of \fIvarName\fR must consist of PostScript code to set a
particular color value (e.g. ``\f(CW1.0 1.0 0.0 setrgbcolor\fR'').  When
outputting color information in PostScript, the array variable \fIvarName\fR 
is checked to see if an element of the name of the color exists. If so, 
it uses the value of the element as the PostScript
command to set the color.  If this option hasn't been specified, or if
there isn't an entry in \fIvarName\fR for a given color, then it uses
the red, green, and blue intensities from the X color.
.TP
\fB\-colormode \fImode\fR
Specifies how to output color information.  \fIMode\fR must be either
\f(CWcolor\fR (for full color output), \f(CWgray\fR (convert all colors to
their gray-scale equivalents) or \f(CWmono\fR (convert foreground colors
to black and background colors to white).  The default mode is
\f(CWcolor\fR. 
.TP
\fB\-fontmap \fIvarName\fR
\fIVarName\fR must be the name of a global array variable that
specifies a font mapping from the X font name to PostScript.  Each
element of \fIvarName\fR must consist of a Tcl list with one or two
elements, which are the name and point size of a PostScript font.
When outputting PostScript commands for a particular font, the 
array variable \fIvarName\fR is checked to see an element of the specified 
font exists.  If there is such an element, then the font
information contained in that element is used in the PostScript
output.  (If the point size is omitted from the list, the point size
of the X font is used).  Otherwise the X font is examined in an
attempt to guess what PostScript font to use.  This works only for
fonts whose foundry property is \fIAdobe\fR (such as Times, Helvetica,
Courier, etc.).  If all of this fails then the font defaults to
\f(CWHelvetica-Bold\fR.
.TP
\fB\-decorations \fIboolean\fR
Indicates if PostScript commands to generate color backgrounds and 3-D
borders should be output.  If \fIboolean\fR is false, the background will 
be white and no 3-D borders will be generated. The
default is \f(CW1\fR.
.TP
\fB\-height \fIpixels\fR
Sets the height of the plot.  This lets you plot the stripchart with a
height different from the one displayed on the screen.  If
\fIpixels\fR is 0, the height is the same as the displayed height.
The default is \f(CW0\fR.
.TP
\fB\-landscape \fIboolean\fR
If \fIboolean\fR is true, this specifies the printed area is to be
rotated 90 degrees.  In non-rotated output the X-axis of the printed
area runs along the short dimension of the page (``portrait''
orientation); in rotated output the X-axis runs along the long
dimension of the page (``landscape'' orientation).  Defaults to
\f(CW0\fR.
.TP
\fB\-maxpect \fIboolean\fR
Indicates to scale the the plot so that it fills the PostScript page.
The aspect ratio of the strip chart is still retained.  The default is
\f(CW0\fR.
.TP
\fB\-padx \fIpad\fR
Sets the horizontal padding for the left and right page borders.  The
borders are exterior to the plot.  \fIPad\fR can be a list of one or
two screen distances.  If \fIpad\fR has two elements, the left border is padded
by the first distance and the right border by the second.  If
\fIpad\fR has just one distance, both the left and right borders are
padded evenly.  The default is \f(CW1i\fR.
.TP
\fB\-pady \fIpad\fR 
Sets the vertical padding for the top and bottom page borders. The
borders are exterior to the plot.  \fIPad\fR can be a list of one or
two screen distances.  If \fIpad\fR has two elements, the top border is padded
by the first distance and the bottom border by the second.  If
\fIpad\fR has just one distance, both the top and bottom borders are
padded evenly.  The default is \f(CW1i\fR.
.TP
\fB\-paperheight \fIpixels\fR
Sets the height of the postscript page.  This can be used to select
between different page sizes (letter, A4, etc).  The default height is
\f(CW11.0i\fR.
.TP
\fB\-paperwidth \fIpixels\fR
Sets the width of the postscript page.  This can be used to select
between different page sizes (letter, A4, etc).  The default width is
\f(CW8.5i\fR.
.TP
\fB\-width \fIpixels\fR
Sets the width of the plot.  This lets you plot the strip chart with a
width different from the one drawn on the screen.  If \fIpixels\fR
is 0, the width is the same as the widget's width.  The default is
\f(CW0\fR.
.PP
Postscript configuration options may be also be set by the
\fBoption\fR command.  The resource name and class are
\f(CWpostscript\fR and \f(CWPostscript\fR respectively.
.CS
option add *Stripchart.postscript.Decorations false
option add *Stripchart.Postscript.Landscape   true
.CE
.RE
.TP
\fIpathName \fBpostscript output \fR?\fIfileName\fR? ?\fIoption value\fR?...
Outputs a file of encapsulated PostScript.  If a
\fIfileName\fR argument isn't present, the command returns the
PostScript. If any \fIoption-value\fR pairs are present, they set
configuration options controlling how the PostScript is generated.
\fIOption\fR and \fIvalue\fR can be anything accepted by the
postscript \fBconfigure\fR operation above.
.SS "MARKER COMPONENTS"
Markers are simple drawing procedures used to annotate or highlight
areas of the strip chart.  Markers have various types: text strings,
bitmaps, images, connected lines, windows, or polygons.  They can be
associated with a particular element, so that when the element is
hidden or un-hidden, so is the marker.  By default, markers are the
last items drawn, so that data elements will appear in
behind them.  You can change this by configuring the \fB\-under\fR
option.
.PP
Markers, in contrast to elements, don't affect the scaling of the
coordinate axes.  They can also have \fIelastic\fR coordinates
(specified by \f(CW-Inf\fR and \f(CWInf\fR respectively) that translate
into the minimum or maximum limit of the axis.  For example, you can
place a marker so it always remains in the lower left corner of the
plotting area, by using the coordinates \f(CW-Inf\fR,\f(CW-Inf\fR.
.PP
The following operations are available for markers.
.TP
\fIpathName \fBmarker after \fImarkerId\fR ?\fIafterId\fR?
Changes the order of the markers, drawing the first
marker after the second.  If no second \fIafterId\fR argument is
specified, the marker is placed at the end of the display list.  This
command can be used to control how markers are displayed since markers
are drawn in the order of this display list.
.TP
\fIpathName \fBmarker before \fImarkerId\fR ?\fIbeforeId\fR?
Changes the order of the markers, drawing the first
marker before the second.  If no second \fIbeforeId\fR argument is
specified, the marker is placed at the beginning of the display list.
This command can be used to control how markers are displayed since
markers are drawn in the order of this display list.
.TP
\fIpathName \fBmarker cget \fIoption\fR
Returns the current value of the marker configuration option given by
\fIoption\fR.  \fIOption\fR may be any option described
below in the \fBconfigure\fR operation.
.TP
\fIpathName \fBmarker configure \fImarkerId\fR ?\fIoption value\fR?...
Queries or modifies the configuration options for markers.  If
\fIoption\fR isn't specified, a list describing the current
options for \fImarkerId\fR is returned.  If \fIoption\fR is specified,
but not \fIvalue\fR, then a list describing \fIoption\fR is returned.
If one or more \fIoption\fR and \fIvalue\fR pairs are specified, then
for each pair, the marker option \fIoption\fR is set to \fIvalue\fR.
.sp
The following options are valid for all markers.
Each type of marker also has its own type-specific options.  
They are described in the sections below.
.RS
.TP
\fB\-coords \fIcoordList\fR
Specifies the coordinates of the marker.  \fICoordList\fR is 
a list of graph coordinates.  The number of coordinates required
is dependent on the type of marker.  Text, image, and window markers
need only two coordinates (an X\-Y coordinate).   Bitmap markers
can take either two or four coordinates (if four, they represent the
corners of the bitmap). Line markers
need at least four coordinates, polygons at least six.
If \fIcoordList\fR is \f(CW""\fR, the marker will not be displayed.
The default is \f(CW""\fR.
.TP
\fB\-element \fIelemName\fR
Links the marker with the element \fIelemName\fR.  The marker is
drawn only if the element is also currently displayed (see the
element's \fBshow\fR operation).  If \fIelemName\fR is \f(CW""\fR, the
marker is always drawn.  The default is \f(CW""\fR.
.TP
\fB\-hide \fIboolean\fR 
Indicates whether the marker is drawn. If \fIboolean\fR is true,
the marker is not drawn.  The default is \f(CWno\fR.
.TP
\fB\-mapx \fIxAxis\fR 
Specifies the X\-axis to map the marker's X\-coordinates onto.
\fIXAxis\fR must the name of an axis.  The default is \f(CWx\fR.
.TP
\fB\-mapy \fIyAxis\fR
Specifies the Y\-axis to map the marker's Y\-coordinates onto.
\fIYAxis\fR must the name of an axis.  The default is \f(CWy\fR.
.TP
\fB\-name \fImarkerId\fR
Changes the identifier for the marker.  The identifier \fImarkerId\fR 
can not already be used by another marker.  If this option
isn't specified, the marker's name is uniquely generated.
.TP
\fB\-under \fIboolean\fR
Indicates whether the marker is drawn below/above data
elements.  If \fIboolean\fR is true, the marker is be drawn
underneath the data element symbols and lines.  Otherwise, the marker is
drawn on top of the element.  The default is \f(CW0\fR.
.TP
\fB\-xoffset \fIpixels\fR
Specifies a screen distance to offset the marker horizontally. 
\fIPixels\fR is a valid screen distance, such as \f(CW2\fR or \f(CW1.2i\fR.
The default is \f(CW0\fR.
.TP
\fB\-yoffset \fIpixels\fR
Specifies a screen distance to offset the markers vertically.
\fIPixels\fR is a valid screen distance, such as \f(CW2\fR or \f(CW1.2i\fR.
The default is \f(CW0\fR.
.PP
Marker configuration options may also be set by the \fBoption\fR command.
The resource class is either \f(CWBitmapMarker\fR,  \f(CWImageMarker\fR, 
\f(CWLineMarker\fR, \f(CWPolygonMarker\fR, \f(CWTextMarker\fR, or \f(CWWindowMarker\fR,
depending on the type of marker.  The resource name is the name of the
marker.
.CS
option add *Stripchart.TextMarker.Foreground white
option add *Stripchart.BitmapMarker.Foreground white
option add *Stripchart.m1.Background     blue
.CE
.RE
.TP
\fIpathName \fBmarker create \fItype\fR ?\fIoption value\fR?...
Creates a marker of the selected type. \fIType\fR may be either
\f(CWtext\fR, \f(CWline\fR, \f(CWbitmap\fR, \f(CWimage\fR, \f(CWpolygon\fR, or
\f(CWwindow\fR.  This command returns the marker identifier, 
used as the \fImarkerId\fR argument in the other marker-related
commands.  If the \fB\-name\fR option is used, this overrides the
normal marker identifier.  If the name provided is already used for
another marker, the new marker will replace the old.
.TP
\fIpathName \fBmarker delete\fR ?\fIname\fR?...
Removes one of more markers.  The graph will automatically be redrawn
without the marker.\fR.  
.TP
\fIpathName \fBmarker exists \fImarkerId\fR 
Returns \f(CW1\fR if the marker \fImarkerId\fR exists and \f(CW0\fR
otherwise.
.TP
\fIpathName \fBmarker names\fR ?\fIpattern\fR?  
Returns the names of all the markers that currently exist.  If
\fIpattern\fR is supplied, only those markers whose names match it
will be returned.
.TP
\fIpathName \fBmarker type \fImarkerId\fR 
Returns the type of the marker given by \fImarkerId\fR, such as
\f(CWline\fR or \f(CWtext\fR.  If \fImarkerId\fR is not a valid a marker
identifier, \f(CW""\fR is returned.
.SS "BITMAP MARKERS"
A bitmap marker displays a bitmap.  The size of the
bitmap is controlled by the number of coordinates specified.  If two
coordinates, they specify the position of the top-left corner of the
bitmap.  The bitmap retains its normal width and height.  If four
coordinates, the first and second pairs of coordinates represent the
corners of the bitmap.  The bitmap will be stretched or reduced as
necessary to fit into the bounding rectangle.
.PP
Bitmap markers are created with the marker's \fBcreate\fR operation in
the form:
.DS
\fIpathName \fBmarker create bitmap \fR?\fIoption value\fR?...
.DE
There may be many \fIoption\fR-\fIvalue\fR pairs, each 
sets a configuration options for the marker.  These
same \fIoption\fR\-\fIvalue\fR pairs may be used with the marker's
\fBconfigure\fR operation.
.PP
The following options are specific to bitmap markers:
.TP
\fB\-background \fIcolor\fR
Sets the background color of the bitmap.  If \fIcolor\fR is \f(CW""\fR,
the background color will be transparent.  The default background
color is \f(CWwhite\fR.
.TP
\fB\-bitmap \fIbitmap\fR
Specifies the bitmap to be displayed.  If \fIbitmap\fR is \f(CW""\fR,
the marker will not be displayed.  The default is \f(CW""\fR.
.TP
\fB\-foreground \fIcolor\fR 
Sets the foreground color of the bitmap.  The default foreground color
is \f(CWblack\fR.
.TP
\fB\-mask \fImask\fR
Specifies a mask for the bitmap to be displayed. This mask is a bitmap
itself, denoting the pixels that are transparent.  If \fImask\fR is
\f(CW""\fR, all pixels of the bitmap will be drawn.  The default is
\f(CW""\fR.
.TP
\fB\-rotate \fItheta\fR
Sets the rotation of the bitmap.  \fITheta\fR is a real number
representing the angle of rotation in degrees.  The marker is first
rotated and then placed according to its anchor position.  The default
rotation is \f(CW0.0\fR.
.SS "IMAGE MARKERS"
A image marker displays an image.  Image markers are
created with the marker's \fBcreate\fR operation in the form:
.DS
\fIpathName \fBmarker create image \fR?\fIoption value\fR?...
.DE
There may be many \fIoption\fR-\fIvalue\fR
pairs, each sets a configuration option
for the marker.  These same \fIoption\fR\-\fIvalue\fR pairs may be
used with the marker's \fBconfigure\fR operation.
.PP
The following options are specific to image markers:
.TP
\fB\-anchor \fIanchor\fR
\fIAnchor\fR tells how to position the image relative to the
positioning point for the image. For example, if \fIanchor\fR
is \f(CWcenter\fR then the image is centered on the point;  if
\fIanchor\fR is \f(CWn\fR then the image will be drawn such that
the top center point of the rectangular region occupied by the
image will be at the positioning point.
This option defaults to \f(CWcenter\fR.
.TP
\fB\-image \fIimage\fR
Specifies the image to be drawn.
If \fIimage\fR is \f(CW""\fR, the marker will not be
drawn.  The default is \f(CW""\fR.
.SS "LINE MARKERS"
A line marker displays one or more connected line segments.
Line markers are created with marker's \fBcreate\fR operation in the form:
.DS
\fIpathName \fBmarker create line \fR?\fIoption value\fR?...
.DE
There may be many \fIoption\fR-\fIvalue\fR
pairs, each sets a configuration option
for the marker.  These same \fIoption\fR-\fIvalue\fR pairs may be
used with the marker's \fBconfigure\fR operation.
.PP
The following options are specific to line markers:
.TP
\fB\-background \fIcolor\fR
Sets the background color of the line.
The option is affects the line color only when the \fB\-stipple\fR option 
is set.  
If this option isn't specified then it defaults to \f(CWwhite\fR.
.TP
\fB\-dashes \fIdashList\fR
Sets the dash style of the line. \fIDashList\fR is a list of up to 11
numbers that alternately represent the lengths of the dashes and gaps
on the line.  Each number must be between 1 and 255.  If
\fIdashList\fR is \f(CW""\fR, the marker line will be solid.
.TP
\fB\-foreground \fIcolor\fR
Sets the foreground color.  The default foreground color is \f(CWblack\fR.
.TP
\fB\-linewidth \fIpixels\fR
Sets the width of the lines.
The default width is \f(CW0\fR.
.TP
\fB\-stipple \fIbitmap\fR
Specifies a stipple pattern used to draw the line, rather than
a solid line.
\fIBitmap\fR specifies a bitmap to use as the stipple
pattern.  If \fIbitmap\fR is \f(CW""\fR, then the
line is drawn in a solid fashion. The default is \f(CW""\fR.
.SS "POLYGON MARKERS"
A polygon marker displays a closed region described as two or more
connected line segments.  It is assumed the first and
last points are connected.  Polygon markers are created using the
marker \fBcreate\fR operation in the form:
.DS
\fIpathName \fBmarker create polygon \fR?\fIoption value\fR?...
.DE
There may be many \fIoption\fR-\fIvalue\fR
pairs, each sets a configuration option
for the marker.  These same \fIoption\fR\-\fIvalue\fR pairs may be
used with the \fBmarker configure\fR command to change the marker's
configuration.
The following options are supported for polygon markers:
.TP
\fB\-dashes \fIdashList\fR
Sets the dash style of the outline of the polygon. \fIDashList\fR is a
list of up to 11 numbers that alternately represent the lengths of
the dashes and gaps on the outline.  Each number must be between 1 and
255. If \fIdashList\fR is \f(CW""\fR, the outline will be a solid line.
.TP
\fB\-fill \fIcolor\fR
Sets the fill color of the polygon.  If \fIcolor\fR is \f(CW""\fR, then
the interior of the polygon is transparent.
The default is \f(CWwhite\fR.
.TP
\fB\-linewidth \fIpixels\fR
Sets the width of the outline of the polygon. If \fIpixels\fR is zero, 
no outline is drawn. The default is \f(CW0\fR.
.TP
\fB\-outline \fIcolor\fR
Sets the color of the outline of the polygon.  If the polygon is
stippled (see the \fB\-stipple\fR option), then this represents the
foreground color of the stipple.  The default is \f(CWblack\fR.
.TP
\fB\-stipple \fIbitmap\fR
Specifies that the polygon should be drawn with a stippled pattern
rather than a solid color. \fIBitmap\fR specifies a bitmap to use as
the stipple pattern.  If \fIbitmap\fR is \f(CW""\fR, then the polygon is
filled with a solid color (if the \fB\-fill\fR option is set).  The
default is \f(CW""\fR.
.SS "TEXT MARKERS"
A text marker displays a string of characters on one or more lines of
text.  Embedded newlines cause line breaks.  They may be used to
annotate regions of the strip chart.  Text markers are created with the
\fBcreate\fR operation in the form:
.DS
\fIpathName \fBmarker create text \fR?\fIoption value\fR?...
.DE
There may be many \fIoption\fR-\fIvalue\fR pairs, 
each sets a configuration option for the text marker.  
These same \fIoption\fR\-\fIvalue\fR pairs may be used with the 
marker's \fBconfigure\fR operation.  
.PP
The following options are specific to text markers:
.TP
\fB\-anchor \fIanchor\fR
\fIAnchor\fR tells how to position the text relative to the
positioning point for the text. For example, if \fIanchor\fR is
\f(CWcenter\fR then the text is centered on the point; if
\fIanchor\fR is \f(CWn\fR then the text will be drawn such that the
top center point of the rectangular region occupied by the text will
be at the positioning point.  This default is \f(CWcenter\fR.
.TP
\fB\-background \fIcolor\fR
Sets the background color of the text string.  If \fIcolor\fR is
\f(CW""\fR, the background will be transparent.  The default is
\f(CWwhite\fR.
.TP
\fB\-font \fIfontName\fR
Specifies the font of the text.  The default is
\f(CW*-Helvetica-Bold-R-Normal-*-120-*\fR.
.TP
\fB\-foreground \fIcolor\fR
Sets the foreground color of the text.  The default is \f(CWblack\fR.
.TP
\fB\-justify \fIjustify\fR
Specifies how the text should be justified.  This matters only when
the marker contains more than one line of text. \fIJustify\fR must be
\f(CWleft\fR, \f(CWright\fR, or \f(CWcenter\fR.  The default is
\f(CWcenter\fR.
.TP
\fB\-padx \fIpad\fR
Sets the padding to the left and right exteriors of the text.
\fIPad\fR can be a list of one or two screen distances.  If \fIpad\fR
has two elements, the left side of the text is padded by the first
distance and the right side by the second.  If \fIpad\fR has just one
distance, both the left and right sides are padded evenly.  The
default is \f(CW4\fR.
.TP
\fB\-pady \fIpad\fR
Sets the padding above and below the text.  \fIPad\fR can be a list of
one or two screen distances.  If \fIpad\fR has two elements, the area above the
text is padded by the first distance and the area below by the second.
If \fIpad\fR is just one distance, both the top and bottom areas
are padded evenly.  The default is \f(CW4\fR.
.TP
\fB\-rotate \fItheta\fR
Specifies the number of degrees to rotate the text.  \fITheta\fR is a
real number representing the angle of rotation.  The marker is first
rotated along its center and is then drawn according to its anchor
position. The default is \f(CW0.0\fR.
.TP
\fB\-text \fItext\fR
Specifies the text of the marker.  The exact way the text is
displayed may be affected by other options such as \fB\-anchor\fR or
\fB\-rotate\fR.
.SS "WINDOW MARKERS"
A window marker displays a widget at a given position.
Window markers are created with the marker's \fBcreate\fR operation in
the form:
.DS
\fIpathName \fBmarker create window \fR?\fIoption value\fR?...
.DE
There may be many \fIoption\fR-\fIvalue\fR
pairs, each sets a configuration option
for the marker.  These same \fIoption\fR\-\fIvalue\fR pairs may be
used with the marker's \fBconfigure\fR command.
.PP
The following options are specific to window markers:
.TP
\fB\-anchor \fIanchor\fR
\fIAnchor\fR tells how to position the widget relative to the
positioning point for the widget. For example, if \fIanchor\fR is
\f(CWcenter\fR then the widget is centered on the point; if \fIanchor\fR
is \f(CWn\fR then the widget will be displayed such that the top center
point of the rectangular region occupied by the widget will be at the
positioning point.  This option defaults to \f(CWcenter\fR.
.TP
\fB\-height \fIpixels\fR
Specifies the height to assign to the marker's window.  If this option
isn't specified, or if it is specified as \f(CW""\fR, then the window is
given whatever height the widget requests internally.
.TP
\fB\-width \fIpixels\fR
Specifies the width to assign to the marker's window.  If this option
isn't specified, or if it is specified as \f(CW""\fR, then the window is
given whatever width the widget requests internally.
.TP
\fB\-window \fIpathName\fR
Specifies the widget to be managed.  \fIPathName\fR must
be a child of the \fBstripchart\fR widget.
.SH "GRAPH COMPONENT BINDINGS"
Specific stripchart components, such as elements, markers and legend
entries, can have a command trigger when event occurs in them, much
like canvas items in Tk's canvas widget.  Not all event sequences are
valid.  The only binding events that may be specified are those
related to the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR).
.sp
Only one element or marker can be picked during an event.  This means,
that if the mouse is directly over both an element and a marker, only
the uppermost component is selected.  This isn't true for legend entries.  
Both a legend entry and an element (or marker) binding commands 
will be invoked if both items are picked.
.sp
It is possible for multiple bindings to match a particular event.
This could occur, for example, if one binding is associated with the
element name and another is associated with one of the element's tags
(see the \fB\-bindtags\fR option).  When this occurs, all of the 
matching bindings are invoked.  A binding associated with the element
name is invoked first, followed by one binding for each of the element's 
bindtags.  If there are multiple matching bindings for a single tag, 
then only the most specific binding is invoked.  A continue command 
in a binding script terminates that script, and a break command 
terminates that script and skips any remaining scripts for the event, 
just as for the bind command.
.sp
The \fB\-bindtags\R option for these components controls addition
tag names which can be matched.  Implicitly elements and markers
always have tags matching their names.  Setting the value of
the \fB\-bindtags\fR option doesn't change this.
.SH "C LANGUAGE API"
You can manipulate data elements from the C language.  There
may be situations where it is too expensive to translate the data
values from ASCII strings.  Or you might want to read data in a
special file format.
.PP
Data can manipulated from the C language using BLT vectors.
You specify the x and y data coordinates of an element as vectors and
manipulate the vector from C.  The strip chart will be redrawn automatically
after the vectors are updated.
.PP
From Tcl, create the vectors and configure the element to use them.
.CS
vector X Y
\&.s element configure line1 -xdata X -ydata Y
.CE
To set data points from C, you pass the values as arrays of doubles
using the \fBBlt_ResetVector\fR call.  The vector is reset with the
new data and at the next idle point (when Tk re-enters its event
loop), the strip chart will be redrawn automatically.
.CS
#include <tcl.h>
#include <blt.h>

register int i;
Blt_Vector *xVec, *yVec;
double x[50], y[50];

/* Get the BLT vectors "X" and "Y" (created above from Tcl) */
if ((Blt_GetVector(interp, "X", 50, &xVec) != TCL_OK) ||
    (Blt_GetVector(interp, "Y", 50, &yVec) != TCL_OK)) {
    return TCL_ERROR;
}

for (i = 0; i < 50; i++) {
    x[i] = i * 0.02;
    y[i] = sin(x[i]);
}	

/* Put the data into BLT vectors */
if ((Blt_ResetVector(xVec, x, 50, 50, TCL_VOLATILE) != TCL_OK) ||
    (Blt_ResetVector(yVec, y, 50, 50, TCL_VOLATILE) != TCL_OK)) {
   return TCL_ERROR;
}
.CE
See the \fBvector\fR manual page for more details.
.SH SPEED TIPS
There may be cases where the strip chart needs to be drawn and updated as
quickly as possible.  If drawing speed becomes a big
problem, here are a few tips to speed up displays.
.TP 2
\(bu 
Try to minimize the number of data points.  The more data points
the looked at, the more work the strip chart must do.
.TP 2
\(bu 
If your data is generated as floating point values, the time required
to convert the data values to and from ASCII strings can be
significant, especially when there any many data points.  You can
avoid the redundant string-to-decimal conversions using the C API to
BLT vectors.
.TP 2
\(bu
Data elements without symbols are drawn faster than with symbols.
Set the data element's \fB\-symbol\fR option to \f(CWnone\fR.  If you need to
draw symbols, try using the simple symbols such as \f(CWsplus\fR and
\f(CWscross\fR.
.TP 2
\(bu
Don't stipple or dash the element.  Solid lines are much faster.
.TP 2
\(bu 
If you update data elements frequently, try turning off the
widget's \fB\-bufferelements\fR option.  When the strip chart is first
displayed, it draws data elements into an internal pixmap.  The pixmap
acts as a cache, so that when the strip chart needs to be redrawn again, and
the data elements or coordinate axes haven't changed, the pixmap is
simply copied to the screen.  This is especially useful when you are
using markers to highlight points and regions on the strip chart.  But if
the strip chart is updated frequently, changing either the element data or
coordinate axes, the buffering becomes redundant.
.SH LIMITATIONS
Auto-scale routines do not use requested min/max limits as boundaries
when the axis is logarithmically scaled.
.PP
The PostScript output generated for polygons with more than 1500
points may exceed the limits of some printers (See PostScript Language
Reference Manual, page 568).  The work-around is to break the polygon
into separate pieces.
.SH "FUTURE INCOMPATIBILITY"
The \fB\-mapped\fR options are obsoleted and will be removed.  You can
achieve the same results using the \fB\-hide\fR option instead.
.CS
# Works for now.
\&.s legend configure -mapped no

# Instead use this.
\&.s legend configure -hide yes    
.CE 
.SH KEYWORDS
stripchart, graph, widget
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted jni/libffi/src/powerpc/linux64_closure.S.orig.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
/* -----------------------------------------------------------------------
   sysv.h - Copyright (c) 2003 Jakub Jelinek <jakub@redhat.com>
	    Copyright (c) 2008 Red Hat, Inc.

   PowerPC64 Assembly glue.

   Permission is hereby granted, free of charge, to any person obtaining
   a copy of this software and associated documentation files (the
   ``Software''), to deal in the Software without restriction, including
   without limitation the rights to use, copy, modify, merge, publish,
   distribute, sublicense, and/or sell copies of the Software, and to
   permit persons to whom the Software is furnished to do so, subject to
   the following conditions:

   The above copyright notice and this permission notice shall be included
   in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
   DEALINGS IN THE SOFTWARE.
   ----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>

	.file	"linux64_closure.S"

#ifdef POWERPC64
	FFI_HIDDEN (ffi_closure_LINUX64)
	.globl  ffi_closure_LINUX64
# if _CALL_ELF == 2
	.text
ffi_closure_LINUX64:
	addis	%r2, %r12, .TOC.-ffi_closure_LINUX64@ha
	addi	%r2, %r2, .TOC.-ffi_closure_LINUX64@l
	.localentry ffi_closure_LINUX64, . - ffi_closure_LINUX64
# else
	.section        ".opd","aw"
	.align  3
ffi_closure_LINUX64:
#  ifdef _CALL_LINUX
	.quad   .L.ffi_closure_LINUX64,.TOC.@tocbase,0
	.type   ffi_closure_LINUX64,@function
	.text
.L.ffi_closure_LINUX64:
#  else
	FFI_HIDDEN (.ffi_closure_LINUX64)
	.globl  .ffi_closure_LINUX64
	.quad   .ffi_closure_LINUX64,.TOC.@tocbase,0
	.size   ffi_closure_LINUX64,24
	.type   .ffi_closure_LINUX64,@function
	.text
.ffi_closure_LINUX64:
#  endif
# endif

# if _CALL_ELF == 2
#  32 byte special reg save area + 64 byte parm save area
#  + 64 byte retval area + 13*8 fpr save area + round to 16
#  define STACKFRAME 272
#  define PARMSAVE 32
#  define RETVAL PARMSAVE+64
# else
#  48 bytes special reg save area + 64 bytes parm save area
#  + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
#  define STACKFRAME 240
#  define PARMSAVE 48
#  define RETVAL PARMSAVE+64
# endif

.LFB1:
# if _CALL_ELF == 2
	ld	%r12, FFI_TRAMPOLINE_SIZE(%r11)		# closure->cif
	mflr	%r0
	lwz	%r12, 28(%r12)				# cif->flags
	mtcrf	0x40, %r12
	addi	%r12, %r1, PARMSAVE
	bt	7, .Lparmsave
	# Our caller has not allocated a parameter save area.
	# We need to allocate one here and use it to pass gprs to
	# ffi_closure_helper_LINUX64.
	addi	%r12, %r1, -STACKFRAME+PARMSAVE
.Lparmsave:
	std	%r0, 16(%r1)
	# Save general regs into parm save area
	std	%r3, 0(%r12)
	std	%r4, 8(%r12)
	std	%r5, 16(%r12)
	std	%r6, 24(%r12)
	std	%r7, 32(%r12)
	std	%r8, 40(%r12)
	std	%r9, 48(%r12)
	std	%r10, 56(%r12)

	# load up the pointer to the parm save area
	mr	%r5, %r12
# else
	# copy r2 to r11 and load TOC into r2
	mr	%r11, %r2
	ld	%r2, 16(%r11)

	mflr	%r0
	# Save general regs into parm save area
	# This is the parameter save area set up by our caller.
	std	%r3, PARMSAVE+0(%r1)
	std	%r4, PARMSAVE+8(%r1)
	std	%r5, PARMSAVE+16(%r1)
	std	%r6, PARMSAVE+24(%r1)
	std	%r7, PARMSAVE+32(%r1)
	std	%r8, PARMSAVE+40(%r1)
	std	%r9, PARMSAVE+48(%r1)
	std	%r10, PARMSAVE+56(%r1)

	std	%r0, 16(%r1)

	# load up the pointer to the parm save area
	addi	%r5, %r1, PARMSAVE
# endif

	# next save fpr 1 to fpr 13
	stfd	%f1, -104+(0*8)(%r1)
	stfd	%f2, -104+(1*8)(%r1)
	stfd	%f3, -104+(2*8)(%r1)
	stfd	%f4, -104+(3*8)(%r1)
	stfd	%f5, -104+(4*8)(%r1)
	stfd	%f6, -104+(5*8)(%r1)
	stfd	%f7, -104+(6*8)(%r1)
	stfd	%f8, -104+(7*8)(%r1)
	stfd	%f9, -104+(8*8)(%r1)
	stfd	%f10, -104+(9*8)(%r1)
	stfd	%f11, -104+(10*8)(%r1)
	stfd	%f12, -104+(11*8)(%r1)
	stfd	%f13, -104+(12*8)(%r1)

	# load up the pointer to the saved fpr registers */
	addi	%r6, %r1, -104

	# load up the pointer to the result storage
	addi	%r4, %r1, -STACKFRAME+RETVAL

	stdu	%r1, -STACKFRAME(%r1)
.LCFI0:

	# get the context pointer from the trampoline
	mr	%r3, %r11

	# make the call
# if defined _CALL_LINUX || _CALL_ELF == 2
	bl ffi_closure_helper_LINUX64
# else
	bl .ffi_closure_helper_LINUX64
# endif
.Lret:

	# now r3 contains the return type
	# so use it to look up in a table
	# so we know how to deal with each type

	# look up the proper starting point in table
	# by using return type as offset
	ld %r0, STACKFRAME+16(%r1)
	cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT
	bge .Lsmall
	mflr %r4		# move address of .Lret to r4
	sldi %r3, %r3, 4	# now multiply return type by 16
	addi %r4, %r4, .Lret_type0 - .Lret
	add %r3, %r3, %r4	# add contents of table to table address
	mtctr %r3
	bctr			# jump to it

# Each of the ret_typeX code fragments has to be exactly 16 bytes long
# (4 instructions). For cache effectiveness we align to a 16 byte boundary
# first.
	.align 4

.Lret_type0:
# case FFI_TYPE_VOID
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
	nop
# case FFI_TYPE_INT
# ifdef __LITTLE_ENDIAN__
	lwa %r3, RETVAL+0(%r1)
# else
	lwa %r3, RETVAL+4(%r1)
# endif
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_FLOAT
	lfs %f1, RETVAL+0(%r1)
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_DOUBLE
	lfd %f1, RETVAL+0(%r1)
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_LONGDOUBLE
	lfd %f1, RETVAL+0(%r1)
	mtlr %r0
	lfd %f2, RETVAL+8(%r1)
	b .Lfinish
# case FFI_TYPE_UINT8
# ifdef __LITTLE_ENDIAN__
	lbz %r3, RETVAL+0(%r1)
# else
	lbz %r3, RETVAL+7(%r1)
# endif
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_SINT8
# ifdef __LITTLE_ENDIAN__
	lbz %r3, RETVAL+0(%r1)
# else
	lbz %r3, RETVAL+7(%r1)
# endif
	extsb %r3,%r3
	mtlr %r0
	b .Lfinish
# case FFI_TYPE_UINT16
# ifdef __LITTLE_ENDIAN__
	lhz %r3, RETVAL+0(%r1)
# else
	lhz %r3, RETVAL+6(%r1)
# endif
	mtlr %r0
.Lfinish:
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_SINT16
# ifdef __LITTLE_ENDIAN__
	lha %r3, RETVAL+0(%r1)
# else
	lha %r3, RETVAL+6(%r1)
# endif
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_UINT32
# ifdef __LITTLE_ENDIAN__
	lwz %r3, RETVAL+0(%r1)
# else
	lwz %r3, RETVAL+4(%r1)
# endif
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_SINT32
# ifdef __LITTLE_ENDIAN__
	lwa %r3, RETVAL+0(%r1)
# else
	lwa %r3, RETVAL+4(%r1)
# endif
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_UINT64
	ld %r3, RETVAL+0(%r1)
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_SINT64
	ld %r3, RETVAL+0(%r1)
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_TYPE_STRUCT
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
	nop
# case FFI_TYPE_POINTER
	ld %r3, RETVAL+0(%r1)
	mtlr %r0
	addi %r1, %r1, STACKFRAME
	blr
# case FFI_V2_TYPE_FLOAT_HOMOG
	lfs %f1, RETVAL+0(%r1)
	lfs %f2, RETVAL+4(%r1)
	lfs %f3, RETVAL+8(%r1)
	b .Lmorefloat
# case FFI_V2_TYPE_DOUBLE_HOMOG
	lfd %f1, RETVAL+0(%r1)
	lfd %f2, RETVAL+8(%r1)
	lfd %f3, RETVAL+16(%r1)
	lfd %f4, RETVAL+24(%r1)
	mtlr %r0
	lfd %f5, RETVAL+32(%r1)
	lfd %f6, RETVAL+40(%r1)
	lfd %f7, RETVAL+48(%r1)
	lfd %f8, RETVAL+56(%r1)
	addi %r1, %r1, STACKFRAME
	blr
.Lmorefloat:
	lfs %f4, RETVAL+12(%r1)
	mtlr %r0
	lfs %f5, RETVAL+16(%r1)
	lfs %f6, RETVAL+20(%r1)
	lfs %f7, RETVAL+24(%r1)
	lfs %f8, RETVAL+28(%r1)
	addi %r1, %r1, STACKFRAME
	blr
.Lsmall:
# ifdef __LITTLE_ENDIAN__
	ld %r3,RETVAL+0(%r1)
	mtlr %r0
	ld %r4,RETVAL+8(%r1)
	addi %r1, %r1, STACKFRAME
	blr
# else
	# A struct smaller than a dword is returned in the low bits of r3
	# ie. right justified.  Larger structs are passed left justified
	# in r3 and r4.  The return value area on the stack will have
	# the structs as they are usually stored in memory.
	cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT + 7 # size 8 bytes?
	neg %r5, %r3
	ld %r3,RETVAL+0(%r1)
	blt .Lsmalldown
	mtlr %r0
	ld %r4,RETVAL+8(%r1)
	addi %r1, %r1, STACKFRAME
	blr
.Lsmalldown:
	addi %r5, %r5, FFI_V2_TYPE_SMALL_STRUCT + 7
	mtlr %r0
	sldi %r5, %r5, 3
	addi %r1, %r1, STACKFRAME
	srd %r3, %r3, %r5
	blr
# endif

.LFE1:
	.long	0
	.byte	0,12,0,1,128,0,0,0
# if _CALL_ELF == 2
	.size	ffi_closure_LINUX64,.-ffi_closure_LINUX64
# else
#  ifdef _CALL_LINUX
	.size	ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64
#  else
	.size	.ffi_closure_LINUX64,.-.ffi_closure_LINUX64
#  endif
# endif

	.section	.eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1:
	.4byte	.LECIE1-.LSCIE1	 # Length of Common Information Entry
.LSCIE1:
	.4byte	0x0	 # CIE Identifier Tag
	.byte	0x1	 # CIE Version
	.ascii "zR\0"	 # CIE Augmentation
	.uleb128 0x1	 # CIE Code Alignment Factor
	.sleb128 -8	 # CIE Data Alignment Factor
	.byte	0x41	 # CIE RA Column
	.uleb128 0x1	 # Augmentation size
	.byte	0x14	 # FDE Encoding (pcrel udata8)
	.byte	0xc	 # DW_CFA_def_cfa
	.uleb128 0x1
	.uleb128 0x0
	.align 3
.LECIE1:
.LSFDE1:
	.4byte	.LEFDE1-.LASFDE1	 # FDE Length
.LASFDE1:
	.4byte	.LASFDE1-.Lframe1	 # FDE CIE offset
	.8byte	.LFB1-.	 # FDE initial location
	.8byte	.LFE1-.LFB1	 # FDE address range
	.uleb128 0x0	 # Augmentation size
	.byte	0x2	 # DW_CFA_advance_loc1
	.byte	.LCFI0-.LFB1
	.byte	0xe	 # DW_CFA_def_cfa_offset
	.uleb128 STACKFRAME
	.byte	0x11	 # DW_CFA_offset_extended_sf
	.uleb128 0x41
	.sleb128 -2
	.align 3
.LEFDE1:

# if defined __ELF__ && defined __linux__
	.section	.note.GNU-stack,"",@progbits
# endif
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































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

21
22
23
24
25
26
27










28
29
30
31
32
33
34
..
58
59
60
61
62
63
64









65
66
67
68
69
70
71
..
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-background background Background
This option is the same as the standard \fB\-background\fR option
except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
and border.










.OP \-class class Class
Specifies a class for the window.
This class will be used when querying the option database for
the window's other options, and it will also be used later for
other purposes such as bindings.
The \fB\-class\fR option may not be changed with the \fBconfigure\fR
widget command.
................................................................................
Specifies the desired height for the window in any of the forms
acceptable to \fBTk_GetPixels\fR.  If this option is less than or equal
to zero then the window will not request any size at all.  Note that this
sets the total height of the frame, any \fB\-borderwidth\fR or similar is
not added.  Normally \fB\-height\fR should not be used if a propagating
geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the
frame since the geometry manager will override the height of the frame.









.OP \-visual visual Visual
Specifies visual information for the new window in any of the
forms accepted by \fBTk_GetVisual\fR.
If this option is not specified, the new window will use the same
visual as its parent.
The \fB\-visual\fR option may not be modified with the \fBconfigure\fR
widget command.
................................................................................
or in the option database
to configure aspects of the frame such as its background color
and relief.  The \fBframe\fR command returns the
path name of the new window.
.PP
A frame is a simple widget.  Its primary purpose is to act as a
spacer or container for complex window layouts.  The only features
of a frame are its background color and an optional 3-D border to make the
frame appear raised or sunken.
.SH "WIDGET COMMAND"
.PP
The \fBframe\fR command creates a new Tcl command whose
name is the same as the path name of the frame's window.  This
command may be used to invoke various
operations on the widget.  It has the following general form:







>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>







 







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-background background Background
This option is the same as the standard \fB\-background\fR option
except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
and border.
.VS "8.7, TIP262"
An empty background will disable drawing the background image.
.OP \-backgroundimage backgroundImage BackgroundImage
This specifies an image to display on the frame's background within
the border of the frame (i.e., the image will be clipped by the
frame's highlight ring and border, if either are present); subwidgets
of the frame will be drawn on top. The image must have been created
with the \fBimage create\fR command. If specified as the empty string,
no image will be displayed.
.VE "8.7, TIP262"
.OP \-class class Class
Specifies a class for the window.
This class will be used when querying the option database for
the window's other options, and it will also be used later for
other purposes such as bindings.
The \fB\-class\fR option may not be changed with the \fBconfigure\fR
widget command.
................................................................................
Specifies the desired height for the window in any of the forms
acceptable to \fBTk_GetPixels\fR.  If this option is less than or equal
to zero then the window will not request any size at all.  Note that this
sets the total height of the frame, any \fB\-borderwidth\fR or similar is
not added.  Normally \fB\-height\fR should not be used if a propagating
geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the
frame since the geometry manager will override the height of the frame.
.OP \-tile tile Tile
.VS "8.7, TIP262"
This specifies how to draw the background image (see
\fB\-backgroundimage\fR) on the frame.
If true (according to \fBTcl_GetBoolean\fR), the image will be tiled
to fill the whole frame, with the origin of the first copy of the
image being the top left of the interior of the frame.
If false (the default), the image will be centered within the frame.
.VE "8.7, TIP262"
.OP \-visual visual Visual
Specifies visual information for the new window in any of the
forms accepted by \fBTk_GetVisual\fR.
If this option is not specified, the new window will use the same
visual as its parent.
The \fB\-visual\fR option may not be modified with the \fBconfigure\fR
widget command.
................................................................................
or in the option database
to configure aspects of the frame such as its background color
and relief.  The \fBframe\fR command returns the
path name of the new window.
.PP
A frame is a simple widget.  Its primary purpose is to act as a
spacer or container for complex window layouts.  The only features
of a frame are its background and an optional 3-D border to make the
frame appear raised or sunken.
.SH "WIDGET COMMAND"
.PP
The \fBframe\fR command creates a new Tcl command whose
name is the same as the path name of the frame's window.  This
command may be used to invoke various
operations on the widget.  It has the following general form:

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

21
22
23
24
25
26
27











28
29
30
31
32
33
34
..
67
68
69
70
71
72
73









74
75
76
77
78
79
80
...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-background background Background
This option is the same as the standard \fB\-background\fR option
except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
and border.











.OP \-class class Class
Specifies a class for the window.
This class will be used when querying the option database for
the window's other options, and it will also be used later for
other purposes such as bindings.
The \fB\-class\fR option may not be changed with the \fBconfigure\fR
widget command.
................................................................................
Specifies the screen on which to place the new window.
Any valid screen name may be used, even one associated with a
different display.
Defaults to the same screen as its parent.
This option is special in that it may not be specified via the option
database, and it may not be modified with the \fBconfigure\fR
widget command.









.OP \-use use Use
This option is used for embedding. If the value is not an empty string,
it must be the window identifier of a container window, specified as
a hexadecimal string like the ones returned by the \fBwinfo id\fR
command. The toplevel widget will be created as a child of the given
container instead of the root window for the screen.  If the container
window is in a Tk application, it must be a frame or toplevel widget for
................................................................................
path name of the new window.
.PP
A toplevel is similar to a \fBframe\fR except that it is created as a
top-level window:  its X parent is the root window of a screen
rather than the logical parent from its Tk path name.  The primary
purpose of a toplevel is to serve as a container for dialog boxes
and other collections of widgets.  The only visible features
of a toplevel are its background color and an optional 3-D border
to make the toplevel appear raised or sunken.
.SH "WIDGET COMMAND"
.PP
The \fBtoplevel\fR command creates a new Tcl command whose
name is the same as the path name of the toplevel's window.  This
command may be used to invoke various
operations on the widget.  It has the following general form:







>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>







 







|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-background background Background
This option is the same as the standard \fB\-background\fR option
except that its value may also be specified as an empty string.
In this case, the widget will display no background or border, and
no colors will be consumed from its colormap for its background
and border.
.VS "8.7, TIP262"
An empty background will disable drawing the background image.
.OP \-backgroundimage backgroundImage BackgroundImage
This specifies an image to display on the toplevel's background within
the border of the toplevel (i.e., the image will be clipped by the
toplevel's highlight ring and border, if either are present) on top of
the background;
subwidgets of the toplevel will be drawn on top. The image must have
been created with the \fBimage create\fR command. If specified as the
empty string, no image will be displayed.
.VE "8.7, TIP262"
.OP \-class class Class
Specifies a class for the window.
This class will be used when querying the option database for
the window's other options, and it will also be used later for
other purposes such as bindings.
The \fB\-class\fR option may not be changed with the \fBconfigure\fR
widget command.
................................................................................
Specifies the screen on which to place the new window.
Any valid screen name may be used, even one associated with a
different display.
Defaults to the same screen as its parent.
This option is special in that it may not be specified via the option
database, and it may not be modified with the \fBconfigure\fR
widget command.
.OP \-tile tile Tile
.VS "8.7, TIP262"
This specifies how to draw the background image (see
\fB\-backgroundimage\fR) on the toplevel.
If true (according to \fBTcl_GetBoolean\fR), the image will be tiled
to fill the whole toplevel, with the origin of the first copy of the
image being the top left of the interior of the toplevel.
If false (the default), the image will be centered within the toplevel.
.VE "8.7, TIP262"
.OP \-use use Use
This option is used for embedding. If the value is not an empty string,
it must be the window identifier of a container window, specified as
a hexadecimal string like the ones returned by the \fBwinfo id\fR
command. The toplevel widget will be created as a child of the given
container instead of the root window for the screen.  If the container
window is in a Tk application, it must be a frame or toplevel widget for
................................................................................
path name of the new window.
.PP
A toplevel is similar to a \fBframe\fR except that it is created as a
top-level window:  its X parent is the root window of a screen
rather than the logical parent from its Tk path name.  The primary
purpose of a toplevel is to serve as a container for dialog boxes
and other collections of widgets.  The only visible features
of a toplevel are its background and an optional 3-D border
to make the toplevel appear raised or sunken.
.SH "WIDGET COMMAND"
.PP
The \fBtoplevel\fR command creates a new Tcl command whose
name is the same as the path name of the toplevel's window.  This
command may be used to invoke various
operations on the widget.  It has the following general form:

Changes to jni/sdl2tk/generic/tkFrame.c.

90
91
92
93
94
95
96










97
98
99
100
101
102
103
...
215
216
217
218
219
220
221



222
223


224
225
226
227
228
229


230
231
232
233
234



235
236


237
238
239
240
241
242
243
244
245
246
247
248


249
250
251
252
253
254
255
...
307
308
309
310
311
312
313






314
315
316
317
318
319
320
...
864
865
866
867
868
869
870





871
872
873



874
875
876
877
878
879
880
...
941
942
943
944
945
946
947

948
949
950
951
952
953
954
...
964
965
966
967
968
969
970














971
972
973
974
975
976
977
....
1105
1106
1107
1108
1109
1110
1111









1112
1113
1114
1115
1116
1117
1118
....
1449
1450
1451
1452
1453
1454
1455














1456
1457
1458
1459
1460
1461
1462
1463
1464




1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
....
1591
1592
1593
1594
1595
1596
1597
1598

1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613































1614
1615
1616
1617
1618
1619
1620
....
2024
2025
2026
2027
2028
2029
2030
2031
2032


























































































































2033
2034
2035
2036
2037
2038
				 * pixels of extra space to leave on left and
				 * right of child area. */
    int padX;			/* Integer value corresponding to padXPtr. */
    Tcl_Obj *padYPtr;		/* Value of -padx option: specifies how many
				 * pixels of extra space to leave above and
				 * below child area. */
    int padY;			/* Integer value corresponding to padYPtr. */










} Frame;

/*
 * A data structure of the following type is kept for each labelframe widget
 * managed by this file:
 */

................................................................................
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_PIXELS, "-width", "width", "Width",
	DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width), 0, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};

static const Tk_OptionSpec frameOptSpec[] = {



    {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
	NULL, 0, -1, 0, "-borderwidth", 0},


    {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
	DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
    {TK_OPTION_STRING, "-class", "class", "Class",
	DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
    {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
	DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},


    {TK_OPTION_END, NULL, NULL, NULL,
	NULL, 0, 0, 0, commonOptSpec, 0}
};

static const Tk_OptionSpec toplevelOptSpec[] = {



    {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
	NULL, 0, -1, 0, "-borderwidth", 0},


    {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
	DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
    {TK_OPTION_STRING, "-class", "class", "Class",
	DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
    {TK_OPTION_STRING, "-menu", "menu", "Menu",
	DEF_TOPLEVEL_MENU, -1, Tk_Offset(Frame, menuName),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
	DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
    {TK_OPTION_STRING, "-screen", "screen", "Screen",
	DEF_TOPLEVEL_SCREEN, -1, Tk_Offset(Frame, screenName),
	TK_OPTION_NULL_OK, 0, 0},


    {TK_OPTION_STRING, "-use", "use", "Use",
	DEF_TOPLEVEL_USE, -1, Tk_Offset(Frame, useThis),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL,
	NULL, 0, 0, 0, commonOptSpec, 0}
};

................................................................................
			    int objc, Tcl_Obj *const objv[]);
static int		CreateFrame(ClientData clientData, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const argv[],
			    enum FrameType type, const char *appName);
static void		DestroyFrame(void *memPtr);
static void		DestroyFramePartly(Frame *framePtr);
static void		DisplayFrame(ClientData clientData);






static void		FrameCmdDeletedProc(ClientData clientData);
static void		FrameEventProc(ClientData clientData,
			    XEvent *eventPtr);
static void		FrameLostSlaveProc(ClientData clientData,
			    Tk_Window tkwin);
static void		FrameRequestProc(ClientData clientData,
			    Tk_Window tkwin);
................................................................................

    if (framePtr->type == TYPE_LABELFRAME) {
	Tk_FreeTextLayout(labelframePtr->textLayout);
	if (labelframePtr->textGC != NULL) {
	    Tk_FreeGC(framePtr->display, labelframePtr->textGC);
	}
    }





    if (framePtr->colormap != None) {
	Tk_FreeColormap(framePtr->display, framePtr->colormap);
    }



    ckfree(framePtr);
}
 
/*
 *----------------------------------------------------------------------
 *
 * DestroyFramePartly --
................................................................................
    int objc,			/* Number of valid entries in objv. */
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    char *oldMenuName;
    Tk_Window oldWindow = NULL;
    Labelframe *labelframePtr = (Labelframe *) framePtr;


    /*
     * Need the old menubar name for the menu code to delete it.
     */

    if (framePtr->menuName == NULL) {
    	oldMenuName = NULL;
................................................................................
	    framePtr->optionTable, objc, objv,
	    framePtr->tkwin, &savedOptions, NULL) != TCL_OK) {
	if (oldMenuName != NULL) {
	    ckfree(oldMenuName);
	}
	return TCL_ERROR;
    }














    Tk_FreeSavedOptions(&savedOptions);

    /*
     * A few of the options require additional processing.
     */

    if ((((oldMenuName == NULL) && (framePtr->menuName != NULL))
................................................................................

    anyTextLabel = (framePtr->type == TYPE_LABELFRAME) &&
	    (labelframePtr->textPtr != NULL) &&
	    (labelframePtr->labelWin == NULL);
    anyWindowLabel = (framePtr->type == TYPE_LABELFRAME) &&
	    (labelframePtr->labelWin != NULL);










    if (framePtr->type == TYPE_LABELFRAME) {
	/*
	 * The textGC is needed even in the labelWin case, so it's always
	 * created for a labelframe.
	 */

	gcValues.font = Tk_FontId(labelframePtr->tkfont);
................................................................................
     * If -background is set to "", no interior is drawn.
     */

    if (framePtr->border == NULL) {
	return;
    }















    if (framePtr->type != TYPE_LABELFRAME) {
	/*
	 * Pass to platform specific draw function. In general, it just draws
	 * a simple rectangle, but it may "theme" the background.
	 */

    noLabel:
	TkpDrawFrame(tkwin, framePtr->border, hlWidth,
		framePtr->borderWidth, framePtr->relief);




    } else {
	Labelframe *labelframePtr = (Labelframe *) framePtr;

	if ((labelframePtr->textPtr == NULL) &&
		(labelframePtr->labelWin == NULL)) {
	    goto noLabel;
	}

#ifndef TK_NO_DOUBLE_BUFFERING
	/*
	 * In order to avoid screen flashes, this function redraws the frame
	 * into off-screen memory, then copies it back on-screen in a single
	 * operation. This means there's no point in time where the on-screen
	 * image has been cleared.
	 */

	pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin),
		Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
#else
	pixmap = Tk_WindowId(tkwin);
#endif /* TK_NO_DOUBLE_BUFFERING */

	/*
	 * Clear the pixmap.
	 */

	Tk_Fill3DRectangle(tkwin, pixmap, framePtr->border, 0, 0,
		Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);

................................................................................
	    } else {
		Tk_MaintainGeometry(labelframePtr->labelWin, framePtr->tkwin,
			labelframePtr->labelBox.x, labelframePtr->labelBox.y,
			labelframePtr->labelBox.width,
			labelframePtr->labelBox.height);
	    }
	}


#ifndef TK_NO_DOUBLE_BUFFERING
	/*
	 * Everything's been redisplayed; now copy the pixmap onto the screen
	 * and free up the pixmap.
	 */

	XCopyArea(framePtr->display, pixmap, Tk_WindowId(tkwin),
		labelframePtr->textGC, hlWidth, hlWidth,
		(unsigned) (Tk_Width(tkwin) - 2 * hlWidth),
		(unsigned) (Tk_Height(tkwin) - 2 * hlWidth),
		hlWidth, hlWidth);
	Tk_FreePixmap(framePtr->display, pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
    }
































}
 
/*
 *--------------------------------------------------------------
 *
 * FrameEventProc --
 *
................................................................................
    }
    framePtr = cmdInfo.objClientData;
    if (framePtr->type != TYPE_TOPLEVEL) {
	return NULL;
    }
    return framePtr->tkwin;
}
 
/*


























































































































 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */







>
>
>
>
>
>
>
>
>
>







 







>
>
>


>
>






>
>





>
>
>


>
>












>
>







 







>
>
>
>
>
>







 







>
>
>
>
>



>
>
>







 







>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>







|

>
>
>
>








<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|
>

|
|
|
|

|
|
|
|
|
|

|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
...
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
...
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
...
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
....
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
....
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
....
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552














1553
1554
1555
1556
1557
1558
1559
....
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
....
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
				 * pixels of extra space to leave on left and
				 * right of child area. */
    int padX;			/* Integer value corresponding to padXPtr. */
    Tcl_Obj *padYPtr;		/* Value of -padx option: specifies how many
				 * pixels of extra space to leave above and
				 * below child area. */
    int padY;			/* Integer value corresponding to padYPtr. */
    Tcl_Obj *bgimgPtr;		/* Value of -backgroundimage option: specifies
				 * image to display on window's background, or
				 * NULL if none. */
    Tk_Image bgimg;		/* Derived from bgimgPtr by calling
				 * Tk_GetImage, or NULL if bgimgPtr is
				 * NULL. */
    int tile;			/* Whether to tile the bgimg. */
#ifndef TK_NO_DOUBLE_BUFFERING
    GC copyGC;			/* GC for copying when double-buffering. */
#endif /* TK_NO_DOUBLE_BUFFERING */
} Frame;

/*
 * A data structure of the following type is kept for each labelframe widget
 * managed by this file:
 */

................................................................................
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_PIXELS, "-width", "width", "Width",
	DEF_FRAME_WIDTH, -1, Tk_Offset(Frame, width), 0, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};

static const Tk_OptionSpec frameOptSpec[] = {
    {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage",
	DEF_FRAME_BG_IMAGE, Tk_Offset(Frame, bgimgPtr), -1,
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
	NULL, 0, -1, 0, "-borderwidth", 0},
    {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL,
	NULL, 0, -1, 0, "-backgroundimage", 0},
    {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
	DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
    {TK_OPTION_STRING, "-class", "class", "Class",
	DEF_FRAME_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
    {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
	DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
    {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile",
	DEF_FRAME_BG_TILE, -1, Tk_Offset(Frame, tile), 0, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL,
	NULL, 0, 0, 0, commonOptSpec, 0}
};

static const Tk_OptionSpec toplevelOptSpec[] = {
    {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage",
	DEF_FRAME_BG_IMAGE, Tk_Offset(Frame, bgimgPtr), -1,
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
	NULL, 0, -1, 0, "-borderwidth", 0},
    {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL,
	NULL, 0, -1, 0, "-backgroundimage", 0},
    {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
	DEF_FRAME_BORDER_WIDTH, -1, Tk_Offset(Frame, borderWidth), 0, 0, 0},
    {TK_OPTION_STRING, "-class", "class", "Class",
	DEF_TOPLEVEL_CLASS, -1, Tk_Offset(Frame, className), 0, 0, 0},
    {TK_OPTION_STRING, "-menu", "menu", "Menu",
	DEF_TOPLEVEL_MENU, -1, Tk_Offset(Frame, menuName),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_RELIEF, "-relief", "relief", "Relief",
	DEF_FRAME_RELIEF, -1, Tk_Offset(Frame, relief), 0, 0, 0},
    {TK_OPTION_STRING, "-screen", "screen", "Screen",
	DEF_TOPLEVEL_SCREEN, -1, Tk_Offset(Frame, screenName),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile",
	DEF_FRAME_BG_TILE, -1, Tk_Offset(Frame, tile), 0, 0, 0},
    {TK_OPTION_STRING, "-use", "use", "Use",
	DEF_TOPLEVEL_USE, -1, Tk_Offset(Frame, useThis),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL,
	NULL, 0, 0, 0, commonOptSpec, 0}
};

................................................................................
			    int objc, Tcl_Obj *const objv[]);
static int		CreateFrame(ClientData clientData, Tcl_Interp *interp,
			    int objc, Tcl_Obj *const argv[],
			    enum FrameType type, const char *appName);
static void		DestroyFrame(void *memPtr);
static void		DestroyFramePartly(Frame *framePtr);
static void		DisplayFrame(ClientData clientData);
static void		DrawFrameBackground(Tk_Window tkwin, Pixmap pixmap,
			    int highlightWidth, int borderWidth,
			    Tk_Image bgimg, int bgtile);
static void		FrameBgImageProc(ClientData clientData,
			    int x, int y, int width, int height,
			    int imgWidth, int imgHeight);
static void		FrameCmdDeletedProc(ClientData clientData);
static void		FrameEventProc(ClientData clientData,
			    XEvent *eventPtr);
static void		FrameLostSlaveProc(ClientData clientData,
			    Tk_Window tkwin);
static void		FrameRequestProc(ClientData clientData,
			    Tk_Window tkwin);
................................................................................

    if (framePtr->type == TYPE_LABELFRAME) {
	Tk_FreeTextLayout(labelframePtr->textLayout);
	if (labelframePtr->textGC != NULL) {
	    Tk_FreeGC(framePtr->display, labelframePtr->textGC);
	}
    }
#ifndef TK_NO_DOUBLE_BUFFERING
    if (framePtr->copyGC != NULL) {
	Tk_FreeGC(framePtr->display, framePtr->copyGC);
    }
#endif /* TK_NO_DOUBLE_BUFFERING */
    if (framePtr->colormap != None) {
	Tk_FreeColormap(framePtr->display, framePtr->colormap);
    }
    if (framePtr->bgimg) {
	Tk_FreeImage(framePtr->bgimg);
    }
    ckfree(framePtr);
}
 
/*
 *----------------------------------------------------------------------
 *
 * DestroyFramePartly --
................................................................................
    int objc,			/* Number of valid entries in objv. */
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    char *oldMenuName;
    Tk_Window oldWindow = NULL;
    Labelframe *labelframePtr = (Labelframe *) framePtr;
    Tk_Image image = NULL;

    /*
     * Need the old menubar name for the menu code to delete it.
     */

    if (framePtr->menuName == NULL) {
    	oldMenuName = NULL;
................................................................................
	    framePtr->optionTable, objc, objv,
	    framePtr->tkwin, &savedOptions, NULL) != TCL_OK) {
	if (oldMenuName != NULL) {
	    ckfree(oldMenuName);
	}
	return TCL_ERROR;
    }

    if (framePtr->bgimgPtr) {
	image = Tk_GetImage(interp, framePtr->tkwin,
		Tcl_GetString(framePtr->bgimgPtr), FrameBgImageProc, framePtr);
	if (image == NULL) {
	    Tk_RestoreSavedOptions(&savedOptions);
	    return TCL_ERROR;
	}
    }
    if (framePtr->bgimg) {
	Tk_FreeImage(framePtr->bgimg);
    }
    framePtr->bgimg = image;

    Tk_FreeSavedOptions(&savedOptions);

    /*
     * A few of the options require additional processing.
     */

    if ((((oldMenuName == NULL) && (framePtr->menuName != NULL))
................................................................................

    anyTextLabel = (framePtr->type == TYPE_LABELFRAME) &&
	    (labelframePtr->textPtr != NULL) &&
	    (labelframePtr->labelWin == NULL);
    anyWindowLabel = (framePtr->type == TYPE_LABELFRAME) &&
	    (labelframePtr->labelWin != NULL);

#ifndef TK_NO_DOUBLE_BUFFERING
    gcValues.graphics_exposures = False;
    gc = Tk_GetGC(tkwin, GCGraphicsExposures, &gcValues);
    if (framePtr->copyGC != NULL) {
	Tk_FreeGC(framePtr->display, framePtr->copyGC);
    }
    framePtr->copyGC = gc;
#endif /* TK_NO_DOUBLE_BUFFERING */

    if (framePtr->type == TYPE_LABELFRAME) {
	/*
	 * The textGC is needed even in the labelWin case, so it's always
	 * created for a labelframe.
	 */

	gcValues.font = Tk_FontId(labelframePtr->tkfont);
................................................................................
     * If -background is set to "", no interior is drawn.
     */

    if (framePtr->border == NULL) {
	return;
    }

#ifndef TK_NO_DOUBLE_BUFFERING
    /*
     * In order to avoid screen flashes, this function redraws the frame into
     * off-screen memory, then copies it back on-screen in a single operation.
     * This means there's no point in time where the on-screen image has been
     * cleared.
     */

    pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin),
	    Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin));
#else
    pixmap = Tk_WindowId(tkwin);
#endif /* TK_NO_DOUBLE_BUFFERING */

    if (framePtr->type != TYPE_LABELFRAME) {
	/*
	 * Pass to platform specific draw function. In general, it just draws
	 * a simple rectangle, but it may "theme" the background.
	 */

    noLabel:
	TkpDrawFrameEx(tkwin, pixmap, framePtr->border, hlWidth,
		framePtr->borderWidth, framePtr->relief);
	if (framePtr->bgimg) {
	    DrawFrameBackground(tkwin, pixmap, hlWidth, framePtr->borderWidth,
		    framePtr->bgimg, framePtr->tile);
	}
    } else {
	Labelframe *labelframePtr = (Labelframe *) framePtr;

	if ((labelframePtr->textPtr == NULL) &&
		(labelframePtr->labelWin == NULL)) {
	    goto noLabel;
	}















	/*
	 * Clear the pixmap.
	 */

	Tk_Fill3DRectangle(tkwin, pixmap, framePtr->border, 0, 0,
		Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT);

................................................................................
	    } else {
		Tk_MaintainGeometry(labelframePtr->labelWin, framePtr->tkwin,
			labelframePtr->labelBox.x, labelframePtr->labelBox.y,
			labelframePtr->labelBox.width,
			labelframePtr->labelBox.height);
	    }
	}
    }

#ifndef TK_NO_DOUBLE_BUFFERING
    /*
     * Everything's been redisplayed; now copy the pixmap onto the screen and
     * free up the pixmap.
     */

    XCopyArea(framePtr->display, pixmap, Tk_WindowId(tkwin),
	    framePtr->copyGC, hlWidth, hlWidth,
	    (unsigned) (Tk_Width(tkwin) - 2 * hlWidth),
	    (unsigned) (Tk_Height(tkwin) - 2 * hlWidth),
	    hlWidth, hlWidth);
    Tk_FreePixmap(framePtr->display, pixmap);
#endif /* TK_NO_DOUBLE_BUFFERING */
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrame --
 *
 *	This procedure draws the rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrame(
    Tk_Window tkwin,
    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    /*
     * Legacy shim to allow for external callers. Internal ones use
     * non-exposed TkpDrawFrameEx directly so they can use double-buffering.
     */

    TkpDrawFrameEx(tkwin, Tk_WindowId(tkwin), border,
	    highlightWidth, borderWidth, relief);
}
 
/*
 *--------------------------------------------------------------
 *
 * FrameEventProc --
 *
................................................................................
    }
    framePtr = cmdInfo.objClientData;
    if (framePtr->type != TYPE_TOPLEVEL) {
	return NULL;
    }
    return framePtr->tkwin;
}
 
/*
 *----------------------------------------------------------------------
 *
 * FrameBgImageProc --
 *
 *	This function is invoked by the image code whenever the manager for an
 *	image does something that affects the size or contents of an image
 *	displayed on a frame's background.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Arranges for the button to get redisplayed.
 *
 *----------------------------------------------------------------------
 */

static void
FrameBgImageProc(
    ClientData clientData,	/* Pointer to widget record. */
    int x, int y,		/* Upper left pixel (within image) that must
				 * be redisplayed. */
    int width, int height,	/* Dimensions of area to redisplay (might be
				 * <= 0). */
    int imgWidth, int imgHeight)/* New dimensions of image. */
{
    register Frame *framePtr = clientData;

    /*
     * Changing the background image never alters the dimensions of the frame.
     */

    if (framePtr->tkwin && Tk_IsMapped(framePtr->tkwin) &&
	    !(framePtr->flags & REDRAW_PENDING)) {
	Tcl_DoWhenIdle(DisplayFrame, framePtr);
	framePtr->flags |= REDRAW_PENDING;
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * DrawFrameBackground --
 *
 *	This function draws the background image of a rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

static void
DrawFrameBackground(
    Tk_Window tkwin,
    Pixmap pixmap,
    int highlightWidth,
    int borderWidth,
    Tk_Image bgimg,
    int bgtile)
{
    int width, height;			/* Area to paint on. */
    int imageWidth, imageHeight;	/* Dimensions of image. */
    const int bw = highlightWidth + borderWidth;

    Tk_SizeOfImage(bgimg, &imageWidth, &imageHeight);
    width = Tk_Width(tkwin) - 2*bw;
    height = Tk_Height(tkwin) - 2*bw;

    if (bgtile) {
	/*
	 * Draw the image tiled in the widget (inside the border).
	 */

	int x, y;

	for (x = bw; x - bw < width; x += imageWidth) {
	    int w = imageWidth;
	    if (x - bw + imageWidth > width) {
		w = (width + bw) - x;
	    }
	    for (y = bw; y < height + bw; y += imageHeight) {
		int h = imageHeight;
		if (y - bw + imageHeight > height) {
		    h = (height + bw) - y;
		}
		Tk_RedrawImage(bgimg, 0, 0, w, h, pixmap, x, y);
	    }
	}
    } else {
	/*
	 * Draw the image centred in the widget (inside the border).
	 */

	int x, y, xOff, yOff, w, h;

	if (width > imageWidth) {
	    x = 0;
	    xOff = (Tk_Width(tkwin) - imageWidth) / 2;
	    w = imageWidth;
	} else {
	    x = (imageWidth - width) / 2;
	    xOff = bw;
	    w = width;
	}
	if (height > imageHeight) {
	    y = 0;
	    yOff = (Tk_Height(tkwin) - imageHeight) / 2;
	    h = imageHeight;
	} else {
	    y = (imageHeight - height) / 2;
	    yOff = bw;
	    h = height;
	}
	Tk_RedrawImage(bgimg, x, y, w, h, pixmap, xOff, yOff);
    }
}
 
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */

Changes to jni/sdl2tk/generic/tkInt.h.

1217
1218
1219
1220
1221
1222
1223



1224
1225
1226
1227
1228
1229
1230
			    int *lengthPtr);
MODULE_SCOPE void	TkUnderlineCharsInContext(Display *display,
			    Drawable drawable, GC gc, Tk_Font tkfont,
			    const char *string, int numBytes, int x, int y,
			    int firstByte, int lastByte);
MODULE_SCOPE void	TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
			    int c, struct TkFontAttributes *faPtr);



MODULE_SCOPE Tcl_Obj *	TkNewWindowObj(Tk_Window tkwin);
MODULE_SCOPE void	TkpShowBusyWindow(TkBusy busy);
MODULE_SCOPE void	TkpHideBusyWindow(TkBusy busy);
MODULE_SCOPE void	TkpMakeTransparentWindowExist(Tk_Window tkwin,
			    Window parent);
MODULE_SCOPE void	TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
			    Window *parentPtr, Tk_Window tkParent,







>
>
>







1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
			    int *lengthPtr);
MODULE_SCOPE void	TkUnderlineCharsInContext(Display *display,
			    Drawable drawable, GC gc, Tk_Font tkfont,
			    const char *string, int numBytes, int x, int y,
			    int firstByte, int lastByte);
MODULE_SCOPE void	TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
			    int c, struct TkFontAttributes *faPtr);
MODULE_SCOPE void	TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable,
			    Tk_3DBorder border, int highlightWidth,
			    int borderWidth, int relief);
MODULE_SCOPE Tcl_Obj *	TkNewWindowObj(Tk_Window tkwin);
MODULE_SCOPE void	TkpShowBusyWindow(TkBusy busy);
MODULE_SCOPE void	TkpHideBusyWindow(TkBusy busy);
MODULE_SCOPE void	TkpMakeTransparentWindowExist(Tk_Window tkwin,
			    Window parent);
MODULE_SCOPE void	TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
			    Window *parentPtr, Tk_Window tkParent,

Changes to jni/sdl2tk/generic/tkTest.c.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
....
1555
1556
1557
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
#if defined(_WIN32) && !defined(PLATFORM_SDL)
#include "tkWinInt.h"
#endif

#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
#define APP_IS_DRAWING TkTestAppIsDrawing()
#else
#define APP_IS_DRAWING 0
#endif

#ifdef __UNIX__
#include "tkUnixInt.h"
#endif
#ifdef PLATFORM_SDL
#include "tkSDLInt.h"
................................................................................
{
    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);
    }
    if (width > (instPtr->masterPtr->width - imageX)) {
	width = instPtr->masterPtr->width - imageX;
    }
    if (height > (instPtr->masterPtr->height - imageY)) {
	height = instPtr->masterPtr->height - imageY;
    }







|

|







 







|
|
|
|
|
|
<
>
|
|
|
|
<
>
|
>
>
>
>
>
>
>
>
>
>


>
|
|
<

|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
....
1555
1556
1557
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
1589

1590
1591
1592
1593
1594
1595
1596
1597
1598
#if defined(_WIN32) && !defined(PLATFORM_SDL)
#include "tkWinInt.h"
#endif

#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
#define LOG_DISPLAY TkTestLogDisplay()
#else
#define LOG_DISPLAY 1
#endif

#ifdef __UNIX__
#include "tkUnixInt.h"
#endif
#ifdef PLATFORM_SDL
#include "tkSDLInt.h"
................................................................................
{
    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
     * a display proc must be run inside of the drawRect method of an NSView
     * in order for the graphics operations to have any effect.  To deal with
     * this, whenever a display proc is called outside of any drawRect method
     * it schedules a redraw of the NSView by calling [view setNeedsDisplay:YES].
     * This will trigger a later call to the view's drawRect method which will
     * run the display proc a second time.

     *
     * This complicates testing, since it can result in more calls to the display
     * proc than are expected by the test.  It can also result in an inconsistent
     * number of calls unless the test waits until the call to drawRect actually
     * occurs before validating its results.

     *
     * In an attempt to work around this, this display proc only logs those
     * calls which occur within a drawRect method.  This means that tests must
     * be written so as to ensure that the drawRect method is run before
     * results are validated.  In practice it usually suffices to run update
     * idletasks (to run the display proc the first time) followed by update
     * (to run the display proc in drawRect).
     *
     * This also has the consequence that the image changed command will log
     * different results on Aqua than on other systems, because when the image
     * is redisplayed in the drawRect method the entire image will be drawn,
     * not just the changed portion.  Tests must account for this.
     */

    if (LOG_DISPLAY) {
	sprintf(buffer, "%s display %d %d %d %d",
		instPtr->masterPtr->imageName, imageX, imageY, width, height);

	Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
		    NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
    }
    if (width > (instPtr->masterPtr->width - imageX)) {
	width = instPtr->masterPtr->width - imageX;
    }
    if (height > (instPtr->masterPtr->height - imageY)) {
	height = instPtr->masterPtr->height - imageY;
    }

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

208
209
210
211
212
213
214

215

216
217
218
219
220
221
222
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG

#define DEF_FRAME_BG_MONO		WHITE

#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG







>

>







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG
#define DEF_FRAME_BG_IMAGE		NULL
#define DEF_FRAME_BG_MONO		WHITE
#define DEF_FRAME_BG_TILE		"0"
#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG

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

2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
....
2030
2031
2032
2033
2034
2035
2036
2037
2038

2039
2040
2041
2042
2043
2044
2045
....
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
	}
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrame --
 *
 *	This procedure draws the rectangular frame area. If the user has
 *	requested themeing, it draws with the background theme.
 *
 * Results:
 *	None.
 *
................................................................................
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrame(
    Tk_Window tkwin,

    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    if (useThemedToplevel && Tk_IsTopLevel(tkwin)) {
	static Tk_3DBorder themedBorder = NULL;
................................................................................
		    "systemWindowHeaderBackground");
	}
	if (themedBorder) {
	    border = themedBorder;
	}
    }

    Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin),
	    border, highlightWidth, highlightWidth,
	    Tk_Width(tkwin) - 2 * highlightWidth,
	    Tk_Height(tkwin) - 2 * highlightWidth,
	    borderWidth, relief);
}
 
/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
 * End:
 */







|







 







|

>







 







|
<
|
|
<










2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
....
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
....
2050
2051
2052
2053
2054
2055
2056
2057

2058
2059

2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
	}
    }
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrameEx --
 *
 *	This procedure draws the rectangular frame area. If the user has
 *	requested themeing, it draws with the background theme.
 *
 * Results:
 *	None.
 *
................................................................................
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrameEx(
    Tk_Window tkwin,
    Drawable drawable,
    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    if (useThemedToplevel && Tk_IsTopLevel(tkwin)) {
	static Tk_3DBorder themedBorder = NULL;
................................................................................
		    "systemWindowHeaderBackground");
	}
	if (themedBorder) {
	    border = themedBorder;
	}
    }

    Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,

	    highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth,
	    Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief);

}
 
/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
 * End:
 */

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

844
845
846
847
848
849
850
851


852
853
854
855
856
857
858
	 * the screen.
	 */

	XMapWindow(eventPtr->xmaprequest.display,
		eventPtr->xmaprequest.window);
    } else if (eventPtr->type == DestroyNotify) {
	/*
	 * The embedded application is gone. Destroy the container window.


	 */

	Tk_DestroyWindow((Tk_Window) winPtr);
    }
    Tk_DeleteErrorHandler(errHandler);
}
 







|
>
>







844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
	 * the screen.
	 */

	XMapWindow(eventPtr->xmaprequest.display,
		eventPtr->xmaprequest.window);
    } else if (eventPtr->type == DestroyNotify) {
	/*
	 * It is not clear whether the container should be destroyed
	 * when an embedded window is destroyed.  See ticket [67384bce7d].
	 * Here we are following unix, by destroying the container.
	 */

	Tk_DestroyWindow((Tk_Window) winPtr);
    }
    Tk_DeleteErrorHandler(errHandler);
}
 

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

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
	int y, int width, int height);
MODULE_SCOPE void TkpRetainRegion(TkRegion r);
MODULE_SCOPE void TkpReleaseRegion(TkRegion r);
MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
MODULE_SCOPE Bool TkpAppIsDrawing(void);
MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin);
MODULE_SCOPE Bool TkTestAppIsDrawing(void);
MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin);

/*
 * Include the stubbed internal platform-specific API.
 */

#include "tkIntPlatDecls.h"







|







198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x,
	int y, int width, int height);
MODULE_SCOPE void TkpRetainRegion(TkRegion r);
MODULE_SCOPE void TkpReleaseRegion(TkRegion r);
MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
MODULE_SCOPE Bool TkpAppIsDrawing(void);
MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin);
MODULE_SCOPE Bool TkTestLogDisplay(void);
MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin);

/*
 * Include the stubbed internal platform-specific API.
 */

#include "tkIntPlatDecls.h"

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

86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

102
103
104


105
106
107
108
109
110
111
112

113



114
115
116
117
118
119
120
121
122
123
124
    return TCL_OK;
}
#endif
 
/*
 *----------------------------------------------------------------------
 *
 * TkTestAppIsDrawing --
 *
 *      A test widget display procedure which records calls can use this to
 *      detect whether it is being called from within [NSView drawRect].
 *      If so, it probably should not be recording the call since it was
 *      probably generated spontaneously by the window manager rather than
 *      by an explicit call to update. This is just a wrapper for the NSApp
 *      property.
 *

 *
 * Results:
 *      Returns true if and only if called from within [NSView drawRect].


 *
 * Side effects:
 *	None
 *
 *----------------------------------------------------------------------
 */
MODULE_SCOPE Bool
TkTestAppIsDrawing(void) {

    return [NSApp isDrawing];



}
 

/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
 * End:
 */







|

|
|
|
|
|
|
|
>


|
>
>







|
>
|
>
>
>











86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
    return TCL_OK;
}
#endif
 
/*
 *----------------------------------------------------------------------
 *
 * TkTestLogDisplay --
 *
 *      The test image display procedure calls this to determine whether it
 *      should write a log message recording that it has being run.  On OSX
 *      10.14 and later, only calls to the display procedure which occur inside
 *      of the drawRect method should be logged, since those are the only ones
 *      which actually draw anything.  On earlier systems the opposite is true.
 *      The calls from within the drawRect method are redundant, since the
 *      first time the display procedure is run it will do the drawing and that
 *      first call will usually not occur inside of drawRect.
 *
 * Results:
 *      On OSX 10.14 and later, returns true if and only if called from
 *      within [NSView drawRect].  On earlier systems returns false if
 *      and only if called from with [NSView drawRect].
 *
 * Side effects:
 *	None
 *
 *----------------------------------------------------------------------
 */
MODULE_SCOPE Bool
TkTestLogDisplay(void) {
    if ([NSApp macMinorVersion] >= 14) {
	return [NSApp isDrawing];
    } else {
	return ![NSApp isDrawing];
    }
}
 

/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
 * End:
 */

Changes to jni/sdl2tk/sdl/tkSDLDefault.h.

189
190
191
192
193
194
195

196

197
198
199
200
201
202
203
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG

#define DEF_FRAME_BG_MONO		WHITE

#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG







>

>







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG
#define DEF_FRAME_BG_IMAGE		NULL
#define DEF_FRAME_BG_MONO		WHITE
#define DEF_FRAME_BG_TILE		"0"
#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG

Changes to jni/sdl2tk/sdl/tkSDLDraw.c.

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223

224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
{
    TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrame --
 *
 *	This function draws the rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrame(
    Tk_Window tkwin,

    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
	    highlightWidth, Tk_Width(tkwin) - 2*highlightWidth,
	    Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief);
}
 
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */







|













|

>





|











201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
{
    TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrameEx --
 *
 *	This function draws the rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrameEx(
    Tk_Window tkwin,
    Drawable drawable,
    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,
	    highlightWidth, Tk_Width(tkwin) - 2*highlightWidth,
	    Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief);
}
 
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */

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

152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

169

170





171
172
173
174
175
176
177
...
716
717
718
719
720
721
722






723
724
725
726
727
728
729
...
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
...
762
763
764
765
766
767
768






769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
    .c itemconfigure i1 -image {}
    update
    list $x [.c bbox i1]
} -cleanup {
	.c delete all
	image delete foo
} -result {{{foo free}} {}}
test canvImg-4.2 {ConfiugreImage procedure} -constraints testImageType -setup {
    .c delete all
} -body {
	image create test foo -variable x
    image create test foo2 -variable y
    foo2 changed 0 0 0 0 80 60
    .c create image 50 100 -image foo -tags i1 -anchor nw
    update
    set x {}
    set y {}

    .c itemconfigure i1 -image foo2

    update





    list $x $y [.c bbox i1]
} -cleanup {
	.c delete all
	image delete foo
	image delete foo2
} -result {{{foo free}} {{foo2 get} {foo2 display 0 0 80 60}} {50 100 130 160}}
test canvImg-4.3 {ConfiugreImage procedure} -constraints testImageType -setup {
................................................................................
    .c scale image 25 0 2.0 1.5
    .c bbox image
} -cleanup {
	.c delete all
	image delete foo
} -result {75 150 105 165}







test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup {
    .c delete all
    update
} -body {
	image create test foo -variable x
    .c create image 50 100 -image foo -tags image -anchor nw
    update
................................................................................
    set x {}
    foo changed 2 4 6 8 30 15
    update
    return $x
} -cleanup {
	.c delete all
	image delete foo
} -result {{foo display 2 4 6 8}}

test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup {
    .c delete all
    update
} -body {
	image create test foo -variable x
    .c create image 50 100 -image foo -tags image -anchor nw
................................................................................
    set x {}
    foo changed 0 0 0 0 40 50
    .c bbox image
} -cleanup {
	.c delete all
	image delete foo
} -result {30 75 70 125}






test canvImg-11.3 {ImageChangedProc procedure} -constraints {
	testImageType
} -setup {
    .c delete all
    update
} -body {
    image create test foo -variable x
	image create test foo2 -variable y
    foo changed 0 0 0 0 40 50
    foo2 changed 0 0 0 0 80 60

    .c create image 50 100 -image foo -tags image -anchor nw
    .c create image 70 110 -image foo2 -anchor nw
    update
    set y {}
    image create test foo -variable x
    update
    return $y
} -cleanup {
	.c delete all
	image delete foo foo2
} -result {{foo2 display 0 0 20 40}}

# cleanup
imageFinish
cleanupTests
return

# Local variables:
# mode: tcl
# End:







|


|






>

>

>
>
>
>
>







 







>
>
>
>
>
>







 







|







 







>
>
>
>
>
>







|













|









152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
...
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
...
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
...
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
    .c itemconfigure i1 -image {}
    update
    list $x [.c bbox i1]
} -cleanup {
	.c delete all
	image delete foo
} -result {{{foo free}} {}}
test canvImg-4.2 {ConfigureImage procedure} -constraints testImageType -setup {
    .c delete all
} -body {
    image create test foo -variable x
    image create test foo2 -variable y
    foo2 changed 0 0 0 0 80 60
    .c create image 50 100 -image foo -tags i1 -anchor nw
    update
    set x {}
    set y {}
    set timer [after 300 {lappend y "timeout"}]
    .c itemconfigure i1 -image foo2
    update idletasks
    update
    # On MacOS we need to wait for the test image display procedure to run.
    while {"timeout" ni $y && [lindex $y end 1] ne "display"} {
        vwait y
    }
    after cancel timer
    list $x $y [.c bbox i1]
} -cleanup {
	.c delete all
	image delete foo
	image delete foo2
} -result {{{foo free}} {{foo2 get} {foo2 display 0 0 80 60}} {50 100 130 160}}
test canvImg-4.3 {ConfiugreImage procedure} -constraints testImageType -setup {
................................................................................
    .c scale image 25 0 2.0 1.5
    .c bbox image
} -cleanup {
	.c delete all
	image delete foo
} -result {75 150 105 165}

if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
    # Aqua >= 10.14 will redraw the entire image.
    set result_10_1 {{foo display 0 0 30 15}}
} else {
    set result_10_1 {{foo display 2 4 6 8}}
}
test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup {
    .c delete all
    update
} -body {
	image create test foo -variable x
    .c create image 50 100 -image foo -tags image -anchor nw
    update
................................................................................
    set x {}
    foo changed 2 4 6 8 30 15
    update
    return $x
} -cleanup {
	.c delete all
	image delete foo
} -result $result_10_1

test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup {
    .c delete all
    update
} -body {
	image create test foo -variable x
    .c create image 50 100 -image foo -tags image -anchor nw
................................................................................
    set x {}
    foo changed 0 0 0 0 40 50
    .c bbox image
} -cleanup {
	.c delete all
	image delete foo
} -result {30 75 70 125}
if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
    # Aqua >= 10.14 will redraw the entire image.
    set result_11_3 {{foo2 display 0 0 80 60}}
} else {
    set result_11_3 {{foo2 display 0 0 20 40}}
}
test canvImg-11.3 {ImageChangedProc procedure} -constraints {
	testImageType
} -setup {
    .c delete all
    update
} -body {
    image create test foo -variable x
    image create test foo2 -variable y
    foo changed 0 0 0 0 40 50
    foo2 changed 0 0 0 0 80 60

    .c create image 50 100 -image foo -tags image -anchor nw
    .c create image 70 110 -image foo2 -anchor nw
    update
    set y {}
    image create test foo -variable x
    update
    return $y
} -cleanup {
	.c delete all
	image delete foo foo2
} -result $result_11_3

# cleanup
imageFinish
cleanupTests
return

# Local variables:
# mode: tcl
# End:

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55






















56
57
58
59
60
61
62
63
64
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
..
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
...
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
...
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
...
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371



















372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
...
424
425
426
427
428
429
430
431
432
433
434
435
436




437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485

486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
...
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
...
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
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
...
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
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
...
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
...
920
921
922
923
924
925
926
927
928
929
930

931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
....
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
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
....
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105

1106
1107
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
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
....
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159

1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
....
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
....
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
....
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
....
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
....
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
....
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
....
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
....
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526


1527
1528
1529


































































































1530





















































































































































































1531





1532
1533
1534
1535
1536
1537
# This file is a Tcl script to test out the "frame" and "toplevel"
# commands of Tk.  It is organized in the standard fashion for Tcl
# tests.
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.2
namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands



# eatColors --
# Creates a toplevel window and allocates enough colors in it to
# use up all the slots in the colormap.
#
# Arguments:
# w -		Name of toplevel window to create.

proc eatColors {w} {
    catch {destroy $w}
    toplevel $w
    wm geom $w +0+0
    canvas $w.c -width 400 -height 200 -bd 0
    pack $w.c
    for {set y 0} {$y < 8} {incr y} {
	for {set x 0} {$x < 40} {incr x} {
	    set color [format #%02x%02x%02x [expr $x*6] [expr $y*30] 0]
	    $w.c create rectangle [expr 10*$x] [expr 20*$y] \
		    [expr 10*$x + 10] [expr 20*$y + 20] -outline {} \
		    -fill $color
	}
    }
    update
}

# colorsFree --
#
# Returns 1 if there appear to be free colormap entries in a window,
# 0 otherwise.
#
# Arguments:
# w -			Name of window in which to check.
# red, green, blue -	Intensities to use in a trial color allocation
#			to see if there are colormap entries free.

proc colorsFree {w {red 31} {green 245} {blue 192}} {
    set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]]
    expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \
	    && ([lindex $vals 2]/256 == $blue)
}

























test frame-1.1 {frame configuration options} -setup {
	deleteWindows
} -body {
    frame .f -class NewFrame
    .f configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Frame NewFrame}
test frame-1.2 {frame configuration options} -setup {
................................................................................
    frame .f -class NewFrame
    .f configure -class Different
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -class option after widget is created}

test frame-1.3 {frame configuration options} -setup {
	deleteWindows
} -body {
    frame .f -colormap new
    .f configure -colormap
} -cleanup {
    deleteWindows
} -result {-colormap colormap Colormap {} new}
test frame-1.4 {frame configuration options} -setup {
................................................................................
    frame .f -colormap new
    .f configure -colormap .
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -colormap option after widget is created}

test frame-1.5 {frame configuration options} -setup {
	deleteWindows
} -body {
    frame .f -visual default
    .f configure -visual
} -cleanup {
    deleteWindows
} -result {-visual visual Visual {} default}
test frame-1.6 {frame configuration options} -setup {
................................................................................
    frame .f -visual default
    .f configure -visual best
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -visual option after widget is created}

test frame-1.7 {frame configuration options} -setup {
	deleteWindows
} -body {
    frame .f -screen bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {unknown option "-screen"}
test frame-1.8 {frame configuration options} -setup {
	deleteWindows
} -body {
    frame .f -container true
} -cleanup {
    deleteWindows
} -result {.f}
test frame-1.9 {frame configuration options} -setup {
    deleteWindows
................................................................................
} -body {
    frame .f -container true
    .f configure -container
} -cleanup {
    deleteWindows
} -result {-container container Container 0 1}
test frame-1.10 {frame configuration options} -setup {
	deleteWindows
} -body {
    frame .f -container bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {expected boolean value but got "bogus"}
test frame-1.11 {frame configuration options} -setup {
	deleteWindows
} -body {
    frame .f
    .f configure -container 1
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -container option after widget is created}
test frame-1.12 {frame configuration options} -setup {
	deleteWindows
} -body {
    # Make sure all options can be set to the default value
    frame .f
    set opts {}
    foreach opt [.f configure] {
        if {[llength $opt] == 5} {
            lappend opts [lindex $opt 0] [lindex $opt 4]
        }
    }
    eval frame .g $opts
    destroy .f .g
} -cleanup {

    deleteWindows
} -result {}

destroy .f
frame .f
test frame-1.13 {frame configuration options} -body {
    .f configure -background #ff0000
    lindex [.f configure -background] 4
} -cleanup {
    .f configure -background [lindex [.f configure -background] 3]
} -result {#ff0000}
test frame-1.14 {frame configuration options} -body {
    .f configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-1.15 {frame configuration options} -body {
    .f configure -bd 4
    lindex [.f configure -bd] 4
} -cleanup {
................................................................................
    .f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-1.17 {frame configuration options} -body {
    .f configure -bg #00ff00
    lindex [.f configure -bg] 4
} -cleanup {
    .f configure -bg [lindex [.f configure -bg] 3]
} -result {#00ff00}
test frame-1.18 {frame configuration options} -body {
    .f configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-1.19 {frame configuration options} -body {
    .f configure -borderwidth 1.3
    lindex [.f configure -borderwidth] 4
} -cleanup {
................................................................................
    .f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-1.25 {frame configuration options} -body {
    .f configure -highlightbackground #112233
    lindex [.f configure -highlightbackground] 4
} -cleanup {
    .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3]
} -result {#112233}
test frame-1.26 {frame configuration options} -body {
    .f configure -highlightbackground ugly
} -returnCodes error -result {unknown color name "ugly"}
test frame-1.27 {frame configuration options} -body {
    .f configure -highlightcolor #123456
    lindex [.f configure -highlightcolor] 4
} -cleanup {
    .f configure -highlightcolor [lindex [.f configure -highlightcolor] 3]
} -result {#123456}
test frame-1.28 {frame configuration options} -body {
    .f configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-1.29 {frame configuration options} -body {
    .f configure -highlightthickness 6
    lindex [.f configure -highlightthickness] 4
} -cleanup {
................................................................................
    .f configure -width [lindex [.f configure -width] 3]
} -result {32}
test frame-1.39 {frame configuration options} -body {
    .f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
destroy .f


test frame-2.1 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -class NewClass
    wm geometry .t +0+0
    .t configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Toplevel NewClass}
................................................................................
    wm geometry .t +0+0
    .t configure -class Another
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -class option after widget is created}

test frame-2.3 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -colormap new
    wm geometry .t +0+0
    .t configure -colormap
} -cleanup {
    deleteWindows
} -result {-colormap colormap Colormap {} new}
................................................................................
    wm geometry .t +0+0
    .t configure -colormap .
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -colormap option after widget is created}

test frame-2.5 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    .t configure -container 1
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -container option after widget is created}
................................................................................
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    catch {.t configure -container 1}
    .t configure -container
} -cleanup {
    deleteWindows
} -result {-container container Container 0 0}

test frame-2.7 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -colormap bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {bad window path name "bogus"}


test frame-2.8 {toplevel configuration options} -constraints {
    win
} -setup {
	deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    .t configure -use 0x44022
} -cleanup {
    deleteWindows
} -returnCodes error -result {window "0x44022" doesn't exist}
test frame-2.9 {toplevel configuration options} -constraints {
    win
} -setup {



















    deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    catch {.t configure -use 0x44022}
    .t configure -use
} -cleanup {
    deleteWindows
} -result {-use use Use {} {}}

test frame-2.10 {toplevel configuration options} -constraints {
    nonwin
} -setup {
    deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    .t configure -use 0x44022
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -use option after widget is created}
test frame-2.11 {toplevel configuration options} -constraints {
    nonwin
} -setup {
	deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    catch {.t configure -use 0x44022}
    .t configure -use
} -cleanup {
    deleteWindows
} -result {-use use Use {} {}}

test frame-2.12 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100 -visual default
    wm geometry .t +0+0
    .t configure -visual
} -cleanup {
    deleteWindows
................................................................................
    wm geometry .t +0+0
    .t configure -visual best
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -visual option after widget is created}

test frame-2.14 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -visual who_knows?
} -cleanup {
    deleteWindows
} -returnCodes error -result {unknown or ambiguous visual name "who_knows?": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, truecolor, or default}




test frame-2.15 {toplevel configuration options} -constraints haveDISPLAY -setup {
	deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
    wm geometry .t +0+0
    string compare [.t configure -screen] "-screen screen Screen {} $env(DISPLAY)"
} -cleanup {
    deleteWindows
} -result {0}
test frame-2.16 {toplevel configuration options} -constraints haveDISPLAY -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
    wm geometry .t +0+0
    .t configure -screen another
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -screen option after widget is created}

test frame-2.17 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -screen bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {couldn't connect to display "bogus"}
test frame-2.18 {toplevel configuration options} -setup {
	deleteWindows
} -body {
    toplevel .t -container 1 -width 300 -height 120
    wm geometry .t +0+0
    toplevel .x -container 1 -use [winfo id .t]
} -cleanup {
    deleteWindows
} -returnCodes error -result {windows cannot have both the -use and the -container option set}
test frame-2.19 {toplevel configuration options} -setup {
	deleteWindows
    set opts {}
} -body {
    # Make sure all options can be set to the default value
    toplevel .f
    foreach opt [.f configure] {
        if {[llength $opt] == 5} {
            lappend opts [lindex $opt 0] [lindex $opt 4]
        }
    }
    eval toplevel .g $opts
    destroy .f .g
} -cleanup {

    deleteWindows
} -result {}


destroy .t
toplevel .t -width 300 -height 150
wm geometry .t +0+0
update
test frame-2.20 {toplevel configuration options} -body {
    .t configure -background #ff0000
    lindex [.t configure -background] 4
} -result {#ff0000}
test frame-2.21 {toplevel configuration options} -body {
    .t configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.22 {toplevel configuration options} -body {
    .t configure -bd 4
    lindex [.t configure -bd] 4
} -result {4}
test frame-2.23 {toplevel configuration options} -body {
    .t configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-2.24 {toplevel configuration options} -body {
    .t configure -bg #00ff00
    lindex [.t configure -bg] 4
} -result {#00ff00}
test frame-2.25 {toplevel configuration options} -body {
    .t configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.26 {toplevel configuration options} -body {
    .t configure -borderwidth 1.3
    lindex [.t configure -borderwidth] 4
} -result {1}
................................................................................
} -result {100}
test frame-2.31 {toplevel configuration options} -body {
    .t configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-2.32 {toplevel configuration options} -body {
    .t configure -highlightcolor #123456
    lindex [.t configure -highlightcolor] 4
} -result {#123456}
test frame-2.33 {toplevel configuration options} -body {
    .t configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.34 {toplevel configuration options} -body {
    .t configure -highlightthickness 3
    lindex [.t configure -highlightthickness] 4
} -result {3}
................................................................................
destroy .t


test frame-3.1 {TkCreateFrame procedure} -body {
    frame
} -returnCodes error -result {wrong # args: should be "frame pathName ?-option value ...?"}
test frame-3.2 {TkCreateFrame procedure} -setup {
	deleteWindows
    frame .f
} -body {
    .f configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Frame Frame}
test frame-3.3 {TkCreateFrame procedure} -setup {
	deleteWindows
    toplevel .t
    wm geometry .t +0+0
} -body {
    .t configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Toplevel Toplevel}
test frame-3.4 {TkCreateFrame procedure} -setup {
	deleteWindows
} -body {
    toplevel .t -width 350 -class NewClass -bg black -visual default -height 90
    wm geometry .t +0+0
    update
    list [lindex [.t configure -width] 4] \
	    [lindex [.t configure -background] 4] \
	    [lindex [.t configure -height] 4]
} -cleanup {
    deleteWindows
} -result {350 black 90}

# Be sure that the -class, -colormap, and -visual options are processed
# before configuring the widget.
test frame-3.5 {TkCreateFrame procedure} -setup {
	deleteWindows
} -body {
    option add *NewFrame.background #123456
    frame .f -class NewFrame
    lindex [.f configure -background] 4
} -cleanup {
    deleteWindows
    option clear
} -result {#123456}
test frame-3.6 {TkCreateFrame procedure} -setup {
	deleteWindows
} -body {
    option add *NewFrame.background #123456
    frame .f -class NewFrame
    lindex [.f configure -background] 4
} -cleanup {
    deleteWindows
    option clear
} -result {#123456}
test frame-3.7 {TkCreateFrame procedure} -setup {
	deleteWindows
} -body {
    option add *NewFrame.background #332211
    option add *f.class NewFrame
    frame .f
    list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4]
} -cleanup {
    deleteWindows
    option clear
} -result {NewFrame #332211}
test frame-3.8 {TkCreateFrame procedure} -setup {
	deleteWindows
} -body {
    option add *Silly.background #122334
    option add *f.Class Silly
    frame .f
    list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4]
} -cleanup {
    deleteWindows
    option clear
} -result {Silly #122334}
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 {
# This call to update idletasks was added to prevent a crash that was
# observed on OSX 10.12 (Sierra) only.  Any change, such as using the
# Development version to make debugging symbols available, adding a print
# statement, or calling update idletasks here, would make the test pass
# with no segfault.
    update idletasks
    deleteWindows
} -result {0 0 140 300}
test frame-3.10 {TkCreateFrame procedure, -use option} -constraints {
    unix
} -setup {
    deleteWindows
................................................................................
    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}

# The tests below require specific display characteristics (i.e. that
# they are run on a pseudocolor display of depth 8).  Even so, they
# are non-portable: some machines don't seem to ever run out of
# colors.
if {[testConstraint defaultPseudocolor8]} {
    eatColors .t1
}
test frame-3.11 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 nonPortable
} -setup {
	deleteWindows
} -body {
    toplevel .t -width 300 -height 200 -bg #475601
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    deleteWindows
} -result {0}
test frame-3.12 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 nonPortable
} -setup {
	deleteWindows
} -body {
    toplevel .t -width 300 -height 200 -bg #475601 -colormap new
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    deleteWindows
} -result {1}
test frame-3.13 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 nonPortable
} -setup {
	deleteWindows
} -body {
    option add *t.class Toplevel2
    option add *Toplevel2.colormap new
    toplevel .t -width 300 -height 200 -bg #475601
    wm geometry .t +0+0
    update
    option clear
    colorsFree .t
} -cleanup {
    deleteWindows
} -result {1}
test frame-3.14 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 nonPortable
} -setup {
	deleteWindows
} -body {
    option add *t.class Toplevel3
    option add *Toplevel3.Colormap new
    toplevel .t -width 300 -height 200 -bg #475601 -colormap new
    wm geometry .t +0+0
    update
    option clear
    colorsFree .t
} -cleanup {
    deleteWindows
} -result {1}
test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -constraints {
    defaultPseudocolor8 unix nonPortable
} -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 -colormap new
    tkwait visibility .x
    list [colorsFree .t] [colorsFree .x]
} -cleanup {
    destroy .t
} -result {0 1}
test frame-3.16 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 nonPortable
} -setup {
	deleteWindows
} -body {
    toplevel .t -width 300 -height 200 -bg #475601 -visual default
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    deleteWindows
} -result {0}
test frame-3.17 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 nonPortable
} -setup {
	deleteWindows
} -body {
    toplevel .t -width 300 -height 200 -bg #475601 -visual default \
	    -colormap new
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    deleteWindows
} -result {1}
test frame-3.18 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
	deleteWindows
} -body {
    toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    colorsFree .t 131 131 131
} -cleanup {
    deleteWindows
} -result {1}
test frame-3.19 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
	deleteWindows
} -body {
    option add *t.class T4
    option add *T4.visual {grayscale 8}
    toplevel .t -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    option clear
    list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
} -cleanup {
    deleteWindows
} -result {1 {grayscale 8}}
test frame-3.20 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
	deleteWindows
} -body {
    set x ok
    option add *t.class T5
    option add *T5.Visual {grayscale 8}
    toplevel .t -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    option clear
    list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
} -cleanup {
    deleteWindows
} -result {1 {grayscale 8}}
test frame-3.21 {TkCreateFrame procedure} -constraints {
	defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
	deleteWindows
} -body {
    set x ok
    toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    colorsFree .t 131 131 131
} -cleanup {
    deleteWindows
} -result {1}
if {[testConstraint defaultPseudocolor8]} {
    destroy .t1
}

test frame-3.22 {TkCreateFrame procedure, default dimensions} -setup {
	deleteWindows
} -body {
    toplevel .t
    wm geometry .t +0+0
    update
    set result "[winfo reqwidth .t] [winfo reqheight .t]"
    frame .t.f -bg red
    pack .t.f
................................................................................
test frame-3.24 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    toplevel .t -width 300 -height 200 -colormap new -bogus option
    wm geometry .t +0+0
} -returnCodes error -result {unknown option "-bogus"}


test frame-4.1 {TkCreateFrame procedure} -setup {
	deleteWindows
} -body {
    catch {frame .f -gorp glob}
    winfo exists .f
} -result 0
test frame-4.2 {TkCreateFrame procedure} -setup {
	deleteWindows
} -body {
    list [frame .f -width 200 -height 100] [winfo exists .f]
} -cleanup {
    deleteWindows
} -result {.f 1}


frame .f -highlightcolor black
test frame-5.1 {FrameWidgetCommand procedure} -body {
    .f
} -returnCodes error -result {wrong # args: should be ".f option ?arg ...?"}
test frame-5.2 {FrameWidgetCommand procedure, cget option} -body {
    .f cget
................................................................................
    destroy .t
} -body {
    toplevel .t
    .t cget -screen
} -cleanup {
    destroy .t
} -returnCodes ok -match glob -result *

test frame-5.8 {FrameWidgetCommand procedure, configure option} -body {
    llength [.f configure]
} -result {18}

test frame-5.9 {FrameWidgetCommand procedure, configure option} -body {
    .f configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
test frame-5.10 {FrameWidgetCommand procedure, configure option} -body {
    .f configure -gorp bogus
} -returnCodes error -result {unknown option "-gorp"}
test frame-5.11 {FrameWidgetCommand procedure, configure option} -body {
    .f configure -width 200 -height
} -returnCodes error -result {value for "-height" missing}
test frame-5.12 {FrameWidgetCommand procedure} -body {
    .f swizzle
} -returnCodes error -result {bad option "swizzle": must be cget or configure}
test frame-5.13 {FrameWidgetCommand procedure, configure option} -body {
    llength [. configure]
} -result {21}
destroy .f

test frame-6.1 {ConfigureFrame procedure} -setup {
	deleteWindows
} -body {
    frame .f -width 150
    list [winfo reqwidth .f] [winfo reqheight .f]
} -cleanup {
    deleteWindows
} -result {150 1}
test frame-6.2 {ConfigureFrame procedure} -setup {
	deleteWindows
} -body {
    frame .f -height 97
    list [winfo reqwidth .f] [winfo reqheight .f]
} -cleanup {
    deleteWindows
} -result {1 97}
test frame-6.3 {ConfigureFrame procedure} -setup {
	deleteWindows
} -body {
    frame .f
    set result {}
    lappend result [winfo reqwidth .f] [winfo reqheight .f]
    .f configure -width 100 -height 180
    lappend result [winfo reqwidth .f] [winfo reqheight .f]
    .f configure -width 0 -height 0
    lappend result [winfo reqwidth .f] [winfo reqheight .f]
} -cleanup {
    deleteWindows
} -result {1 1 100 180 100 180}

test frame-7.1 {FrameEventProc procedure} -setup {
	deleteWindows
} -body {
    frame .frame2
    set result [info commands .frame2]
    destroy .frame2
    lappend result [info commands .frame2]
} -result {.frame2 {}}
test frame-7.2 {FrameEventProc procedure} -setup {
	deleteWindows
    set x {}
} -body {
    frame .f1 -bg #543210
    rename .f1 .f2
    lappend x [winfo children .]
    lappend x [.f2 cget -bg]
    destroy .f1
    lappend x [info command .f*] [winfo children .]
} -cleanup {
    deleteWindows
} -result {.f1 #543210 {} {}}

test frame-8.1 {FrameCmdDeletedProc procedure} -setup {
	deleteWindows
} -body {
    frame .f1
    rename .f1 {}
    list [info command .f*] [winfo children .]
} -cleanup {
    deleteWindows
} -result {{} {}}
test frame-8.2 {FrameCmdDeletedProc procedure} -setup {
	deleteWindows
} -body {
    toplevel .f1 -menu .m
    wm geometry .f1 +0+0
    update
    rename .f1 {}
    update
    list [info command .f*] [winfo children .]
................................................................................
} -cleanup {
    deleteWindows
} -result {{} {}}
#
# This one fails with the dash-patch!!!! Still don't know why  :-(
#
#test frame-8.3 {FrameCmdDeletedProc procedure} -setup {
#    eval destroy [winfo children .]
#    deleteWindows
#} -body {
#    toplevel .f1 -menu .m
#    wm geometry .f1 +0+0
#    menu .m
#    update
#    rename .f1 {}
#    update
#    list [info command .f*] [winfo children .]
#} -cleanup {
#    eval destroy [winfo children .]
#    deleteWindows
#} -result {{} .m}

test frame-9.1 {MapFrame procedure} -setup {
	deleteWindows
} -body {
    toplevel .t -width 100 -height 400
    wm geometry .t +0+0
    set result [winfo ismapped .t]
    update idletasks
    lappend result [winfo ismapped .t]
} -cleanup {
    deleteWindows
} -result {0 1}
test frame-9.2 {MapFrame procedure} -setup {
	deleteWindows
} -body {
    toplevel .t -width 100 -height 400
    wm geometry .t +0+0
    destroy .t
    update
    winfo exists .t
} -result {0}
test frame-9.3 {MapFrame procedure, window deleted while mapping} -setup {
	deleteWindows
} -body {
    toplevel .t2 -width 200 -height 200
    wm geometry .t2 +0+0
    tkwait visibility .t2
    toplevel .t -width 100 -height 400
    wm geometry .t +0+0
    frame .t2.f -width 50 -height 50
................................................................................
    pack .t2.f -side top
    update idletasks
    winfo exists .t
} -cleanup {
    deleteWindows
} -result {0}


test frame-10.1 {frame widget vs hidden commands} -setup {
	deleteWindows
} -body {
    set l [interp hidden]
    frame .t
    interp hide {} .t
    destroy .t
    set res1 [list [winfo children .] [interp hidden]]
    set res2 [list {} $l]
    expr {$res1 eq $res2}
} -result 1


test frame-11.1 {TkInstallFrameMenu} -setup {
	deleteWindows
} -body {
    menu .m1
    .m1 add cascade -menu .m1.system
    menu .m1.system -tearoff 0
    .m1.system add command -label foo
    toplevel .t -menu .m1
} -cleanup {
    deleteWindows
} -result {.t}
test frame-11.2 {TkInstallFrameMenu - frame renamed} -setup {
	deleteWindows
} -body {
    catch {rename foo {}}

    menu .m1
    .m1 add cascade -menu .m1.system
    menu .m1.system -tearoff 0
    .m1.system add command -label foo
    toplevel .t
    rename .t foo
} -cleanup {
    deleteWindows
} -result {}


test frame-12.1 {FrameWorldChanged procedure} -setup {
	deleteWindows
} -body {
    # Test -bd -padx and -pady
    frame .f -borderwidth 2 -padx 3 -pady 4
    place .f -x 0 -y 0 -width 40 -height 40
    pack [frame .f.f] -fill both -expand 1
    update
    list [winfo x .f.f] [winfo y .f.f] [winfo width .f.f] [winfo height .f.f]
} -cleanup {
    deleteWindows
} -result {5 6 30 28}
test frame-12.2 {FrameWorldChanged procedure} -setup {
	deleteWindows
} -body {
    # Test all -labelanchor positions
    set font {helvetica 12}
    labelframe .f -highlightthickness 1 -bd 3 -padx 1 -pady 2 -font $font \
            -text "Mupp"
    set fh [expr {[font metrics $font -linespace] + 2 - 3}]
    set fw [expr {[font measure $font "Mupp"] + 2 - 3}]
    if {$fw < 0} {set fw 0}
    if {$fh < 0} {set fh 0}
    place .f -x 0 -y 0 -width 100 -height 100
    pack [frame .f.f] -fill both -expand 1

    set result {}
    foreach lp {nw n ne en e es se s sw ws w wn} {
        .f configure -labelanchor $lp
        update
        set expx 5
        set expy 6
        set expw 90
................................................................................
        set exph 88
        switch -glob $lp {
            n* {incr expy $fh ; incr exph -$fh}
            s* {incr exph -$fh}
            w* {incr expx $fw ; incr expw -$fw}
            e* {incr expw -$fw}
        }
        lappend result [expr {\
                [winfo x .f.f] == $expx && [winfo y .f.f] == $expy &&\
                [winfo width .f.f] == $expw && [winfo height .f.f] == $exph}]

    }
    return $result
} -cleanup {
    deleteWindows
} -result {1 1 1 1 1 1 1 1 1 1 1 1}
test frame-12.3 {FrameWorldChanged procedure} -setup {
	deleteWindows
} -body {
    # Check reaction on font change
    font create myfont -family courier -size 10
    labelframe .f -font myfont -text Mupp
    place .f -x 0 -y 0 -width 40 -height 40
    pack [frame .f.f] -fill both -expand 1
    update
................................................................................
    set y2 [winfo y .f.f]
    expr {($h2 - $h1) - ($y2 - $y1)}
} -cleanup {
    deleteWindows
    font delete myfont
} -result {0}


test frame-13.1 {labelframe configuration options} -setup {
	deleteWindows
} -body {
    labelframe .f -class NewFrame
    .f configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Labelframe NewFrame}
test frame-13.2 {labelframe configuration options} -setup {
................................................................................
} -body {
    labelframe .f -class NewFrame
    .f configure -class Different
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -class option after widget is created}
test frame-13.3 {labelframe configuration options} -setup {
	deleteWindows
} -body {
    labelframe .f -colormap new
} -cleanup {
    deleteWindows
} -result {.f}
test frame-13.4 {labelframe configuration options} -setup {
	deleteWindows
} -body {
    labelframe .f -visual default
} -cleanup {
    deleteWindows
} -result {.f}
test frame-13.5 {labelframe configuration options} -setup {
	deleteWindows
} -body {
    labelframe .f -screen bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {unknown option "-screen"}
test frame-13.6 {labelframe configuration options} -setup {
	deleteWindows
} -body {
    labelframe .f -container true
} -cleanup {
    deleteWindows
} -result {.f}
test frame-13.7 {labelframe configuration options} -setup {
    deleteWindows
................................................................................
} -body {
    labelframe .f -container true
    .f configure -container
} -cleanup {
    deleteWindows
} -result {-container container Container 0 1}
test frame-13.8 {labelframe configuration options} -setup {
	deleteWindows
} -body {
     labelframe .f -container bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {expected boolean value but got "bogus"}
test frame-13.9 {labelframe configuration options} -setup {
	deleteWindows
} -body {
    labelframe .f
    .f configure -container 1
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -container option after widget is created}

destroy .f
labelframe .f
test frame-13.10 {labelframe configuration options} -body {
    .f configure -background #ff0000
    lindex [.f configure -background] 4
} -cleanup {
    .f configure -background [lindex [.f configure -background] 3]
} -result {#ff0000}
test frame-13.11 {labelframe configuration options} -body {
        .f configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.12 {labelframe configuration options} -body {
    .f configure -bd 4
    lindex [.f configure -bd] 4
} -cleanup {
    .f configure -bd [lindex [.f configure -bd] 3]
} -result {4}
test frame-13.13 {labelframe configuration options} -body {
        .f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.14 {labelframe configuration options} -body {
    .f configure -bg #00ff00
    lindex [.f configure -bg] 4
} -cleanup {
    .f configure -bg [lindex [.f configure -bg] 3]
} -result {#00ff00}
test frame-13.15 {labelframe configuration options} -body {
        .f configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.16 {labelframe configuration options} -body {
    .f configure -borderwidth 1.3
    lindex [.f configure -borderwidth] 4
} -cleanup {
    .f configure -borderwidth [lindex [.f configure -borderwidth] 3]
} -result {1}
test frame-13.17 {labelframe configuration options} -body {
        .f configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.18 {labelframe configuration options} -body {
    .f configure -cursor arrow
    lindex [.f configure -cursor] 4
} -cleanup {
    .f configure -cursor [lindex [.f configure -cursor] 3]
} -result {arrow}
test frame-13.19 {labelframe configuration options} -body {
        .f configure -cursor badValue
} -returnCodes error -result {bad cursor spec "badValue"}
test frame-13.20 {labelframe configuration options} -body {
    .f configure -fg #0000ff
    lindex [.f configure -fg] 4
} -cleanup {
    .f configure -fg [lindex [.f configure -fg] 3]
} -result {#0000ff}
test frame-13.21 {labelframe configuration options} -body {
        .f configure -fg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.22 {labelframe configuration options} -body {
    .f configure -font {courier 8}
    lindex [.f configure -font] 4
} -cleanup {
    .f configure -font [lindex [.f configure -font] 3]
} -result {courier 8}
test frame-13.23 {labelframe configuration options} -body {
    .f configure -foreground #ff0000
    lindex [.f configure -foreground] 4
} -cleanup {
    .f configure -foreground [lindex [.f configure -foreground] 3]
} -result {#ff0000}
test frame-13.24 {labelframe configuration options} -body {
        .f configure -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.25 {labelframe configuration options} -body {
    .f configure -height 100
    lindex [.f configure -height] 4
} -cleanup {
    .f configure -height [lindex [.f configure -height] 3]
} -result {100}
test frame-13.26 {labelframe configuration options} -body {
        .f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-13.27 {labelframe configuration options} -body {
    .f configure -highlightbackground #112233
    lindex [.f configure -highlightbackground] 4
} -cleanup {
    .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3]
} -result {#112233}
test frame-13.28 {labelframe configuration options} -body {
        .f configure -highlightbackground ugly
} -returnCodes error -result {unknown color name "ugly"}
test frame-13.29 {labelframe configuration options} -body {
    .f configure -highlightcolor #123456
    lindex [.f configure -highlightcolor] 4
} -cleanup {
    .f configure -highlightcolor [lindex [.f configure -highlightcolor] 3]
} -result {#123456}
test frame-13.30 {labelframe configuration options} -body {
        .f configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.31 {labelframe configuration options} -body {
    .f configure -highlightthickness 6
    lindex [.f configure -highlightthickness] 4
} -cleanup {
    .f configure -highlightthickness [lindex [.f configure -highlightthickness] 3]
} -result {6}
test frame-13.32 {labelframe configuration options} -body {
        .f configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.33 {labelframe configuration options} -body {
    .f configure -labelanchor se
    lindex [.f configure -labelanchor] 4
} -cleanup {
    .f configure -labelanchor [lindex [.f configure -labelanchor] 3]
} -result {se}
test frame-13.34 {labelframe configuration options} -body {
        .f configure -labelanchor badValue
} -returnCodes error -result {bad labelanchor "badValue": must be e, en, es, n, ne, nw, s, se, sw, w, wn, or ws}
test frame-13.35 {labelframe configuration options} -body {
    .f configure -padx 3
    lindex [.f configure -padx] 4
} -cleanup {
    .f configure -padx [lindex [.f configure -padx] 3]
} -result {3}
test frame-13.36 {labelframe configuration options} -body {
        .f configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.37 {labelframe configuration options} -body {
    .f configure -pady 4
    lindex [.f configure -pady] 4
} -cleanup {
    .f configure -pady [lindex [.f configure -pady] 3]
} -result {4}
test frame-13.38 {labelframe configuration options} -body {
        .f configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.39 {labelframe configuration options} -body {
    .f configure -relief ridge
    lindex [.f configure -relief] 4
} -cleanup {
    .f configure -relief [lindex [.f configure -relief] 3]
} -result {ridge}
test frame-13.40 {labelframe configuration options} -body {
        .f configure -relief badValue
} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
test frame-13.41 {labelframe configuration options} -body {
    .f configure -takefocus {any string}
    lindex [.f configure -takefocus] 4
} -cleanup {
    .f configure -takefocus [lindex [.f configure -takefocus] 3]
} -result {any string}
................................................................................
test frame-13.43 {labelframe configuration options} -body {
    .f configure -width 32
    lindex [.f configure -width] 4
} -cleanup {
    .f configure -width [lindex [.f configure -width] 3]
} -result {32}
test frame-13.44 {labelframe configuration options} -body {
        .f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
destroy .f


test frame-14.1 {labelframe labelwidget option} -setup {
	deleteWindows
} -body {
    # Test that label is moved in stacking order
    label .l -text Mupp -font {helvetica 8}
    labelframe .f -labelwidget .l
    pack .f
    frame .f.f -width 50 -height 50
    pack .f.f
................................................................................
    update
    list [winfo children .] [winfo width .f] \
        [expr {[winfo height .f] - [winfo height .l]}]
} -cleanup {
    deleteWindows
} -result {{.f .l} 54 52}
test frame-14.2 {labelframe labelwidget option} -setup {
	deleteWindows
} -body {
    # Test the labelframe's reaction if the label is destroyed
    label .l -text Aratherlonglabel
    labelframe .f -labelwidget .l
    pack .f
    label .f.l -text Mupp
    pack .f.l
................................................................................
    lappend res [.f cget -labelwidget]
    update
    lappend res [expr {[winfo width .f] - [winfo width .f.l]}]
} -cleanup {
    deleteWindows
} -result {.l 12 {} 4}
test frame-14.3 {labelframe labelwidget option} -setup {
	deleteWindows
} -body {
    # Test the labelframe's reaction if the label is stolen
    label .l -text Aratherlonglabel
    labelframe .f -labelwidget .l
    pack .f
    label .f.l -text Mupp
    pack .f.l
................................................................................
    lappend res [.f cget -labelwidget]
    update
    lappend res [expr {[winfo width .f] - [winfo width .f.l]}]
} -cleanup {
    deleteWindows
} -result {.l 12 {} 4}
test frame-14.4 {labelframe labelwidget option} -setup {
	deleteWindows
} -body {
    # Test the label's reaction if the labelframe is destroyed
    label .l -text Mupp
    labelframe .f -labelwidget .l
    pack .f
    update
    set res [list [winfo manager .l]]
    destroy .f
    lappend res [winfo manager .l]
} -cleanup {
    deleteWindows
} -result {labelframe {}}
test frame-14.5 {labelframe labelwidget option} -setup {
	deleteWindows
} -body {
    # Test that the labelframe reacts on changes in label
    label .l -text Aratherlonglabel
    labelframe .f -labelwidget .l
    pack .f
    label .f.l -text Mupp
    pack .f.l
................................................................................
    update
    lappend res [expr {[winfo width .f] - [winfo width .l]}]
    lappend res [expr {[winfo width .f] > $first}]
} -cleanup {
    deleteWindows
} -result {12 12 1 12 1}
test frame-14.6 {labelframe labelwidget option} -setup {
	deleteWindows
} -body {
    # Destroying a labelframe with a child label caused a crash
    # when not handling mapping of the label correctly.
    # This test does not test anything directly, it's just ment
    # to catch if the same mistake is made again.
    labelframe .f
    pack .f
    label .f.l -text Mupp
    .f configure -labelwidget .f.l
    update
} -cleanup {
    deleteWindows
} -result {}


deleteWindows
rename eatColors {}
rename colorsFree {}
























































































































































































































































































# cleanup





cleanupTests
return




|
|












>
>

|
|












|
|
|
|







|
|







|
|
<


>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|







 







|







 







|







 







|






|







 







|






|







|









|
<

>

|








|







 







|







 







|








|







 







<

|







 







|







 







|







 







<

|





<
<
|
<
<
|








|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>










<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

|







 







|





>
>
>
>
|
|



|


|
|










|






|








|









|
<

>

|
<








|













|







 







|







 







|







|








|










<



|









|









|










|












|









|
|
|
|
|







 







<
|
|
|
<




|

|






|


|

|






|


|

|









|


|

|









|




|










|

|






|


|

|







|


|

|






|


|

|









|


|

|

<








|


|

|

<





|




<

|







 







<

|





|





<







 







<

|
<
>













|
|



|







|







|













|







|













|








|







 







<










<




|










|








|







 







<

|

<



|
<
<
|

<

|










|
<

>










<

|











|





|
|
<
<


<







 







|
|
|
>






|







 







<

|







 







|






|






|






|







 







|






|






<







|

|








|






|

|








|








|






|

|












|

|








|






|

|






|

|








|








|








|








|








|







 







|



<

|







 







|







 







|







 







|













|







 







|

|
|
|
|








>
>
|
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>



|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
...
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
...
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
...
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
...
305
306
307
308
309
310
311

312
313
314
315
316
317
318
319
320
...
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
...
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
...
363
364
365
366
367
368
369

370
371
372
373
374
375
376


377


378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418



























419
420
421
422
423
424
425
426
427
...
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497

498
499
500
501

502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
...
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
...
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625

626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
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
694
...
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
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839

840
841
842
843
844
845
846
847
848
849
850
851
852
853
854

855
856
857
858
859
860
861
862
863
864

865
866
867
868
869
870
871
872
873
...
884
885
886
887
888
889
890

891
892
893
894
895
896
897
898
899
900
901
902
903

904
905
906
907
908
909
910
...
925
926
927
928
929
930
931

932
933

934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
....
1022
1023
1024
1025
1026
1027
1028

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
....
1072
1073
1074
1075
1076
1077
1078

1079
1080
1081

1082
1083
1084
1085


1086
1087

1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100

1101
1102
1103
1104
1105
1106
1107
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
1133


1134
1135

1136
1137
1138
1139
1140
1141
1142
....
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
....
1173
1174
1175
1176
1177
1178
1179

1180
1181
1182
1183
1184
1185
1186
1187
1188
....
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
....
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246

1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
....
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412

1413
1414
1415
1416
1417
1418
1419
1420
1421
....
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
....
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
....
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
....
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520


1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
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
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
# This file is a Tcl script to test out the "frame", "labelframe" and
# "toplevel" commands of Tk.  It is organized in the standard fashion for Tcl
# tests.
#
# Copyright (c) 1994 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.

package require tcltest 2.2
namespace import ::tcltest::*
eval tcltest::configure $argv
tcltest::loadTestedCommands

tcltest::testConstraint x11 [expr {[tk windowingsystem] eq "x11"}]

# eatColors --
# Creates a toplevel window and allocates enough colors in it to use up all
# the slots in an 8-bit colormap.
#
# Arguments:
# w -		Name of toplevel window to create.

proc eatColors {w} {
    catch {destroy $w}
    toplevel $w
    wm geom $w +0+0
    canvas $w.c -width 400 -height 200 -bd 0
    pack $w.c
    for {set y 0} {$y < 8} {incr y} {
	for {set x 0} {$x < 40} {incr x} {
	    set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0]
	    $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \
		[expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \
		-fill $color
	}
    }
    update
}

# colorsFree --
#
# Returns 1 if there appear to be free colormap entries in a window, 0
# otherwise.
#
# Arguments:
# w -			Name of window in which to check.
# red, green, blue -	Intensities to use in a trial color allocation
#			to see if there are colormap entries free.

proc colorsFree {w {red 31} {green 245} {blue 192}} {
    lassign [winfo rgb $w [format "#%02x%02x%02x" $red $green $blue]] r g b
    expr {($r/256 == $red) && ($g/256 == $green) && ($b/256 == $blue)}

}

# uniq --
#
# Returns the unique items of a list in the order they first appear.
#
# Arguments:
# list -		The list to uniq-ify.
proc uniq {list} {
    set d {}
    foreach item $list {
	dict set d $item {}
    }
    return [dict keys $d]
}

# optnames --
#
# Returns the option names out of a list of option details.
#
# Arguments:
# options -		The option detail list.
proc optnames {options} {
    lsort [lmap desc $options {lindex $desc 0}]
}
 
test frame-1.1 {frame configuration options} -setup {
    deleteWindows
} -body {
    frame .f -class NewFrame
    .f configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Frame NewFrame}
test frame-1.2 {frame configuration options} -setup {
................................................................................
    frame .f -class NewFrame
    .f configure -class Different
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -class option after widget is created}

test frame-1.3 {frame configuration options} -setup {
    deleteWindows
} -body {
    frame .f -colormap new
    .f configure -colormap
} -cleanup {
    deleteWindows
} -result {-colormap colormap Colormap {} new}
test frame-1.4 {frame configuration options} -setup {
................................................................................
    frame .f -colormap new
    .f configure -colormap .
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -colormap option after widget is created}

test frame-1.5 {frame configuration options} -setup {
    deleteWindows
} -body {
    frame .f -visual default
    .f configure -visual
} -cleanup {
    deleteWindows
} -result {-visual visual Visual {} default}
test frame-1.6 {frame configuration options} -setup {
................................................................................
    frame .f -visual default
    .f configure -visual best
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -visual option after widget is created}

test frame-1.7 {frame configuration options} -setup {
    deleteWindows
} -body {
    frame .f -screen bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {unknown option "-screen"}
test frame-1.8 {frame configuration options} -setup {
    deleteWindows
} -body {
    frame .f -container true
} -cleanup {
    deleteWindows
} -result {.f}
test frame-1.9 {frame configuration options} -setup {
    deleteWindows
................................................................................
} -body {
    frame .f -container true
    .f configure -container
} -cleanup {
    deleteWindows
} -result {-container container Container 0 1}
test frame-1.10 {frame configuration options} -setup {
    deleteWindows
} -body {
    frame .f -container bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {expected boolean value but got "bogus"}
test frame-1.11 {frame configuration options} -setup {
    deleteWindows
} -body {
    frame .f
    .f configure -container 1
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -container option after widget is created}
test frame-1.12 {frame configuration options} -setup {
    deleteWindows
} -body {
    # Make sure all options can be set to the default value
    frame .f
    set opts {}
    foreach opt [.f configure] {
        if {[llength $opt] == 5} {
            lappend opts [lindex $opt 0] [lindex $opt 4]
        }
    }
    frame .g {*}$opts

} -cleanup {
    destroy .f .g
    deleteWindows
} -result .g

destroy .f
frame .f
test frame-1.13 {frame configuration options} -body {
    .f configure -background #ff0000
    lindex [.f configure -background] 4
} -cleanup {
    .f configure -background [lindex [.f configure -background] 3]
} -result "#ff0000"
test frame-1.14 {frame configuration options} -body {
    .f configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-1.15 {frame configuration options} -body {
    .f configure -bd 4
    lindex [.f configure -bd] 4
} -cleanup {
................................................................................
    .f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-1.17 {frame configuration options} -body {
    .f configure -bg #00ff00
    lindex [.f configure -bg] 4
} -cleanup {
    .f configure -bg [lindex [.f configure -bg] 3]
} -result "#00ff00"
test frame-1.18 {frame configuration options} -body {
    .f configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-1.19 {frame configuration options} -body {
    .f configure -borderwidth 1.3
    lindex [.f configure -borderwidth] 4
} -cleanup {
................................................................................
    .f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-1.25 {frame configuration options} -body {
    .f configure -highlightbackground #112233
    lindex [.f configure -highlightbackground] 4
} -cleanup {
    .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3]
} -result "#112233"
test frame-1.26 {frame configuration options} -body {
    .f configure -highlightbackground ugly
} -returnCodes error -result {unknown color name "ugly"}
test frame-1.27 {frame configuration options} -body {
    .f configure -highlightcolor #123456
    lindex [.f configure -highlightcolor] 4
} -cleanup {
    .f configure -highlightcolor [lindex [.f configure -highlightcolor] 3]
} -result "#123456"
test frame-1.28 {frame configuration options} -body {
    .f configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-1.29 {frame configuration options} -body {
    .f configure -highlightthickness 6
    lindex [.f configure -highlightthickness] 4
} -cleanup {
................................................................................
    .f configure -width [lindex [.f configure -width] 3]
} -result {32}
test frame-1.39 {frame configuration options} -body {
    .f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
destroy .f


test frame-2.1 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -class NewClass
    wm geometry .t +0+0
    .t configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Toplevel NewClass}
................................................................................
    wm geometry .t +0+0
    .t configure -class Another
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -class option after widget is created}

test frame-2.3 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -colormap new
    wm geometry .t +0+0
    .t configure -colormap
} -cleanup {
    deleteWindows
} -result {-colormap colormap Colormap {} new}
................................................................................
    wm geometry .t +0+0
    .t configure -colormap .
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -colormap option after widget is created}

test frame-2.5 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    .t configure -container 1
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -container option after widget is created}
................................................................................
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    catch {.t configure -container 1}
    .t configure -container
} -cleanup {
    deleteWindows
} -result {-container container Container 0 0}

test frame-2.7 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -colormap bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {bad window path name "bogus"}


test frame-2.8 {toplevel configuration options} -constraints win -setup {


    deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    .t configure -use 0x44022
} -cleanup {
    deleteWindows
} -returnCodes error -result {window "0x44022" doesn't exist}
test frame-2.9 {toplevel configuration options} -constraints win -setup {
    deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    catch {.t configure -use 0x44022}
    .t configure -use
} -cleanup {
    deleteWindows
} -result {-use use Use {} {}}
test frame-2.10 {toplevel configuration options} -constraints nonwin -setup {
    deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    .t configure -use 0x44022
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -use option after widget is created}
test frame-2.11 {toplevel configuration options} -constraints nonwin -setup {
    deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100
    wm geometry .t +0+0
    catch {.t configure -use 0x44022}
    .t configure -use
} -cleanup {
    deleteWindows
} -result {-use use Use {} {}}



























test frame-2.12 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    catch {destroy .t}
    toplevel .t -width 200 -height 100 -visual default
    wm geometry .t +0+0
    .t configure -visual
} -cleanup {
    deleteWindows
................................................................................
    wm geometry .t +0+0
    .t configure -visual best
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -visual option after widget is created}

test frame-2.14 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -visual who_knows?
} -cleanup {
    deleteWindows
} -returnCodes error -result {unknown or ambiguous visual name "who_knows?": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, truecolor, or default}
set expectedScreen ""
if {[tcltest::testConstraint haveDISPLAY]} {
    set expectedScreen [list -screen screen Screen {} $env(DISPLAY)]
}
test frame-2.15 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
    wm geometry .t +0+0
    .t configure -screen
} -cleanup {
    deleteWindows
} -result $expectedScreen
test frame-2.16 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -screen $env(DISPLAY)
    wm geometry .t +0+0
    .t configure -screen another
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -screen option after widget is created}

test frame-2.17 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    toplevel .t -width 200 -height 100 -screen bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {couldn't connect to display "bogus"}
test frame-2.18 {toplevel configuration options} -setup {
    deleteWindows
} -body {
    toplevel .t -container 1 -width 300 -height 120
    wm geometry .t +0+0
    toplevel .x -container 1 -use [winfo id .t]
} -cleanup {
    deleteWindows
} -returnCodes error -result {windows cannot have both the -use and the -container option set}
test frame-2.19 {toplevel configuration options} -setup {
    deleteWindows
    set opts {}
} -body {
    # Make sure all options can be set to the default value
    toplevel .f
    foreach opt [.f configure] {
        if {[llength $opt] == 5} {
            lappend opts [lindex $opt 0] [lindex $opt 4]
        }
    }
    toplevel .g {*}$opts

} -cleanup {
    destroy .f .g
    deleteWindows
} -result .g


destroy .t
toplevel .t -width 300 -height 150
wm geometry .t +0+0
update
test frame-2.20 {toplevel configuration options} -body {
    .t configure -background #ff0000
    lindex [.t configure -background] 4
} -result "#ff0000"
test frame-2.21 {toplevel configuration options} -body {
    .t configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.22 {toplevel configuration options} -body {
    .t configure -bd 4
    lindex [.t configure -bd] 4
} -result {4}
test frame-2.23 {toplevel configuration options} -body {
    .t configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-2.24 {toplevel configuration options} -body {
    .t configure -bg #00ff00
    lindex [.t configure -bg] 4
} -result "#00ff00"
test frame-2.25 {toplevel configuration options} -body {
    .t configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.26 {toplevel configuration options} -body {
    .t configure -borderwidth 1.3
    lindex [.t configure -borderwidth] 4
} -result {1}
................................................................................
} -result {100}
test frame-2.31 {toplevel configuration options} -body {
    .t configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-2.32 {toplevel configuration options} -body {
    .t configure -highlightcolor #123456
    lindex [.t configure -highlightcolor] 4
} -result "#123456"
test frame-2.33 {toplevel configuration options} -body {
    .t configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-2.34 {toplevel configuration options} -body {
    .t configure -highlightthickness 3
    lindex [.t configure -highlightthickness] 4
} -result {3}
................................................................................
destroy .t


test frame-3.1 {TkCreateFrame procedure} -body {
    frame
} -returnCodes error -result {wrong # args: should be "frame pathName ?-option value ...?"}
test frame-3.2 {TkCreateFrame procedure} -setup {
    deleteWindows
    frame .f
} -body {
    .f configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Frame Frame}
test frame-3.3 {TkCreateFrame procedure} -setup {
    deleteWindows
    toplevel .t
    wm geometry .t +0+0
} -body {
    .t configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Toplevel Toplevel}
test frame-3.4 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    toplevel .t -width 350 -class NewClass -bg black -visual default -height 90
    wm geometry .t +0+0
    update
    list [lindex [.t configure -width] 4] \
	    [lindex [.t configure -background] 4] \
	    [lindex [.t configure -height] 4]
} -cleanup {
    deleteWindows
} -result {350 black 90}

# Be sure that the -class, -colormap, and -visual options are processed
# before configuring the widget.
test frame-3.5 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    option add *NewFrame.background #123456
    frame .f -class NewFrame
    lindex [.f configure -background] 4
} -cleanup {
    deleteWindows
    option clear
} -result {#123456}
test frame-3.6 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    option add *NewFrame.background #123456
    frame .f -class NewFrame
    lindex [.f configure -background] 4
} -cleanup {
    deleteWindows
    option clear
} -result {#123456}
test frame-3.7 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    option add *NewFrame.background #332211
    option add *f.class NewFrame
    frame .f
    list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4]
} -cleanup {
    deleteWindows
    option clear
} -result {NewFrame #332211}
test frame-3.8 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    option add *Silly.background #122334
    option add *f.Class Silly
    frame .f
    list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4]
} -cleanup {
    deleteWindows
    option clear
} -result {Silly #122334}
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 {
    # This call to update idletasks was added to prevent a crash that was
    # observed on OSX 10.12 (Sierra) only.  Any change, such as using the
    # Development version to make debugging symbols available, adding a print
    # statement, or calling update idletasks here, would make the test pass
    # with no segfault.
    update idletasks
    deleteWindows
} -result {0 0 140 300}
test frame-3.10 {TkCreateFrame procedure, -use option} -constraints {
    unix
} -setup {
    deleteWindows
................................................................................
    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}

# The tests below require specific display characteristics (i.e. that they are
# run on a pseudocolor display of depth 8).  Even so, they are non-portable:
# some machines don't seem to ever run out of colors.

if {[testConstraint defaultPseudocolor8]} {
    eatColors .t1
}
test frame-3.11 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 nonPortable
} -setup {
    destroy .t
} -body {
    toplevel .t -width 300 -height 200 -bg #475601
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    destroy .t
} -result {0}
test frame-3.12 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 nonPortable
} -setup {
    destroy .t
} -body {
    toplevel .t -width 300 -height 200 -bg #475601 -colormap new
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    destroy .t
} -result {1}
test frame-3.13 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 nonPortable
} -setup {
    destroy .t
} -body {
    option add *t.class Toplevel2
    option add *Toplevel2.colormap new
    toplevel .t -width 300 -height 200 -bg #475601
    wm geometry .t +0+0
    update
    option clear
    colorsFree .t
} -cleanup {
    destroy .t
} -result {1}
test frame-3.14 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 nonPortable
} -setup {
    destroy .t
} -body {
    option add *t.class Toplevel3
    option add *Toplevel3.Colormap new
    toplevel .t -width 300 -height 200 -bg #475601 -colormap new
    wm geometry .t +0+0
    update
    option clear
    colorsFree .t
} -cleanup {
    destroy .t
} -result {1}
test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -constraints {
    defaultPseudocolor8 unix nonPortable
} -setup {
    destroy .t
} -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 -colormap new
    tkwait visibility .x
    list [colorsFree .t] [colorsFree .x]
} -cleanup {
    destroy .t
} -result {0 1}
test frame-3.16 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 nonPortable
} -setup {
    destroy .t
} -body {
    toplevel .t -width 300 -height 200 -bg #475601 -visual default
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    destroy .t
} -result {0}
test frame-3.17 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 nonPortable
} -setup {
    destroy .t
} -body {
    toplevel .t -width 300 -height 200 -bg #475601 -visual default \
	    -colormap new
    wm geometry .t +0+0
    update
    colorsFree .t
} -cleanup {
    destroy .t
} -result {1}
test frame-3.18 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
    destroy .t
} -body {
    toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    colorsFree .t 131 131 131
} -cleanup {
    destroy .t
} -result {1}
test frame-3.19 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
    destroy .t
} -body {
    option add *t.class T4
    option add *T4.visual {grayscale 8}
    toplevel .t -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    option clear
    list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
} -cleanup {
    destroy .t
} -result {1 {grayscale 8}}
test frame-3.20 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
    destroy .t
} -body {

    option add *t.class T5
    option add *T5.Visual {grayscale 8}
    toplevel .t -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    option clear
    list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4]
} -cleanup {
    destroy .t
} -result {1 {grayscale 8}}
test frame-3.21 {TkCreateFrame procedure} -constraints {
    defaultPseudocolor8 haveGrayscale8 nonPortable
} -setup {
    destroy .t
} -body {

    toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343
    wm geometry .t +0+0
    update
    colorsFree .t 131 131 131
} -cleanup {
    destroy .t
} -result {1}
if {[testConstraint defaultPseudocolor8]} {
    destroy .t1
}

test frame-3.22 {TkCreateFrame procedure, default dimensions} -setup {
    deleteWindows
} -body {
    toplevel .t
    wm geometry .t +0+0
    update
    set result "[winfo reqwidth .t] [winfo reqheight .t]"
    frame .t.f -bg red
    pack .t.f
................................................................................
test frame-3.24 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    toplevel .t -width 300 -height 200 -colormap new -bogus option
    wm geometry .t +0+0
} -returnCodes error -result {unknown option "-bogus"}


test frame-4.1 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    catch {frame .f -gorp glob}
    winfo exists .f
} -result 0
test frame-4.2 {TkCreateFrame procedure} -setup {
    deleteWindows
} -body {
    list [frame .f -width 200 -height 100] [winfo exists .f]
} -cleanup {
    deleteWindows
} -result {.f 1}


frame .f -highlightcolor black
test frame-5.1 {FrameWidgetCommand procedure} -body {
    .f
} -returnCodes error -result {wrong # args: should be ".f option ?arg ...?"}
test frame-5.2 {FrameWidgetCommand procedure, cget option} -body {
    .f cget
................................................................................
    destroy .t
} -body {
    toplevel .t
    .t cget -screen
} -cleanup {
    destroy .t
} -returnCodes ok -match glob -result *

test frame-5.8 {FrameWidgetCommand procedure, configure option} -body {
    optnames [.f configure]

} -result {-background -backgroundimage -bd -bg -bgimg -borderwidth -class -colormap -container -cursor -height -highlightbackground -highlightcolor -highlightthickness -padx -pady -relief -takefocus -tile -visual -width}
test frame-5.9 {FrameWidgetCommand procedure, configure option} -body {
    .f configure -gorp
} -returnCodes error -result {unknown option "-gorp"}
test frame-5.10 {FrameWidgetCommand procedure, configure option} -body {
    .f configure -gorp bogus
} -returnCodes error -result {unknown option "-gorp"}
test frame-5.11 {FrameWidgetCommand procedure, configure option} -body {
    .f configure -width 200 -height
} -returnCodes error -result {value for "-height" missing}
test frame-5.12 {FrameWidgetCommand procedure} -body {
    .f swizzle
} -returnCodes error -result {bad option "swizzle": must be cget or configure}
test frame-5.13 {FrameWidgetCommand procedure, configure option} -body {
    optnames [. configure]
} -result {-background -backgroundimage -bd -bg -bgimg -borderwidth -class -colormap -container -cursor -height -highlightbackground -highlightcolor -highlightthickness -menu -padx -pady -relief -screen -takefocus -tile -use -visual -width}
destroy .f

test frame-6.1 {ConfigureFrame procedure} -setup {
    deleteWindows
} -body {
    frame .f -width 150
    list [winfo reqwidth .f] [winfo reqheight .f]
} -cleanup {
    deleteWindows
} -result {150 1}
test frame-6.2 {ConfigureFrame procedure} -setup {
    deleteWindows
} -body {
    frame .f -height 97
    list [winfo reqwidth .f] [winfo reqheight .f]
} -cleanup {
    deleteWindows
} -result {1 97}
test frame-6.3 {ConfigureFrame procedure} -setup {
    deleteWindows
} -body {
    frame .f
    set result {}
    lappend result [winfo reqwidth .f] [winfo reqheight .f]
    .f configure -width 100 -height 180
    lappend result [winfo reqwidth .f] [winfo reqheight .f]
    .f configure -width 0 -height 0
    lappend result [winfo reqwidth .f] [winfo reqheight .f]
} -cleanup {
    deleteWindows
} -result {1 1 100 180 100 180}

test frame-7.1 {FrameEventProc procedure} -setup {
    deleteWindows
} -body {
    frame .frame2
    set result [info commands .frame2]
    destroy .frame2
    lappend result [info commands .frame2]
} -result {.frame2 {}}
test frame-7.2 {FrameEventProc procedure} -setup {
    deleteWindows
    set x {}
} -body {
    frame .f1 -bg #543210
    rename .f1 .f2
    lappend x [winfo children .]
    lappend x [.f2 cget -bg]
    destroy .f1
    lappend x [info command .f*] [winfo children .]
} -cleanup {
    deleteWindows
} -result {.f1 #543210 {} {}}

test frame-8.1 {FrameCmdDeletedProc procedure} -setup {
    deleteWindows
} -body {
    frame .f1
    rename .f1 {}
    list [info command .f*] [winfo children .]
} -cleanup {
    deleteWindows
} -result {{} {}}
test frame-8.2 {FrameCmdDeletedProc procedure} -setup {
    deleteWindows
} -body {
    toplevel .f1 -menu .m
    wm geometry .f1 +0+0
    update
    rename .f1 {}
    update
    list [info command .f*] [winfo children .]
................................................................................
} -cleanup {
    deleteWindows
} -result {{} {}}
#
# This one fails with the dash-patch!!!! Still don't know why  :-(
#
#test frame-8.3 {FrameCmdDeletedProc procedure} -setup {

#    deleteWindows
#} -body {
#    toplevel .f1 -menu .m
#    wm geometry .f1 +0+0
#    menu .m
#    update
#    rename .f1 {}
#    update
#    list [info command .f*] [winfo children .]
#} -cleanup {

#    deleteWindows
#} -result {{} .m}

test frame-9.1 {MapFrame procedure} -setup {
    deleteWindows
} -body {
    toplevel .t -width 100 -height 400
    wm geometry .t +0+0
    set result [winfo ismapped .t]
    update idletasks
    lappend result [winfo ismapped .t]
} -cleanup {
    deleteWindows
} -result {0 1}
test frame-9.2 {MapFrame procedure} -setup {
    deleteWindows
} -body {
    toplevel .t -width 100 -height 400
    wm geometry .t +0+0
    destroy .t
    update
    winfo exists .t
} -result {0}
test frame-9.3 {MapFrame procedure, window deleted while mapping} -setup {
    deleteWindows
} -body {
    toplevel .t2 -width 200 -height 200
    wm geometry .t2 +0+0
    tkwait visibility .t2
    toplevel .t -width 100 -height 400
    wm geometry .t +0+0
    frame .t2.f -width 50 -height 50
................................................................................
    pack .t2.f -side top
    update idletasks
    winfo exists .t
} -cleanup {
    deleteWindows
} -result {0}


test frame-10.1 {frame widget vs hidden commands} -setup {
    deleteWindows
} -body {

    frame .t
    interp hide {} .t
    destroy .t
    list [winfo children .] [lsort [interp hidden]]


} -result [list {} [lsort [interp hidden]]]


test frame-11.1 {TkInstallFrameMenu} -setup {
    deleteWindows
} -body {
    menu .m1
    .m1 add cascade -menu .m1.system
    menu .m1.system -tearoff 0
    .m1.system add command -label foo
    toplevel .t -menu .m1
} -cleanup {
    deleteWindows
} -result {.t}
test frame-11.2 {TkInstallFrameMenu - frame renamed} -setup {
    deleteWindows

    catch {rename foo {}}
} -body {
    menu .m1
    .m1 add cascade -menu .m1.system
    menu .m1.system -tearoff 0
    .m1.system add command -label foo
    toplevel .t
    rename .t foo
} -cleanup {
    deleteWindows
} -result {}


test frame-12.1 {FrameWorldChanged procedure} -setup {
    deleteWindows
} -body {
    # Test -bd -padx and -pady
    frame .f -borderwidth 2 -padx 3 -pady 4
    place .f -x 0 -y 0 -width 40 -height 40
    pack [frame .f.f] -fill both -expand 1
    update
    list [winfo x .f.f] [winfo y .f.f] [winfo width .f.f] [winfo height .f.f]
} -cleanup {
    deleteWindows
} -result {5 6 30 28}
test frame-12.2 {FrameWorldChanged procedure} -setup {
    deleteWindows
} -body {
    # Test all -labelanchor positions
    set font {helvetica 12}
    labelframe .f -highlightthickness 1 -bd 3 -padx 1 -pady 2 -font $font \
            -text "Mupp"
    set fh [expr {max([font metrics $font -linespace] + 2 - 3, 0)}]
    set fw [expr {max([font measure $font "Mupp"] + 2 - 3, 0)}]


    place .f -x 0 -y 0 -width 100 -height 100
    pack [frame .f.f] -fill both -expand 1

    set result {}
    foreach lp {nw n ne en e es se s sw ws w wn} {
        .f configure -labelanchor $lp
        update
        set expx 5
        set expy 6
        set expw 90
................................................................................
        set exph 88
        switch -glob $lp {
            n* {incr expy $fh ; incr exph -$fh}
            s* {incr exph -$fh}
            w* {incr expx $fw ; incr expw -$fw}
            e* {incr expw -$fw}
        }
        lappend result [expr {
	    [winfo x .f.f] == $expx && [winfo y .f.f] == $expy &&
	    [winfo width .f.f] == $expw && [winfo height .f.f] == $exph
	}]
    }
    return $result
} -cleanup {
    deleteWindows
} -result {1 1 1 1 1 1 1 1 1 1 1 1}
test frame-12.3 {FrameWorldChanged procedure} -setup {
    deleteWindows
} -body {
    # Check reaction on font change
    font create myfont -family courier -size 10
    labelframe .f -font myfont -text Mupp
    place .f -x 0 -y 0 -width 40 -height 40
    pack [frame .f.f] -fill both -expand 1
    update
................................................................................
    set y2 [winfo y .f.f]
    expr {($h2 - $h1) - ($y2 - $y1)}
} -cleanup {
    deleteWindows
    font delete myfont
} -result {0}


test frame-13.1 {labelframe configuration options} -setup {
    deleteWindows
} -body {
    labelframe .f -class NewFrame
    .f configure -class
} -cleanup {
    deleteWindows
} -result {-class class Class Labelframe NewFrame}
test frame-13.2 {labelframe configuration options} -setup {
................................................................................
} -body {
    labelframe .f -class NewFrame
    .f configure -class Different
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -class option after widget is created}
test frame-13.3 {labelframe configuration options} -setup {
    deleteWindows
} -body {
    labelframe .f -colormap new
} -cleanup {
    deleteWindows
} -result {.f}
test frame-13.4 {labelframe configuration options} -setup {
    deleteWindows
} -body {
    labelframe .f -visual default
} -cleanup {
    deleteWindows
} -result {.f}
test frame-13.5 {labelframe configuration options} -setup {
    deleteWindows
} -body {
    labelframe .f -screen bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {unknown option "-screen"}
test frame-13.6 {labelframe configuration options} -setup {
    deleteWindows
} -body {
    labelframe .f -container true
} -cleanup {
    deleteWindows
} -result {.f}
test frame-13.7 {labelframe configuration options} -setup {
    deleteWindows
................................................................................
} -body {
    labelframe .f -container true
    .f configure -container
} -cleanup {
    deleteWindows
} -result {-container container Container 0 1}
test frame-13.8 {labelframe configuration options} -setup {
    deleteWindows
} -body {
     labelframe .f -container bogus
} -cleanup {
    deleteWindows
} -returnCodes error -result {expected boolean value but got "bogus"}
test frame-13.9 {labelframe configuration options} -setup {
    deleteWindows
} -body {
    labelframe .f
    .f configure -container 1
} -cleanup {
    deleteWindows
} -returnCodes error -result {can't modify -container option after widget is created}

destroy .f
labelframe .f
test frame-13.10 {labelframe configuration options} -body {
    .f configure -background #ff0000
    lindex [.f configure -background] 4
} -cleanup {
    .f configure -background [lindex [.f configure -background] 3]
} -result "#ff0000"
test frame-13.11 {labelframe configuration options} -body {
    .f configure -background non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.12 {labelframe configuration options} -body {
    .f configure -bd 4
    lindex [.f configure -bd] 4
} -cleanup {
    .f configure -bd [lindex [.f configure -bd] 3]
} -result {4}
test frame-13.13 {labelframe configuration options} -body {
    .f configure -bd badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.14 {labelframe configuration options} -body {
    .f configure -bg #00ff00
    lindex [.f configure -bg] 4
} -cleanup {
    .f configure -bg [lindex [.f configure -bg] 3]
} -result "#00ff00"
test frame-13.15 {labelframe configuration options} -body {
    .f configure -bg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.16 {labelframe configuration options} -body {
    .f configure -borderwidth 1.3
    lindex [.f configure -borderwidth] 4
} -cleanup {
    .f configure -borderwidth [lindex [.f configure -borderwidth] 3]
} -result {1}
test frame-13.17 {labelframe configuration options} -body {
    .f configure -borderwidth badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.18 {labelframe configuration options} -body {
    .f configure -cursor arrow
    lindex [.f configure -cursor] 4
} -cleanup {
    .f configure -cursor [lindex [.f configure -cursor] 3]
} -result {arrow}
test frame-13.19 {labelframe configuration options} -body {
    .f configure -cursor badValue
} -returnCodes error -result {bad cursor spec "badValue"}
test frame-13.20 {labelframe configuration options} -body {
    .f configure -fg #0000ff
    lindex [.f configure -fg] 4
} -cleanup {
    .f configure -fg [lindex [.f configure -fg] 3]
} -result "#0000ff"
test frame-13.21 {labelframe configuration options} -body {
    .f configure -fg non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.22 {labelframe configuration options} -body {
    .f configure -font {courier 8}
    lindex [.f configure -font] 4
} -cleanup {
    .f configure -font [lindex [.f configure -font] 3]
} -result {courier 8}
test frame-13.23 {labelframe configuration options} -body {
    .f configure -foreground #ff0000
    lindex [.f configure -foreground] 4
} -cleanup {
    .f configure -foreground [lindex [.f configure -foreground] 3]
} -result "#ff0000"
test frame-13.24 {labelframe configuration options} -body {
    .f configure -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.25 {labelframe configuration options} -body {
    .f configure -height 100
    lindex [.f configure -height] 4
} -cleanup {
    .f configure -height [lindex [.f configure -height] 3]
} -result {100}
test frame-13.26 {labelframe configuration options} -body {
    .f configure -height not_a_number
} -returnCodes error -result {bad screen distance "not_a_number"}
test frame-13.27 {labelframe configuration options} -body {
    .f configure -highlightbackground #112233
    lindex [.f configure -highlightbackground] 4
} -cleanup {
    .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3]
} -result "#112233"
test frame-13.28 {labelframe configuration options} -body {
    .f configure -highlightbackground ugly
} -returnCodes error -result {unknown color name "ugly"}
test frame-13.29 {labelframe configuration options} -body {
    .f configure -highlightcolor #123456
    lindex [.f configure -highlightcolor] 4
} -cleanup {
    .f configure -highlightcolor [lindex [.f configure -highlightcolor] 3]
} -result "#123456"
test frame-13.30 {labelframe configuration options} -body {
    .f configure -highlightcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
test frame-13.31 {labelframe configuration options} -body {
    .f configure -highlightthickness 6
    lindex [.f configure -highlightthickness] 4
} -cleanup {
    .f configure -highlightthickness [lindex [.f configure -highlightthickness] 3]
} -result {6}
test frame-13.32 {labelframe configuration options} -body {
    .f configure -highlightthickness badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.33 {labelframe configuration options} -body {
    .f configure -labelanchor se
    lindex [.f configure -labelanchor] 4
} -cleanup {
    .f configure -labelanchor [lindex [.f configure -labelanchor] 3]
} -result {se}
test frame-13.34 {labelframe configuration options} -body {
    .f configure -labelanchor badValue
} -returnCodes error -result {bad labelanchor "badValue": must be e, en, es, n, ne, nw, s, se, sw, w, wn, or ws}
test frame-13.35 {labelframe configuration options} -body {
    .f configure -padx 3
    lindex [.f configure -padx] 4
} -cleanup {
    .f configure -padx [lindex [.f configure -padx] 3]
} -result {3}
test frame-13.36 {labelframe configuration options} -body {
    .f configure -padx badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.37 {labelframe configuration options} -body {
    .f configure -pady 4
    lindex [.f configure -pady] 4
} -cleanup {
    .f configure -pady [lindex [.f configure -pady] 3]
} -result {4}
test frame-13.38 {labelframe configuration options} -body {
    .f configure -pady badValue
} -returnCodes error -result {bad screen distance "badValue"}
test frame-13.39 {labelframe configuration options} -body {
    .f configure -relief ridge
    lindex [.f configure -relief] 4
} -cleanup {
    .f configure -relief [lindex [.f configure -relief] 3]
} -result {ridge}
test frame-13.40 {labelframe configuration options} -body {
    .f configure -relief badValue
} -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}
test frame-13.41 {labelframe configuration options} -body {
    .f configure -takefocus {any string}
    lindex [.f configure -takefocus] 4
} -cleanup {
    .f configure -takefocus [lindex [.f configure -takefocus] 3]
} -result {any string}
................................................................................
test frame-13.43 {labelframe configuration options} -body {
    .f configure -width 32
    lindex [.f configure -width] 4
} -cleanup {
    .f configure -width [lindex [.f configure -width] 3]
} -result {32}
test frame-13.44 {labelframe configuration options} -body {
    .f configure -width badValue
} -returnCodes error -result {bad screen distance "badValue"}
destroy .f


test frame-14.1 {labelframe labelwidget option} -setup {
    deleteWindows
} -body {
    # Test that label is moved in stacking order
    label .l -text Mupp -font {helvetica 8}
    labelframe .f -labelwidget .l
    pack .f
    frame .f.f -width 50 -height 50
    pack .f.f
................................................................................
    update
    list [winfo children .] [winfo width .f] \
        [expr {[winfo height .f] - [winfo height .l]}]
} -cleanup {
    deleteWindows
} -result {{.f .l} 54 52}
test frame-14.2 {labelframe labelwidget option} -setup {
    deleteWindows
} -body {
    # Test the labelframe's reaction if the label is destroyed
    label .l -text Aratherlonglabel
    labelframe .f -labelwidget .l
    pack .f
    label .f.l -text Mupp
    pack .f.l
................................................................................
    lappend res [.f cget -labelwidget]
    update
    lappend res [expr {[winfo width .f] - [winfo width .f.l]}]
} -cleanup {
    deleteWindows
} -result {.l 12 {} 4}
test frame-14.3 {labelframe labelwidget option} -setup {
    deleteWindows
} -body {
    # Test the labelframe's reaction if the label is stolen
    label .l -text Aratherlonglabel
    labelframe .f -labelwidget .l
    pack .f
    label .f.l -text Mupp
    pack .f.l
................................................................................
    lappend res [.f cget -labelwidget]
    update
    lappend res [expr {[winfo width .f] - [winfo width .f.l]}]
} -cleanup {
    deleteWindows
} -result {.l 12 {} 4}
test frame-14.4 {labelframe labelwidget option} -setup {
    deleteWindows
} -body {
    # Test the label's reaction if the labelframe is destroyed
    label .l -text Mupp
    labelframe .f -labelwidget .l
    pack .f
    update
    set res [list [winfo manager .l]]
    destroy .f
    lappend res [winfo manager .l]
} -cleanup {
    deleteWindows
} -result {labelframe {}}
test frame-14.5 {labelframe labelwidget option} -setup {
    deleteWindows
} -body {
    # Test that the labelframe reacts on changes in label
    label .l -text Aratherlonglabel
    labelframe .f -labelwidget .l
    pack .f
    label .f.l -text Mupp
    pack .f.l
................................................................................
    update
    lappend res [expr {[winfo width .f] - [winfo width .l]}]
    lappend res [expr {[winfo width .f] > $first}]
} -cleanup {
    deleteWindows
} -result {12 12 1 12 1}
test frame-14.6 {labelframe labelwidget option} -setup {
    deleteWindows
} -body {
    # Destroying a labelframe with a child label caused a crash when not
    # handling mapping of the label correctly.
    # This test does not test anything directly, it's just ment to catch if
    # the same mistake is made again.
    labelframe .f
    pack .f
    label .f.l -text Mupp
    .f configure -labelwidget .f.l
    update
} -cleanup {
    deleteWindows
} -result {}

test frame-15.1 {TIP 262: frame background images} -setup {
    deleteWindows


    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
} -body {
    frame .f -width 100 -height 100
    pack .f
    list [image inuse gorp] [.f configure -backgroundimage gorp;update] \
	[image inuse gorp] [winfo width .f] [winfo height .f]
} -cleanup {
    image delete gorp
    deleteWindows
} -result {0 {} 1 100 100}
test frame-15.2 {TIP 262: frame background images} -setup {
    deleteWindows
    catch {rename gorp ""}
} -body {
    frame .f -width 100 -height 100
    pack .f
    update
    .f configure -backgroundimage gorp
} -returnCodes error -cleanup {
    deleteWindows
} -result {image "gorp" doesn't exist}
test frame-15.3 {TIP 262: frame background images} -setup {
    deleteWindows
    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
} -body {
    frame .f -width 100 -height 100 -backgroundimage gorp
    pack .f
    .f configure -tile yes
    update
    list [.f cget -bgimg] [.f cget -tile]
} -cleanup {
    image delete gorp
    deleteWindows
} -result {gorp 1}
test frame-15.4 {TIP 262: frame background images} -setup {
    deleteWindows
    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
} -body {
    frame .f -width 100 -height 100 -backgroundimage gorp
    pack .f
    .f configure -tile yes
    update
    gorp put red -to 15 15 20 20
    update
    list [.f cget -bgimg] [.f cget -tile]
} -cleanup {
    image delete gorp
    deleteWindows
} -result {gorp 1}
test frame-15.5 {TIP 262: frame background images} -setup {
    deleteWindows
    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
    set result {}
} -body {
    frame .f -width 100 -height 100 -backgroundimage gorp
    pack .f
    .f configure -tile yes
    update
    image delete gorp
    update
    set result [list [.f cget -bgimg] [.f cget -tile]]
    image create photo gorp -width 250 -height 250
    update
    lappend result [.f cget -backgroundimage]
} -cleanup {
    catch {image delete gorp}
    deleteWindows
} -result {gorp 1 gorp}
test frame-15.6 {TIP 262: frame background images} -setup {
    deleteWindows
    set result {}
    . configure -width 200 -height 200
} -constraints testImageType -body {
    image create test gorp -variable result
    pack [frame .f -width 100 -height 100 -bgimg gorp]
    update idletasks; update
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 0 0 30 15}}
test frame-15.6a {TIP 262: frame background images (offsets)} -setup {
    deleteWindows
    set result {}
    . configure -width 200 -height 200
} -constraints testImageType -body {
    image create test gorp -variable result
    pack [frame .f -width 10 -height 10 -bgimg gorp]
    update idletasks; update
    # On MacOS must wait for the test image display procedure to run.
    set timer [after 300 {lappend result "timedout"}]
    while {"timedout" ni $result &&
	   "gorp display 10 2 10 10" ni $result} {
       vwait result
    }
    after cancel $timer
    update idletasks; update
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 10 2 10 10}}
test frame-15.7 {TIP 262: frame background images} -setup {
    deleteWindows
    set result {}
    . configure -width 200 -height 200
} -constraints testImageType -body {
    image create test gorp -variable result
    pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1]
    update idletasks; update
    # On MacOS must wait for the test image display procedure to run.
    set timer [after 300 {lappend result "timedout"}]
    while {"timedout" ni $result &&
	   "gorp display 0 0 20 10" ni $result} {
	vwait result
    }
    after cancel $timer
    if {[lindex $result end] eq "timedout"} {
	return [lreplace $result end end]
    }
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 10} {gorp display 0 0 20 15} {gorp display 0 0 20 10}}
test frame-15.7a {TIP 262: frame background images (offsets)} -setup {
    deleteWindows
    set result {}
    . configure -width 200 -height 200
} -constraints testImageType -body {
    image create test gorp -variable result
    pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -highlightthick 1]
    update idletasks; update
    # On MacOS must wait for the test image display procedure to run.
    set timer [after 300 {lappend result "timedout"}]
    while {"timedout" ni $result &&
	   "gorp display 0 0 18 8" ni $result} {
	vwait result
   }
    after cancel $timer
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 8} {gorp display 0 0 18 15} {gorp display 0 0 18 8}}
test frame-15.7b {TIP 262: frame background images (offsets)} -setup {
    deleteWindows
    set result {}
    . configure -width 200 -height 200
} -constraints testImageType -body {
    image create test gorp -variable result
    pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -bd 2]
    update idletasks; update
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 6} {gorp display 0 0 16 15} {gorp display 0 0 16 6}}
test frame-15.7c {TIP 262: frame background images (offsets)} -setup {
    deleteWindows
    set result {}
    . configure -width 200 -height 200
} -constraints testImageType -body {
    image create test gorp -variable result
    pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -bd 2 -highlightthick 1]
    update idletasks; update
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 4} {gorp display 0 0 14 15} {gorp display 0 0 14 4}}
test frame-15.8 {TIP 262: toplevel background images} -setup {
    deleteWindows
    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
} -body {
    toplevel .t -width 100 -height 100
    update
    # Used to verify that setting a background image doesn't change the widget size
    set w [winfo width .t]
    set h [winfo height .t]
    list [image inuse gorp] [.t configure -backgroundimage gorp;update] \
	[image inuse gorp] \
	[expr {$w-[winfo width .t]}] [expr {$h-[winfo height .t]}]
} -cleanup {
    image delete gorp
    deleteWindows
} -result {0 {} 1 0 0}
test frame-15.9 {TIP 262: toplevel background images} -setup {
    deleteWindows
    catch {rename gorp ""}
} -body {
    toplevel .t -width 100 -height 100
    update
    .t configure -backgroundimage gorp
} -returnCodes error -cleanup {
    deleteWindows
} -result {image "gorp" doesn't exist}
test frame-15.10 {TIP 262: toplevel background images} -setup {
    deleteWindows
    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
} -body {
    toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes
    update
    list [.t cget -bgimg] [.t cget -tile]
} -cleanup {
    image delete gorp
    deleteWindows
} -result {gorp 1}
test frame-15.11 {TIP 262: toplevel background images} -setup {
    deleteWindows
    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
} -body {
    toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes
    update
    gorp put red -to 15 15 20 20
    update
    list [.t cget -bgimg] [.t cget -tile]
} -cleanup {
    image delete gorp
    deleteWindows
} -result {gorp 1}
test frame-15.12 {TIP 262: toplevel background images} -setup {
    deleteWindows
    image create photo gorp -width 10 -height 10
    gorp put black -to 2 2 7 7
    set result {}
} -body {
    toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes
    update
    image delete gorp
    update
    set result [list [.t cget -bgimg] [.t cget -tile]]
    image create photo gorp -width 250 -height 250
    update
    lappend result [.t cget -backgroundimage]
} -cleanup {
    catch {image delete gorp}
    deleteWindows
} -result {gorp 1 gorp}
test frame-15.13 {TIP 262: toplevel background images} -setup {
    deleteWindows
    set result {}
} -constraints testImageType -body {
    image create test gorp -variable result
    toplevel .t -width 100 -height 100 -bgimg gorp
    wm overrideredirect .t 1;	# Reduce trouble from window managers
    update idletasks; update
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 0 0 30 15}}
test frame-15.14 {TIP 262: toplevel background images} -setup {
    deleteWindows
    set result {}
} -constraints testImageType -body {
    image create test gorp -variable result
    toplevel .t -width 50 -height 25 -bgimg gorp -tile 1
    wm overrideredirect .t 1;	# Reduce trouble from window managers
    update idletasks; update
    # On MacOS must wait for the test image display procedure to run.
    set timer [after 300 {lappend result "timedout"}]
    while {"timedout" ni $result &&
	   "gorp display 0 0 20 10" ni $result} {
	vwait result
   }
    after cancel $timer
    return [uniq $result]
} -cleanup {
    deleteWindows
    catch {image delete gorp}
} -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 10} {gorp display 0 0 20 15} {gorp display 0 0 20 10}}
 
# cleanup
deleteWindows
apply {cmds {foreach cmd $cmds {rename $cmd {}}}} {
    eatColors colorsFree uniq optnames
}

cleanupTests
return

# Local Variables:
# mode: tcl
# End:

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

58
59
60
61
62
63
64

65

66








67
68
69
70
71
72
73
...
341
342
343
344
345
346
347





348
349
350
351
352
353
354
355
356
357

358

359





360
361
362
363
364






365
366
367
368
369
370
371
...
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
    imageCleanup
} -body {
    image create test myimage -variable x
    .c create image 100 50 -image myimage
    .c create image 100 150 -image myimage
    update
    set x {}

    image create test myimage -variable x

    update








    return $x
} -cleanup {
    imageCleanup
} -result {{myimage free} {myimage free} {myimage delete} {myimage get} {myimage get} {myimage display 0 0 30 15} {myimage display 0 0 30 15}}
test image-1.8 {Tk_ImageCmd procedure, "create" option} -constraints {
	testImageType
} -setup {
................................................................................
    button .b -image myimage2
    lappend res [image inuse myimage2]
} -cleanup {
    imageCleanup
    catch {destroy .b}
} -result [list 0 1]







test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
    .c delete all
    imageCleanup
    update
} -body {
    image create test foo -variable x
    .c create image 50 50 -image foo
    update
    set x {}

    foo changed 5 6 7 8 30 15

    update





    return $x
} -cleanup {
    .c delete all
    imageCleanup
} -result {{foo display 5 6 7 8}}






test image-9.2 {Tk_ImageChanged procedure} -constraints testImageType -setup {
    .c delete all
    imageCleanup
    update
} -body {
    image create test foo -variable x
    .c create image 50 50 -image foo
................................................................................
    set x {}
    foo changed 5 6 7 8 30 15
    update
    return $x
} -cleanup {
    .c delete all
    imageCleanup
} -result {{foo display 5 6 25 9} {foo display 0 0 12 14}}


test image-10.1 {Tk_GetImage procedure} -setup {
    imageCleanup
} -body {
    .c create image 100 10 -image bad_name
} -cleanup {
    imageCleanup







>

>

>
>
>
>
>
>
>
>







 







>
>
>
>
>
|









>

>

>
>
>
>
>




|
>
>
>
>
>
>







 







|
<







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
...
402
403
404
405
406
407
408
409

410
411
412
413
414
415
416
    imageCleanup
} -body {
    image create test myimage -variable x
    .c create image 100 50 -image myimage
    .c create image 100 150 -image myimage
    update
    set x {}
    set timer [after 500 {lappend x "timeout"}]
    image create test myimage -variable x
    update idletasks
    update
    # On MacOS we need to wait for the test image display procedure to run.
    while {"timeout" ni $x && [lindex $x end 1] ne "display"} {
        vwait x
    }
    after cancel timer
    if {[lindex $x end] eq "timeout"} {
       return [lreplace $x end end]
    }
    return $x
} -cleanup {
    imageCleanup
} -result {{myimage free} {myimage free} {myimage delete} {myimage get} {myimage get} {myimage display 0 0 30 15} {myimage display 0 0 30 15}}
test image-1.8 {Tk_ImageCmd procedure, "create" option} -constraints {
	testImageType
} -setup {
................................................................................
    button .b -image myimage2
    lappend res [image inuse myimage2]
} -cleanup {
    imageCleanup
    catch {destroy .b}
} -result [list 0 1]

if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
    # Aqua >= 10.14 will redraw the entire image in drawRect.
    set result_9_1 {{foo display 0 0 30 15}}
} else {
    set result_9_1 {{foo display 5 6 7 8}}
}
test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup {
    .c delete all
    imageCleanup
    update
} -body {
    image create test foo -variable x
    .c create image 50 50 -image foo
    update
    set x {}
    set timer [after 500 {lappend x "timeout"}]
    foo changed 5 6 7 8 30 15
    update idletasks
    update
    # On MacOS we need to wait for the test image display procedure to run.
    while {"timeout" ni $x && [lindex $x end 1] ne "display"} {
        vwait x
    }
    after cancel timer
    return $x
} -cleanup {
    .c delete all
    imageCleanup
} -result $result_9_1
if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} {
    # Aqua >= 10.14 will redraw the entire image.
    set result_9_2 {{foo display 0 0 30 15} {foo display 0 0 30 15}}
} else {
    set result_9_2 {{foo display 5 6 25 9} {foo display 0 0 12 14}}
}
test image-9.2 {Tk_ImageChanged procedure} -constraints testImageType -setup {
    .c delete all
    imageCleanup
    update
} -body {
    image create test foo -variable x
    .c create image 50 50 -image foo
................................................................................
    set x {}
    foo changed 5 6 7 8 30 15
    update
    return $x
} -cleanup {
    .c delete all
    imageCleanup
} -result $result_9_2


test image-10.1 {Tk_GetImage procedure} -setup {
    imageCleanup
} -body {
    .c create image 100 10 -image bad_name
} -cleanup {
    imageCleanup

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

979
980
981
982
983
984
985


986
987
988
989
990
991
992
993
994
    }]
    update
    list $x $y
} -cleanup {
	deleteWindows
    bind . <KeyPress> {}
} -result {{{key a 1}} {}}


test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints {
    unix
} -setup {
    deleteWindows
    catch {interp delete slave}
    ::_test_tmp::testInterp slave
    load {} Tktest slave
} -body {
    deleteWindows







>
>

|







979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
    }]
    update
    list $x $y
} -cleanup {
	deleteWindows
    bind . <KeyPress> {}
} -result {{{key a 1}} {}}
# TkpRedirectKeyEvent is not implemented in win or aqua.  If someone
# implements it they should change the constraints for this test.
test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints {
    unix notAqua
} -setup {
    deleteWindows
    catch {interp delete slave}
    ::_test_tmp::testInterp slave
    load {} Tktest slave
} -body {
    deleteWindows

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

390
391
392
393
394
395
396







397
398
399
400
401
402
403
...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419

    list rootx [expr {[winfo rootx .emb] == [winfo rootx .con]}] \
        rooty [expr {[winfo rooty .emb] == [winfo rooty .con]}]
} -cleanup {
    deleteWindows
} -result {rootx 1 rooty 1}








test winfo-13.2 {destroying embedded toplevel} -setup {
    deleteWindows
} -body {
    frame .con -container 1
    pack .con -expand yes -fill both
    toplevel .emb -use [winfo id .con] -bd 0 -highlightthickness 0
    button .emb.b
................................................................................
    update

    destroy .emb
    update
    list embedded [winfo exists .emb.b] container [winfo exists .con]
} -cleanup {
    deleteWindows
} -result {embedded 0 container 1}

test winfo-13.3 {destroying container window} -setup {
    deleteWindows
} -body {
    frame .con -container 1
    pack .con -expand yes -fill both
    toplevel .emb -use [winfo id .con] -bd 0 -highlightthickness 0







>
>
>
>
>
>
>







 







|







390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
...
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426

    list rootx [expr {[winfo rootx .emb] == [winfo rootx .con]}] \
        rooty [expr {[winfo rooty .emb] == [winfo rooty .con]}]
} -cleanup {
    deleteWindows
} -result {rootx 1 rooty 1}

# Windows does not destroy the container when an embedded window is
# destroyed.  Unix and macOS do destroy it.  See ticket [67384bce7d].
if {[tk windowingsystem] == "win"} {
   set result_13_2 {embedded 0 container 1}
} else {
   set result_13_2 {embedded 0 container 0}
}
test winfo-13.2 {destroying embedded toplevel} -setup {
    deleteWindows
} -body {
    frame .con -container 1
    pack .con -expand yes -fill both
    toplevel .emb -use [winfo id .con] -bd 0 -highlightthickness 0
    button .emb.b
................................................................................
    update

    destroy .emb
    update
    list embedded [winfo exists .emb.b] container [winfo exists .con]
} -cleanup {
    deleteWindows
} -result $result_13_2

test winfo-13.3 {destroying container window} -setup {
    deleteWindows
} -body {
    frame .con -container 1
    pack .con -expand yes -fill both
    toplevel .emb -use [winfo id .con] -bd 0 -highlightthickness 0

Changes to jni/sdl2tk/unix/tkUnixDefault.h.

169
170
171
172
173
174
175

176

177
178
179
180
181
182
183
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG

#define DEF_FRAME_BG_MONO		WHITE

#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG







>

>







169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG
#define DEF_FRAME_BG_IMAGE		NULL
#define DEF_FRAME_BG_MONO		WHITE
#define DEF_FRAME_BG_TILE		"0"
#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG

Changes to jni/sdl2tk/unix/tkUnixDraw.c.

204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
{
    TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrame --
 *
 *	This function draws the rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrame(
    Tk_Window tkwin,

    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
	    highlightWidth, Tk_Width(tkwin) - 2*highlightWidth,
	    Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief);
}
 
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */







|













|

>





|











204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
{
    TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrameEx --
 *
 *	This function draws the rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrameEx(
    Tk_Window tkwin,
    Drawable drawable,
    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,
	    highlightWidth, Tk_Width(tkwin) - 2*highlightWidth,
	    Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief);
}
 
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */

Changes to jni/sdl2tk/win/tkWinDefault.h.

174
175
176
177
178
179
180

181

182
183
184
185
186
187
188
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG

#define DEF_FRAME_BG_MONO		WHITE

#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG







>

>







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#define DEF_ENTRY_WIDTH			"20"

/*
 * Defaults for frames:
 */

#define DEF_FRAME_BG_COLOR		NORMAL_BG
#define DEF_FRAME_BG_IMAGE		NULL
#define DEF_FRAME_BG_MONO		WHITE
#define DEF_FRAME_BG_TILE		"0"
#define DEF_FRAME_BORDER_WIDTH		"0"
#define DEF_FRAME_CLASS			"Frame"
#define DEF_FRAME_COLORMAP		""
#define DEF_FRAME_CONTAINER		"0"
#define DEF_FRAME_CURSOR		""
#define DEF_FRAME_HEIGHT		"0"
#define DEF_FRAME_HIGHLIGHT_BG		NORMAL_BG

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

1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515

1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
{
    TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrame --
 *
 *	This function draws the rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrame(
    Tk_Window tkwin,

    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    Tk_Fill3DRectangle(tkwin, Tk_WindowId(tkwin), border, highlightWidth,
	    highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth,
	    Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief);
}
 
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */







|













|

>





|











1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
{
    TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0);
}
 
/*
 *----------------------------------------------------------------------
 *
 * TkpDrawFrameEx --
 *
 *	This function draws the rectangular frame area.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Draws inside the tkwin area.
 *
 *----------------------------------------------------------------------
 */

void
TkpDrawFrameEx(
    Tk_Window tkwin,
    Drawable drawable,
    Tk_3DBorder border,
    int highlightWidth,
    int borderWidth,
    int relief)
{
    Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth,
	    highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth,
	    Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief);
}
 
/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */

Changes to jni/topcua/examples/uacam.tcl.

2
3
4
5
6
7
8

9
10
11
12
13
14
15
..
36
37
38
39
40
41
42

43









44
45
46
47
48
49
50
..
99
100
101
102
103
104
105



106
107
108
109
110
111
#
# Requires Linux, MacOSX, or FreeBSD, due to tcluvc support,
# but can be easily modified for Windows to use tclwmf instead.

package require Tk
package require topcua
package require tcluvc


# hide Tk toplevel
wm withdraw .

# get first available camera
set cam [lindex [uvc devices] 0]
if {$cam eq {}} {
................................................................................

# image capture callback
proc capture {cam} {
    # limit frame rate, otherwise it consumes too much CPU for
    # image processing and the OPC/UA server part starves
    lassign [uvc counters $cam] all done dropped
    if {$all % 20 == 0} {

	uvc image $cam $::img









	set ::png [$::img data -format png]
    }
}

# create OPC/UA server
opcua new server 4840 S

................................................................................

# create variable in our folder to return last photo image
set att [opcua attrs default VariableAttributes]
dict set att dataType $IT	;# Image data type
dict set att valueRank -1	;# 1-dimensional array
opcua add S Variable "ns=$ns;s=Image" $obj HasComponent "$ns:Image" {} $att \
    ::opcua::S::_lastimg




# start server using Tk's event loop
opcua start S

# start camera
uvc start $cam 







>







 







>

>
>
>
>
>
>
>
>
>







 







>
>
>





|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#
# Requires Linux, MacOSX, or FreeBSD, due to tcluvc support,
# but can be easily modified for Windows to use tclwmf instead.

package require Tk
package require topcua
package require tcluvc
package require tkpath

# hide Tk toplevel
wm withdraw .

# get first available camera
set cam [lindex [uvc devices] 0]
if {$cam eq {}} {
................................................................................

# image capture callback
proc capture {cam} {
    # limit frame rate, otherwise it consumes too much CPU for
    # image processing and the OPC/UA server part starves
    lassign [uvc counters $cam] all done dropped
    if {$all % 20 == 0} {
	set ts [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"]
	uvc image $cam $::img
	set surf [::tkp::surface new 320 240]
	$surf create pimage 0 0 -image $::img
	$surf create ptext 160 225 -text $ts -textanchor c \
	    -fontfamily Courier -fontweight bold -fontsize 22 \
	    -stroke white -strokewidth 1 -strokeopacity 0.6 \
	    -fill black -fillopacity 0.3
	$::img configure -width 320 -height 240
	$surf copy $::img
	$surf destroy
	set ::png [$::img data -format png]
    }
}

# create OPC/UA server
opcua new server 4840 S

................................................................................

# create variable in our folder to return last photo image
set att [opcua attrs default VariableAttributes]
dict set att dataType $IT	;# Image data type
dict set att valueRank -1	;# 1-dimensional array
opcua add S Variable "ns=$ns;s=Image" $obj HasComponent "$ns:Image" {} $att \
    ::opcua::S::_lastimg

# start with empty image data
set png {}

# start server using Tk's event loop
opcua start S

# start camera
uvc start $cam

Changes to src/org/libsdl/app/SDLActivity.java.

694
695
696
697
698
699
700








701
702
703
704
705
706
707
        public int x, y, w, h;

        public ShowTextInputTask(int x, int y, int w, int h) {
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;








        }

        @Override
        public void run() {
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING);
            params.leftMargin = x;
            params.topMargin = y;







>
>
>
>
>
>
>
>







694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
        public int x, y, w, h;

        public ShowTextInputTask(int x, int y, int w, int h) {
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;

            /* Minimum size of 1 pixel, so it takes focus. */
            if (this.w <= 0) {
                this.w = 1;
            }
            if (this.h + HEIGHT_PADDING <= 0) {
                this.h = 1 - HEIGHT_PADDING;
            }
        }

        @Override
        public void run() {
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(w, h + HEIGHT_PADDING);
            params.leftMargin = x;
            params.topMargin = y;