Fix handling visuals and colormaps incorrectly
cf. https://github.com/hut/ranger/issues/86 Origin: https://gist.github.com/BwackNinja/60a344730170f9ce2163 Bug-Arch: https://bugs.archlinux.org/task/46836 Bug: https://sourceforge.net/p/w3m/patches/72/
This commit is contained in:
committed by
Tatsuya Kinoshita
parent
a38c995c48
commit
e24b4064da
@@ -219,9 +219,12 @@ x11_set_background(w3mimg_op * self, char *background)
|
|||||||
Pixmap p;
|
Pixmap p;
|
||||||
GC gc;
|
GC gc;
|
||||||
XImage *i;
|
XImage *i;
|
||||||
|
XWindowAttributes attr;
|
||||||
|
|
||||||
|
XGetWindowAttributes(xi->display, xi->window, &attr);
|
||||||
|
|
||||||
p = XCreatePixmap(xi->display, xi->window, 1, 1,
|
p = XCreatePixmap(xi->display, xi->window, 1, 1,
|
||||||
DefaultDepth(xi->display, 0));
|
attr.depth);
|
||||||
gc = XCreateGC(xi->display, xi->window, 0, NULL);
|
gc = XCreateGC(xi->display, xi->window, 0, NULL);
|
||||||
if (!p || !gc)
|
if (!p || !gc)
|
||||||
exit(1); /* XXX */
|
exit(1); /* XXX */
|
||||||
@@ -333,6 +336,7 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
|
|||||||
ImlibImage *im;
|
ImlibImage *im;
|
||||||
#elif defined(USE_IMLIB2)
|
#elif defined(USE_IMLIB2)
|
||||||
Imlib_Image im;
|
Imlib_Image im;
|
||||||
|
XWindowAttributes attr;
|
||||||
#elif defined(USE_GDKPIXBUF)
|
#elif defined(USE_GDKPIXBUF)
|
||||||
GdkPixbufAnimation *animation;
|
GdkPixbufAnimation *animation;
|
||||||
int j, iw, ih, n, frame_num, delay = -1, max_anim;
|
int j, iw, ih, n, frame_num, delay = -1, max_anim;
|
||||||
@@ -379,15 +383,16 @@ x11_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
|
|||||||
w = imlib_image_get_width();
|
w = imlib_image_get_width();
|
||||||
if (h <= 0)
|
if (h <= 0)
|
||||||
h = imlib_image_get_height();
|
h = imlib_image_get_height();
|
||||||
|
XGetWindowAttributes(xi->display, xi->window, &attr);
|
||||||
img->pixmap = (void *)XCreatePixmap(xi->display, xi->parent, w, h,
|
img->pixmap = (void *)XCreatePixmap(xi->display, xi->parent, w, h,
|
||||||
DefaultDepth(xi->display, 0));
|
attr.depth);
|
||||||
if (!img->pixmap)
|
if (!img->pixmap)
|
||||||
return 0;
|
return 0;
|
||||||
XSetForeground(xi->display, xi->imageGC, xi->background_pixel);
|
XSetForeground(xi->display, xi->imageGC, xi->background_pixel);
|
||||||
XFillRectangle(xi->display, (Pixmap) img->pixmap, xi->imageGC, 0, 0, w, h);
|
XFillRectangle(xi->display, (Pixmap) img->pixmap, xi->imageGC, 0, 0, w, h);
|
||||||
imlib_context_set_display(xi->display);
|
imlib_context_set_display(xi->display);
|
||||||
imlib_context_set_visual(DefaultVisual(xi->display, 0));
|
imlib_context_set_visual(attr.visual);
|
||||||
imlib_context_set_colormap(DefaultColormap(xi->display, 0));
|
imlib_context_set_colormap(attr.colormap);
|
||||||
imlib_context_set_drawable((Drawable) img->pixmap);
|
imlib_context_set_drawable((Drawable) img->pixmap);
|
||||||
imlib_render_image_on_drawable_at_size(0, 0, w, h);
|
imlib_render_image_on_drawable_at_size(0, 0, w, h);
|
||||||
imlib_free_image();
|
imlib_free_image();
|
||||||
|
Reference in New Issue
Block a user