Browse Source

Fix underscore input not working with jp106 keyboard on wayland platform

Naoto Kondo 8 months ago
parent
commit
f367a6c231
1 changed files with 5 additions and 6 deletions
  1. 5 6
      platform/linuxbsd/wayland/wayland_thread.cpp

+ 5 - 6
platform/linuxbsd/wayland/wayland_thread.cpp

@@ -193,10 +193,7 @@ bool WaylandThread::_seat_state_configure_key_event(SeatState &p_ss, Ref<InputEv
 	Key keycode = KeyMappingXKB::get_keycode(xkb_state_key_get_one_sym(p_ss.xkb_state, p_keycode));
 	Key physical_keycode = KeyMappingXKB::get_scancode(p_keycode);
 	KeyLocation key_location = KeyMappingXKB::get_location(p_keycode);
-
-	if (physical_keycode == Key::NONE) {
-		return false;
-	}
+	uint32_t unicode = xkb_state_key_get_utf32(p_ss.xkb_state, p_keycode);
 
 	if (keycode == Key::NONE) {
 		keycode = physical_keycode;
@@ -206,6 +203,10 @@ bool WaylandThread::_seat_state_configure_key_event(SeatState &p_ss, Ref<InputEv
 		keycode -= 'a' - 'A';
 	}
 
+	if (physical_keycode == Key::NONE && keycode == Key::NONE && unicode == 0) {
+		return false;
+	}
+
 	p_event->set_window_id(DisplayServer::MAIN_WINDOW_ID);
 
 	// Set all pressed modifiers.
@@ -219,8 +220,6 @@ bool WaylandThread::_seat_state_configure_key_event(SeatState &p_ss, Ref<InputEv
 	p_event->set_physical_keycode(physical_keycode);
 	p_event->set_location(key_location);
 
-	uint32_t unicode = xkb_state_key_get_utf32(p_ss.xkb_state, p_keycode);
-
 	if (unicode != 0) {
 		p_event->set_key_label(fix_key_label(unicode, keycode));
 	} else {