| 217 | static int osk_accumulated_state = 0; |
| 218 | |
| 219 | void osk_control(int x, int y, int button, int buttonstate) |
| 220 | { |
| 221 | if (!imgui_osk_is_active()) { |
| 222 | osk_accumulated_state = 0; |
| 223 | return; |
| 224 | } |
| 225 | if (vkbd_allowed(0)) |
| 226 | { |
| 227 | // Update accumulated direction state: always refresh direction bits |
| 228 | if (!button) { |
| 229 | // Direction event: replace all direction bits |
| 230 | osk_accumulated_state &= ~(OSK_LEFT | OSK_RIGHT | OSK_UP | OSK_DOWN); |
| 231 | if (x < 0) osk_accumulated_state |= OSK_LEFT; |
| 232 | if (x > 0) osk_accumulated_state |= OSK_RIGHT; |
| 233 | if (y < 0) osk_accumulated_state |= OSK_UP; |
| 234 | if (y > 0) osk_accumulated_state |= OSK_DOWN; |
| 235 | } else { |
| 236 | // Button event: update button bit |
| 237 | if (buttonstate) |
| 238 | osk_accumulated_state |= OSK_BUTTON; |
| 239 | else |
| 240 | osk_accumulated_state &= ~OSK_BUTTON; |
| 241 | } |
| 242 | |
| 243 | int code; |
| 244 | int pressed; |
| 245 | // imgui_osk_process handles inputdevice_do_keyboard internally |
| 246 | // via press_key/release_key — don't call it again here |
| 247 | imgui_osk_process(osk_accumulated_state, &code, &pressed); |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | static int isdevice (struct uae_input_device *id) |
| 252 | { |
no test coverage detected