src/video/wayland/SDL_waylandvideo.h
author Gabriel Jacobo <gabomdq@gmail.com>
Sat, 14 Dec 2013 20:18:43 -0300
changeset 8062 4fc5f66d63cc
child 8082 5b83ad3f01ac
permissions -rw-r--r--
Wayland support

Based on the original port to Wayland by: Joel Teichroeb, Benjamin Franzke, Scott Moreau, et al.

Additional changes in this commit, done by me:

* Wayland uses the common EGL framework
* EGL can now create a desktop OpenGL context
* testgl2 loads GL functions dynamically, no need to link to libGL anymore
* Assorted fixes to the Wayland backend

Tested on the Weston Compositor (v1.0.5) that ships with Ubuntu 13.10,
running Weston under X. Tests ran: testrendercopyex (all backends), testgl2, testgles2,testintersections
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 #include "SDL_config.h"
    23 
    24 #ifndef _SDL_waylandvideo_h
    25 #define _SDL_waylandvideo_h
    26 
    27 #include <wayland-client.h>
    28 #include <wayland-cursor.h>
    29 #include <wayland-egl.h>
    30 
    31 #include <EGL/egl.h>
    32 
    33 struct xkb_context;
    34 struct SDL_WaylandInput;
    35 
    36 typedef struct {
    37     struct wl_display *display;
    38     struct wl_registry *registry;
    39     struct wl_compositor *compositor;
    40     struct wl_output *output;
    41     struct wl_shm *shm;
    42     struct wl_cursor_theme *cursor_theme;
    43     struct wl_cursor *default_cursor;
    44     struct wl_pointer *pointer;
    45     struct wl_shell *shell;
    46 
    47     struct {
    48         int32_t x, y, width, height;
    49     } screen_allocation;
    50 
    51     struct wl_list modes_list;
    52 
    53     EGLDisplay edpy;
    54     EGLContext context;
    55     EGLConfig econf;
    56 
    57     struct xkb_context *xkb_context;
    58     struct SDL_WaylandInput *input;
    59 
    60     uint32_t shm_formats;
    61 } SDL_VideoData;
    62 
    63 static inline void
    64 wayland_schedule_write(SDL_VideoData *data)
    65 {
    66     wl_display_flush(data->display);
    67 }
    68 
    69 #endif /* _SDL_nullvideo_h */
    70 
    71 /* vi: set ts=4 sw=4 expandtab: */