/* input_manager touch functions */ void input_manager::set_touch_focus(wayfire_surface_t *surface, uint32_t time, int id, int x, int y) { bool focus_compositor_surface = wf_compositor_surface_from_surface(surface); bool had_focus = wlr_seat_touch_get_point(seat, id); wlr_surface *next_focus = NULL; if (surface && !focus_compositor_surface) next_focus = surface->surface; // create a new touch point, we have a valid new focus if (!had_focus && next_focus) wlr_seat_touch_notify_down(seat, next_focus, time, id, x, y); if (had_focus && !next_focus) wlr_seat_touch_notify_up(seat, time, id); if (next_focus) wlr_seat_touch_point_focus(seat, next_focus, time, id, x, y); /* Manage the touch_focus, we take only the first finger for that */ if (id == 0) { auto compositor_surface = wf_compositor_surface_from_surface(touch_focus); if (compositor_surface) compositor_surface->on_touch_up(); compositor_surface = wf_compositor_surface_from_surface(surface); if (compositor_surface) compositor_surface->on_touch_down(x, y); touch_focus = surface; } }
void poll_input_devices( struct input_t* inp ) { static int update_ts = No; /* Clear input structure */ // ZeroMemory( inp, sizeof( struct input_t ) ); /* Poll input devices */ while( SDL_PollEvent( &event ) ) { switch( event.type ) { case SDL_KEYDOWN: on_key_down( &event.key.keysym, inp ); update_ts = Yes; break; case SDL_KEYUP: on_key_up( &event.key.keysym, inp ); update_ts = No; inp->timestamp = 0; break; case SDL_MOUSEBUTTONDOWN: on_touch_down( &event.button, inp ); update_ts = Yes; break; case SDL_MOUSEBUTTONUP: on_touch_up( &event.button, inp ); update_ts = No; inp->timestamp = 0; break; case SDL_JOYBUTTONDOWN: on_joy_button_down( &event.jbutton, inp ); update_ts = Yes; break; case SDL_JOYBUTTONUP: on_joy_button_up( &event.jbutton, inp ); update_ts = No; inp->timestamp = 0; break; case SDL_JOYAXISMOTION: on_joy_axis_move( &event.jaxis, inp ); break; case SDL_QUIT: inp->escape = Yes; break; } } /* Update timestamp */ if( update_ts ) inp->timestamp++; else inp->timestamp = 0; }
JNIEXPORT void JNICALL jni_on_touch_down(JNIEnv * /*env*/, jclass /*cls*/, jfloat normalized_x, jfloat normalized_y) { DLOG(); on_touch_down(normalized_x, normalized_y); }
JNIEXPORT void JNICALL Java_com_technegames_insectoiddefense_RendererWrapper_on_1touch_1down(JNIEnv* env, jclass cls, jfloat raw_touch_x, jfloat raw_touch_y) { UNUSED(env); UNUSED(cls); on_touch_down(raw_touch_x, raw_touch_y); }