[PATCH 2/2] Better compatibility with older GTK and Cairo

Lubomir I. Ivanov neolit123 at gmail.com
Mon Sep 10 15:31:01 PDT 2012


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

divelist.c:
Replaced "gtk_tree_path_get_indices_with_depth()" with the coupled alternative:
	int depth = gtk_tree_path_get_depth(path);
	int *indices = gtk_tree_path_get_indices(path);
for compatibility GTK+ < 2.22

*:
Replaced all usage of "cairo_rectangle_int_t" with "cairo_rectangle_t"
for compatibility with Cairo < 1.10.

Both modification make building Subsurface possible on a fairly recent Debian
distribution, which reports to have the version of the abovementioned
libraries "up-to-date", yet they are slightly outdated.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 divelist.c | 4 ++--
 gtk-gui.c  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/divelist.c b/divelist.c
index 77538b7..d4848ef 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1820,8 +1820,8 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
 		}
 		/* only offer trip editing options when we are displaying the tree model */
 		if (dive_list.model == dive_list.treemodel) {
-			int depth;
-			int *indices = gtk_tree_path_get_indices_with_depth(path, &depth);
+			int depth = gtk_tree_path_get_depth(path);
+			int *indices = gtk_tree_path_get_indices(path);
 			/* top level dive or child dive that is not the first child */
 			if (depth == 1 || indices[1] > 0) {
 				menuitem = gtk_menu_item_new_with_label("Create new trip above");
diff --git a/gtk-gui.c b/gtk-gui.c
index 5002b95..e8e1fc7 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -969,7 +969,7 @@ void exit_ui(void)
 }
 
 typedef struct {
-	cairo_rectangle_int_t rect;
+	cairo_rectangle_t rect;
 	const char *text;
 } tooltip_record_t;
 
@@ -978,7 +978,7 @@ static int tooltips;
 
 void attach_tooltip(int x, int y, int w, int h, const char *text)
 {
-	cairo_rectangle_int_t *rect;
+	cairo_rectangle_t *rect;
 	tooltip_rects = realloc(tooltip_rects, (tooltips + 1) * sizeof(tooltip_record_t));
 	rect = &tooltip_rects[tooltips].rect;
 	rect->x = x;
@@ -996,7 +996,7 @@ static gboolean profile_tooltip (GtkWidget *widget, gint x, gint y,
 			gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data)
 {
 	int i;
-	cairo_rectangle_int_t *drawing_area = user_data;
+	cairo_rectangle_t *drawing_area = user_data;
 	gint tx = x - drawing_area->x; /* get transformed coordinates */
 	gint ty = y - drawing_area->y;
 
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list