Skip to content

Commit

Permalink
Fix unused variables warning when touch is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
exyxz committed Oct 13, 2023
1 parent 51f81e1 commit 8eb32f9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions platform/linuxbsd/x11/display_server_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4085,9 +4085,6 @@ void DisplayServerX11::process_events() {
if (XGetEventData(x11_display, &event.xcookie)) {
if (event.xcookie.type == GenericEvent && event.xcookie.extension == xi.opcode) {
XIDeviceEvent *event_data = (XIDeviceEvent *)event.xcookie.data;
int index = event_data->detail;
Vector2 pos = Vector2(event_data->event_x, event_data->event_y);

switch (event_data->evtype) {
case XI_HierarchyChanged:
case XI_DeviceChanged: {
Expand Down Expand Up @@ -4204,6 +4201,9 @@ void DisplayServerX11::process_events() {
}
bool is_begin = event_data->evtype == XI_TouchBegin;

int index = event_data->detail;
Vector2 pos = Vector2(event_data->event_x, event_data->event_y);

Ref<InputEventScreenTouch> st;
st.instantiate();
st->set_window_id(window_id);
Expand Down Expand Up @@ -4235,6 +4235,10 @@ void DisplayServerX11::process_events() {
if (ime_window_event || ignore_events) {
break;
}

int index = event_data->detail;
Vector2 pos = Vector2(event_data->event_x, event_data->event_y);

HashMap<int, Vector2>::Iterator curr_pos_elem = xi.state.find(index);
if (!curr_pos_elem) { // Defensive
break;
Expand Down

0 comments on commit 8eb32f9

Please sign in to comment.