Commit 9881ad084225feec6b6921ff823e43cbc01ad0d6
1 parent
aefafc4e
Exists in
master
and in
1 other branch
Updating timer enging to match lib3270 update.
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
src/terminal/iocallback.c
... | ... | @@ -37,7 +37,7 @@ static void * static_AddSource(H3270 *session, int fd, LIB3270_IO_FLAG flag, |
37 | 37 | static void static_RemoveSource(H3270 *session, void *id); |
38 | 38 | static void static_SetSourceState(H3270 *session, void *id, int enabled); |
39 | 39 | |
40 | -static void * static_AddTimer(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session)); | |
40 | +static void * static_AddTimer(H3270 *session, unsigned long interval_ms, int (*proc)(H3270 *session, void *userdata), void *userdata); | |
41 | 41 | static void static_RemoveTimer(H3270 *session, void * timer); |
42 | 42 | static int static_Sleep(H3270 *hSession, int seconds); |
43 | 43 | static int static_RunPendingEvents(H3270 *hSession, int wait); |
... | ... | @@ -48,7 +48,7 @@ static int static_RunPendingEvents(H3270 *hSession, int wait); |
48 | 48 | { |
49 | 49 | unsigned char remove; |
50 | 50 | void * userdata; |
51 | - int (*call)(H3270 *session); | |
51 | + int (*call)(H3270 *session, void *userdata); | |
52 | 52 | H3270 * session; |
53 | 53 | } TIMER; |
54 | 54 | |
... | ... | @@ -74,17 +74,18 @@ static void static_SetSourceState(G_GNUC_UNUSED H3270 *session, void *id, int en |
74 | 74 | static gboolean do_timer(TIMER *t) |
75 | 75 | { |
76 | 76 | if(!t->remove) |
77 | - return t->call(t->session) != 0; | |
77 | + return t->call(t->session,t->userdata); | |
78 | 78 | |
79 | 79 | return FALSE; |
80 | 80 | } |
81 | 81 | |
82 | -static void * static_AddTimer(H3270 *session, unsigned long interval, int (*call)(H3270 *session)) | |
82 | +static void * static_AddTimer(H3270 *session, unsigned long interval, int (*call)(H3270 *session, void *userdata), void *userdata) | |
83 | 83 | { |
84 | 84 | TIMER *t = g_malloc0(sizeof(TIMER)); |
85 | 85 | |
86 | 86 | t->call = call; |
87 | 87 | t->session = session; |
88 | + t->userdata = userdata; | |
88 | 89 | |
89 | 90 | g_timeout_add_full(G_PRIORITY_DEFAULT, (guint) interval, (GSourceFunc) do_timer, t, g_free); |
90 | 91 | ... | ... |