Fix screensaver appearing in fullscreen.

This commit is contained in:
Themaister 2012-10-13 19:53:04 +02:00
parent ba647047ce
commit 6fd1940741
3 changed files with 10 additions and 18 deletions

View File

@ -33,6 +33,7 @@ static Window g_win;
static Colormap g_cmap; static Colormap g_cmap;
static Atom g_quit_atom; static Atom g_quit_atom;
static bool g_has_focus; static bool g_has_focus;
static bool g_true_full;
static unsigned g_screen; static unsigned g_screen;
static GLXContext g_ctx; static GLXContext g_ctx;
@ -366,9 +367,8 @@ static bool gfx_ctx_set_video_mode(
driver.display_type = RARCH_DISPLAY_X11; driver.display_type = RARCH_DISPLAY_X11;
driver.video_display = (uintptr_t)g_dpy; driver.video_display = (uintptr_t)g_dpy;
driver.video_window = (uintptr_t)g_win;
// Always assume that we have focus in true fullscreen. g_true_full = true_full;
driver.video_window = true_full ? (uintptr_t)None : (uintptr_t)g_win;
return true; return true;
@ -449,7 +449,7 @@ static bool gfx_ctx_has_focus(void)
int rev; int rev;
XGetInputFocus(g_dpy, &win, &rev); XGetInputFocus(g_dpy, &win, &rev);
return (win == g_win && g_has_focus) || (g_win == None); return (win == g_win && g_has_focus) || g_true_full;
} }
static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)

View File

@ -35,6 +35,7 @@ static Window g_win;
static Colormap g_cmap; static Colormap g_cmap;
static Atom g_quit_atom; static Atom g_quit_atom;
static bool g_has_focus; static bool g_has_focus;
static bool g_true_full;
static unsigned g_screen; static unsigned g_screen;
static EGLContext g_egl_ctx; static EGLContext g_egl_ctx;
@ -385,9 +386,8 @@ static bool gfx_ctx_set_video_mode(
driver.display_type = RARCH_DISPLAY_X11; driver.display_type = RARCH_DISPLAY_X11;
driver.video_display = (uintptr_t)g_dpy; driver.video_display = (uintptr_t)g_dpy;
driver.video_window = (uintptr_t)g_win;
// Always assume that we have focus in true fullscreen. g_true_full = true_full;
driver.video_window = true_full ? (uintptr_t)None : (uintptr_t)g_win;
return true; return true;
@ -479,7 +479,7 @@ static bool gfx_ctx_has_focus(void)
int rev; int rev;
XGetInputFocus(g_dpy, &win, &rev); XGetInputFocus(g_dpy, &win, &rev);
return (win == g_win && g_has_focus) || (g_win == None); return (win == g_win && g_has_focus) || g_true_full;
} }
static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol) static gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)

View File

@ -277,12 +277,8 @@ static void x_input_poll_mouse(x11_input_t *x11)
x11->mouse_last_x = x11->mouse_x; x11->mouse_last_x = x11->mouse_x;
x11->mouse_last_y = x11->mouse_y; x11->mouse_last_y = x11->mouse_y;
Window win = x11->win;
if (win == None)
win = RootWindow(x11->display, DefaultScreen(x11->display));
XQueryPointer(x11->display, XQueryPointer(x11->display,
win, x11->win,
&root_win, &child_win, &root_win, &child_win,
&root_x, &root_y, &root_x, &root_y,
&win_x, &win_y, &win_x, &win_y,
@ -299,11 +295,7 @@ static void x_input_poll(void *data)
{ {
x11_input_t *x11 = (x11_input_t*)data; x11_input_t *x11 = (x11_input_t*)data;
Window win = None; if (video_focus_func())
int rev = 0;
XGetInputFocus(x11->display, &win, &rev);
if (win == x11->win || x11->win == None)
XQueryKeymap(x11->display, x11->state); XQueryKeymap(x11->display, x11->state);
else else
memset(x11->state, 0, sizeof(x11->state)); memset(x11->state, 0, sizeof(x11->state));