Tk Source Code

Check-in [b1cb77b6]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

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

Overview
Comment:Fix merging from trunk: Make logging arrangements for macOS10.14 available in revised_text branch
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | revised_text | tip-466
Files: files | file ages | folders
SHA3-256:b1cb77b6b399e5df7b67fcb282385bd7637c9e525df5606cd6da69e4c2d73a10
User & Date: fvogel 2018-11-15 20:01:08
Context
2018-11-15
20:57
Fix merging from trunk: Remove unused macro FORCE_DISPLAY check-in: 034b594c user: fvogel tags: revised_text, tip-466
20:01
Fix merging from trunk: Make logging arrangements for macOS10.14 available in revised_text branch check-in: b1cb77b6 user: fvogel tags: revised_text, tip-466
19:43
Fix merging from trunk: Remove unused function GenerateWidgetViewSyncEvent, in the revised_text branch this became TkTextGenerateWidgetViewSyncEvent check-in: 4d1d025c user: fvogel tags: revised_text, tip-466
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkTextDisp.c.

29
30
31
32
33
34
35


36
37
38
39
40
41
42
43


44
45
46
47
48
49
50
...
156
157
158
159
160
161
162
163





164
165
166

167



168
169
170
171
172
173
174
....
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
# include "tkWinInt.h"
#elif defined(__CYGWIN__)
# include "tkUnixInt.h"
#endif

#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 portability 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>
................................................................................
 * precision is different (e.g. Intel)
 */

#define FP_EQUAL_SCALE(double1, double2, scaleFactor) \
    (fabs((double1) - (double2))*((scaleFactor) + 1.0) < 0.3)

/*
 * Macro to make debugging/testing logging a little easier.





 */

#define LOG(toVar,what) \

    Tcl_SetVar2(textPtr->interp, toVar, NULL, what, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT)




/*
 * Speed up if the text content only contains monospaced line heights, and line wrapping
 * is disabled.
 *
 * But this speed-up trial seems not to have any effect which is worth the effort,
 * especially because it can be used only if no line wrapping will be done.
................................................................................
	}
	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) {
	UpdateDisplayInfo(textPtr);
	dInfoPtr->flags &= ~REDRAW_PENDING;
	ClearRegion(invalidRegion);
	goto doScrollbars;
    }
    DEBUG(stats.numRedisplays += 1);
    TK_TEXT_DEBUG(Tcl_SetVar2(interp, "tk_textRedraw", NULL, "", TCL_GLOBAL_ONLY));

    /*
     * Choose a new current item if that is needed (this could cause event
     * handlers to be invoked, hence the preserve/release calls and the loop,
     * since the handlers could conceivably necessitate yet another current
     * item calculation). The textPtr check is because the whole window could go
     * away in the meanwhile.







>
>








>
>







 







|
>
>
>
>
>



>
|
>
>
>







 







|








|







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
...
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
....
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
# include "tkWinInt.h"
#elif defined(__CYGWIN__)
# include "tkUnixInt.h"
#endif

#ifdef MAC_OSX_TK
# include "tkMacOSXInt.h"
# define OK_TO_LOG (!TkpAppIsDrawing())
# define FORCE_DISPLAY(winPtr) TkpDisplayWindow(winPtr)
/* 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 portability to 8.5/6 */
# define OK_TO_LOG 1
# define FORCE_DISPLAY(winPtr)
# ifndef DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED
#  define DEF_TEXT_INACTIVE_SELECT_COLOR_DISABLED "0"
# endif
#endif

#include <stdlib.h>
#include <assert.h>
................................................................................
 * precision is different (e.g. Intel)
 */

#define FP_EQUAL_SCALE(double1, double2, scaleFactor) \
    (fabs((double1) - (double2))*((scaleFactor) + 1.0) < 0.3)

/*
 * Macros to make debugging/testing logging a little easier.
 *
 * On OSX 10.14 Drawing procedures are sometimes run because the system has
 * decided to redraw the window.  This can corrupt the data that a test is
 * trying to collect.  So we don't write to the logging variables when the
 * drawing procedure is being run that way.  Other systems can always log.
 */

#define LOG(toVar,what) \
    if (OK_TO_LOG) \
        Tcl_SetVar2(textPtr->interp, toVar, NULL, what, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT)
#define CLEAR(var) \
    if (OK_TO_LOG) \
	Tcl_SetVar2(interp, var, NULL, "", TCL_GLOBAL_ONLY)

/*
 * Speed up if the text content only contains monospaced line heights, and line wrapping
 * is disabled.
 *
 * But this speed-up trial seems not to have any effect which is worth the effort,
 * especially because it can be used only if no line wrapping will be done.
................................................................................
	}
	return;
    }

    interp = textPtr->interp;
    Tcl_Preserve(interp);

    TK_TEXT_DEBUG(CLEAR("tk_textRelayout"));

    if (!Tk_IsMapped(textPtr->tkwin) || dInfoPtr->maxX <= dInfoPtr->x || dInfoPtr->maxY <= dInfoPtr->y) {
	UpdateDisplayInfo(textPtr);
	dInfoPtr->flags &= ~REDRAW_PENDING;
	ClearRegion(invalidRegion);
	goto doScrollbars;
    }
    DEBUG(stats.numRedisplays += 1);
    TK_TEXT_DEBUG(CLEAR("tk_textRedraw"));

    /*
     * Choose a new current item if that is needed (this could cause event
     * handlers to be invoked, hence the preserve/release calls and the loop,
     * since the handlers could conceivably necessitate yet another current
     * item calculation). The textPtr check is because the whole window could go
     * away in the meanwhile.