Attachment "not-a-solution.diff" to
ticket [c23f79ef]
added by
chrstphrchvz
2023-11-24 18:36:11.
diff --git unix/tkUnixRFont.c unix/tkUnixRFont.c
index 2c017e2f5..a51ba863c 100644
--- unix/tkUnixRFont.c
+++ unix/tkUnixRFont.c
@@ -38,6 +38,8 @@ typedef struct {
Display *display;
int screen;
+ Visual *visual;
+ Colormap cmap;
XftDraw *ftDraw;
int ncolors;
int firstColor;
@@ -332,6 +334,8 @@ InitFont(
fontPtr->display = Tk_Display(tkwin);
fontPtr->screen = Tk_ScreenNumber(tkwin);
+ fontPtr->visual = Tk_Visual(tkwin);
+ fontPtr->cmap = Tk_Colormap(tkwin);
fontPtr->ftDraw = 0;
fontPtr->ncolors = 0;
fontPtr->firstColor = -1;
@@ -888,7 +892,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */
* Translate the pixel value to a color. Needs a server round-trip.
*/
xcolor.pixel = pixel;
- XQueryColor(display, DefaultColormap(display, fontPtr->screen), &xcolor);
+ XQueryColor(display, fontPtr->cmap, &xcolor);
fontPtr->colors[last].color.color.red = xcolor.red;
fontPtr->colors[last].color.color.green = xcolor.green;
@@ -944,8 +948,7 @@ Tk_DrawChars(
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
- DefaultVisual(display, fontPtr->screen),
- DefaultColormap(display, fontPtr->screen));
+ fontPtr->visual, fontPtr->cmap);
} else {
Tk_ErrorHandler handler =
Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
@@ -1085,8 +1088,7 @@ TkDrawAngledChars(
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
- DefaultVisual(display, fontPtr->screen),
- DefaultColormap(display, fontPtr->screen));
+ fontPtr->visual, fontPtr->cmap);
} else {
Tk_ErrorHandler handler =
Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);
@@ -1203,8 +1205,7 @@ TkDrawAngledChars(
printf("Switch to drawable 0x%x\n", drawable);
#endif /* DEBUG_FONTSEL */
fontPtr->ftDraw = XftDrawCreate(display, drawable,
- DefaultVisual(display, fontPtr->screen),
- DefaultColormap(display, fontPtr->screen));
+ fontPtr->visual, fontPtr->cmap);
} else {
Tk_ErrorHandler handler =
Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL);