Jelajahi Sumber

wayland/events: Names will always be sent before devices and capabilities

Wayland previously didn't specify that the seat name preceded the capabilities, but it is now specified that the name event must always come first. Remove the 'SDL_Set<device>Name()' functions that were only added to accommodate the case of compositors sending the name after the seat capabilities, as this clarification means that they are no longer needed.
Frank Praznik 2 bulan lalu
induk
melakukan
03fcbb4e46

+ 0 - 13
src/events/SDL_keyboard.c

@@ -172,19 +172,6 @@ void SDL_RemoveKeyboard(SDL_KeyboardID keyboardID, bool send_event)
     }
 }
 
-void SDL_SetKeyboardName(SDL_KeyboardID keyboardID, const char *name)
-{
-    SDL_assert(keyboardID != 0);
-
-    const int keyboard_index = SDL_GetKeyboardIndex(keyboardID);
-
-    if (keyboard_index >= 0) {
-        SDL_KeyboardInstance *instance = &SDL_keyboards[keyboard_index];
-        SDL_free(instance->name);
-        instance->name = SDL_strdup(name ? name : "");
-    }
-}
-
 bool SDL_HasKeyboard(void)
 {
     return (SDL_keyboard_count > 0);

+ 0 - 3
src/events/SDL_keyboard_c.h

@@ -43,9 +43,6 @@ extern void SDL_AddKeyboard(SDL_KeyboardID keyboardID, const char *name, bool se
 // A keyboard has been removed from the system
 extern void SDL_RemoveKeyboard(SDL_KeyboardID keyboardID, bool send_event);
 
-// Set or update the name of a keyboard instance.
-extern void SDL_SetKeyboardName(SDL_KeyboardID keyboardID, const char *name);
-
 // Set the mapping of scancode to key codes
 extern void SDL_SetKeymap(SDL_Keymap *keymap, bool send_event);
 

+ 0 - 13
src/events/SDL_mouse.c

@@ -413,19 +413,6 @@ void SDL_RemoveMouse(SDL_MouseID mouseID, bool send_event)
     }
 }
 
-void SDL_SetMouseName(SDL_MouseID mouseID, const char *name)
-{
-    SDL_assert(mouseID != 0);
-
-    const int mouse_index = SDL_GetMouseIndex(mouseID);
-
-    if (mouse_index >= 0) {
-        SDL_MouseInstance *instance = &SDL_mice[mouse_index];
-        SDL_free(instance->name);
-        instance->name = SDL_strdup(name ? name : "");
-    }
-}
-
 bool SDL_HasMouse(void)
 {
     return (SDL_mouse_count > 0);

+ 0 - 3
src/events/SDL_mouse_c.h

@@ -169,9 +169,6 @@ extern void SDL_AddMouse(SDL_MouseID mouseID, const char *name, bool send_event)
 // A mouse has been removed from the system
 extern void SDL_RemoveMouse(SDL_MouseID mouseID, bool send_event);
 
-// Set or update the name of a mouse instance.
-extern void SDL_SetMouseName(SDL_MouseID mouseID, const char *name);
-
 // Get the mouse state structure
 extern SDL_Mouse *SDL_GetMouse(void);
 

+ 0 - 10
src/events/SDL_touch.c

@@ -205,16 +205,6 @@ int SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name
     return index;
 }
 
-// Set or update the name of a touch.
-void SDL_SetTouchName(SDL_TouchID id, const char *name)
-{
-    SDL_Touch *touch = SDL_GetTouch(id);
-    if (touch) {
-        SDL_free(touch->name);
-        touch->name = SDL_strdup(name ? name : "");
-    }
-}
-
 static bool SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
 {
     SDL_Finger *finger;

+ 0 - 3
src/events/SDL_touch_c.h

@@ -42,9 +42,6 @@ extern bool SDL_TouchDevicesAvailable(void);
 // Add a touch, returning the index of the touch, or -1 if there was an error.
 extern int SDL_AddTouch(SDL_TouchID id, SDL_TouchDeviceType type, const char *name);
 
-// Set or update the name of a touch.
-extern void SDL_SetTouchName(SDL_TouchID id, const char *name);
-
 // Get the touch with a given id
 extern SDL_Touch *SDL_GetTouch(SDL_TouchID id);
 

+ 0 - 16
src/video/wayland/SDL_waylandevents.c

@@ -2352,25 +2352,9 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, enum w
 static void seat_handle_name(void *data, struct wl_seat *wl_seat, const char *name)
 {
     SDL_WaylandSeat *seat = (SDL_WaylandSeat *)data;
-    char name_fmt[256];
 
     if (name && *name != '\0') {
         seat->name = SDL_strdup(name);
-
-        if (seat->keyboard.wl_keyboard) {
-            SDL_snprintf(name_fmt, sizeof(name_fmt), "%s (%s)", WAYLAND_DEFAULT_KEYBOARD_NAME, seat->name);
-            SDL_SetKeyboardName(seat->keyboard.sdl_id, name_fmt);
-        }
-
-        if (seat->pointer.wl_pointer) {
-            SDL_snprintf(name_fmt, sizeof(name_fmt), "%s (%s)", WAYLAND_DEFAULT_POINTER_NAME, seat->name);
-            SDL_SetMouseName(seat->pointer.sdl_id, name_fmt);
-        }
-
-        if (seat->touch.wl_touch) {
-            SDL_snprintf(name_fmt, sizeof(name_fmt), "%s (%s)", WAYLAND_DEFAULT_TOUCH_NAME, seat->name);
-            SDL_SetTouchName((SDL_TouchID)(uintptr_t)seat->touch.wl_touch, name_fmt);
-        }
     }
 }