Add show_mouse() context callback.

This commit is contained in:
Themaister 2013-03-29 13:46:11 +01:00
parent 067e00b3dd
commit 5e755671da
16 changed files with 51 additions and 6 deletions

View File

@ -282,5 +282,6 @@ const gfx_ctx_driver_t gfx_ctx_android = {
NULL,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"android",
};

View File

@ -404,5 +404,6 @@ const gfx_ctx_driver_t gfx_ctx_bbqnx = {
NULL,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"blackberry_qnx",
};

View File

@ -629,6 +629,7 @@ const gfx_ctx_driver_t gfx_ctx_drm_egl = {
gfx_ctx_get_proc_address,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"kms-egl",
};

View File

@ -314,7 +314,7 @@ static bool gfx_ctx_set_video_mode(
x11_set_window_attr(g_dpy, g_win);
if (fullscreen)
x11_hide_mouse(g_dpy, g_win);
x11_show_mouse(g_dpy, g_win, false);
if (true_full)
{
@ -505,6 +505,11 @@ static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned
return false;
}
static void gfx_ctx_show_mouse(bool state)
{
x11_show_mouse(g_dpy, g_win, state);
}
const gfx_ctx_driver_t gfx_ctx_glx = {
gfx_ctx_init,
gfx_ctx_destroy,
@ -522,6 +527,7 @@ const gfx_ctx_driver_t gfx_ctx_glx = {
gfx_ctx_get_proc_address,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
gfx_ctx_show_mouse,
"glx",
};

View File

@ -136,5 +136,6 @@ const gfx_ctx_driver_t gfx_ctx_ios = {
NULL,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"ios",
};

View File

@ -430,6 +430,7 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
NULL,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"ps3",
#ifdef HAVE_RMENU
gfx_ctx_get_available_resolutions,

View File

@ -187,7 +187,8 @@ static bool gfx_ctx_set_video_mode(
RARCH_WARN("GL double buffer has not been enabled.\n");
// Remove that ugly mouse :D
SDL_ShowCursor(SDL_DISABLE);
if (fullscreen)
SDL_ShowCursor(SDL_DISABLE);
sdl_set_handles();
@ -354,6 +355,11 @@ static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned
return false;
}
static void gfx_ctx_show_mouse(bool state)
{
SDL_ShowCursor(state ? SDL_ENABLE : SDL_DISABLE);
}
const gfx_ctx_driver_t gfx_ctx_sdl_gl = {
gfx_ctx_init,
gfx_ctx_destroy,
@ -371,6 +377,7 @@ const gfx_ctx_driver_t gfx_ctx_sdl_gl = {
gfx_ctx_get_proc_address,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
gfx_ctx_show_mouse,
"sdl-gl",
};

View File

@ -480,5 +480,6 @@ const gfx_ctx_driver_t gfx_ctx_videocore = {
gfx_ctx_get_proc_address,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"videocore",
};

View File

@ -439,6 +439,11 @@ static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned
return false;
}
static void gfx_ctx_show_mouse(bool state)
{
show_cursor(state);
}
const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_init,
gfx_ctx_destroy,
@ -456,6 +461,7 @@ const gfx_ctx_driver_t gfx_ctx_wgl = {
gfx_ctx_get_proc_address,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
gfx_ctx_show_mouse,
"wgl",
};

View File

@ -22,7 +22,7 @@
#include "../../general.h"
#include "../../input/input_common.h"
void x11_hide_mouse(Display *dpy, Window win)
static void x11_hide_mouse(Display *dpy, Window win)
{
Cursor no_ptr;
Pixmap bm_no;
@ -47,6 +47,14 @@ void x11_hide_mouse(Display *dpy, Window win)
XFreeColors(dpy, colormap, &black.pixel, 1, 0);
}
void x11_show_mouse(Display *dpy, Window win, bool state)
{
if (state)
XUndefineCursor(dpy, win);
else
x11_hide_mouse(dpy, win);
}
static Atom XA_NET_WM_STATE;
static Atom XA_NET_WM_STATE_FULLSCREEN;
static Atom XA_NET_MOVERESIZE_WINDOW;

View File

@ -31,7 +31,7 @@
#include "../../boolean.h"
void x11_hide_mouse(Display *dpy, Window win);
void x11_show_mouse(Display *dpy, Window win, bool state);
void x11_windowed_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(Window win);
bool x11_enter_fullscreen(Display *dpy, unsigned width, unsigned height, XF86VidModeModeInfo *desktop_mode);

View File

@ -395,6 +395,7 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
NULL,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
NULL,
"xdk",
#if defined(HAVE_RMENU)
gfx_ctx_xdk_get_available_resolutions,

View File

@ -374,7 +374,7 @@ static bool gfx_ctx_set_video_mode(
x11_set_window_attr(g_dpy, g_win);
if (fullscreen)
x11_hide_mouse(g_dpy, g_win);
x11_show_mouse(g_dpy, g_win, false);
if (true_full)
{
@ -548,6 +548,11 @@ static bool gfx_ctx_write_egl_image(const void *frame, unsigned width, unsigned
return false;
}
static void gfx_ctx_show_mouse(bool state)
{
x11_show_mouse(g_dpy, g_win, state);
}
const gfx_ctx_driver_t gfx_ctx_x_egl = {
gfx_ctx_init,
gfx_ctx_destroy,
@ -565,6 +570,7 @@ const gfx_ctx_driver_t gfx_ctx_x_egl = {
gfx_ctx_get_proc_address,
gfx_ctx_init_egl_image_buffer,
gfx_ctx_write_egl_image,
gfx_ctx_show_mouse,
"x-egl",
};

View File

@ -110,6 +110,9 @@ typedef struct gfx_ctx_driver
// Always returns true the first time it's called for a new index. The graphics core must handle a change in the handle correctly.
bool (*write_egl_image)(const void *frame, unsigned width, unsigned height, unsigned pitch, bool rgb32, unsigned index, void **image_handle);
// Shows or hides mouse. Can be NULL if context doesn't have a concept of mouse pointer.
void (*show_mouse)(bool state);
// Human readable string.
const char *ident;

View File

@ -2196,6 +2196,8 @@ static void gl_overlay_enable(void *data, bool state)
{
gl_t *gl = (gl_t*)data;
gl->overlay_enable = state;
if (gl->ctx_driver->show_mouse && gl->fullscreen)
gl->ctx_driver->show_mouse(state);
}
static void gl_overlay_full_screen(void *data, bool enable)

View File

@ -415,7 +415,7 @@ static void *xv_init(const video_info_t *video, const input_driver_t **input, vo
if (video->fullscreen)
{
x11_windowed_fullscreen(xv->display, xv->window);
x11_hide_mouse(xv->display, xv->window);
x11_show_mouse(xv->display, xv->window, false);
}
xv->gc = XCreateGC(xv->display, xv->window, 0, 0);