src/video/wayland/SDL_waylanddatamanager.c
author Ryan C. Gordon
Mon, 23 Jan 2017 12:06:10 -0500
changeset 10837 c2f241c2f6ad
parent 10737 3406a0f8b041
child 11296 44853f387017
permissions -rw-r--r--
audio: Fix same bug as last commit, but for _mm_bslli_si128 vs _mm_slli_si128.
slouken@10583
     1
/*
slouken@10583
     2
  Simple DirectMedia Layer
slouken@10737
     3
  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
slouken@10583
     4
slouken@10583
     5
  This software is provided 'as-is', without any express or implied
slouken@10583
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@10583
     7
  arising from the use of this software.
slouken@10583
     8
slouken@10583
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@10583
    10
  including commercial applications, and to alter it and redistribute it
slouken@10583
    11
  freely, subject to the following restrictions:
slouken@10583
    12
slouken@10583
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@10583
    14
     claim that you wrote the original software. If you use this software
slouken@10583
    15
     in a product, an acknowledgment in the product documentation would be
slouken@10583
    16
     appreciated but is not required.
slouken@10583
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@10583
    18
     misrepresented as being the original software.
slouken@10583
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@10583
    20
*/
slouken@10583
    21
slouken@10583
    22
#include "../../SDL_internal.h"
slouken@10583
    23
slouken@10583
    24
#if SDL_VIDEO_DRIVER_WAYLAND
slouken@10583
    25
icculus@10594
    26
#include <fcntl.h>
slouken@10583
    27
#include <unistd.h>
slouken@10583
    28
#include <limits.h>
slouken@10583
    29
#include <signal.h>
slouken@10583
    30
slouken@10583
    31
#include "SDL_stdinc.h"
slouken@10583
    32
#include "SDL_assert.h"
slouken@10583
    33
slouken@10583
    34
#include "SDL_waylandvideo.h"
slouken@10583
    35
#include "SDL_waylanddatamanager.h"
slouken@10583
    36
slouken@10583
    37
#include "SDL_waylanddyn.h"
slouken@10583
    38
slouken@10583
    39
static ssize_t
slouken@10583
    40
write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos)
slouken@10583
    41
{
slouken@10583
    42
    int ready = 0;
slouken@10583
    43
    ssize_t bytes_written = 0;
slouken@10583
    44
    ssize_t length = total_length - *pos;
slouken@10583
    45
slouken@10583
    46
    sigset_t sig_set;
slouken@10583
    47
    sigset_t old_sig_set;
slouken@10583
    48
    struct timespec zerotime = {0};
slouken@10583
    49
    fd_set set;
slouken@10583
    50
    struct timeval timeout;
slouken@10583
    51
slouken@10583
    52
    FD_ZERO(&set);
slouken@10583
    53
    FD_SET(fd, &set);
slouken@10583
    54
slouken@10583
    55
    timeout.tv_sec = 1;
slouken@10583
    56
    timeout.tv_usec = 0;
slouken@10583
    57
slouken@10583
    58
    ready = select(fd + 1, NULL, &set, NULL, &timeout);
slouken@10583
    59
slouken@10583
    60
    sigemptyset(&sig_set);
slouken@10583
    61
    sigaddset(&sig_set, SIGPIPE);  
slouken@10583
    62
slouken@10583
    63
    pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); 
slouken@10583
    64
slouken@10583
    65
    if (ready == 0) {
slouken@10583
    66
        bytes_written = SDL_SetError("Pipe timeout");
slouken@10583
    67
    } else if (ready < 0) {
slouken@10583
    68
        bytes_written = SDL_SetError("Pipe select error");
slouken@10583
    69
    } else {
slouken@10583
    70
        if (length > 0) {
slouken@10583
    71
            bytes_written = write(fd, buffer + *pos, SDL_min(length, PIPE_BUF));
slouken@10583
    72
        }
slouken@10583
    73
slouken@10583
    74
        if (bytes_written > 0) {
slouken@10583
    75
            *pos += bytes_written;
slouken@10583
    76
        }
slouken@10583
    77
    }
slouken@10583
    78
slouken@10583
    79
    sigtimedwait(&sig_set, 0, &zerotime);
