You are not logged in.

#1 2008-08-29 21:10:35

Fackamato
Member
Registered: 2006-03-31
Posts: 579

xchat pkgbuild with newest nvidia

The latest nvidia driver (177.70) isn't exactly causing xchat to crash, but xchat crashes with this driver when you enable transparency. So here's the patch + PKGBUILD to have a working xchat w/ transp. w/ nvidia 177.70:

pixmap.patch

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));

PKGBUILD

# $Id: PKGBUILD 2738 2008-06-14 03:11:41Z eric $
# Maintainer: Eric Belanger <eric@archlinux.org>

pkgname=xchat
pkgver=2.8.6
pkgrel=1
pkgdesc="A GTK+ based IRC client"
arch=('i686' 'x86_64')
url="http://www.xchat.org/"
license=('GPL')
depends=('gtk2>=2.10.9' 'openssl>=0.9.8b' 'dbus-glib>=0.7.2')
makedepends=('tcl' 'perl' 'python')
optdepends=('enchant: for spell checking support')
options=('!libtool')
source=(http://www.xchat.org/files/source/${pkgver%.*}/${pkgname}-${pkgver}.tar.bz2 pixmap.patch    )
md5sums=('1f2670865d43a23a9abc596dde999aca' 'a0b3889d160ddf21eebd25b645bd1e48')
sha1sums=('7a7463e65cb26c680ed70dd96cec98bcc05435a4')

build() {

  cp pixmap.patch ${startdir}/src/${pkgname}-${pkgver}
  cd ${startdir}/src/${pkgname}-${pkgver}
  patch -p1 < pixmap.patch
  ./configure --prefix=/usr --sysconfdir=/etc \
              --enable-openssl --enable-dbus \
              --disable-gnome --disable-textfe \
          --enable-ipv6 --enable-shm \
          --enable-spell=static || return 1
  make || return 1
  make DESTDIR=${startdir}/pkg install || return 1
}

Works fine for me under kernel26-ice nvidia-ice (modified for 177.70)! Enjoy smile

PS. 177.70 is a bit faster for me actually, on 2D/pixmap operations (wo and w/ compiz) smile (8600M GT)

Offline

Board footer

Powered by FluxBB