2 * Midnight Commander -- GNOME edition
4 * Copyright 1997 The Free Software Foundation
6 * Author:Miguel de Icaza (miguel@gnu.org)
14 /* The tty.h file is included since we try to use as much object code
15 * from the curses distribution as possible so we need to send back
16 * the same constants that the code expects on the non-X version
17 * of the code. The constants may be the ones from curses/ncurses
18 * or our macro definitions for slang
29 callback_trampoline (gpointer data
, gint source
, GdkInputCondition condition
)
31 struct trampoline
*t
= data
;
33 /* return value is ignored */
34 (*t
->fn
)(source
, t
->fn_closure
);
38 * We need to keep track of the select callbacks, as we need to release
39 * the trampoline closure.
45 add_select_channel (int fd
, select_fn callback
, void *info
)
49 t
= g_new (struct trampoline
, 1);
53 t
->tag
= gdk_input_add (fd
, GDK_INPUT_READ
, callback_trampoline
, t
);
54 g_list_prepend (select_list
, t
);
57 static struct trampoline
*tclosure
;
60 find_select_closure_callback (gpointer data
, gpointer user_data
)
62 struct trampoline
*t
= data
;
63 int *pfd
= (int *) user_data
;
70 delete_select_channel (int fd
)
73 g_list_foreach (select_list
, find_select_closure_callback
, &fd
);
75 select_list
= g_list_remove (select_list
, tclosure
);
76 gdk_input_remove (tclosure
->tag
);
79 g_warning ("could not find closure for %d\n", fd
);