mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 18:40:09 +00:00
(xvideo.c) Style nits
This commit is contained in:
parent
77ba9c650f
commit
5068e2ddbf
@ -408,21 +408,22 @@ static void *xv_init(const video_info_t *video,
|
|||||||
const input_driver_t **input, void **input_data)
|
const input_driver_t **input, void **input_data)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
struct sigaction sa;
|
|
||||||
unsigned adaptor_count = 0;
|
|
||||||
int visualmatches = 0;
|
|
||||||
XSetWindowAttributes attributes = {0};
|
|
||||||
unsigned width = 0, height = 0;
|
|
||||||
char buf[128], buf_fps[128];
|
char buf[128], buf_fps[128];
|
||||||
Atom atom = 0;
|
struct sigaction sa = {{0}};
|
||||||
void *xinput = NULL;
|
XSetWindowAttributes attributes = {0};
|
||||||
XVisualInfo *visualinfo = NULL;
|
XVisualInfo visualtemplate = {0};
|
||||||
XVisualInfo visualtemplate = {0};
|
unsigned width = 0;
|
||||||
XvAdaptorInfo *adaptor_info = NULL;
|
unsigned height = 0;
|
||||||
driver_t *driver = driver_get_ptr();
|
unsigned adaptor_count = 0;
|
||||||
settings_t *settings = config_get_ptr();
|
int visualmatches = 0;
|
||||||
|
Atom atom = 0;
|
||||||
|
void *xinput = NULL;
|
||||||
|
XVisualInfo *visualinfo = NULL;
|
||||||
|
XvAdaptorInfo *adaptor_info = NULL;
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
const struct retro_game_geometry *geom = NULL;
|
const struct retro_game_geometry *geom = NULL;
|
||||||
struct retro_system_av_info *av_info = NULL;
|
struct retro_system_av_info *av_info = NULL;
|
||||||
xv_t *xv = (xv_t*)calloc(1, sizeof(*xv));
|
xv_t *xv = (xv_t*)calloc(1, sizeof(*xv));
|
||||||
if (!xv)
|
if (!xv)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -495,13 +496,13 @@ static void *xv_init(const video_info_t *video,
|
|||||||
xv->colormap = XCreateColormap(xv->display,
|
xv->colormap = XCreateColormap(xv->display,
|
||||||
DefaultRootWindow(xv->display), visualinfo->visual, AllocNone);
|
DefaultRootWindow(xv->display), visualinfo->visual, AllocNone);
|
||||||
|
|
||||||
attributes.colormap = xv->colormap;
|
attributes.colormap = xv->colormap;
|
||||||
attributes.border_pixel = 0;
|
attributes.border_pixel = 0;
|
||||||
attributes.event_mask = StructureNotifyMask | KeyPressMask |
|
attributes.event_mask = StructureNotifyMask | KeyPressMask |
|
||||||
KeyReleaseMask | ButtonReleaseMask | ButtonPressMask | DestroyNotify | ClientMessage;
|
KeyReleaseMask | ButtonReleaseMask | ButtonPressMask | DestroyNotify | ClientMessage;
|
||||||
|
|
||||||
width = video->fullscreen ? ( (video->width == 0) ? geom->base_width : video->width) : video->width;
|
width = video->fullscreen ? ( (video->width == 0) ? geom->base_width : video->width) : video->width;
|
||||||
height = video->fullscreen ? ((video->height == 0) ? geom->base_height : video->height) : video->height;
|
height = video->fullscreen ? ((video->height == 0) ? geom->base_height : video->height) : video->height;
|
||||||
xv->window = XCreateWindow(xv->display, DefaultRootWindow(xv->display),
|
xv->window = XCreateWindow(xv->display, DefaultRootWindow(xv->display),
|
||||||
0, 0, width, height,
|
0, 0, width, height,
|
||||||
0, xv->depth, InputOutput, visualinfo->visual,
|
0, xv->depth, InputOutput, visualinfo->visual,
|
||||||
@ -541,12 +542,13 @@ static void *xv_init(const video_info_t *video,
|
|||||||
RARCH_ERR("XVideo: XShmCreateImage failed.\n");
|
RARCH_ERR("XVideo: XShmCreateImage failed.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
xv->width = xv->image->width;
|
|
||||||
xv->height = xv->image->height;
|
|
||||||
|
|
||||||
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
|
xv->width = xv->image->width;
|
||||||
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
|
xv->height = xv->image->height;
|
||||||
|
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
|
||||||
|
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
|
||||||
xv->shminfo.readOnly = false;
|
xv->shminfo.readOnly = false;
|
||||||
|
|
||||||
if (!XShmAttach(xv->display, &xv->shminfo))
|
if (!XShmAttach(xv->display, &xv->shminfo))
|
||||||
{
|
{
|
||||||
RARCH_ERR("XVideo: XShmAttach failed.\n");
|
RARCH_ERR("XVideo: XShmAttach failed.\n");
|
||||||
@ -560,7 +562,7 @@ static void *xv_init(const video_info_t *video,
|
|||||||
XSetWMProtocols(xv->display, xv->window, &xv->quit_atom, 1);
|
XSetWMProtocols(xv->display, xv->window, &xv->quit_atom, 1);
|
||||||
|
|
||||||
sa.sa_handler = xvideo_sighandler;
|
sa.sa_handler = xvideo_sighandler;
|
||||||
sa.sa_flags = SA_RESTART;
|
sa.sa_flags = SA_RESTART;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sigaction(SIGINT, &sa, NULL);
|
sigaction(SIGINT, &sa, NULL);
|
||||||
sigaction(SIGTERM, &sa, NULL);
|
sigaction(SIGTERM, &sa, NULL);
|
||||||
@ -608,7 +610,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
|
|||||||
/* We render @ 2x scale to combat chroma downsampling. */
|
/* We render @ 2x scale to combat chroma downsampling. */
|
||||||
if (xv->width != (width << 1) || xv->height != (height << 1))
|
if (xv->width != (width << 1) || xv->height != (height << 1))
|
||||||
{
|
{
|
||||||
xv->width = width << 1;
|
xv->width = width << 1;
|
||||||
xv->height = height << 1;
|
xv->height = height << 1;
|
||||||
|
|
||||||
XShmDetach(xv->display, &xv->shminfo);
|
XShmDetach(xv->display, &xv->shminfo);
|
||||||
@ -624,7 +626,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
xv->width = xv->image->width;
|
xv->width = xv->image->width;
|
||||||
xv->height = xv->image->height;
|
xv->height = xv->image->height;
|
||||||
|
|
||||||
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
|
xv->shminfo.shmid = shmget(IPC_PRIVATE, xv->image->data_size, IPC_CREAT | 0777);
|
||||||
@ -634,7 +636,7 @@ static bool check_resize(xv_t *xv, unsigned width, unsigned height)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
|
xv->shminfo.shmaddr = xv->image->data = (char*)shmat(xv->shminfo.shmid, NULL, 0);
|
||||||
xv->shminfo.readOnly = false;
|
xv->shminfo.readOnly = false;
|
||||||
|
|
||||||
if (!XShmAttach(xv->display, &xv->shminfo))
|
if (!XShmAttach(xv->display, &xv->shminfo))
|
||||||
@ -801,7 +803,7 @@ void x_input_poll_wheel(void *data, XButtonEvent *event, bool latch);
|
|||||||
static bool xv_alive(void *data)
|
static bool xv_alive(void *data)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
xv_t *xv = (xv_t*)data;
|
xv_t *xv = (xv_t*)data;
|
||||||
driver_t *driver = driver_get_ptr();
|
driver_t *driver = driver_get_ptr();
|
||||||
|
|
||||||
while (XPending(xv->display))
|
while (XPending(xv->display))
|
||||||
|
@ -53,12 +53,12 @@ cothread_t co_create(unsigned int size, void (*coentry)(void))
|
|||||||
|
|
||||||
if(thread)
|
if(thread)
|
||||||
{
|
{
|
||||||
struct sigaction handler;
|
|
||||||
struct sigaction old_handler;
|
|
||||||
|
|
||||||
stack_t stack;
|
stack_t stack;
|
||||||
stack_t old_stack;
|
stack_t old_stack;
|
||||||
|
|
||||||
|
struct sigaction handler = {{0}};
|
||||||
|
struct sigaction old_handler = {{0}};
|
||||||
|
|
||||||
thread->coentry = thread->stack = 0;
|
thread->coentry = thread->stack = 0;
|
||||||
|
|
||||||
stack.ss_flags = 0;
|
stack.ss_flags = 0;
|
||||||
@ -68,7 +68,7 @@ cothread_t co_create(unsigned int size, void (*coentry)(void))
|
|||||||
if(stack.ss_sp && !sigaltstack(&stack, &old_stack))
|
if(stack.ss_sp && !sigaltstack(&stack, &old_stack))
|
||||||
{
|
{
|
||||||
handler.sa_handler = springboard;
|
handler.sa_handler = springboard;
|
||||||
handler.sa_flags = SA_ONSTACK;
|
handler.sa_flags = SA_ONSTACK;
|
||||||
sigemptyset(&handler.sa_mask);
|
sigemptyset(&handler.sa_mask);
|
||||||
creating = thread;
|
creating = thread;
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ cothread_t co_create(unsigned int size, void (*coentry)(void))
|
|||||||
|
|
||||||
void co_delete(cothread_t cothread)
|
void co_delete(cothread_t cothread)
|
||||||
{
|
{
|
||||||
if(cothread)
|
if (cothread)
|
||||||
{
|
{
|
||||||
if(((cothread_struct*)cothread)->stack)
|
if(((cothread_struct*)cothread)->stack)
|
||||||
free(((cothread_struct*)cothread)->stack);
|
free(((cothread_struct*)cothread)->stack);
|
||||||
@ -103,7 +103,7 @@ void co_delete(cothread_t cothread)
|
|||||||
|
|
||||||
void co_switch(cothread_t cothread)
|
void co_switch(cothread_t cothread)
|
||||||
{
|
{
|
||||||
if(!sigsetjmp(co_running->context, 0))
|
if (!sigsetjmp(co_running->context, 0))
|
||||||
{
|
{
|
||||||
co_running = (cothread_struct*)cothread;
|
co_running = (cothread_struct*)cothread;
|
||||||
siglongjmp(co_running->context, 1);
|
siglongjmp(co_running->context, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user