1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
diff -ruN xchat-2.8.6.orig/src/fe-gtk/xtext.c xchat-2.8.6/src/fe-gtk/xtext.c
--- xchat-2.8.6.orig/src/fe-gtk/xtext.c 2008-02-24 06:04:30.000000000 +0100
+++ xchat-2.8.6/src/fe-gtk/xtext.c 2008-10-14 11:04:57.000000000 +0200
@@ -1350,6 +1350,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)
{
@@ -1366,8 +1382,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);
@@ -3559,6 +3579,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);
@@ -3576,18 +3601,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)
@@ -3612,7 +3639,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 (
@@ -3630,7 +3657,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);
@@ -3650,7 +3677,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));
|