wayland: Fix primary selection handling when the protocol isn't supported
The primary selection protocol is optional, so the function pointers to the internal Wayland functions should only be set if the protocol is supported. This allows graceful fall-back to the generic SDL implementation in other cases. Fixes the clipboard tests under Weston.main
parent
e152129787
commit
72034b9a07
|
@ -107,7 +107,7 @@ int Wayland_SetPrimarySelectionText(SDL_VideoDevice *_this, const char *text)
|
|||
{
|
||||
SDL_VideoData *video_data = _this->driverdata;
|
||||
SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL;
|
||||
int status = 0;
|
||||
int status = -1;
|
||||
|
||||
if (video_data->input != NULL && video_data->input->primary_selection_device != NULL) {
|
||||
primary_selection_device = video_data->input->primary_selection_device;
|
||||
|
|
|
@ -230,9 +230,6 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
|
|||
device->SetClipboardData = Wayland_SetClipboardData;
|
||||
device->GetClipboardData = Wayland_GetClipboardData;
|
||||
device->HasClipboardData = Wayland_HasClipboardData;
|
||||
device->SetPrimarySelectionText = Wayland_SetPrimarySelectionText;
|
||||
device->GetPrimarySelectionText = Wayland_GetPrimarySelectionText;
|
||||
device->HasPrimarySelectionText = Wayland_HasPrimarySelectionText;
|
||||
device->StartTextInput = Wayland_StartTextInput;
|
||||
device->StopTextInput = Wayland_StopTextInput;
|
||||
device->SetTextInputRect = Wayland_SetTextInputRect;
|
||||
|
@ -912,6 +909,12 @@ int Wayland_VideoInit(SDL_VideoDevice *_this)
|
|||
|
||||
Wayland_InitKeyboard(_this);
|
||||
|
||||
if (data->primary_selection_device_manager) {
|
||||
_this->SetPrimarySelectionText = Wayland_SetPrimarySelectionText;
|
||||
_this->GetPrimarySelectionText = Wayland_GetPrimarySelectionText;
|
||||
_this->HasPrimarySelectionText = Wayland_HasPrimarySelectionText;
|
||||
}
|
||||
|
||||
data->initializing = SDL_FALSE;
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue