Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | "#ifdef MAC_OSX_TK" code replaced, the generic implementation should not contain platform specific code (only debugging code is an exception). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | revised_text | tip-466 |
Files: | files | file ages | folders |
SHA1: |
a232ec01e6b7266f6be31f19e5e728c4 |
User & Date: | gcramer 2017-05-25 09:38:16 |
Context
2017-05-26
| ||
14:53 | Bugfix [cda289a8ea]: The old handling/implementation of the selection options is tohubohu, so I used the opportunity to overwork it: (1) I added the tag options -inactivebackground and -inactiveforegound, and these options are tied to widget options -inactiveselectbackground and -inactiveselectforeground. (2) For symmetry reasons I added the tag options -inactiveselectbackground and -inactiveselectforeground, these options will overrule the options -inactivebackground and -inactivebackgound of the "sel" tag, provided that the actual tag has a higher priority. (3) The manual has been updated with new options. Furthermore section "THE SELECTION" has been refined. (4) In legacy widget tag option -selectbackground is tied to widget option -selectbackground if the tag option -selectbackground is not null, otherwise the widget option is tied to tag option "-background", this is very confusing, and not conform to documentation, this binding has been changed. Now the widget option -selectbackground is tied with tag option "-background" (of the "sel" tag), this is conform to (revised and legacy) documentation, it is a clear behavior, and allows more freedom in configuration. The tag options "-selectbackground" and "-selectforeground" now will overrule the options "-background" and "-foreground" of the "sel" tag, provided that the actual tag has a higher priority. (5) I changed test case textTag-5.23 according to (3). Moreover this test case has been extended for testing all bindings. BTW: Test case text-5.24 has been removed, it was a duplicate of prior textTag-5.23. (6) Complete rework of function MakeStyle(), the "sel" tag now will be handled separately, after all other tags have been processed, this makes it easier to follow the flow. (7) The old implementation has an erroneous resource management with the shared (tied) options of the "sel" tag and the selection options of the widget. This has been replaced with a proper implementation. Unfortunately the new implementation for resource management of shared options is a bit tricky, because the option table does not support shared options. (8). DEF_TEXT_INACTIVE_SELECT_BG_COLOR has been set to NULL for Windows, this should finally fix the issue of this bug report. check-in: b2f64dc3 user: gcramer tags: revised_text, tip-466 | |
2017-05-25
| ||
09:38 | "#ifdef MAC_OSX_TK" code replaced, the generic implementation should not contain platform specific code (only debugging code is an exception). check-in: a232ec01 user: gcramer tags: revised_text, tip-466 | |
2017-05-24
| ||
16:24 | Correction of typo in comment. check-in: b61d5510 user: gcramer tags: revised_text, tip-466 | |
Changes
Changes to generic/tkInt.h.
︙ | ︙ | |||
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | const char *buffer, int pad1, int pad2); MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *pad1Ptr, int *pad2Ptr); MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr); MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr); MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin); MODULE_SCOPE void TkpDrawCharsInContext(Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, int rangeStart, int rangeLength, int x, int y); MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont, const char *source, int numBytes, int rangeStart, int rangeLength, int maxLength, int flags, | > > > > > | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | const char *buffer, int pad1, int pad2); MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *pad1Ptr, int *pad2Ptr); MODULE_SCOPE void TkFocusSplit(TkWindow *winPtr); MODULE_SCOPE void TkFocusJoin(TkWindow *winPtr); MODULE_SCOPE int TkpAlwaysShowSelection(Tk_Window tkwin); #ifdef MAC_OSX_TK MODULE_SCOPE int TkpDrawingIsDisabled(Tk_Window tkwin); #else # define TkpDrawingIsDisabled(tkwin) 0 #endif MODULE_SCOPE void TkpDrawCharsInContext(Display * display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, int rangeStart, int rangeLength, int x, int y); MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont, const char *source, int numBytes, int rangeStart, int rangeLength, int maxLength, int flags, |
︙ | ︙ |
Changes to generic/tkTextDisp.c.
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #ifdef MAC_OSX_TK # include "tkMacOSXInt.h" /* Version 8.5 has forgotten to define this constant. */ # ifndef TK_DO_NOT_DRAW # define TK_DO_NOT_DRAW 0x80 # endif #endif #include <stdlib.h> #include <assert.h> #ifndef MIN # define MIN(a,b) (a < b ? a : b) | > > > > > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #ifdef MAC_OSX_TK # include "tkMacOSXInt.h" /* Version 8.5 has forgotten to define this constant. */ # ifndef TK_DO_NOT_DRAW # define TK_DO_NOT_DRAW 0x80 # endif # ifndef DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED # define DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED "1" # endif #else /* for partability to 8.5/6 */ # ifndef DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED # define DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED "0" # endif #endif #include <stdlib.h> #include <assert.h> #ifndef MIN # define MIN(a,b) (a < b ? a : b) |
︙ | ︙ | |||
1861 1862 1863 1864 1865 1866 1867 | /* * If this is the selection tag, and inactiveSelBorder is NULL (the * default on Windows), then we need to skip it if we don't have the * focus. */ | > | | > > | | < < | | | < | | | < | 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 | /* * If this is the selection tag, and inactiveSelBorder is NULL (the * default on Windows), then we need to skip it if we don't have the * focus. */ if (containsSelection) { if (tagPtr == textPtr->selTagPtr && !(textPtr->flags & HAVE_FOCUS)) { if (textPtr->state == TK_TEXT_STATE_DISABLED && *DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED == '1') { /* Don't show inactive selection in disabled widgets. */ continue; } if (!textPtr->inactiveSelBorder) { continue; } border = textPtr->inactiveSelBorder; fgColor = textPtr->inactiveSelFgColorPtr; } if (tagPtr->selBorder) { border = tagPtr->selBorder; } if (tagPtr->selFgColor != None) { fgColor = tagPtr->selFgColor; } else if (fgColor == None) { fgColor = textPtr->selFgColorPtr; |
︙ | ︙ | |||
8081 8082 8083 8084 8085 8086 8087 | DLine *dlPtr; Pixmap pixmap; int maxHeight, borders; int bottomY = 0; /* Initialization needed only to stop compiler warnings. */ int extent1, extent2; Tcl_Interp *interp; | > > > | > | | | < < < < < < < < | 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 | DLine *dlPtr; Pixmap pixmap; int maxHeight, borders; int bottomY = 0; /* Initialization needed only to stop compiler warnings. */ int extent1, extent2; Tcl_Interp *interp; if (textPtr->flags & DESTROYED) { return; /* the widget has been deleted */ } if (TkpDrawingIsDisabled(textPtr->tkwin)) { /* * If drawing is disabled, all we need to do is clear the REDRAW_PENDING flag. */ dInfoPtr->flags &= ~REDRAW_PENDING; if (dInfoPtr->flags & ASYNC_PENDING) { assert(dInfoPtr->flags & ASYNC_UPDATE); dInfoPtr->flags &= ~ASYNC_PENDING; /* continue with asynchronous pixel-height calculation */ InvokeAsyncUpdateLineMetrics(textPtr); } return; } interp = textPtr->interp; Tcl_Preserve(interp); TK_TEXT_DEBUG(Tcl_SetVar2(interp, "tk_textRelayout", NULL, "", TCL_GLOBAL_ONLY)); if (!Tk_IsMapped(textPtr->tkwin) || dInfoPtr->maxX <= dInfoPtr->x || dInfoPtr->maxY <= dInfoPtr->y) { |
︙ | ︙ | |||
8275 8276 8277 8278 8279 8280 8281 | * Now scroll the lines. This may generate damage which we handle by * calling TextInvalidateRegion to mark the display blocks as stale. */ damageRgn = TkCreateRegion(); if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x - extent1, oldY, dInfoPtr->maxX - dInfoPtr->x + extent1 + extent2, height, 0, y - oldY, damageRgn)) { | < < < < | 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 | * Now scroll the lines. This may generate damage which we handle by * calling TextInvalidateRegion to mark the display blocks as stale. */ damageRgn = TkCreateRegion(); if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x - extent1, oldY, dInfoPtr->maxX - dInfoPtr->x + extent1 + extent2, height, 0, y - oldY, damageRgn)) { TextInvalidateRegion(textPtr, damageRgn); } DEBUG(stats.numCopies += 1); TkDestroyRegion(damageRgn); } /* * Clear the REDRAW_PENDING flag here. This is actually pretty tricky. We want to |
︙ | ︙ |
Changes to macosx/tkMacOSXDefault.h.
︙ | ︙ | |||
527 528 529 530 531 532 533 534 535 536 537 538 539 540 | #define DEF_TEXT_INSERT_WIDTH "1" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" #define DEF_TEXT_PADY "1" #define DEF_TEXT_RELIEF "flat" #define DEF_TEXT_INACTIVE_SELECT_BG_COLOR INACTIVE_SELECT_BG #define DEF_TEXT_INACTIVE_SELECT_FG_COLOR INACTIVE_SELECT_FG #define DEF_TEXT_SELECT_COLOR SELECT_BG #define DEF_TEXT_SELECT_MONO BLACK #define DEF_TEXT_SELECT_BD_COLOR "1" #define DEF_TEXT_SELECT_BD_MONO "0" #define DEF_TEXT_SELECT_FG_COLOR SELECT_FG #define DEF_TEXT_SELECT_FG_MONO WHITE #define DEF_TEXT_SELECT_RELIEF "flat" | > | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | #define DEF_TEXT_INSERT_WIDTH "1" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" #define DEF_TEXT_PADY "1" #define DEF_TEXT_RELIEF "flat" #define DEF_TEXT_INACTIVE_SELECT_BG_COLOR INACTIVE_SELECT_BG #define DEF_TEXT_INACTIVE_SELECT_FG_COLOR INACTIVE_SELECT_FG #define DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED "1" #define DEF_TEXT_SELECT_COLOR SELECT_BG #define DEF_TEXT_SELECT_MONO BLACK #define DEF_TEXT_SELECT_BD_COLOR "1" #define DEF_TEXT_SELECT_BD_MONO "0" #define DEF_TEXT_SELECT_FG_COLOR SELECT_FG #define DEF_TEXT_SELECT_FG_MONO WHITE #define DEF_TEXT_SELECT_RELIEF "flat" |
︙ | ︙ |
Changes to macosx/tkMacOSXDraw.c.
︙ | ︙ | |||
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | return (SHRT_MAX / 4); } #endif /* *---------------------------------------------------------------------- * * TkScrollWindow -- * * Scroll a rectangle of the specified window and accumulate * a damage region. * * Results: * Returns 0 if the scroll genereated no additional damage. | > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | return (SHRT_MAX / 4); } #endif /* *---------------------------------------------------------------------- * * TkpDrawingIsDisabled -- * * Query whether the given window is disabled, in this case drawing * is also disabled. * * Results: * Whether the drawing is disabled. * * Side effects: * None. * *---------------------------------------------------------------------- */ int TkpDrawingIsDisabled( Tk_Window tkwin) { MacDrawable *macWin = ((TkWindow *) tkwin)->privatePtr; return macWin && !!(macWin->flags & TK_DO_NOT_DRAW); } /* *---------------------------------------------------------------------- * * TkScrollWindow -- * * Scroll a rectangle of the specified window and accumulate * a damage region. * * Results: * Returns 0 if the scroll genereated no additional damage. |
︙ | ︙ | |||
1502 1503 1504 1505 1506 1507 1508 | HIShapeRef dmgRgn = NULL, extraRgn = NULL; NSRect bounds, visRect, scrollSrc, scrollDst; int result = 0; if ( view ) { /* Get the scroll area in NSView coordinates (origin at bottom left). */ bounds = [view bounds]; | | < | 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 | HIShapeRef dmgRgn = NULL, extraRgn = NULL; NSRect bounds, visRect, scrollSrc, scrollDst; int result = 0; if ( view ) { /* Get the scroll area in NSView coordinates (origin at bottom left). */ bounds = [view bounds]; scrollSrc = NSMakeRect(macDraw->xOff + x, bounds.size.height - height - (macDraw->yOff + y), width, height); scrollDst = NSOffsetRect(scrollSrc, dx, -dy); /* Limit scrolling to the window content area. */ visRect = [view visibleRect]; scrollSrc = NSIntersectionRect(scrollSrc, visRect); |
︙ | ︙ | |||
1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 | childPtr->changes.y = macChild->yOff; childPtr->changes.x = macChild->xOff; } } } } /* Queue up Expose events for the damage region. */ int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE); [view generateExposeEvents:dmgRgn childrenOnly:1]; Tcl_SetServiceMode(oldMode); } } else { dmgRgn = HIShapeCreateEmpty(); TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); } if (dmgRgn) { | > > | 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 | childPtr->changes.y = macChild->yOff; childPtr->changes.x = macChild->xOff; } } } } #if 0 /* Don't queue Expose event, otherwise it is not compatible to UNIX and Windows version. */ /* Queue up Expose events for the damage region. */ int oldMode = Tcl_SetServiceMode(TCL_SERVICE_NONE); [view generateExposeEvents:dmgRgn childrenOnly:1]; Tcl_SetServiceMode(oldMode); #endif } } else { dmgRgn = HIShapeCreateEmpty(); TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); } if (dmgRgn) { |
︙ | ︙ |
Changes to unix/tkUnixDefault.h.
︙ | ︙ | |||
486 487 488 489 490 491 492 493 494 495 496 497 498 499 | #define DEF_TEXT_INSERT_WIDTH "2" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" #define DEF_TEXT_PADY "1" #define DEF_TEXT_RELIEF "sunken" #define DEF_TEXT_INACTIVE_SELECT_BG_COLOR SELECT_BG #define DEF_TEXT_INACTIVE_SELECT_FG_COLOR SELECT_FG #define DEF_TEXT_SELECT_COLOR SELECT_BG #define DEF_TEXT_SELECT_MONO BLACK #define DEF_TEXT_SELECT_BD_COLOR "0" #define DEF_TEXT_SELECT_BD_MONO "0" #define DEF_TEXT_SELECT_FG_COLOR BLACK #define DEF_TEXT_SELECT_FG_MONO WHITE #define DEF_TEXT_SELECT_RELIEF "raised" | > | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | #define DEF_TEXT_INSERT_WIDTH "2" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" #define DEF_TEXT_PADY "1" #define DEF_TEXT_RELIEF "sunken" #define DEF_TEXT_INACTIVE_SELECT_BG_COLOR SELECT_BG #define DEF_TEXT_INACTIVE_SELECT_FG_COLOR SELECT_FG #define DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED "0" #define DEF_TEXT_SELECT_COLOR SELECT_BG #define DEF_TEXT_SELECT_MONO BLACK #define DEF_TEXT_SELECT_BD_COLOR "0" #define DEF_TEXT_SELECT_BD_MONO "0" #define DEF_TEXT_SELECT_FG_COLOR BLACK #define DEF_TEXT_SELECT_FG_MONO WHITE #define DEF_TEXT_SELECT_RELIEF "raised" |
︙ | ︙ |
Changes to win/tkWinDefault.h.
︙ | ︙ | |||
487 488 489 490 491 492 493 494 495 496 497 498 499 500 | #define DEF_TEXT_INSERT_WIDTH "2" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" #define DEF_TEXT_PADY "1" #define DEF_TEXT_RELIEF "sunken" #define DEF_TEXT_INACTIVE_SELECT_BG_COLOR NULL #define DEF_TEXT_INACTIVE_SELECT_FG_COLOR NULL #define DEF_TEXT_SELECT_COLOR SELECT_BG #define DEF_TEXT_SELECT_MONO BLACK #define DEF_TEXT_SELECT_BD_COLOR "0" #define DEF_TEXT_SELECT_BD_MONO "0" #define DEF_TEXT_SELECT_FG_COLOR SELECT_FG #define DEF_TEXT_SELECT_FG_MONO WHITE #define DEF_TEXT_SELECT_RELIEF "flat" | > | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | #define DEF_TEXT_INSERT_WIDTH "2" #define DEF_TEXT_MAX_UNDO "0" #define DEF_TEXT_PADX "1" #define DEF_TEXT_PADY "1" #define DEF_TEXT_RELIEF "sunken" #define DEF_TEXT_INACTIVE_SELECT_BG_COLOR NULL #define DEF_TEXT_INACTIVE_SELECT_FG_COLOR NULL #define DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED "0" #define DEF_TEXT_SELECT_COLOR SELECT_BG #define DEF_TEXT_SELECT_MONO BLACK #define DEF_TEXT_SELECT_BD_COLOR "0" #define DEF_TEXT_SELECT_BD_MONO "0" #define DEF_TEXT_SELECT_FG_COLOR SELECT_FG #define DEF_TEXT_SELECT_FG_MONO WHITE #define DEF_TEXT_SELECT_RELIEF "flat" |
︙ | ︙ |