1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c
index 3321a01..a973357 100644
--- a/firmware/target/hosted/sdl/button-sdl.c
+++ b/firmware/target/hosted/sdl/button-sdl.c
@@ -80,7 +80,7 @@ bool remote_button_hold(void) {
     return remote_hold_button_state;
 }
 #endif
-static void button_event(int key, bool pressed);
+static bool button_event(int key, bool pressed);
 extern bool debug_wps;
 extern bool mapping;

@@ -213,7 +213,8 @@ static bool event_handler(SDL_Event *event)
     {
     case SDL_KEYDOWN:
     case SDL_KEYUP:
-        button_event(event->key.keysym.sym, event->type == SDL_KEYDOWN);
+        if (button_event(event->key.keysym.sym, event->type == SDL_KEYDOWN))
+            return true;
         break;
 #ifdef HAVE_TOUCHSCREEN
     case SDL_MOUSEMOTION:
@@ -259,12 +260,12 @@ void gui_message_loop(void)
     } while(!quit);
 }

-static void button_event(int key, bool pressed)
+static bool button_event(int key, bool pressed)
 {
     int new_btn = 0;
     static bool usb_connected = false;
     if (usb_connected && key != USB_KEY)
-        return;
+        return flase;
     switch (key)
     {
     case USB_KEY:
@@ -276,7 +277,7 @@ static void button_event(int key, bool pressed)
             else
                 queue_post(&button_queue, SYS_USB_DISCONNECTED, 0);
         }
-        return;
+        return false;

 #ifdef HAS_BUTTON_HOLD
     case SDLK_h:
@@ -285,7 +286,7 @@ static void button_event(int key, bool pressed)
             hold_button_state = !hold_button_state;
             DEBUGF("Hold button is %s\n", hold_button_state?"ON":"OFF");
         }
-        return;
+        return false;
 #endif

 #ifdef HAS_REMOTE_BUTTON_HOLD
@@ -296,7 +297,7 @@ static void button_event(int key, bool pressed)
             DEBUGF("Remote hold button is %s\n",
                    remote_hold_button_state?"ON":"OFF");
         }
-        return;
+        return false;
 #endif

 #if defined(IRIVER_H100_SERIES) || defined (IRIVER_H300_SERIES)
@@ -328,7 +329,7 @@ static void button_event(int key, bool pressed)
         if(pressed)
         {
             sim_trigger_screendump();
-            return;
+            return false;
         }
         break;
 #ifdef HAVE_TOUCHSCREEN
@@ -339,6 +340,8 @@ static void button_event(int key, bool pressed)
             printf("Touchscreen mode: %s\n", touchscreen_get_mode() == TOUCHSCREEN_POINT ? "TOUCHSCREEN_POINT" : "TOUCHSCREEN_BUTTON");
         }
 #endif
+    case SDLK_F6:
+        return true;
     default:
 #ifdef HAVE_TOUCHSCREEN
         new_btn = key_to_touch(key, mouse_coords);
@@ -376,7 +379,10 @@ static void button_event(int key, bool pressed)
         btn |= new_btn;
     else
         btn &= ~new_btn;
+
+    return false;
 }
+
 #if defined(HAVE_BUTTON_DATA) && defined(HAVE_TOUCHSCREEN)
 int button_read_device(int* data)
 {