slouken@10583
    80
    pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL);
slouken@10583
    81
slouken@10583
    82
    return bytes_written;
slouken@10583
    83
}
slouken@10583
    84
slouken@10583
    85
static ssize_t
slouken@10583
    86
read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate)
slouken@10583
    87
{
slouken@10583
    88
    int ready = 0;
slouken@10583
    89
    void* output_buffer = NULL;
slouken@10583
    90
    char temp[PIPE_BUF];
slouken@10583
    91
    size_t new_buffer_length = 0;
slouken@10583
    92
    ssize_t bytes_read = 0;
slouken@10583
    93
    size_t pos = 0;
slouken@10583
    94
slouken@10583
    95
    fd_set set;
slouken@10583
    96
    struct timeval timeout;
slouken@10583
    97
slouken@10583
    98
    FD_ZERO(&set);
slouken@10583
    99
    FD_SET(fd, &set);
slouken@10583
   100
slouken@10583
   101
    timeout.tv_sec = 1;
slouken@10583
   102
    timeout.tv_usec = 0;
slouken@10583
   103
slouken@10583
   104
    ready = select(fd + 1, &set, NULL, NULL, &timeout);  
slouken@10583
   105
  
slouken@10583
   106
    if (ready == 0) {
slouken@10583
   107
        bytes_read = SDL_SetError("Pipe timeout");
slouken@10583
   108
    } else if (ready < 0) {
slouken@10583
   109
        bytes_read = SDL_SetError("Pipe select error");
slouken@10583
   110
    } else {
slouken@10583
   111
        bytes_read = read(fd, temp, sizeof(temp));
slouken@10583
   112
    }
slouken@10583
   113
slouken@10583
   114
    if (bytes_read > 0) {
slouken@10583
   115
        pos = *total_length;
slouken@10583
   116
        *total_length += bytes_read;
slouken@10583
   117
slouken@10583
   118
        if (null_terminate == SDL_TRUE) {
slouken@10583
   119
            new_buffer_length = *total_length + 1;
slouken@10583
   120
        } else {
slouken@10583
   121
            new_buffer_length = *total_length;
slouken@10583
   122
        }
slouken@10583
   123
slouken@10583
   124
        if (*buffer == NULL) {
slouken@10583
   125
            output_buffer = SDL_malloc(new_buffer_length);
slouken@10583
   126
        } else {
slouken@10583
   127
            output_buffer = SDL_realloc(*buffer, new_buffer_length);
slouken@10583
   128
        }           
slouken@10583
   129
        
slouken@10583
   130
        if (output_buffer == NULL) {
slouken@10583
   131
            bytes_read = SDL_OutOfMemory();
slouken@10583
   132
        } else {
slouken@10583
   133
            SDL_memcpy(output_buffer + pos, temp, bytes_read);
slouken@10583
   134
slouken@10583
   135
            if (null_terminate == SDL_TRUE) {
slouken@10583
   136
                SDL_memset(output_buffer + (new_buffer_length - 1), 0, 1);
slouken@10583
   137
            }
slouken@10583
   138
            
slouken@10583
   139
            *buffer = output_buffer;
slouken@10583
   140
        }
slouken@10583
   141
    }
slouken@10583
   142
slouken@10583
   143
    return bytes_read;
slouken@10583
   144
}
slouken@10583
   145
slouken@10583
   146
#define MIME_LIST_SIZE 4
slouken@10583
   147
slouken@10583
   148
static const char* mime_conversion_list[MIME_LIST_SIZE][2] = {
slouken@10583
   149
    {"text/plain", TEXT_MIME},
slouken@10583
   150
    {"TEXT", TEXT_MIME},
slouken@10583
   151
    {"UTF8_STRING", TEXT_MIME},
slouken@10583
   152
    {"STRING", TEXT_MIME}
slouken@10583
   153
};
slouken@10583
   154
slouken@10583
   155
const char*
slouken@10583
   156
