mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
106 lines
2.7 KiB
Diff
106 lines
2.7 KiB
Diff
diff -ur xchat-2.8.4/src/fe-gtk/xtext.c xchat-2.8.4-shm-pixmaps/src/fe-gtk/xtext.c
|
|
--- xchat-2.8.4/src/fe-gtk/xtext.c 2007-06-08 11:57:07.000000000 +0200
|
|
+++ xchat-2.8.4-shm-pixmaps/src/fe-gtk/xtext.c 2008-05-23 00:56:52.000000000 +0200
|
|
@@ -1347,6 +1347,22 @@
|
|
}
|
|
}
|
|
|
|
+#ifdef USE_SHM
|
|
+static int
|
|
+have_shm_pixmaps(Display *dpy)
|
|
+{
|
|
+ static int checked = 0, major, minor;
|
|
+ static Bool have = FALSE;
|
|
+
|
|
+ if (!checked) {
|
|
+ XShmQueryVersion(dpy, &major, &minor, &have);
|
|
+ checked = 1;
|
|
+ }
|
|
+
|
|
+ return have;
|
|
+}
|
|
+#endif
|
|
+
|
|
static void
|
|
gtk_xtext_paint (GtkWidget *widget, GdkRectangle *area)
|
|
{
|
|
@@ -1363,8 +1379,12 @@
|
|
{
|
|
xtext->last_win_x = x;
|
|
xtext->last_win_y = y;
|
|
-#if !defined(USE_SHM) && !defined(WIN32)
|
|
+#ifndef WIN32
|
|
+#ifdef USE_SHM
|
|
+ if (xtext->shaded && !have_shm_pixmaps(GDK_WINDOW_XDISPLAY (xtext->draw_buf)))
|
|
+#else
|
|
if (xtext->shaded)
|
|
+#endif
|
|
{
|
|
xtext->recycle = TRUE;
|
|
gtk_xtext_load_trans (xtext);
|
|
@@ -3549,6 +3569,11 @@
|
|
GC tgc;
|
|
Display *xdisplay = GDK_WINDOW_XDISPLAY (xtext->draw_buf);
|
|
|
|
+#ifdef USE_SHM
|
|
+ int shm_pixmaps;
|
|
+ shm_pixmaps = have_shm_pixmaps(xdisplay);
|
|
+#endif
|
|
+
|
|
XGetGeometry (xdisplay, p, &root, &dummy, &dummy, &width, &height,
|
|
&dummy, &depth);
|
|
|
|
@@ -3566,18 +3591,20 @@
|
|
XFreeGC (xdisplay, tgc);
|
|
|
|
#ifdef USE_SHM
|
|
- ximg = get_image (xtext, xdisplay, &xtext->shminfo, 0, 0, w, h, depth, tmp);
|
|
-#else
|
|
- ximg = XGetImage (xdisplay, tmp, 0, 0, w, h, -1, ZPixmap);
|
|
+ if (shm_pixmaps)
|
|
+ ximg = get_image (xtext, xdisplay, &xtext->shminfo, 0, 0, w, h, depth, tmp);
|
|
+ else
|
|
#endif
|
|
+ ximg = XGetImage (xdisplay, tmp, 0, 0, w, h, -1, ZPixmap);
|
|
XFreePixmap (xdisplay, tmp);
|
|
} else
|
|
{
|
|
#ifdef USE_SHM
|
|
- ximg = get_image (xtext, xdisplay, &xtext->shminfo, x, y, w, h, depth, p);
|
|
-#else
|
|
- ximg = XGetImage (xdisplay, p, x, y, w, h, -1, ZPixmap);
|
|
+ if (shm_pixmaps)
|
|
+ ximg = get_image (xtext, xdisplay, &xtext->shminfo, x, y, w, h, depth, p);
|
|
+ else
|
|
#endif
|
|
+ ximg = XGetImage (xdisplay, p, x, y, w, h, -1, ZPixmap);
|
|
}
|
|
|
|
if (!ximg)
|
|
@@ -3602,7 +3629,7 @@
|
|
else
|
|
{
|
|
#ifdef USE_SHM
|
|
- if (xtext->shm)
|
|
+ if (xtext->shm && shm_pixmaps)
|
|
{
|
|
#if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
|
|
shaded_pix = gdk_pixmap_foreign_new (
|
|
@@ -3620,7 +3647,7 @@
|
|
}
|
|
|
|
#ifdef USE_SHM
|
|
- if (!xtext->shm)
|
|
+ if (!xtext->shm || !shm_pixmaps)
|
|
#endif
|
|
XPutImage (xdisplay, GDK_WINDOW_XWINDOW (shaded_pix),
|
|
GDK_GC_XGC (xtext->fgc), ximg, 0, 0, 0, 0, w, h);
|
|
@@ -3640,7 +3667,7 @@
|
|
if (xtext->pixmap)
|
|
{
|
|
#ifdef USE_SHM
|
|
- if (xtext->shm)
|
|
+ if (xtext->shm && have_shm_pixmaps(GDK_WINDOW_XDISPLAY (xtext->draw_buf)))
|
|
{
|
|
XFreePixmap (GDK_WINDOW_XDISPLAY (xtext->pixmap),
|
|
GDK_WINDOW_XWINDOW (xtext->pixmap));
|