changeset 1877:60abfe87dc05

Fixes for callbacks getting the correct parameters on GTK2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 09 Aug 2013 09:42:02 +0000
parents 4ca16d418039
children 313e5d64714d
files gtk/dw.c
diffstat 1 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Fri Aug 09 02:20:09 2013 +0000
+++ b/gtk/dw.c	Fri Aug 09 09:42:02 2013 +0000
@@ -1543,13 +1543,13 @@
       if(event->button == 3)
       {
          int (*contextfunc)(HWND, char *, int, int, void *, void *) = work.func;
-         char *text;
+         void **params;
          int row, col;
 
          gtk_clist_get_selection_info(GTK_CLIST(widget), event->x, event->y, &row, &col);
 
-         text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), row);
-         retval = contextfunc(work.window, text, event->x, event->y, work.data, NULL);
+         params = (void **)gtk_clist_get_row_data(GTK_CLIST(widget), row);
+         retval = contextfunc(work.window, params ? params[0] : NULL, event->x, event->y, work.data, params ? params[1] : NULL);
       }
    }
    return retval;
@@ -1704,14 +1704,14 @@
    {
       if(event->button == 1 && event->type == GDK_2BUTTON_PRESS)
       {
-         int (*contextfunc)(HWND, char *, void *) = work.func;
-         char *text;
+         int (*contextfunc)(HWND, char *, void *, void *) = work.func;
+         void **params;
          int row, col;
 
          gtk_clist_get_selection_info(GTK_CLIST(widget), event->x, event->y, &row, &col);
 
-         text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), row);
-         retval = contextfunc(work.window, text, work.data);
+         params = (void **)gtk_clist_get_row_data(GTK_CLIST(widget), row);
+         retval = contextfunc(work.window, params ? params[0] : NULL, work.data, params ? params[1] : NULL);
          gtk_object_set_data(GTK_OBJECT(widget), "_dw_double_click", GINT_TO_POINTER(1));
       }
    }
@@ -1726,11 +1726,11 @@
    if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__);
    if(work.window && event->keyval == VK_RETURN)
    {
-      int (*contextfunc)(HWND, char *, void *) = work.func;
-      char *text;
-
-      text = (char *)gtk_clist_get_row_data(GTK_CLIST(widget), GTK_CLIST(widget)->focus_row);
-      retval = contextfunc(work.window, text, work.data);
+      int (*contextfunc)(HWND, char *, void *, void *) = work.func;
+      void **params;
+
+      params = (void **)gtk_clist_get_row_data(GTK_CLIST(widget), GTK_CLIST(widget)->focus_row);
+      retval = contextfunc(work.window, params ? params[0] : NULL, work.data, params ? params[1] : NULL);
    }
    return retval;
 }
@@ -1785,7 +1785,7 @@
 static gint _container_select_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data)
 {
    SignalHandler work = _get_signal_handler(data);
-   char *rowdata = gtk_clist_get_row_data(GTK_CLIST(widget), row);
+   void **rowdata = (void **)gtk_clist_get_row_data(GTK_CLIST(widget), row);
    int (*contextfunc)(HWND, HWND, char *, void *, void *) = work.func;
 
    if ( dbgfp != NULL ) _dw_log("%s %d: %s\n",__FILE__,__LINE__,__func__);
@@ -1797,7 +1797,7 @@
       gtk_object_set_data(GTK_OBJECT(widget), "_dw_double_click", GINT_TO_POINTER(0));
       return TRUE;
    }
-   return contextfunc(work.window, 0, rowdata, work.data, 0);;
+   return contextfunc(work.window, 0, rowdata ? rowdata[0] : NULL, work.data, rowdata ? rowdata[1] : NULL);;
 }
 
 static int _round_value(gfloat val)