Wayland_convert_mime_type(const char *mime_type)
slouken@10583
   157
{
slouken@10583
   158
    const char *found = mime_type;
slouken@10583
   159
slouken@10583
   160
    size_t index = 0;
slouken@10583
   161
slouken@10583
   162
    for (index = 0; index < MIME_LIST_SIZE; ++index) {
slouken@10583
   163
        if (strcmp(mime_conversion_list[index][0], mime_type) == 0) {
slouken@10583
   164
            found = mime_conversion_list[index][1];
slouken@10583
   165
            break;
slouken@10583
   166
        }
slouken@10583
   167
    }
slouken@10583
   168
    
slouken@10583
   169
    return found;
slouken@10583
   170
}
slouken@10583
   171
slouken@10583
   172
static SDL_MimeDataList*
slouken@10583
   173
mime_data_list_find(struct wl_list* list, 
slouken@10583
   174
                    const char* mime_type)
slouken@10583
   175
{
slouken@10583
   176
    SDL_MimeDataList *found = NULL;
slouken@10583
   177
slouken@10583
   178
    SDL_MimeDataList *mime_list = NULL;
slouken@10583
   179
    wl_list_for_each(mime_list, list, link) { 
slouken@10583
   180
        if (strcmp(mime_list->mime_type, mime_type) == 0) {
slouken@10583
   181
            found = mime_list;
slouken@10583
   182
            break;
slouken@10583
   183
        }
slouken@10583
   184
    }    
slouken@10583
   185
    return found;
slouken@10583
   186
}
slouken@10583
   187
slouken@10583
   188
static int
slouken@10583
   189
mime_data_list_add(struct wl_list* list, 
slouken@10583
   190
                   const char* mime_type,
slouken@10583
   191
                   void* buffer, size_t length)
slouken@10583
   192
{
slouken@10583
   193
    int status = 0;
slouken@10583
   194
    size_t mime_type_length = 0;
slouken@10583
   195
slouken@10583
   196
    SDL_MimeDataList *mime_data = NULL;
slouken@10583
   197
slouken@10583
   198
    mime_data = mime_data_list_find(list, mime_type);
slouken@10583
   199
slouken@10583
   200
    if (mime_data == NULL) {
slouken@10583
   201
        mime_data = SDL_calloc(1, sizeof(*mime_data));
slouken@10583
   202
        if (mime_data == NULL) {
slouken@10583
   203
            status = SDL_OutOfMemory();
slouken@10583
   204
        } else {
slouken@10583
   205
            WAYLAND_wl_list_insert(list, &(mime_data->link));
slouken@10583
   206
slouken@10583
   207
            mime_type_length = strlen(mime_type) + 1;
slouken@10583
   208
            mime_data->mime_type = SDL_malloc(mime_type_length);
slouken@10583
   209
            if (mime_data->mime_type == NULL) {
slouken@10583
   210
                status = SDL_OutOfMemory();
slouken@10583
   211
            } else {
slouken@10583
   212
                SDL_memcpy(mime_data->mime_type, mime_type, mime_type_length);
slouken@10583
   213
            }
slouken@10583
   214
        }
slouken@10583
   215
    }
slouken@10583
   216
    
slouken@10583
   217
    if (mime_data != NULL && buffer != NULL && length > 0) {
slouken@10583
   218
        if (mime_data->data != NULL) {
slouken@10583
   219
            SDL_free(mime_data->data);
slouken@10583
   220
        }
slouken@10583
   221
        mime_data->data = buffer;
slouken@10583
   222
        mime_data->length = length;
slouken@10583
   223
    }
slouken@10583
   224
slouken@10583
   225
    return status;
slouken@10583
   226
}
slouken@10583
   227
slouken@10583
   228
static void
slouken@10583
   229
mime_data_list_free(struct wl_list *list)
slouken@10583
   230
{
slouken@10583
   231
    SDL_MimeDataList *mime_data = NULL; 
slouken@10583
   232
    SDL_MimeDataList *next = NULL;
slouken@10583
   233
slouken@10583
   234
    wl_list_for_each_safe(mime_data, next, list, link) {
slouken@10583
   235
        if (mime_data->data != NULL) {
slouken@10583
   236
            SDL_free(mime_data->data);
slouken@10583
   237
        }        
slouken@10583
   238
        if (mime_data->mime_type != NULL) {
slouken@10583
   239
            SDL_free(mime_data->mime_type);
slouken@10583
   240
        }
slouken@10583
   241
        SDL_free(mime_data);       
slouken@10583
   242
    } 
slouken@10583
   243
}
slouken@10583
   244
