Reimplemented uiMain() and friends on GTK+.
This commit is contained in:
parent
10ab539ff0
commit
bdf80516c5
|
@ -7,6 +7,8 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "testing.h"
|
#include "testing.h"
|
||||||
|
|
||||||
|
// TODO testingTimers after this fails are wrong on GTK+
|
||||||
|
|
||||||
static jmp_buf timeout_ret;
|
static jmp_buf timeout_ret;
|
||||||
|
|
||||||
static void onTimeout(int sig)
|
static void onTimeout(int sig)
|
||||||
|
@ -17,7 +19,7 @@ static void onTimeout(int sig)
|
||||||
void testingprivRunWithTimeout(testingT *t, const char *file, long line, int64_t timeout, void (*f)(testingT *t, void *data), void *data, const char *comment, int failNowOnError)
|
void testingprivRunWithTimeout(testingT *t, const char *file, long line, int64_t timeout, void (*f)(testingT *t, void *data), void *data, const char *comment, int failNowOnError)
|
||||||
{
|
{
|
||||||
char *timeoutstr;
|
char *timeoutstr;
|
||||||
sig_t prevsig;
|
void (*prevsig)(int);
|
||||||
struct itimerval timer, prevtimer;
|
struct itimerval timer, prevtimer;
|
||||||
int setitimerError = 0;
|
int setitimerError = 0;
|
||||||
|
|
||||||
|
|
34
unix/main.c
34
unix/main.c
|
@ -17,3 +17,37 @@ int uiInit(void *options, uiInitError *err)
|
||||||
uiprivMarkInitialized();
|
uiprivMarkInitialized();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void uiMain(void)
|
||||||
|
{
|
||||||
|
gtk_main();
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiQuit(void)
|
||||||
|
{
|
||||||
|
gtk_main_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct queued {
|
||||||
|
void (*f)(void *);
|
||||||
|
void *data;
|
||||||
|
};
|
||||||
|
|
||||||
|
static gboolean doqueued(gpointer data)
|
||||||
|
{
|
||||||
|
struct queued *q = (struct queued *) data;
|
||||||
|
|
||||||
|
(*(q->f))(q->data);
|
||||||
|
g_free(q);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uiQueueMain(void (*f)(void *data), void *data)
|
||||||
|
{
|
||||||
|
struct queued *q;
|
||||||
|
|
||||||
|
q = g_new0(struct queued, 1);
|
||||||
|
q->f = f;
|
||||||
|
q->data = data;
|
||||||
|
gdk_threads_add_idle(doqueued, q);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue