scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 1 | #include "X11/Xlib.h" |
| 2 | #include "X11/keysym.h" |
| 3 | |
| 4 | #include "SkApplication.h" |
Scroggo | 9df214e | 2011-04-15 14:48:08 +0000 | [diff] [blame] | 5 | #include "SkEvent.h" |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 6 | #include "SkWindow.h" |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 7 | #include "SkTypes.h" |
Scroggo | 9df214e | 2011-04-15 14:48:08 +0000 | [diff] [blame] | 8 | |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 9 | //#include <signal.h> |
| 10 | //#include <sys/time.h> |
| 11 | |
Scroggo | 9df214e | 2011-04-15 14:48:08 +0000 | [diff] [blame] | 12 | SkOSWindow* gWindow; |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 13 | |
| 14 | #if 0 |
| 15 | static void catch_alarm(int sig) |
| 16 | { |
| 17 | SkDebugf("caught alarm; calling ServiceQueueTimer\n"); |
| 18 | SkEvent::ServiceQueueTimer(); |
| 19 | } |
| 20 | #endif |
| 21 | |
| 22 | int main(){ |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 23 | // signal(SIGALRM, catch_alarm); |
| 24 | |
Scroggo | 9df214e | 2011-04-15 14:48:08 +0000 | [diff] [blame] | 25 | gWindow = create_sk_window(NULL); |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 26 | // Start normal Skia sequence |
| 27 | application_init(); |
| 28 | |
Scroggo | 9df214e | 2011-04-15 14:48:08 +0000 | [diff] [blame] | 29 | gWindow->loop(); |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 30 | |
| 31 | application_term(); |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | // SkEvent handlers |
| 36 | |
| 37 | void SkEvent::SignalNonEmptyQueue() |
| 38 | { |
Scroggo | 9df214e | 2011-04-15 14:48:08 +0000 | [diff] [blame] | 39 | if (gWindow) |
| 40 | gWindow->post_linuxevent(); |
| 41 | else |
| 42 | while (SkEvent::ProcessEvent()); |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | void 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 | } |