Merge Platform.h into GLInterface.h

This commit is contained in:
Scott Moreau
2014-01-19 19:06:55 -07:00
parent 75020b9b51
commit 4b3c338930
8 changed files with 101 additions and 188 deletions

View File

@ -5,37 +5,96 @@
#ifndef _GLINTERFACE_H_
#define _GLINTERFACE_H_
#if USE_EGL
#include "GLInterface/Platform.h"
#else
#include "Thread.h"
#if defined(USE_EGL) && USE_EGL
#if USE_EGL
// Currently Wayland/EGL and X11/EGL platforms are supported.
// The platform may be spelected at run time by setting the
// environment variable DOLPHIN_EGL_PLATFORM to "wayland" or "x11".
enum egl_platform {
EGL_PLATFORM_NONE,
EGL_PLATFORM_WAYLAND,
EGL_PLATFORM_X11,
EGL_PLATFORM_ANDROID
};
#if HAVE_X11
#include "GLInterface/X11_Util.h"
#endif
#if HAVE_WAYLAND
#include "GLInterface/Wayland_Util.h"
#endif
#include "GLInterface/EGL.h"
#elif defined(__APPLE__)
#include "GLInterface/AGL.h"
#elif defined(_WIN32)
#include "GLInterface/WGL.h"
#elif defined(HAVE_X11) && HAVE_X11
#elif HAVE_X11
#include "GLInterface/GLX.h"
#include <GL/glx.h>
#else
#error Platform doesnt have a GLInterface
#endif
#if HAVE_WAYLAND
struct geometry {
int width;
int height;
};
struct xkb {
struct xkb_context *context;
struct xkb_keymap *keymap;
struct xkb_state *state;
xkb_mod_mask_t control_mask;
xkb_mod_mask_t alt_mask;
xkb_mod_mask_t shift_mask;
};
#endif
typedef struct {
#if defined(USE_EGL) && USE_EGL // This is currently a X11/EGL implementation for desktop
int screen;
#if HAVE_WAYLAND
struct wl_display *wl_display;
struct wl_registry *wl_registry;
struct wl_compositor *wl_compositor;
struct wl_shell *wl_shell;
struct wl_seat *wl_seat;
struct {
struct wl_pointer *wl_pointer;
uint32_t serial;
} pointer;
struct {
struct wl_keyboard *wl_keyboard;
struct xkb xkb;
uint32_t modifiers;
} keyboard;
struct wl_shm *wl_shm;
struct wl_cursor_theme *wl_cursor_theme;
struct wl_cursor *wl_cursor;
struct wl_surface *wl_cursor_surface;
struct geometry geometry, window_size;
struct wl_egl_window *wl_egl_native;
struct wl_surface *wl_surface;
struct wl_shell_surface *wl_shell_surface;
bool fullscreen, running;
#endif
#if USE_EGL
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
int x, y;
unsigned int width, height;
#elif defined(__APPLE__)
enum egl_platform platform;
EGLNativeWindowType native_window;
#elif HAVE_X11
GLXContext ctx;
#endif
#if defined(__APPLE__)
NSView *cocoaWin;
NSOpenGLContext *cocoaCtx;
#elif defined(HAVE_X11) && HAVE_X11
#elif HAVE_X11
int screen;
Window win;
Window parent;
@ -43,16 +102,14 @@ typedef struct {
// evdpy is to be used by XEventThread only
Display *dpy, *evdpy;
XVisualInfo *vi;
GLXContext ctx;
XSetWindowAttributes attr;
std::thread xEventThread;
#endif
int x, y;
unsigned int width, height;
#endif
} GLWindow;
extern cInterfaceBase *GLInterface;
extern GLWindow GLWin;
#endif
#endif