diff src/netbeans.c @ 8218:3456e2ebebd4 v7.4.1402

commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 23 17:14:37 2016 +0100 patch 7.4.1402 Problem: GTK 3 is not supported. Solution: Add GTK 3 support. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Tue, 23 Feb 2016 17:15:05 +0100
parents 05b88224cea1
children 60586ce747c4
line wrap: on
line diff
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -3055,17 +3055,56 @@ netbeans_draw_multisign_indicator(int ro
     int i;
     int y;
     int x;
+#if GTK_CHECK_VERSION(3,0,0)
+    cairo_t *cr = NULL;
+#else
     GdkDrawable *drawable = gui.drawarea->window;
+#endif
 
     if (!NETBEANS_OPEN)
 	return;
 
+#if GTK_CHECK_VERSION(3,0,0)
+    cr = cairo_create(gui.surface);
+    {
+	GdkVisual *visual = NULL;
+	guint32 r_mask, g_mask, b_mask;
+	gint r_shift, g_shift, b_shift;
+
+	visual = gdk_window_get_visual(gtk_widget_get_window(gui.drawarea));
+	if (visual != NULL)
+	{
+	    gdk_visual_get_red_pixel_details(visual, &r_mask, &r_shift, NULL);
+	    gdk_visual_get_green_pixel_details(visual, &g_mask, &g_shift, NULL);
+	    gdk_visual_get_blue_pixel_details(visual, &b_mask, &b_shift, NULL);
+
+	    cairo_set_source_rgb(cr,
+		    ((gui.fgcolor->red & r_mask) >> r_shift) / 255.0,
+		    ((gui.fgcolor->green & g_mask) >> g_shift) / 255.0,
+		    ((gui.fgcolor->blue & b_mask) >> b_shift) / 255.0);
+	}
+    }
+#endif
+
     x = 0;
     y = row * gui.char_height + 2;
 
     for (i = 0; i < gui.char_height - 3; i++)
+#if GTK_CHECK_VERSION(3,0,0)
+	cairo_rectangle(cr, x+2, y++, 1, 1);
+#else
 	gdk_draw_point(drawable, gui.text_gc, x+2, y++);
-
+#endif
+
+#if GTK_CHECK_VERSION(3,0,0)
+    cairo_rectangle(cr, x+0, y, 1, 1);
+    cairo_rectangle(cr, x+2, y, 1, 1);
+    cairo_rectangle(cr, x+4, y++, 1, 1);
+    cairo_rectangle(cr, x+1, y, 1, 1);
+    cairo_rectangle(cr, x+2, y, 1, 1);
+    cairo_rectangle(cr, x+3, y++, 1, 1);
+    cairo_rectangle(cr, x+2, y, 1, 1);
+#else
     gdk_draw_point(drawable, gui.text_gc, x+0, y);
     gdk_draw_point(drawable, gui.text_gc, x+2, y);
     gdk_draw_point(drawable, gui.text_gc, x+4, y++);
@@ -3073,6 +3112,11 @@ netbeans_draw_multisign_indicator(int ro
     gdk_draw_point(drawable, gui.text_gc, x+2, y);
     gdk_draw_point(drawable, gui.text_gc, x+3, y++);
     gdk_draw_point(drawable, gui.text_gc, x+2, y);
+#endif
+
+#if GTK_CHECK_VERSION(3,0,0)
+    cairo_destroy(cr);
+#endif
 }
 #endif /* FEAT_GUI_GTK */