Create x11_install_quit_atom

This commit is contained in:
twinaphex 2015-11-19 12:18:35 +01:00
parent 9b44a2496b
commit 655520aeec
5 changed files with 13 additions and 12 deletions

View File

@ -31,7 +31,7 @@ static Atom XA_NET_WM_STATE;
static Atom XA_NET_WM_STATE_FULLSCREEN;
static Atom XA_NET_MOVERESIZE_WINDOW;
Colormap g_x11_cmap;
Atom g_x11_quit_atom;
static Atom g_x11_quit_atom;
static volatile sig_atomic_t g_x11_quit;
bool g_x11_has_focus;
Window g_x11_win;
@ -573,3 +573,10 @@ void x11_colormap_destroy(void)
XFreeColormap(g_x11_dpy, g_x11_cmap);
g_x11_cmap = None;
}
void x11_install_quit_atom(void)
{
g_x11_quit_atom = XInternAtom(g_x11_dpy, "WM_DELETE_WINDOW", False);
if (g_x11_quit_atom)
XSetWMProtocols(g_x11_dpy, g_x11_win, &g_x11_quit_atom, 1);
}

View File

@ -35,7 +35,6 @@
#include "../video_context_driver.h"
extern Atom g_x11_quit_atom;
extern bool g_x11_has_focus;
extern Window g_x11_win;
extern Display *g_x11_dpy;
@ -89,5 +88,7 @@ void x11_window_destroy(bool fullscreen);
void x11_colormap_destroy(void);
void x11_install_quit_atom(void);
#endif

View File

@ -548,10 +548,7 @@ static void *xv_init(const video_info_t *video,
XSync(g_x11_dpy, False);
memset(xv->image->data, 128, xv->image->data_size);
g_x11_quit_atom = XInternAtom(g_x11_dpy, "WM_DELETE_WINDOW", False);
if (g_x11_quit_atom)
XSetWMProtocols(g_x11_dpy, g_x11_win, &g_x11_quit_atom, 1);
x11_install_quit_atom();
x11_install_sighandlers();
xv_set_nonblock_state(xv, !video->vsync);

View File

@ -471,9 +471,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
glXMakeContextCurrent(g_x11_dpy, glx->g_glx_win, glx->g_glx_win, glx->g_ctx);
XSync(g_x11_dpy, False);
g_x11_quit_atom = XInternAtom(g_x11_dpy, "WM_DELETE_WINDOW", False);
if (g_x11_quit_atom)
XSetWMProtocols(g_x11_dpy, g_x11_win, &g_x11_quit_atom, 1);
x11_install_quit_atom();
glXGetConfig(g_x11_dpy, vi, GLX_DOUBLEBUFFER, &val);
glx->g_is_double = val;

View File

@ -450,9 +450,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
XIfEvent(g_x11_dpy, &event, egl_wait_notify, NULL);
g_x11_quit_atom = XInternAtom(g_x11_dpy, "WM_DELETE_WINDOW", False);
if (g_x11_quit_atom)
XSetWMProtocols(g_x11_dpy, g_x11_win, &g_x11_quit_atom, 1);
x11_install_quit_atom();
gfx_ctx_xegl_swap_interval(data, g_interval);