Browse Source

longer fake middle click for applications that need it (firefox)

Thomas Buck 1 year ago
parent
commit
0679e7cb18
3 changed files with 11 additions and 6 deletions
  1. 1
    0
      firmware/include/config.h
  2. 2
    1
      firmware/include/controls.h
  3. 8
    5
      firmware/src/controls.c

+ 1
- 0
firmware/include/config.h View File

21
 #define INVERT_SCROLL_Y_AXIS false
21
 #define INVERT_SCROLL_Y_AXIS false
22
 #define SCROLL_REDUCE_SENSITIVITY 10
22
 #define SCROLL_REDUCE_SENSITIVITY 10
23
 #define MIN_SCROLL_SUPPRESS_CLICK 10
23
 #define MIN_SCROLL_SUPPRESS_CLICK 10
24
+#define MOUSE_FAKE_MIDDLE_CLICK_TIME 10
24
 
25
 
25
 #define DEBOUNCE_DELAY_MS 5
26
 #define DEBOUNCE_DELAY_MS 5
26
 
27
 

+ 2
- 1
firmware/include/controls.h View File

19
     bool button[MOUSE_BUTTONS_COUNT];
19
     bool button[MOUSE_BUTTONS_COUNT];
20
     int16_t delta_x, delta_y;
20
     int16_t delta_x, delta_y;
21
     int16_t scroll_x, scroll_y;
21
     int16_t scroll_x, scroll_y;
22
-    bool scroll_lock, fake_middle;
22
+    bool scroll_lock;
23
+    uint16_t fake_middle;
23
     int16_t internal_scroll_x, internal_scroll_y;
24
     int16_t internal_scroll_x, internal_scroll_y;
24
 };
25
 };
25
 
26
 

+ 8
- 5
firmware/src/controls.c View File

24
     mouse.scroll_x = 0;
24
     mouse.scroll_x = 0;
25
     mouse.scroll_y = 0;
25
     mouse.scroll_y = 0;
26
     mouse.scroll_lock = false;
26
     mouse.scroll_lock = false;
27
-    mouse.fake_middle = false;
27
+    mouse.fake_middle = 0;
28
 
28
 
29
     last_mouse = mouse;
29
     last_mouse = mouse;
30
 }
30
 }
111
         mouse.internal_scroll_y = 0;
111
         mouse.internal_scroll_y = 0;
112
     }
112
     }
113
 
113
 
114
-    if (mouse.fake_middle) {
115
-        mouse.button[MOUSE_MIDDLE] = false;
116
-        mouse.fake_middle = false;
114
+    if (mouse.fake_middle > 0) {
115
+        mouse.fake_middle++;
116
+        if (mouse.fake_middle > MOUSE_FAKE_MIDDLE_CLICK_TIME) {
117
+            mouse.fake_middle = 0;
118
+            mouse.button[MOUSE_MIDDLE] = false;
119
+        }
117
     }
120
     }
118
 
121
 
119
     if (!mouse.scroll_lock && last_mouse.scroll_lock) {
122
     if (!mouse.scroll_lock && last_mouse.scroll_lock) {
121
         if (scroll_sum < MIN_SCROLL_SUPPRESS_CLICK) {
124
         if (scroll_sum < MIN_SCROLL_SUPPRESS_CLICK) {
122
             // fake middle mouse click, user was not scrolling
125
             // fake middle mouse click, user was not scrolling
123
             mouse.button[MOUSE_MIDDLE] = true;
126
             mouse.button[MOUSE_MIDDLE] = true;
124
-            mouse.fake_middle = true;
127
+            mouse.fake_middle = 1;
125
         }
128
         }
126
     }
129
     }
127
 
130
 

Loading…
Cancel
Save