slouken@10583
   245
ssize_t 
slouken@10583
   246
Wayland_data_source_send(SDL_WaylandDataSource *source,  
slouken@10583
   247
                         const char *mime_type, int fd)
slouken@10583
   248
{
slouken@10583
   249
    size_t written_bytes = 0;
slouken@10583
   250
    ssize_t status = 0;
slouken@10583
   251
    SDL_MimeDataList *mime_data = NULL;
slouken@10583
   252
 
slouken@10583
   253
    mime_type = Wayland_convert_mime_type(mime_type);
slouken@10583
   254
    mime_data = mime_data_list_find(&source->mimes,
slouken@10583
   255
                                                      mime_type);
slouken@10583
   256
slouken@10583
   257
    if (mime_data == NULL || mime_data->data == NULL) {
slouken@10583
   258
        status = SDL_SetError("Invalid mime type");
slouken@10583
   259
        close(fd);
slouken@10583
   260
    } else {
slouken@10583
   261
        while (write_pipe(fd, mime_data->data, mime_data->length,
slouken@10583
   262
                          &written_bytes) > 0);
slouken@10583
   263
        close(fd);
slouken@10583
   264
        status = written_bytes;
slouken@10583
   265
    }
slouken@10583
   266
    return status;
slouken@10583
   267
}
slouken@10583
   268
slouken@10583
   269
int Wayland_data_source_add_data(SDL_WaylandDataSource *source,
slouken@10583
   270
                                 const char *mime_type,
slouken@10583
   271
                                 const void *buffer,
slouken@10583
   272
                                 size_t length) 
slouken@10583
   273
{
slouken@10583
   274
    int status = 0;
slouken@10583
   275
    if (length > 0) {
slouken@10583
   276
        void *internal_buffer = SDL_malloc(length);
slouken@10583
   277
        if (internal_buffer == NULL) {
slouken@10583
   278
            status = SDL_OutOfMemory();
slouken@10583
   279
        } else {
slouken@10583
   280
            SDL_memcpy(internal_buffer, buffer, length);
slouken@10583
   281
            status = mime_data_list_add(&source->mimes, mime_type, 
slouken@10583
   282
                                        internal_buffer, length);
slouken@10583
   283
        }
slouken@10583
   284
    }
slouken@10583
   285
    return status;
slouken@10583
   286
}
slouken@10583
   287
slouken@10583
   288
SDL_bool 
slouken@10583
   289
Wayland_data_source_has_mime(SDL_WaylandDataSource *source,
slouken@10583
   290
                             const char *mime_type)
slouken@10583
   291
{
slouken@10583
   292
    SDL_bool found = SDL_FALSE;
slouken@10583
   293
slouken@10583
   294
    if (source != NULL) {
slouken@10583
   295
        found = mime_data_list_find(&source->mimes, mime_type) != NULL;
slouken@10583
   296
    }
slouken@10583
   297
    return found;
slouken@10583
   298
}
slouken@10583
   299
slouken@10583
   300
void* 
slouken@10583
   301
Wayland_data_source_get_data(SDL_WaylandDataSource *source,
slouken@10583
   302
                             size_t *length, const char* mime_type,
slouken@10583
   303
                             SDL_bool null_terminate)
slouken@10583
   304
{
slouken@10583
   305
    SDL_MimeDataList *mime_data = NULL;
slouken@10583
   306
    void *buffer = NULL;
slouken@10583
   307
    *length = 0;
slouken@10583
   308
slouken@10583
   309
    if (source == NULL) {
slouken@10583
   310
        SDL_SetError("Invalid data source");
slouken@10583
   311
    } else {
slouken@10583
   312
        mime_data = mime_data_list_find(&source->mimes, mime_type);
slouken@10583
   313
        if (mime_data != NULL && mime_data->length > 0) {
slouken@10583
   314
            buffer = SDL_malloc(mime_data->length);
slouken@10583
   315
            if (buffer == NULL) {
slouken@10583
   316
                *length = SDL_OutOfMemory();
slouken@10583
   317
            } else {
slouken@10583
   318
                *length = mime_data->length;
slouken@10583
   319
                SDL_memcpy(buffer, mime_data->data, mime_data->length);
slouken@10583
   320
            }
slouken@10583
   321
       }
slouken@10583
   322
    }
slouken@10583
   323
slouken@10583
   324
    return buffer;
slouken@10583
   325
}
slouken@10583
   326
