vinfo_template.screen = XScreenNumberOfScreen (screen);
-#if defined (USE_GTK) && defined (USE_CAIRO)
+#if !defined USE_X_TOOLKIT
/* First attempt to use 32-bit visual if available */
vinfo_template.depth = 32;
return;
}
-#endif /* USE_GTK && USE_CAIRO */
+#endif /* !USE_X_TOOLKIT */
/* 32-bit visual not available, fallback to default visual */
dpyinfo->visual = DefaultVisualOfScreen (screen);
Drawable drawable = FRAME_X_DRAWABLE (f);
char *bits;
Pixmap pixmap, clipmask = (Pixmap) 0;
- int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f));
+ int depth = FRAME_DISPLAY_INFO (f)->n_planes;
XGCValues gcv;
if (p->wd > 8)
x_query_colors (struct frame *f, XColor *colors, int ncolors)
{
struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+ int i;
if (dpyinfo->red_bits > 0)
{
/* For TrueColor displays, we can decompose the RGB value
directly. */
- int i;
unsigned int rmult, gmult, bmult;
unsigned int rmask, gmask, bmask;
colors[i].green = (g * gmult) >> 16;
colors[i].blue = (b * bmult) >> 16;
}
+
+ if (FRAME_DISPLAY_INFO (f)->n_planes == 32)
+ {
+ for (i = 0; i < ncolors; ++i)
+ colors[i].pixel |= ((unsigned long) 0xFF << 24);
+ }
return;
}
}
XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), colors, ncolors);
+
+ if (FRAME_DISPLAY_INFO (f)->n_planes == 32)
+ {
+ for (i = 0; i < ncolors; ++i)
+ colors[i].pixel |= ((unsigned long) 0xFF << 24);
+ }
}
/* Store F's background color into *BGCOLOR. */
/* Create a pixmap as large as the glyph string. Fill it
with the background color. Copy the image to it, using
its mask. Copy the temporary pixmap to the display. */
- Screen *screen = FRAME_X_SCREEN (s->f);
- int depth = DefaultDepthOfScreen (screen);
+ int depth = FRAME_DISPLAY_INFO (s->f)->n_planes;
/* Create a pixmap as large as the glyph string. */
pixmap = XCreatePixmap (display, FRAME_X_DRAWABLE (s->f),
INLINE unsigned long
x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
{
- unsigned long pr, pg, pb;
+ unsigned long pr, pg, pb, pa = 0;
/* Scale down RGB values to the visual's bits per RGB, and shift
them to the right position in the pixel color. Note that the
pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
pb = (b >> (16 - dpyinfo->blue_bits)) << dpyinfo->blue_offset;
+ if (dpyinfo->n_planes == 32)
+ pa = ((unsigned long) 0xFF << 24);
+
/* Assemble the pixel color. */
- return pr | pg | pb;
+ return pr | pg | pb | pa;
}
/* If display has an immutable color map, freeing colors is not