blob: ec61546659fa4c255345ff3789338737157b363f [file] [log] [blame]
scroggob7e9aee2011-03-15 15:15:15 +00001#include "X11/Xlib.h"
2#include "X11/keysym.h"
3
4#include "SkApplication.h"
Scroggo9df214e2011-04-15 14:48:08 +00005#include "SkEvent.h"
scroggob7e9aee2011-03-15 15:15:15 +00006#include "SkWindow.h"
scroggob7e9aee2011-03-15 15:15:15 +00007#include "SkTypes.h"
Scroggo9df214e2011-04-15 14:48:08 +00008
scroggob7e9aee2011-03-15 15:15:15 +00009//#include <signal.h>
10//#include <sys/time.h>
11
Scroggo9df214e2011-04-15 14:48:08 +000012SkOSWindow* gWindow;
scroggob7e9aee2011-03-15 15:15:15 +000013
14#if 0
15static void catch_alarm(int sig)
16{
17 SkDebugf("caught alarm; calling ServiceQueueTimer\n");
18 SkEvent::ServiceQueueTimer();
19}
20#endif
21
22int main(){
scroggob7e9aee2011-03-15 15:15:15 +000023// signal(SIGALRM, catch_alarm);
24
Scroggo9df214e2011-04-15 14:48:08 +000025 gWindow = create_sk_window(NULL);
scroggob7e9aee2011-03-15 15:15:15 +000026 // Start normal Skia sequence
27 application_init();
28
Scroggo9df214e2011-04-15 14:48:08 +000029 gWindow->loop();
scroggob7e9aee2011-03-15 15:15:15 +000030
31 application_term();
32 return 0;
33}
34
35// SkEvent handlers
36
37void SkEvent::SignalNonEmptyQueue()
38{
Scroggo9df214e2011-04-15 14:48:08 +000039 if (gWindow)
40 gWindow->post_linuxevent();
41 else
42 while (SkEvent::ProcessEvent());
scroggob7e9aee2011-03-15 15:15:15 +000043}
44
45void SkEvent::SignalQueueTimer(SkMSec delay)
46{
47#if 0
48 itimerval newTimer;
49 newTimer.it_interval.tv_sec = 0;
50 newTimer.it_interval.tv_usec = 0;
51 newTimer.it_value.tv_sec = 0;
52 newTimer.it_value.tv_usec = delay * 1000;
53 int success = setitimer(ITIMER_REAL, NULL, &newTimer);
54 SkDebugf("SignalQueueTimer(%i)\nreturnval = %i\n", delay, success);
55#endif
56}