slouken@10583
   327
void
slouken@10583
   328
Wayland_data_source_destroy(SDL_WaylandDataSource *source)
slouken@10583
   329
{
slouken@10583
   330
    if (source != NULL) {
slouken@10583
   331
        wl_data_source_destroy(source->source);
slouken@10583
   332
        mime_data_list_free(&source->mimes);
slouken@10583
   333
        SDL_free(source);
slouken@10583
   334
    }
slouken@10583
   335
}
slouken@10583
   336
slouken@10583
   337
void* 
slouken@10583
   338
Wayland_data_offer_receive(SDL_WaylandDataOffer *offer,
slouken@10583
   339
                           size_t *length, const char* mime_type,
slouken@10583
   340
                           SDL_bool null_terminate)
slouken@10583
   341
{
slouken@10583
   342
    SDL_WaylandDataDevice *data_device = NULL;
slouken@10583
   343
 
slouken@10583
   344
    int pipefd[2];
slouken@10583
   345
    void *buffer = NULL;
slouken@10583
   346
    *length = 0;
slouken@10583
   347
slouken@10583
   348
    if (offer == NULL) {
slouken@10583
   349
        SDL_SetError("Invalid data offer");
philipp@10630
   350
    } else if ((data_device = offer->data_device) == NULL) {
philipp@10630
   351
        SDL_SetError("Data device not initialized");
slouken@10583
   352
    } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) {
slouken@10583
   353
        SDL_SetError("Could not read pipe");
slouken@10583
   354
    } else {
slouken@10583
   355
        wl_data_offer_receive(offer->offer, mime_type, pipefd[1]);
slouken@10583
   356
slouken@10583
   357
        /* TODO: Needs pump and flush? */
slouken@10583
   358
        WAYLAND_wl_display_flush(data_device->video_data->display);
slouken@10583
   359
slouken@10583
   360
        close(pipefd[1]);
slouken@10583
   361
        
slouken@10583
   362
        while (read_pipe(pipefd[0], &buffer, length, null_terminate) > 0);
slouken@10583
   363
        close(pipefd[0]);
slouken@10583
   364
    }
slouken@10583
   365
    return buffer;
slouken@10583
   366
}
slouken@10583
   367
slouken@10583
   368
int 
slouken@10583
   369
Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer,
slouken@10583
   370
                            const char* mime_type)
slouken@10583
   371
{
slouken@10583
   372
    return mime_data_list_add(&offer->mimes, mime_type, NULL, 0);
slouken@10583
   373
}
slouken@10583
   374
slouken@10583
   375
slouken@10583
   376
SDL_bool 
slouken@10583
   377
Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer,
slouken@10583
   378
                            const char *mime_type)
slouken@10583
   379
{
slouken@10583
   380
    SDL_bool found = SDL_FALSE;
slouken@10583
   381
slouken@10583
   382
    if (offer != NULL) {
slouken@10583
   383
        found = mime_data_list_find(&offer->mimes, mime_type) != NULL;
slouken@10583
   384
    }
slouken@10583
   385
    return found;
slouken@10583
   386
}
slouken@10583
   387
slouken@10583
   388
void
slouken@10583
   389
Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer)
slouken@10583
   390
{
slouken@10583
   391
    if (offer != NULL) {
slouken@10583
   392
        wl_data_offer_destroy(offer->offer);
slouken@10583
   393
        mime_data_list_free(&offer->mimes);
slouken@10583
   394
        SDL_free(offer);
slouken@10583
   395
    }
slouken@10583
   396
}
slouken@10583
   397
slouken@10583
   398
