mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Create x11_install_sighandlers
This commit is contained in:
parent
704709f82e
commit
95a5818ccb
@ -486,3 +486,20 @@ bool x11_has_focus(void *data)
|
||||
|
||||
return (win == g_x11_win && g_x11_has_focus) || g_x11_true_full;
|
||||
}
|
||||
|
||||
static void x11_sighandler(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_x11_quit = 1;
|
||||
}
|
||||
|
||||
void x11_install_sighandlers(void)
|
||||
{
|
||||
struct sigaction sa = {{0}};
|
||||
|
||||
sa.sa_handler = x11_sighandler;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
}
|
||||
|
@ -77,5 +77,7 @@ bool x11_has_focus(void *data);
|
||||
|
||||
bool x11_alive(void *data);
|
||||
|
||||
void x11_install_sighandlers(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -86,11 +86,6 @@ static void xv_set_nonblock_state(void *data, bool state)
|
||||
RARCH_WARN("Failed to set SYNC_TO_VBLANK attribute.\n");
|
||||
}
|
||||
|
||||
static void xvideo_sighandler(int sig)
|
||||
{
|
||||
g_x11_quit = 1;
|
||||
}
|
||||
|
||||
static INLINE void calculate_yuv(uint8_t *y, uint8_t *u, uint8_t *v, unsigned r, unsigned g, unsigned b)
|
||||
{
|
||||
int y_ = (int)(+((double)r * 0.257) + ((double)g * 0.504) + ((double)b * 0.098) + 16.0);
|
||||
@ -405,7 +400,6 @@ static void *xv_init(const video_info_t *video,
|
||||
XWindowAttributes target;
|
||||
char buf[128] = {0};
|
||||
char buf_fps[128] = {0};
|
||||
struct sigaction sa = {{0}};
|
||||
XSetWindowAttributes attributes = {0};
|
||||
XVisualInfo visualtemplate = {0};
|
||||
unsigned width = 0;
|
||||
@ -560,11 +554,7 @@ static void *xv_init(const video_info_t *video,
|
||||
if (g_x11_quit_atom)
|
||||
XSetWMProtocols(g_x11_dpy, g_x11_win, &g_x11_quit_atom, 1);
|
||||
|
||||
sa.sa_handler = xvideo_sighandler;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
x11_install_sighandlers();
|
||||
|
||||
xv_set_nonblock_state(xv, !video->vsync);
|
||||
g_x11_has_focus = true;
|
||||
|
@ -59,12 +59,6 @@ static unsigned g_minor;
|
||||
|
||||
static PFNGLXCREATECONTEXTATTRIBSARBPROC glx_create_context_attribs;
|
||||
|
||||
static void glx_sighandler(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_x11_quit = 1;
|
||||
}
|
||||
|
||||
static Bool glx_wait_notify(Display *d, XEvent *e, char *arg)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
@ -340,14 +334,9 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
|
||||
int (*old_handler)(Display*, XErrorEvent*) = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
gfx_ctx_glx_data_t *glx = (gfx_ctx_glx_data_t*)driver->video_context_data;
|
||||
struct sigaction sa = {{0}};
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
sa.sa_handler = glx_sighandler;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
x11_install_sighandlers();
|
||||
|
||||
if (!glx)
|
||||
return false;
|
||||
|
@ -55,12 +55,6 @@ static enum gfx_ctx_api g_api;
|
||||
static unsigned g_major;
|
||||
static unsigned g_minor;
|
||||
|
||||
static void egl_sighandler(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
g_x11_quit = 1;
|
||||
}
|
||||
|
||||
static Bool egl_wait_notify(Display *d, XEvent *e, char *arg)
|
||||
{
|
||||
(void)d;
|
||||
@ -338,6 +332,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
XEvent event;
|
||||
EGLint egl_attribs[16];
|
||||
EGLint *attr;
|
||||
EGLint vid, num_visuals;
|
||||
@ -345,7 +340,6 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
bool true_full = false;
|
||||
int x_off = 0;
|
||||
int y_off = 0;
|
||||
struct sigaction sa = {{0}};
|
||||
XVisualInfo temp = {0};
|
||||
XSetWindowAttributes swa = {0};
|
||||
XVisualInfo *vi = NULL;
|
||||
@ -354,13 +348,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
|
||||
|
||||
int (*old_handler)(Display*, XErrorEvent*) = NULL;
|
||||
|
||||
XEvent event;
|
||||
|
||||
sa.sa_handler = egl_sighandler;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
x11_install_sighandlers();
|
||||
|
||||
windowed_full = settings->video.windowed_fullscreen;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user