]> jfr.im git - irc/xchat.git/commitdiff
xtext: Make compile with gtk 2.13.x
authorzed <redacted>
Fri, 29 Aug 2008 11:24:17 +0000 (11:24 +0000)
committerzed <redacted>
Fri, 29 Aug 2008 11:24:17 +0000 (11:24 +0000)
xtext: Check for mit-shm pixmap support instead of assuming (Red Hat bug #282691, Kevin Kofler).
fe-text: make it build.

git-svn-id: svn://svn.code.sf.net/p/xchat/svn@1312 893a96be-7f27-4fdf-9d1e-6aeec9d3cce1

src/fe-gtk/xtext.c
src/fe-gtk/xtext.h
src/fe-text/fe-text.c

index aded089739f28b70d9ebd7f821cf56c5714f409b..206c3408eb94f35c1979d1d661439b486de7d038 100644 (file)
@@ -1350,6 +1350,24 @@ gtk_xtext_draw_marker (GtkXText * xtext, textentry * ent, int y)
        }
 }
 
+#ifdef USE_SHM
+static int
+have_shm_pixmaps(Display *dpy)
+{
+       int major, minor;
+       static int checked = 0;
+       static int 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 +1384,12 @@ gtk_xtext_paint (GtkWidget *widget, GdkRectangle *area)
                {
                        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);
@@ -2494,10 +2516,10 @@ gtk_xtext_class_init (GtkXTextClass * class)
        xtext_class->word_click = NULL;
 }
 
-GtkType
+GType
 gtk_xtext_get_type (void)
 {
-       static GtkType xtext_type = 0;
+       static GType xtext_type = 0;
 
        if (!xtext_type)
        {
@@ -3559,6 +3581,11 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
        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 +3603,20 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
                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 +3641,7 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
        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 +3659,7 @@ shade_pixmap (GtkXText * xtext, Pixmap p, int x, int y, int w, int h)
        }
 
 #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 +3679,7 @@ gtk_xtext_free_trans (GtkXText * xtext)
        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));
index a61d938c3f0b5b9c859da80bca429bc060ea8bdf..fa490a653f062c72f032867301161a2b2c823a63 100644 (file)
@@ -270,6 +270,6 @@ void gtk_xtext_set_wordwrap (GtkXText *xtext, gboolean word_wrap);
 xtext_buffer *gtk_xtext_buffer_new (GtkXText *xtext);
 void gtk_xtext_buffer_free (xtext_buffer *buf);
 void gtk_xtext_buffer_show (GtkXText *xtext, xtext_buffer *buf, int render);
-GtkType gtk_xtext_get_type (void);
+GType gtk_xtext_get_type (void);
 
 #endif
index 98f6af5969cf9754b59cdf65718b990ea113e1fe..2bc2e6494546232262c033cd3de0aa7abdc79382 100644 (file)
@@ -859,3 +859,4 @@ void fe_tray_set_file (const char *filename){}
 void fe_tray_set_icon (feicon icon){}
 void fe_tray_set_tooltip (const char *text){}
 void fe_tray_set_balloon (const char *title, const char *text){}
+void fe_userlist_update (session *sess, struct User *user){}