mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(Android) Implement 'focused' callback for androidegl_ctx
This commit is contained in:
parent
f42098013f
commit
a8d868f187
@ -21,6 +21,8 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CPU_FAMILY_UNKNOWN = 0,
|
||||
@ -82,6 +84,7 @@ struct android_app
|
||||
int msgread;
|
||||
int msgwrite;
|
||||
int running;
|
||||
bool unfocused;
|
||||
unsigned accelerometer_event_rate;
|
||||
const ASensor* accelerometerSensor;
|
||||
uint64_t sensor_state_mask;
|
||||
|
@ -176,8 +176,11 @@ static bool android_gfx_ctx_bind_api(void *data,
|
||||
|
||||
static bool android_gfx_ctx_has_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
|
||||
if (!android_app)
|
||||
return true;
|
||||
return (android_app->unfocused == true ) ? false : true;
|
||||
}
|
||||
|
||||
static bool android_gfx_ctx_suppress_screensaver(void *data, bool enable)
|
||||
|
@ -393,6 +393,10 @@ static void engine_handle_cmd(void)
|
||||
RETRO_SENSOR_ACCELEROMETER_ENABLE,
|
||||
android_app->accelerometer_event_rate);
|
||||
}
|
||||
slock_lock(android_app->mutex);
|
||||
android_app->unfocused = false;
|
||||
scond_broadcast(android_app->cond);
|
||||
slock_unlock(android_app->mutex);
|
||||
break;
|
||||
case APP_CMD_LOST_FOCUS:
|
||||
{
|
||||
@ -410,6 +414,10 @@ static void engine_handle_cmd(void)
|
||||
RETRO_SENSOR_ACCELEROMETER_DISABLE,
|
||||
android_app->accelerometer_event_rate);
|
||||
}
|
||||
slock_lock(android_app->mutex);
|
||||
android_app->unfocused = true;
|
||||
scond_broadcast(android_app->cond);
|
||||
slock_unlock(android_app->mutex);
|
||||
break;
|
||||
|
||||
case APP_CMD_DESTROY:
|
||||
|
Loading…
x
Reference in New Issue
Block a user