diff --git a/src/country-filter.c b/src/country-filter.c index 9f083da6..165b08ab 100644 --- a/src/country-filter.c +++ b/src/country-filter.c @@ -215,7 +215,9 @@ struct pixmap* get_pixmap_for_country(int id) { return NULL; } +#ifdef GUI_GTK2 gdk_pixbuf_render_pixmap_and_mask(pix->pixbuf,&pix->pix,&pix->mask,255); +#endif g_free (filename); @@ -236,8 +238,10 @@ struct pixmap* get_pixmap_for_country_with_fallback(int id) { flags[0].pixbuf = gdk_pixbuf_new_from_xpm_data( (const char **)noflag_xpm); if (!flags[0].pixbuf) flags[0].pixbuf = GINT_TO_POINTER(-1); +#ifdef GUI_GTK2 else gdk_pixbuf_render_pixmap_and_mask(flags[0].pixbuf,&flags[0].pix,&flags[0].mask,255); +#endif } return &flags[0]; } diff --git a/src/loadpixmap.c b/src/loadpixmap.c index 873d2244..0f8ccd8e 100644 --- a/src/loadpixmap.c +++ b/src/loadpixmap.c @@ -165,11 +165,15 @@ struct pixmap* load_pixmap_as_pixmap (GtkWidget* widget, const gchar* filename, debug(4, "loading gdk_pixbuf from file: %s", found_filename); } +#ifdef GUI_GTK2 if (pix->pixbuf) { gdk_pixbuf_render_pixmap_and_mask (pix->pixbuf, &pix->pix, &pix->mask, 255); } if (pix->pixbuf == NULL || pix->pix == NULL) { +#else + if (pix->pixbuf == NULL) { +#endif // translator: %s = file name xqf_warning (_("Error loading pixmap file: %s"), found_filename?found_filename:filename); g_free (found_filename); diff --git a/src/pixmaps.c b/src/pixmaps.c index b6ab7f05..07e8fb38 100644 --- a/src/pixmaps.c +++ b/src/pixmaps.c @@ -121,6 +121,7 @@ void free_pixmap (struct pixmap *pixmap) { g_object_unref (G_OBJECT (pixmap->pixbuf)); pixmap->pixbuf = NULL; } +#ifdef GUI_GTK2 if (pixmap->pix) { gdk_pixmap_unref (pixmap->pix); pixmap->pix = NULL; @@ -129,6 +130,7 @@ void free_pixmap (struct pixmap *pixmap) { gdk_bitmap_unref (pixmap->mask); pixmap->mask = NULL; } +#endif } @@ -137,11 +139,15 @@ static void create_pixmap (GtkWidget *widget, const char* file, struct pixmap *p if (!pix->pixbuf) { pix->pixbuf = error_pix.pixbuf; +#ifdef GUI_GTK2 pix->pix = error_pix.pix; pix->mask = error_pix.mask; +#endif g_object_ref (G_OBJECT (pix->pixbuf)); +#ifdef GUI_GTK2 gdk_pixmap_ref(pix->pix); gdk_bitmap_ref(pix->mask); +#endif } } @@ -218,7 +224,9 @@ struct pixmap* cat_pixmaps (GtkWidget *window, struct pixmap *dest, struct pixma gdk_pixbuf_copy_area (s1->pixbuf, 0, 0, w1, h1, dest->pixbuf, 0, 0); gdk_pixbuf_copy_area (s2->pixbuf, 0, 0, w2, h2, dest->pixbuf, w1, 0); +#ifdef GUI_GTK2 gdk_pixbuf_render_pixmap_and_mask (dest->pixbuf, &dest->pix, &dest->mask, 255); +#endif return dest; } @@ -316,7 +324,9 @@ void ensure_buddy_pix (GtkWidget *window, int n) { gdk_pixbuf_composite (buddy_pix[4].pixbuf, dest->pixbuf, 0, 0, width, height, 0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 255); } +#ifdef GUI_GTK2 gdk_pixbuf_render_pixmap_and_mask (dest->pixbuf, &dest->pix, &dest->mask, 255); +#endif } @@ -346,7 +356,9 @@ void two_colors_pixmap (GdkWindow *window, int width, int height, GdkColor *top, g_object_unref (G_OBJECT (half_pixbuf)); +#ifdef GUI_GTK2 gdk_pixbuf_render_pixmap_and_mask (dest->pixbuf, &dest->pix, &dest->mask, 255); +#endif } @@ -360,8 +372,10 @@ void create_server_pixmap (GtkWidget *window, struct pixmap *stype, int n, struc gboolean pixmap_cache_lookup (GSList *cache, struct pixmap *pix, unsigned key) { struct cached_pixmap *cp; GdkPixbuf *res_pixbuf = NULL; +#ifdef GUI_GTK2 GdkPixmap *res_pix = NULL; GdkBitmap *res_mask = NULL; +#endif if (!pix) return FALSE; @@ -371,8 +385,10 @@ gboolean pixmap_cache_lookup (GSList *cache, struct pixmap *pix, unsigned key) { if (cp->key == key) { cp->weight += 2; res_pixbuf = cp->pixbuf; +#ifdef GUI_GTK2 res_pix = cp->pix; res_mask = cp->mask; +#endif break; } cache = cache->next; @@ -382,6 +398,7 @@ gboolean pixmap_cache_lookup (GSList *cache, struct pixmap *pix, unsigned key) { if (res_pixbuf) g_object_ref (G_OBJECT (res_pixbuf)); +#ifdef GUI_GTK2 pix->pix = res_pix; if (res_pix) gdk_pixmap_ref (res_pix); @@ -389,6 +406,7 @@ gboolean pixmap_cache_lookup (GSList *cache, struct pixmap *pix, unsigned key) { pix->mask = res_mask; if (res_mask) gdk_bitmap_ref (res_mask); +#endif return (pix->pixbuf != NULL); } @@ -403,12 +421,14 @@ void pixmap_cache_add (GSList **cache, struct pixmap *pix, unsigned key) { cp->pixbuf = pix->pixbuf; g_object_ref (G_OBJECT (cp->pixbuf)); +#ifdef GUI_GTK2 cp->pix = pix->pix; gdk_pixmap_ref (cp->pix); cp->mask = pix->mask; if (cp->mask) gdk_bitmap_ref (cp->mask); +#endif cp->key = key; cp->weight = 10; @@ -427,10 +447,12 @@ static int cached_pixmap_cmp (const struct cached_pixmap *a, static void free_cached_pixmap (struct cached_pixmap *cp) { g_object_unref (G_OBJECT (cp->pixbuf)); +#ifdef GUI_GTK2 gdk_pixmap_unref (cp->pix); if (cp->mask) gdk_bitmap_unref (cp->mask); +#endif g_free (cp); } diff --git a/src/pixmaps.h b/src/pixmaps.h index bfdb1d7d..71aee071 100644 --- a/src/pixmaps.h +++ b/src/pixmaps.h @@ -21,18 +21,25 @@ #include +#ifdef GUI_GTK3 +#include +#endif struct pixmap { GdkPixbuf *pixbuf; +#ifdef GUI_GTK2 GdkPixmap *pix; GdkBitmap *mask; +#endif }; struct cached_pixmap { unsigned key; GdkPixbuf *pixbuf; +#ifdef GUI_GTK2 GdkPixmap *pix; GdkBitmap *mask; +#endif int weight; }; diff --git a/src/skin.c b/src/skin.c index e8ba3ad7..8aca4481 100644 --- a/src/skin.c +++ b/src/skin.c @@ -402,11 +402,15 @@ static gushort convert_color (unsigned c) { void allocate_quake_player_colors (GdkWindow *window) { +#ifdef GUI_GTK2 GdkColormap *colormap; +#endif int i, j; if (!pcolors_allocated) { +#ifdef GUI_GTK2 colormap = gdk_drawable_get_colormap (GDK_DRAWABLE (window)); +#endif for (i = 0; i < 14; i++) { j = (i<8)? 11 : 15 - 11; @@ -414,10 +418,12 @@ void allocate_quake_player_colors (GdkWindow *window) { pcolors[i].red = convert_color (quake_pallete [(i*16 + j)*3 + 0]); pcolors[i].green = convert_color (quake_pallete [(i*16 + j)*3 + 1]); pcolors[i].blue = convert_color (quake_pallete [(i*16 + j)*3 + 2]); +#ifdef GUI_GTK2 if (!gdk_colormap_alloc_color (colormap, &pcolors[i], FALSE, TRUE)) { g_warning ("unable to allocate color: ( %d %d %d )", pcolors[i].red, pcolors[i].green, pcolors[i].blue); } +#endif } pcolors_allocated = TRUE; } diff --git a/src/srv-list.c b/src/srv-list.c index 9e2cbb5c..d2695306 100644 --- a/src/srv-list.c +++ b/src/srv-list.c @@ -54,8 +54,10 @@ static void get_server_pixmap (GtkWidget *window, struct server *s, GSList **cac if (!s || !window || !buddy_pix[1].pixbuf) { pix->pixbuf = NULL; +#ifdef GUI_GTK2 pix->pix = NULL; pix->mask = NULL; +#endif return; }