Add support for ARGB visuals on non-Xt builds
* src/gtkutil.c (xg_create_frame_widgets): Enable RGBA visual on non-PGTK builds. * src/xfns.c (select_visual): Select 32-bit visuals on non-Xt builds. * src/xterm.c (x_draw_fringe_bitmap): (x_draw_image_glyph_string): Stop using DefaultDepthOfScreen. (x_query_colors): * src/xterm.h (x_make_truecolor_pixel): Make colors opaque on 32-bit visuals.
This commit is contained in:
parent
391c1289e2
commit
310bcda934
4 changed files with 23 additions and 9 deletions
|
@ -1593,7 +1593,7 @@ xg_create_frame_widgets (struct frame *f)
|
|||
|
||||
GdkScreen *screen = gtk_widget_get_screen (wtop);
|
||||
|
||||
#if !defined HAVE_PGTK && defined USE_CAIRO
|
||||
#if !defined HAVE_PGTK
|
||||
if (FRAME_DISPLAY_INFO (f)->n_planes == 32)
|
||||
{
|
||||
GdkVisual *visual = gdk_screen_get_rgba_visual (screen);
|
||||
|
|
|
@ -6375,7 +6375,7 @@ select_visual (struct x_display_info *dpyinfo)
|
|||
|
||||
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;
|
||||
|
@ -6391,7 +6391,7 @@ select_visual (struct x_display_info *dpyinfo)
|
|||
return;
|
||||
}
|
||||
|
||||
#endif /* USE_GTK && USE_CAIRO */
|
||||
#endif /* !USE_X_TOOLKIT */
|
||||
|
||||
/* 32-bit visual not available, fallback to default visual */
|
||||
dpyinfo->visual = DefaultVisualOfScreen (screen);
|
||||
|
|
19
src/xterm.c
19
src/xterm.c
|
@ -1966,7 +1966,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
|
|||
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)
|
||||
|
@ -2812,12 +2812,12 @@ void
|
|||
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;
|
||||
|
||||
|
@ -2854,6 +2854,12 @@ x_query_colors (struct frame *f, XColor *colors, int ncolors)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -2871,6 +2877,12 @@ x_query_colors (struct frame *f, XColor *colors, int ncolors)
|
|||
}
|
||||
|
||||
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. */
|
||||
|
@ -3924,8 +3936,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
|
|||
/* 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),
|
||||
|
|
|
@ -1270,7 +1270,7 @@ x_display_set_last_user_time (struct x_display_info *dpyinfo, Time t)
|
|||
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
|
||||
|
@ -1279,8 +1279,11 @@ x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
|
|||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue