Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] (PR#13395) add_idle_callback for gui_xaw
Home

[Freeciv-Dev] (PR#13395) add_idle_callback for gui_xaw

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13395) add_idle_callback for gui_xaw
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Mon, 8 Aug 2005 09:18:17 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13395 >

> [evyscr - Aug 08 14:07:49 2005]:
>
> If I understand right, XtAppAddWorkProc should be used (X Tool
> Intrinsics Manual call it "idle-time working procedure", which is more
> similar to gtk_idle_add, IMHO).

WorkProc version of patch attached. Seems to work for me.

Thanks, evyscr.
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.119
diff -u -r1.119 gui_main.c
--- client/gui-xaw/gui_main.c   5 Aug 2005 15:10:31 -0000       1.119
+++ client/gui-xaw/gui_main.c   8 Aug 2005 16:12:06 -0000
@@ -913,13 +913,16 @@
 /****************************************************************************
   A wrapper for the callback called through add_idle_callback.
 ****************************************************************************/
-static void idle_callback_wrapper(XtPointer data, XtIntervalId *id)
+static Boolean idle_callback_wrapper(XtPointer data)
 {
   struct callback *cb = data;
 
+  freelog(LOG_NORMAL, "Idle callback callback.");
+
   (cb->callback)(cb->data);
   free(cb);
-  XtRemoveTimeOut(*id);
+  /* return True if we want to remove WorkProc */
+  return True;
 }
 
 /****************************************************************************
@@ -931,7 +934,9 @@
 {
   struct callback *cb = fc_malloc(sizeof(*cb));
 
+  freelog(LOG_NORMAL, "Idle callback.");
+
   cb->callback = callback;
   cb->data = data;
-  XtAppAddTimeOut(app_context, 0, idle_callback_wrapper, cb);
+  XtAppAddWorkProc(app_context, idle_callback_wrapper, cb);
 }

[Prev in Thread] Current Thread [Next in Thread]