Create g_x11_screen

This commit is contained in:
twinaphex 2015-12-01 08:42:33 +01:00
parent 96da691728
commit c4354ff429
4 changed files with 20 additions and 18 deletions

View File

@ -44,6 +44,8 @@ static XIM g_x11_xim;
static XIC g_x11_xic;
static bool g_x11_true_full;
unsigned g_x11_screen;
#define XA_INIT(x) XA##x = XInternAtom(dpy, #x, False)
#define _NET_WM_STATE_ADD 1
#define MOVERESIZE_GRAVITY_CENTER 5

View File

@ -38,6 +38,7 @@
extern Window g_x11_win;
extern Display *g_x11_dpy;
extern Colormap g_x11_cmap;
extern unsigned g_x11_screen;
void x11_show_mouse(Display *dpy, Window win, bool state);
void x11_windowed_fullscreen(Display *dpy, Window win);

View File

@ -39,7 +39,6 @@ typedef struct gfx_ctx_glx_data
GLXWindow g_glx_win;
unsigned g_screen;
unsigned g_interval;
GLXContext g_ctx, g_hw_ctx;
@ -100,10 +99,10 @@ static void ctx_glx_destroy_resources(gfx_ctx_glx_data_t *glx)
XTranslateCoordinates(g_x11_dpy, g_x11_win, DefaultRootWindow(g_x11_dpy),
target.x, target.y, &x, &y, &child);
glx->g_screen = x11_get_xinerama_monitor(g_x11_dpy, x, y,
g_x11_screen = x11_get_xinerama_monitor(g_x11_dpy, x, y,
target.width, target.height);
RARCH_LOG("[GLX]: Saved monitor #%u.\n", glx->g_screen);
RARCH_LOG("[GLX]: Saved monitor #%u.\n", g_x11_screen);
}
#endif
@ -267,6 +266,7 @@ error:
if (glx)
free(glx);
g_x11_screen = 0;
return false;
}
@ -315,17 +315,17 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
}
if (settings->video.monitor_index)
glx->g_screen = settings->video.monitor_index - 1;
g_x11_screen = settings->video.monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || glx->g_screen != 0)
if (fullscreen || g_x11_screen != 0)
{
unsigned new_width = width;
unsigned new_height = height;
if (x11_get_xinerama_coord(g_x11_dpy, glx->g_screen,
if (x11_get_xinerama_coord(g_x11_dpy, g_x11_screen,
&x_off, &y_off, &new_width, &new_height))
RARCH_LOG("[GLX]: Using Xinerama on screen #%u.\n", glx->g_screen);
RARCH_LOG("[GLX]: Using Xinerama on screen #%u.\n", g_x11_screen);
else
RARCH_LOG("[GLX]: Xinerama is not active on screen.\n");
@ -374,7 +374,7 @@ static bool gfx_ctx_glx_set_video_mode(void *data,
/* If we want to map the window on a different screen, we'll have to do it by force.
* Otherwise, we should try to let the window manager sort it out.
* x_off and y_off usually get ignored in XCreateWindow(). */
if (glx->g_screen)
if (g_x11_screen)
x11_move_window(g_x11_dpy, g_x11_win, x_off, y_off, width, height);
}
@ -501,6 +501,7 @@ error:
if (glx)
free(glx);
g_x11_screen = 0;
return false;
}

View File

@ -27,8 +27,6 @@
#define EGL_OPENGL_ES3_BIT_KHR 0x0040
#endif
static unsigned g_screen;
static XF86VidModeModeInfo g_desktop_mode;
static bool g_should_reset_mode;
@ -53,16 +51,16 @@ static void gfx_ctx_xegl_destroy(void *data)
#ifdef HAVE_XINERAMA
XWindowAttributes target;
Window child;
int x = 0, y = 0;
XGetWindowAttributes(g_x11_dpy, g_x11_win, &target);
XTranslateCoordinates(g_x11_dpy, g_x11_win, RootWindow(g_x11_dpy, DefaultScreen(g_x11_dpy)),
target.x, target.y, &x, &y, &child);
g_screen = x11_get_xinerama_monitor(g_x11_dpy, x, y,
g_x11_screen = x11_get_xinerama_monitor(g_x11_dpy, x, y,
target.width, target.height);
RARCH_LOG("[X/EGL]: Saved monitor #%u.\n", g_screen);
RARCH_LOG("[X/EGL]: Saved monitor #%u.\n", g_x11_screen);
#endif
x11_window_destroy(false);
@ -295,16 +293,16 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
}
if (settings->video.monitor_index)
g_screen = settings->video.monitor_index - 1;
g_x11_screen = settings->video.monitor_index - 1;
#ifdef HAVE_XINERAMA
if (fullscreen || g_screen != 0)
if (fullscreen || g_x11_screen != 0)
{
unsigned new_width = width;
unsigned new_height = height;
if (x11_get_xinerama_coord(g_x11_dpy, g_screen, &x_off, &y_off, &new_width, &new_height))
RARCH_LOG("[X/EGL]: Using Xinerama on screen #%u.\n", g_screen);
if (x11_get_xinerama_coord(g_x11_dpy, g_x11_screen, &x_off, &y_off, &new_width, &new_height))
RARCH_LOG("[X/EGL]: Using Xinerama on screen #%u.\n", g_x11_screen);
else
RARCH_LOG("[X/EGL]: Xinerama is not active on screen.\n");
@ -368,7 +366,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
* Otherwise, we should try to let the window manager sort it out.
* x_off and y_off usually get ignored in XCreateWindow().
*/
if (g_screen)
if (g_x11_screen)
x11_move_window(g_x11_dpy, g_x11_win, x_off, y_off, width, height);
}