Make desktop_mode a static variable inside x11_common.c

This commit is contained in:
twinaphex 2017-03-23 20:07:56 +01:00
parent 1ce3b12335
commit 805470072b
4 changed files with 14 additions and 13 deletions

View File

@ -28,6 +28,9 @@
#endif
#include "x11_common.h"
#include <X11/extensions/xf86vmode.h>
#include "../../frontend/frontend_driver.h"
#include "../../input/common/input_x11_common.h"
#include "../../verbosity.h"
@ -43,6 +46,7 @@ static DBusConnection* dbus_connection = NULL;
static unsigned int dbus_screensaver_cookie = 0;
#endif
static XF86VidModeModeInfo desktop_mode;
static bool xdg_screensaver_available = true;
bool g_x11_entered = false;
static bool g_x11_has_focus = false;
@ -375,11 +379,11 @@ static bool get_video_mode(video_frame_info_t *video_info,
bool x11_enter_fullscreen(video_frame_info_t *video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode)
unsigned height)
{
XF86VidModeModeInfo mode;
if (!get_video_mode(video_info, dpy, width, height, &mode, desktop_mode))
if (!get_video_mode(video_info, dpy, width, height, &mode, &desktop_mode))
return false;
if (!XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), &mode))
@ -389,9 +393,9 @@ bool x11_enter_fullscreen(video_frame_info_t *video_info,
return true;
}
void x11_exit_fullscreen(Display *dpy, XF86VidModeModeInfo *desktop_mode)
void x11_exit_fullscreen(Display *dpy)
{
XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), desktop_mode);
XF86VidModeSwitchToMode(dpy, DefaultScreen(dpy), &desktop_mode);
XF86VidModeSetViewPort(dpy, DefaultScreen(dpy), 0, 0);
}

View File

@ -25,7 +25,6 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/xf86vmode.h>
#include <boolean.h>
@ -42,9 +41,9 @@ void x11_windowed_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(Window win, bool enable);
bool x11_enter_fullscreen(video_frame_info_t *video_info,
Display *dpy, unsigned width,
unsigned height, XF86VidModeModeInfo *desktop_mode);
unsigned height);
void x11_exit_fullscreen(Display *dpy, XF86VidModeModeInfo *desktop_mode);
void x11_exit_fullscreen(Display *dpy);
void x11_move_window(Display *dpy, Window win,
int x, int y, unsigned width, unsigned height);

View File

@ -94,7 +94,6 @@ typedef struct gfx_ctx_x_data
#endif
unsigned g_interval;
XF86VidModeModeInfo g_desktop_mode;
#ifdef HAVE_VULKAN
gfx_ctx_vulkan_data_t vk;
@ -212,7 +211,7 @@ static void gfx_ctx_x_destroy_resources(gfx_ctx_x_data_t *x)
{
if (x->g_should_reset_mode)
{
x11_exit_fullscreen(g_x11_dpy, &x->g_desktop_mode);
x11_exit_fullscreen(g_x11_dpy);
x->g_should_reset_mode = false;
}
@ -609,7 +608,7 @@ static bool gfx_ctx_x_set_video_mode(void *data,
if (fullscreen && !windowed_full)
{
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height, &x->g_desktop_mode))
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height))
{
x->g_should_reset_mode = true;
true_full = true;

View File

@ -39,7 +39,6 @@ typedef struct
#ifdef HAVE_EGL
egl_ctx_data_t egl;
#endif
XF86VidModeModeInfo desktop_mode;
bool should_reset_mode;
} xegl_ctx_data_t;
@ -75,7 +74,7 @@ static void gfx_ctx_xegl_destroy(void *data)
if (xegl->should_reset_mode)
{
x11_exit_fullscreen(g_x11_dpy, &xegl->desktop_mode);
x11_exit_fullscreen(g_x11_dpy);
xegl->should_reset_mode = false;
}
@ -294,7 +293,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
if (fullscreen && !video_info->windowed_fullscreen)
{
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height, &xegl->desktop_mode))
if (x11_enter_fullscreen(video_info, g_x11_dpy, width, height))
{
xegl->should_reset_mode = true;
true_full = true;