Merge branch 'master' into gl-render

This commit is contained in:
Themaister 2013-03-29 14:10:28 +01:00
commit 5d81093481
9 changed files with 44 additions and 16 deletions

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
#include "../../general.h" #include "../../general.h"
#include "../../input/input_common.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; Cursor no_ptr;
Pixmap bm_no; Pixmap bm_no;
@ -47,6 +47,14 @@ void x11_hide_mouse(Display *dpy, Window win)
XFreeColors(dpy, colormap, &black.pixel, 1, 0); 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;
static Atom XA_NET_WM_STATE_FULLSCREEN; static Atom XA_NET_WM_STATE_FULLSCREEN;
static Atom XA_NET_MOVERESIZE_WINDOW; static Atom XA_NET_MOVERESIZE_WINDOW;

View File

@ -31,7 +31,7 @@
#include "../../boolean.h" #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_windowed_fullscreen(Display *dpy, Window win);
void x11_suspend_screensaver(Window win); void x11_suspend_screensaver(Window win);
bool x11_enter_fullscreen(Display *dpy, unsigned width, unsigned height, XF86VidModeModeInfo *desktop_mode); bool x11_enter_fullscreen(Display *dpy, unsigned width, unsigned height, XF86VidModeModeInfo *desktop_mode);

View File

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

View File

@ -110,9 +110,8 @@ 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. // 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); bool (*write_egl_image)(const void *frame, unsigned width, unsigned height, unsigned pitch, bool rgb32, unsigned index, void **image_handle);
// Called after frame is rendered, but before swap. // Shows or hides mouse. Can be NULL if context doesn't have a concept of mouse pointer.
// Can be used to render context-specific overlays and stuff. void (*show_mouse)(bool state);
bool (*post_render)(void *gl);
// Human readable string. // Human readable string.
const char *ident; const char *ident;

View File

@ -1553,10 +1553,8 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
if (msg && gl->font_ctx) if (msg && gl->font_ctx)
gl->font_ctx->render_msg(gl, msg, NULL); gl->font_ctx->render_msg(gl, msg, NULL);
if (gl->ctx_driver->post_render)
context_post_render_func(gl);
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
else if (gl->overlay_enable) if (gl->overlay_enable)
gl_render_overlay(gl); gl_render_overlay(gl);
#endif #endif
@ -2354,6 +2352,8 @@ static void gl_overlay_enable(void *data, bool state)
{ {
gl_t *gl = (gl_t*)data; gl_t *gl = (gl_t*)data;
gl->overlay_enable = state; 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) 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) if (video->fullscreen)
{ {
x11_windowed_fullscreen(xv->display, xv->window); 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); xv->gc = XCreateGC(xv->display, xv->window, 0, 0);