diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-09-09 01:59:07 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-09-09 01:59:07 +0000 |
commit | 0107dfc8276d73744bb097d643809205ef21d97b (patch) | |
tree | 17d434f51652d949d8167abaf85fe0eacd33612a /uisimulator/sdl/button.c | |
parent | 424750ea95409c6e78188aa47fe7a0f47d1127cb (diff) | |
download | rockbox-0107dfc8276d73744bb097d643809205ef21d97b.tar.gz rockbox-0107dfc8276d73744bb097d643809205ef21d97b.zip |
UISIMULATOR: Give the host OS some needed context switching hints (which _is_ supposed to work on Linux - but I can't tell on VMWare - and does on Windows). I guess I'll know for sure soon. Give sleep() even more genuine behavior. Add some button driver sync with the rockbox threads that should have been there for some time - this is basically interrupt-like processing as any thread not in the kernel pool should be considered. Make the screendump work again by posting the request. Perhaps help out shutting down for some users but not in the way I'd prefer - to think about.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14646 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/button.c')
-rw-r--r-- | uisimulator/sdl/button.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index 1bb9311890..4869dd06b1 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c | |||
@@ -30,6 +30,11 @@ | |||
30 | 30 | ||
31 | static intptr_t button_data; /* data value from last message dequeued */ | 31 | static intptr_t button_data; /* data value from last message dequeued */ |
32 | 32 | ||
33 | /* Special thread-synced queue_post for button driver or any other preemptive sim thread */ | ||
34 | extern void queue_syncpost(struct event_queue *q, long id, intptr_t data); | ||
35 | /* Special thread-synced queue_broadcast for button driver or any other preemptive sim thread */ | ||
36 | extern int queue_syncbroadcast(long id, intptr_t data); | ||
37 | |||
33 | /* how long until repeat kicks in */ | 38 | /* how long until repeat kicks in */ |
34 | #define REPEAT_START 6 | 39 | #define REPEAT_START 6 |
35 | 40 | ||
@@ -110,9 +115,9 @@ void button_event(int key, bool pressed) | |||
110 | { | 115 | { |
111 | usb_connected = !usb_connected; | 116 | usb_connected = !usb_connected; |
112 | if (usb_connected) | 117 | if (usb_connected) |
113 | queue_post(&button_queue, SYS_USB_CONNECTED, 0); | 118 | queue_syncpost(&button_queue, SYS_USB_CONNECTED, 0); |
114 | else | 119 | else |
115 | queue_post(&button_queue, SYS_USB_DISCONNECTED, 0); | 120 | queue_syncpost(&button_queue, SYS_USB_DISCONNECTED, 0); |
116 | } | 121 | } |
117 | return; | 122 | return; |
118 | 123 | ||
@@ -590,7 +595,7 @@ void button_event(int key, bool pressed) | |||
590 | case SDLK_F5: | 595 | case SDLK_F5: |
591 | if(pressed) | 596 | if(pressed) |
592 | { | 597 | { |
593 | screen_dump(); | 598 | queue_syncbroadcast(SYS_SCREENDUMP, 0); |
594 | return; | 599 | return; |
595 | } | 600 | } |
596 | break; | 601 | break; |
@@ -611,17 +616,17 @@ void button_event(int key, bool pressed) | |||
611 | #ifdef HAVE_REMOTE_LCD | 616 | #ifdef HAVE_REMOTE_LCD |
612 | if(diff & BUTTON_REMOTE) | 617 | if(diff & BUTTON_REMOTE) |
613 | if(!skip_remote_release) | 618 | if(!skip_remote_release) |
614 | queue_post(&button_queue, BUTTON_REL | diff, 0); | 619 | queue_syncpost(&button_queue, BUTTON_REL | diff, 0); |
615 | else | 620 | else |
616 | skip_remote_release = false; | 621 | skip_remote_release = false; |
617 | else | 622 | else |
618 | #endif | 623 | #endif |
619 | if(!skip_release) | 624 | if(!skip_release) |
620 | queue_post(&button_queue, BUTTON_REL | diff, 0); | 625 | queue_syncpost(&button_queue, BUTTON_REL | diff, 0); |
621 | else | 626 | else |
622 | skip_release = false; | 627 | skip_release = false; |
623 | #else | 628 | #else |
624 | queue_post(&button_queue, BUTTON_REL | diff, 0); | 629 | queue_syncpost(&button_queue, BUTTON_REL | diff, 0); |
625 | #endif | 630 | #endif |
626 | } | 631 | } |
627 | 632 | ||
@@ -673,7 +678,7 @@ void button_event(int key, bool pressed) | |||
673 | { | 678 | { |
674 | if (queue_empty(&button_queue)) | 679 | if (queue_empty(&button_queue)) |
675 | { | 680 | { |
676 | queue_post(&button_queue, BUTTON_REPEAT | btn, 0); | 681 | queue_syncpost(&button_queue, BUTTON_REPEAT | btn, 0); |
677 | #ifdef HAVE_BACKLIGHT | 682 | #ifdef HAVE_BACKLIGHT |
678 | #ifdef HAVE_REMOTE_LCD | 683 | #ifdef HAVE_REMOTE_LCD |
679 | if(btn & BUTTON_REMOTE) | 684 | if(btn & BUTTON_REMOTE) |
@@ -695,18 +700,18 @@ void button_event(int key, bool pressed) | |||
695 | #ifdef HAVE_REMOTE_LCD | 700 | #ifdef HAVE_REMOTE_LCD |
696 | if (btn & BUTTON_REMOTE) { | 701 | if (btn & BUTTON_REMOTE) { |
697 | if (!remote_filter_first_keypress || is_remote_backlight_on()) | 702 | if (!remote_filter_first_keypress || is_remote_backlight_on()) |
698 | queue_post(&button_queue, btn, 0); | 703 | queue_syncpost(&button_queue, btn, 0); |
699 | else | 704 | else |
700 | skip_remote_release = true; | 705 | skip_remote_release = true; |
701 | } | 706 | } |
702 | else | 707 | else |
703 | #endif | 708 | #endif |
704 | if (!filter_first_keypress || is_backlight_on()) | 709 | if (!filter_first_keypress || is_backlight_on()) |
705 | queue_post(&button_queue, btn, 0); | 710 | queue_syncpost(&button_queue, btn, 0); |
706 | else | 711 | else |
707 | skip_release = true; | 712 | skip_release = true; |
708 | #else /* no backlight, nothing to skip */ | 713 | #else /* no backlight, nothing to skip */ |
709 | queue_post(&button_queue, btn, 0); | 714 | queue_syncpost(&button_queue, btn, 0); |
710 | #endif | 715 | #endif |
711 | post = false; | 716 | post = false; |
712 | } | 717 | } |