mirror of
https://github.com/libretro/RetroArch
synced 2025-02-25 12:41:18 +00:00
Start moving some global variables for X11 context drivers
to x11_common.c
This commit is contained in:
parent
91aa9d54b2
commit
c9dc5cf71d
@ -29,6 +29,8 @@
|
||||
static Atom XA_NET_WM_STATE;
|
||||
static Atom XA_NET_WM_STATE_FULLSCREEN;
|
||||
static Atom XA_NET_MOVERESIZE_WINDOW;
|
||||
Atom g_quit_atom;
|
||||
volatile sig_atomic_t g_quit;
|
||||
|
||||
#define XA_INIT(x) XA##x = XInternAtom(dpy, #x, False)
|
||||
#define _NET_WM_STATE_ADD 1
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "../../config.h"
|
||||
#endif
|
||||
|
||||
#include "../video_context_driver.h"
|
||||
#include <signal.h>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
@ -33,6 +33,11 @@
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../video_context_driver.h"
|
||||
|
||||
Atom g_x11_quit_atom;
|
||||
volatile sig_atomic_t g_x11_quit;
|
||||
|
||||
void x11_show_mouse(Display *dpy, Window win, bool state);
|
||||
void x11_windowed_fullscreen(Display *dpy, Window win);
|
||||
void x11_suspend_screensaver(Window win);
|
||||
|
@ -59,8 +59,6 @@ typedef struct gfx_ctx_glx_data
|
||||
|
||||
} gfx_ctx_glx_data_t;
|
||||
|
||||
static Atom g_quit_atom;
|
||||
static volatile sig_atomic_t g_quit;
|
||||
static unsigned g_major;
|
||||
static unsigned g_minor;
|
||||
|
||||
@ -69,7 +67,7 @@ static PFNGLXCREATECONTEXTATTRIBSARBPROC glx_create_context_attribs;
|
||||
static void glx_sighandler(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_quit = 1;
|
||||
g_x11_quit = 1;
|
||||
}
|
||||
|
||||
static Bool glx_wait_notify(Display *d, XEvent *e, char *arg)
|
||||
@ -279,13 +277,13 @@ static void gfx_ctx_glx_check_window(void *data, bool *quit,
|
||||
{
|
||||
case ClientMessage:
|
||||
if (event.xclient.window == glx->g_win &&
|
||||
(Atom)event.xclient.data.l[0] == g_quit_atom)
|
||||
g_quit = true;
|
||||
(Atom)event.xclient.data.l[0] == g_x11_quit_atom)
|
||||
g_x11_quit = true;
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
if (event.xdestroywindow.window == glx->g_win)
|
||||
g_quit = true;
|
||||
g_x11_quit = true;
|
||||
break;
|
||||
|
||||
case MapNotify:
|
||||
@ -309,7 +307,7 @@ static void gfx_ctx_glx_check_window(void *data, bool *quit,
|
||||
}
|
||||
}
|
||||
|
||||
*quit = g_quit;
|
||||
*quit = g_x11_quit;
|
||||
}
|
||||
|
||||
static void gfx_ctx_glx_swap_buffers(void *data)
|
||||
@ -372,7 +370,7 @@ static bool gfx_ctx_glx_init(void *data)
|
||||
|
||||
XInitThreads();
|
||||
|
||||
g_quit = 0;
|
||||
g_x11_quit = 0;
|
||||
|
||||
if (!glx->g_dpy)
|
||||
glx->g_dpy = XOpenDisplay(NULL);
|
||||
@ -618,9 +616,9 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
|
||||
glXMakeContextCurrent(glx->g_dpy, glx->g_glx_win, glx->g_glx_win, glx->g_ctx);
|
||||
XSync(glx->g_dpy, False);
|
||||
|
||||
g_quit_atom = XInternAtom(glx->g_dpy, "WM_DELETE_WINDOW", False);
|
||||
if (g_quit_atom)
|
||||
XSetWMProtocols(glx->g_dpy, glx->g_win, &g_quit_atom, 1);
|
||||
g_x11_quit_atom = XInternAtom(glx->g_dpy, "WM_DELETE_WINDOW", False);
|
||||
if (g_x11_quit_atom)
|
||||
XSetWMProtocols(glx->g_dpy, glx->g_win, &g_x11_quit_atom, 1);
|
||||
|
||||
glXGetConfig(glx->g_dpy, vi, GLX_DOUBLEBUFFER, &val);
|
||||
glx->g_is_double = val;
|
||||
|
@ -37,7 +37,6 @@
|
||||
static Display *g_dpy;
|
||||
static Window g_win;
|
||||
static Colormap g_cmap;
|
||||
static Atom g_quit_atom;
|
||||
static bool g_has_focus;
|
||||
static bool g_true_full;
|
||||
static unsigned g_screen;
|
||||
@ -55,7 +54,6 @@ static EGLConfig g_egl_config;
|
||||
static XF86VidModeModeInfo g_desktop_mode;
|
||||
static bool g_should_reset_mode;
|
||||
|
||||
static volatile sig_atomic_t g_quit;
|
||||
static bool g_inited;
|
||||
static unsigned g_interval;
|
||||
static enum gfx_ctx_api g_api;
|
||||
@ -65,7 +63,7 @@ static unsigned g_minor;
|
||||
static void egl_sighandler(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_quit = 1;
|
||||
g_x11_quit = 1;
|
||||
}
|
||||
|
||||
static Bool egl_wait_notify(Display *d, XEvent *e, char *arg)
|
||||
@ -167,13 +165,13 @@ static void gfx_ctx_xegl_check_window(void *data, bool *quit,
|
||||
switch (event.type)
|
||||
{
|
||||
case ClientMessage:
|
||||
if (event.xclient.window == g_win && (Atom)event.xclient.data.l[0] == g_quit_atom)
|
||||
g_quit = true;
|
||||
if (event.xclient.window == g_win && (Atom)event.xclient.data.l[0] == g_x11_quit_atom)
|
||||
g_x11_quit = true;
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
if (event.xdestroywindow.window == g_win)
|
||||
g_quit = true;
|
||||
g_x11_quit = true;
|
||||
break;
|
||||
|
||||
case MapNotify:
|
||||
@ -201,7 +199,7 @@ static void gfx_ctx_xegl_check_window(void *data, bool *quit,
|
||||
}
|
||||
}
|
||||
|
||||
*quit = g_quit;
|
||||
*quit = g_x11_quit;
|
||||
}
|
||||
|
||||
static void gfx_ctx_xegl_swap_buffers(void *data)
|
||||
@ -330,7 +328,7 @@ static bool gfx_ctx_xegl_init(void *data)
|
||||
attrib_ptr = NULL;
|
||||
}
|
||||
|
||||
g_quit = 0;
|
||||
g_x11_quit = 0;
|
||||
|
||||
/* Keep one g_dpy alive the entire process lifetime.
|
||||
* This is necessary for nVidia's EGL implementation for now. */
|
||||
@ -599,9 +597,9 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
|
||||
XIfEvent(g_dpy, &event, egl_wait_notify, NULL);
|
||||
|
||||
g_quit_atom = XInternAtom(g_dpy, "WM_DELETE_WINDOW", False);
|
||||
if (g_quit_atom)
|
||||
XSetWMProtocols(g_dpy, g_win, &g_quit_atom, 1);
|
||||
g_x11_quit_atom = XInternAtom(g_dpy, "WM_DELETE_WINDOW", False);
|
||||
if (g_x11_quit_atom)
|
||||
XSetWMProtocols(g_dpy, g_win, &g_x11_quit_atom, 1);
|
||||
|
||||
gfx_ctx_xegl_swap_interval(data, g_interval);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user