Add patch for xchat that removes the space after nick-completed nicknames.
[overlay.git] / net-irc / xchat / files / xchat-2.8.6-shm-pixmaps.patch
1 diff -ruN xchat-2.8.6.orig/src/fe-gtk/xtext.c xchat-2.8.6/src/fe-gtk/xtext.c
2 --- xchat-2.8.6.orig/src/fe-gtk/xtext.c 2008-02-24 06:04:30.000000000 +0100
3 +++ xchat-2.8.6/src/fe-gtk/xtext.c      2008-10-14 11:04:57.000000000 +0200
4 @@ -1350,6 +1350,22 @@
5         }
6  }
7  
8 +#ifdef USE_SHM
9 +static int
10 +have_shm_pixmaps(Display *dpy)
11 +{
12 +    static int checked = 0, major, minor;
13 +    static Bool have = FALSE;
14 +
15 +    if (!checked) {
16 +       XShmQueryVersion(dpy, &major, &minor, &have);
17 +       checked = 1;
18 +    }
19 +
20 +    return have;
21 +}
22 +#endif
23 +
24  static void
25  gtk_xtext_paint (GtkWidget *widget, GdkRectangle *area)
26  {
27 @@ -1366,8 +1382,12 @@
28                 {
29                         xtext->last_win_x = x;
30                         xtext->last_win_y = y;
31 -#if !defined(USE_SHM) && !defined(WIN32)
32 +#ifndef WIN32
33 +#ifdef USE_SHM
34 +                       if (xtext->shaded && !have_shm_pixmaps(GDK_WINDOW_XDISPLAY (xtext->draw_buf)))
35 +#else
36                         if (xtext->shaded)
37 +#endif
38                         {
39                                 xtext->recycle = TRUE;
40                                 gtk_xtext_load_trans (xtext);
41 @@ -3559,6 +3579,11 @@
42         GC tgc;
43         Display *xdisplay = GDK_WINDOW_XDISPLAY (xtext->draw_buf);
44  
45 +#ifdef USE_SHM
46 +       int shm_pixmaps;
47 +       shm_pixmaps = have_shm_pixmaps(xdisplay);
48 +#endif
49 +
50         XGetGeometry (xdisplay, p, &root, &dummy, &dummy, &width, &height,
51                                           &dummy, &depth);
52  
53 @@ -3576,18 +3601,20 @@
54                 XFreeGC (xdisplay, tgc);
55  
56  #ifdef USE_SHM
57 -               ximg = get_image (xtext, xdisplay, &xtext->shminfo, 0, 0, w, h, depth, tmp);
58 -#else
59 -               ximg = XGetImage (xdisplay, tmp, 0, 0, w, h, -1, ZPixmap);
60 +               if (shm_pixmaps)
61 +                       ximg = get_image (xtext, xdisplay, &xtext->shminfo, 0, 0, w, h, depth, tmp);
62 +               else
63  #endif
64 +                       ximg = XGetImage (xdisplay, tmp, 0, 0, w, h, -1, ZPixmap);
65                 XFreePixmap (xdisplay, tmp);
66         } else
67         {
68  #ifdef USE_SHM
69 -               ximg = get_image (xtext, xdisplay, &xtext->shminfo, x, y, w, h, depth, p);
70 -#else
71 -               ximg = XGetImage (xdisplay, p, x, y, w, h, -1, ZPixmap);
72 +               if (shm_pixmaps)
73 +                       ximg = get_image (xtext, xdisplay, &xtext->shminfo, x, y, w, h, depth, p);
74 +               else
75  #endif
76 +                       ximg = XGetImage (xdisplay, p, x, y, w, h, -1, ZPixmap);
77         }
78  
79         if (!ximg)
80 @@ -3612,7 +3639,7 @@
81         else
82         {
83  #ifdef USE_SHM
84 -               if (xtext->shm)
85 +               if (xtext->shm && shm_pixmaps)
86                 {
87  #if (GTK_MAJOR_VERSION == 2) && (GTK_MINOR_VERSION == 0)
88                         shaded_pix = gdk_pixmap_foreign_new (
89 @@ -3630,7 +3657,7 @@
90         }
91  
92  #ifdef USE_SHM
93 -       if (!xtext->shm)
94 +       if (!xtext->shm || !shm_pixmaps)
95  #endif
96                 XPutImage (xdisplay, GDK_WINDOW_XWINDOW (shaded_pix),
97                                           GDK_GC_XGC (xtext->fgc), ximg, 0, 0, 0, 0, w, h);
98 @@ -3650,7 +3677,7 @@
99         if (xtext->pixmap)
100         {
101  #ifdef USE_SHM
102 -               if (xtext->shm)
103 +               if (xtext->shm && have_shm_pixmaps(GDK_WINDOW_XDISPLAY (xtext->draw_buf)))
104                 {
105                         XFreePixmap (GDK_WINDOW_XDISPLAY (xtext->pixmap),
106                                                          GDK_WINDOW_XWINDOW (xtext->pixmap));