@@ -48,6 +48,8 @@ typedef struct {
4848
4949 Display * display ;
5050 int screen ;
51+ Colormap colormap ;
52+ Visual * visual ;
5153 XftDraw * ftDraw ;
5254 int ncolors ;
5355 int firstColor ;
@@ -351,6 +353,8 @@ InitFont(
351353
352354 fontPtr -> display = Tk_Display (tkwin );
353355 fontPtr -> screen = Tk_ScreenNumber (tkwin );
356+ fontPtr -> colormap = Tk_Colormap (tkwin );
357+ fontPtr -> visual = Tk_Visual (tkwin );
354358 fontPtr -> ftDraw = 0 ;
355359 fontPtr -> ncolors = 0 ;
356360 fontPtr -> firstColor = -1 ;
@@ -907,7 +911,7 @@ LookUpColor(Display *display, /* Display to lookup colors on */
907911 * Translate the pixel value to a color. Needs a server round-trip.
908912 */
909913 xcolor .pixel = pixel ;
910- XQueryColor (display , DefaultColormap ( display , fontPtr -> screen ) , & xcolor );
914+ XQueryColor (display , fontPtr -> colormap , & xcolor );
911915
912916 fontPtr -> colors [last ].color .color .red = xcolor .red ;
913917 fontPtr -> colors [last ].color .color .green = xcolor .green ;
@@ -961,9 +965,8 @@ Tk_DrawChars(
961965 if (fontPtr -> ftDraw == 0 ) {
962966 DEBUG (("Switch to drawable 0x%lx\n" , drawable ));
963967 fontPtr -> ftDraw = XftDrawCreate (display , drawable ,
964- DefaultVisual (display , fontPtr -> screen ),
965- DefaultColormap (display , fontPtr -> screen ));
966- } else {
968+ fontPtr -> visual , fontPtr -> colormap );
969+ } else {
967970 Tk_ErrorHandler handler =
968971 Tk_CreateErrorHandler (display , -1 , -1 , -1 , NULL , NULL );
969972
@@ -1100,8 +1103,7 @@ TkDrawAngledChars(
11001103 if (fontPtr -> ftDraw == 0 ) {
11011104 DEBUG (("Switch to drawable 0x%lx\n" , drawable ));
11021105 fontPtr -> ftDraw = XftDrawCreate (display , drawable ,
1103- DefaultVisual (display , fontPtr -> screen ),
1104- DefaultColormap (display , fontPtr -> screen ));
1106+ fontPtr -> visual , fontPtr -> colormap );
11051107 } else {
11061108 Tk_ErrorHandler handler =
11071109 Tk_CreateErrorHandler (display , -1 , -1 , -1 , NULL , NULL );
@@ -1217,8 +1219,7 @@ TkDrawAngledChars(
12171219 if (fontPtr -> ftDraw == 0 ) {
12181220 DEBUG (("Switch to drawable 0x%lx\n" , drawable ));
12191221 fontPtr -> ftDraw = XftDrawCreate (display , drawable ,
1220- DefaultVisual (display , fontPtr -> screen ),
1221- DefaultColormap (display , fontPtr -> screen ));
1222+ fontPtr -> visual , fontPtr -> colormap );
12221223 } else {
12231224 Tk_ErrorHandler handler =
12241225 Tk_CreateErrorHandler (display , -1 , -1 , -1 , NULL , NULL );
0 commit comments