Commit cfeeb7a1 authored by Stefan Haun's avatar Stefan Haun
Browse files

Add fullscreen handling

parent 6d0ca58b
......@@ -56,6 +56,8 @@ typedef _Bool bool;
#define API_DISP_BACKLIGHT 0x2a
#define API_DISP_PRINT_ADV 0x2b
#define API_DISP_OVERLAY 0x2c
#define API_DISP_SET_FULLSCREEN 0x2d
#define API_DISP_IS_FULLSCREEN 0x2e
/* API_BATTERY_VOLTAGE 0x30 */
#define API_BATTERY_CURRENT 0x31
......@@ -1307,6 +1309,27 @@ union disp_framebuffer {
*/
API(API_DISP_OPEN, int epic_disp_open());
/**
* Enable/disable fullscreen mode.
*
* Fullscreen will disable the overlay display.
*
* :param enable: ``true`` to enable fullscreen mode
* :return: ``0`` on success or a negative value in case of an error:
*
* - ``-EBUSY``: Display was already locked from another task.
*/
API(API_DISP_SET_FULLSCREEN, int epic_disp_set_fullscreen(bool enable));
/**
* Return fullscreen status. No lock is required.
*
* Fullscreen will disable the overlay display.
*
* :return: ``true`` if fullscreen is enabled
*/
API(API_DISP_IS_FULLSCREEN, bool epic_disp_is_fullscreen());
/**
* Switch framebuffer to overlay.
*
......
......@@ -12,6 +12,7 @@
static TaskHandle_t lock = NULL;
static struct gfx_region *current_fb = &application_screen;
static bool fullscreen = false;
static int check_lock()
{
......@@ -207,7 +208,10 @@ int epic_disp_update()
return cl;
}
compositor();
if (!fullscreen) {
compositor();
}
gfx_update(&display_screen);
return 0;
}
......@@ -234,17 +238,36 @@ int epic_disp_open()
{
TaskHandle_t task = xTaskGetCurrentTaskHandle();
if (lock == task) {
current_fb = &application_screen;
current_fb = fullscreen ? &display_screen : &application_screen;
return 0;
} else if (lock == NULL) {
lock = task;
current_fb = &application_screen;
current_fb = fullscreen ? &display_screen : &application_screen;
return 0;
} else {
return -EBUSY;
}
}
int epic_disp_set_fullscreen(bool enable)
{
int cl = check_lock();
if (cl < 0) {
return cl;
}
fullscreen = enable;
current_fb = fullscreen ? &display_screen : &application_screen;
return 0;
}
bool epic_disp_is_fullscreen()
{
return fullscreen;
}
int epic_disp_overlay()
{
int cl = check_lock();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment