Implement rgui_environ - framebuffer will update itself when mouse
is active
This commit is contained in:
parent
02dfda3ad3
commit
4d77dacbe5
|
@ -61,6 +61,7 @@ typedef struct
|
||||||
unsigned last_width;
|
unsigned last_width;
|
||||||
unsigned last_height;
|
unsigned last_height;
|
||||||
float scroll_y;
|
float scroll_y;
|
||||||
|
bool mouse_show;
|
||||||
} rgui_t;
|
} rgui_t;
|
||||||
|
|
||||||
static uint16_t *rgui_framebuf_data = NULL;
|
static uint16_t *rgui_framebuf_data = NULL;
|
||||||
|
@ -369,14 +370,12 @@ end:
|
||||||
|
|
||||||
static void rgui_blit_cursor(void)
|
static void rgui_blit_cursor(void)
|
||||||
{
|
{
|
||||||
size_t fb_pitch;
|
int16_t x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
|
||||||
unsigned fb_width, fb_height;
|
int16_t y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
|
||||||
int16_t x = menu_input_mouse_state(MENU_MOUSE_X_AXIS);
|
|
||||||
int16_t y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
|
|
||||||
|
|
||||||
fb_width = menu_display_get_width();
|
unsigned fb_width = menu_display_get_width();
|
||||||
fb_height = menu_display_get_height();
|
unsigned fb_height = menu_display_get_height();
|
||||||
fb_pitch = menu_display_get_framebuffer_pitch();
|
size_t fb_pitch = menu_display_get_framebuffer_pitch();
|
||||||
|
|
||||||
rgui_color_rect(fb_pitch, fb_width, fb_height, x, y - 5, 1, 11, 0xFFFF);
|
rgui_color_rect(fb_pitch, fb_width, fb_height, x, y - 5, 1, 11, 0xFFFF);
|
||||||
rgui_color_rect(fb_pitch, fb_width, fb_height, x - 5, y, 11, 1, 0xFFFF);
|
rgui_color_rect(fb_pitch, fb_width, fb_height, x - 5, y, 11, 1, 0xFFFF);
|
||||||
|
@ -636,11 +635,15 @@ static void rgui_render(void *data)
|
||||||
rgui->force_redraw = true;
|
rgui->force_redraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings->menu.mouse.enable
|
if (rgui->mouse_show)
|
||||||
&& (settings->video.fullscreen
|
{
|
||||||
|| !video_driver_has_windowed())
|
settings_t *settings = config_get_ptr();
|
||||||
)
|
bool cursor_visible = settings->video.fullscreen ||
|
||||||
rgui_blit_cursor();
|
!video_driver_has_windowed();
|
||||||
|
|
||||||
|
if (settings->menu.mouse.enable && cursor_visible)
|
||||||
|
rgui_blit_cursor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgui_framebuffer_free(void)
|
static void rgui_framebuffer_free(void)
|
||||||
|
@ -812,15 +815,28 @@ static void rgui_populate_entries(void *data,
|
||||||
static int rgui_environ(enum menu_environ_cb type,
|
static int rgui_environ(enum menu_environ_cb type,
|
||||||
void *data, void *userdata)
|
void *data, void *userdata)
|
||||||
{
|
{
|
||||||
|
rgui_t *rgui = (rgui_t*)userdata;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0:
|
case MENU_ENVIRON_ENABLE_MOUSE_CURSOR:
|
||||||
|
if (!rgui)
|
||||||
|
return -1;
|
||||||
|
rgui->mouse_show = true;
|
||||||
|
menu_display_set_framebuffer_dirty_flag();
|
||||||
break;
|
break;
|
||||||
|
case MENU_ENVIRON_DISABLE_MOUSE_CURSOR:
|
||||||
|
if (!rgui)
|
||||||
|
return -1;
|
||||||
|
rgui->mouse_show = false;
|
||||||
|
menu_display_unset_framebuffer_dirty_flag();
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
default:
|
default:
|
||||||
return -1;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rgui_pointer_tap(void *data,
|
static int rgui_pointer_tap(void *data,
|
||||||
|
|
Loading…
Reference in New Issue