mirror of
https://git.planet-casio.com/Lephenixnoir/JustUI.git
synced 2025-01-01 06:23:38 +01:00
jscene: poweroff upon SHIFT+AC/ON
This commit is contained in:
parent
4c44b3e413
commit
ef71bc11c0
2 changed files with 16 additions and 0 deletions
|
@ -33,6 +33,8 @@ typedef struct {
|
||||||
uint16_t lost_events;
|
uint16_t lost_events;
|
||||||
/* Whether jscene_run() returns to the main menu */
|
/* Whether jscene_run() returns to the main menu */
|
||||||
bool mainmenu;
|
bool mainmenu;
|
||||||
|
/* Whether jscene_run() powers off */
|
||||||
|
bool poweroff;
|
||||||
|
|
||||||
} jscene;
|
} jscene;
|
||||||
|
|
||||||
|
@ -110,6 +112,12 @@ bool jscene_process_event(jscene *scene, jevent event);
|
||||||
resources before invoking the main menu. */
|
resources before invoking the main menu. */
|
||||||
void jscene_set_mainmenu(jscene *scene, bool mainmenu);
|
void jscene_set_mainmenu(jscene *scene, bool mainmenu);
|
||||||
|
|
||||||
|
/* jscene_set_poweroff(): Set whether jscene_run() will poweroff
|
||||||
|
This type of poweroff (SHIFT+AC/ON) doesn't allow return to menu, so the
|
||||||
|
add-in "must" resume after powering on again, however sensitive programs
|
||||||
|
will probably want to save important data before leaving anyway. */
|
||||||
|
void jscene_set_poweroff(jscene *scene, bool poweroff);
|
||||||
|
|
||||||
/* jscene_run(): Run a scene's main loop
|
/* jscene_run(): Run a scene's main loop
|
||||||
|
|
||||||
This function implements a main control loop that sleeps when there is
|
This function implements a main control loop that sleeps when there is
|
||||||
|
|
|
@ -53,6 +53,7 @@ jscene *jscene_create(int x, int y, int w, int h, void *parent)
|
||||||
s->queue_next = 0;
|
s->queue_next = 0;
|
||||||
s->lost_events = 0;
|
s->lost_events = 0;
|
||||||
s->mainmenu = true;
|
s->mainmenu = true;
|
||||||
|
s->poweroff = true;
|
||||||
|
|
||||||
/* Prepare first layout/paint operation */
|
/* Prepare first layout/paint operation */
|
||||||
s->widget.dirty = 1;
|
s->widget.dirty = 1;
|
||||||
|
@ -225,6 +226,13 @@ jevent jscene_run(jscene *s)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(k.type == KEYEV_DOWN && k.key == KEY_ACON && k.shift && !k.alpha) {
|
||||||
|
if(s->poweroff) {
|
||||||
|
gint_poweroff(true);
|
||||||
|
jscene_queue_event(s, (jevent){ .type = JSCENE_PAINT });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
#ifdef FX9860G
|
#ifdef FX9860G
|
||||||
if(k.type == KEYEV_DOWN && k.key == KEY_OPTN && k.shift && !k.alpha) {
|
if(k.type == KEYEV_DOWN && k.key == KEY_OPTN && k.shift && !k.alpha) {
|
||||||
t6k11_backlight(-1);
|
t6k11_backlight(-1);
|
||||||
|
|
Loading…
Reference in a new issue