int
slouken@10583
   399
Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device)
slouken@10583
   400
{
slouken@10583
   401
    int status = 0;
slouken@10583
   402
slouken@10583
   403
    if (data_device == NULL || data_device->data_device == NULL) {
slouken@10583
   404
        status = SDL_SetError("Invalid Data Device");
slouken@10583
   405
    } else if (data_device->selection_source != 0) {
slouken@10583
   406
        wl_data_device_set_selection(data_device->data_device, NULL, 0);
slouken@10583
   407
        data_device->selection_source = NULL;
slouken@10583
   408
    }
slouken@10583
   409
    return status;
slouken@10583
   410
}
slouken@10583
   411
slouken@10583
   412
int
slouken@10583
   413
Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device,
slouken@10583
   414
                                  SDL_WaylandDataSource *source)
slouken@10583
   415
{
slouken@10583
   416
    int status = 0;
slouken@10583
   417
    size_t num_offers = 0;
slouken@10583
   418
    size_t index = 0;
slouken@10583
   419
slouken@10583
   420
    if (data_device == NULL) {
slouken@10583
   421
        status = SDL_SetError("Invalid Data Device");
slouken@10583
   422
    } else if (source == NULL) {
slouken@10583
   423
        status = SDL_SetError("Invalid source");
slouken@10583
   424
    } else {
slouken@10583
   425
        SDL_MimeDataList *mime_data = NULL;
slouken@10583
   426
slouken@10583
   427
        wl_list_for_each(mime_data, &(source->mimes), link) {
slouken@10583
   428
            wl_data_source_offer(source->source,
slouken@10583
   429
                                 mime_data->mime_type); 
slouken@10583
   430
slouken@10583
   431
            /* TODO - Improve system for multiple mime types to same data */
slouken@10583
   432
            for (index = 0; index < MIME_LIST_SIZE; ++index) {
slouken@10583
   433
                if (strcmp(mime_conversion_list[index][1], mime_data->mime_type) == 0) {
slouken@10583
   434
                    wl_data_source_offer(source->source,
slouken@10583
   435
                                         mime_conversion_list[index][0]);
slouken@10583
   436
               }
slouken@10583
   437
            }
slouken@10583
   438
            /* */
slouken@10583
   439
 
slouken@10583
   440
            ++num_offers;
slouken@10583
   441
        } 
slouken@10583
   442
slouken@10583
   443
        if (num_offers == 0) {
slouken@10583
   444
            Wayland_data_device_clear_selection(data_device);
slouken@10583
   445
            status = SDL_SetError("No mime data");
slouken@10583
   446
        } else {
slouken@10583
   447
            /* Only set if there is a valid serial if not set it later */
slouken@10583
   448
            if (data_device->selection_serial != 0) {
slouken@10583
   449
                wl_data_device_set_selection(data_device->data_device,
slouken@10583
   450
                                             source->source,
slouken@10583
   451
                                             data_device->selection_serial); 
slouken@10583
   452
            }
slouken@10583
   453
            data_device->selection_source = source;
slouken@10583
   454
        }
slouken@10583
   455
    }
slouken@10583
   456
slouken@10583
   457
    return status;
slouken@10583
   458
}
slouken@10583
   459
slouken@10583
   460
int
slouken@10583
   461
Wayland_data_device_set_serial(SDL_WaylandDataDevice *data_device,
slouken@10583
   462
                               uint32_t serial)
slouken@10583
   463
{
slouken@10583
   464
    int status = -1;
slouken@10583
   465
    if (data_device != NULL) {
slouken@10583
   466
        status = 0;
slouken@10583
   467
slouken@10583
   468
        /* If there was no serial and there is a pending selection set it now. */
slouken@10583
   469
        if (data_device->selection_serial == 0
slouken@10583
   470
            && data_device->selection_source != NULL) {
slouken@10583
   471
            wl_data_device_set_selection(data_device->data_device,
slouken@10583
   472
                                         data_device->selection_source->source,
slouken@10583
   473
                                         serial); 
slouken@10583
   474
        }
slouken@10583
   475
slouken@10583
   476
        data_device->selection_serial = serial;
slouken@10583
   477
    }
slouken@10583
   478
slouken@10583
   479
    return status; 
slouken@10583
   480
}
slouken@10583
   481
slouken@10583
   482
#endif /* SDL_VIDEO_DRIVER_WAYLAND */
slouken@10583
   483
slouken@10583
   484
/* vi: set ts=4 sw=4 expandtab: */