sh: slight cleanup of scheduled dupdate mechanism
Mostly renaming and integrating pe_dupdate() it with existing modules.
This commit is contained in:
parent
71ddfff567
commit
3e2f7f0aa0
|
@ -18,7 +18,6 @@
|
|||
#include <gint/keyboard.h>
|
||||
#include <gint/kmalloc.h>
|
||||
#include <gint/fs.h>
|
||||
#include <gint/timer.h>
|
||||
|
||||
#include <justui/jscene.h>
|
||||
#include <justui/jlabel.h>
|
||||
|
@ -56,14 +55,12 @@ struct pe_globals {
|
|||
|
||||
// TODO: Put pe_globals in a header for use by the loop hook in mpconfigport.h
|
||||
widget_shell *pe_shell;
|
||||
/* Whether a delayed dupdate has been scheduled asynchronously. */
|
||||
bool pe_dupdate_scheduled;
|
||||
|
||||
struct pe_globals PE = { 0 };
|
||||
|
||||
|
||||
// TODO : make this more clean by putting these globals into pe_globals and
|
||||
// making this accessible to modules
|
||||
bool is_refreshed_required = false;
|
||||
|
||||
//=== Hook for redirecting stdout/stderr to the shell ===//
|
||||
|
||||
static ssize_t stdouterr_write(void *data, void const *buf, size_t size)
|
||||
|
@ -178,13 +175,17 @@ void pe_enter_graphics_mode(void)
|
|||
PE.shell->widget.update = 0;
|
||||
}
|
||||
|
||||
void pe_refresh_graphics(void)
|
||||
void pe_schedule_dupdate(void)
|
||||
{
|
||||
pe_enter_graphics_mode();
|
||||
pe_dupdate_scheduled = true;
|
||||
}
|
||||
|
||||
void pe_dupdate(void)
|
||||
{
|
||||
/* refresh graphical output on request by setting
|
||||
is_refresh_graphics to true */
|
||||
dupdate();
|
||||
pe_debug_run_videocapture();
|
||||
is_refreshed_required = false;
|
||||
pe_dupdate_scheduled = false;
|
||||
}
|
||||
|
||||
void pe_draw(void)
|
||||
|
@ -205,8 +206,7 @@ void pe_draw(void)
|
|||
dsubimage(377, 207, &img_modifier_states, 16*icon, 0, 15, 14,
|
||||
DIMAGE_NONE);
|
||||
#endif
|
||||
dupdate();
|
||||
pe_debug_run_videocapture();
|
||||
pe_dupdate();
|
||||
}
|
||||
|
||||
//=== Application control functions ===//
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void pe_enter_graphics_mode(void);
|
||||
extern void pe_dupdate(void);
|
||||
|
||||
#ifdef FX9860G
|
||||
extern font_t font_4x4;
|
||||
extern font_t font_4x6;
|
||||
|
@ -70,10 +73,8 @@ static mp_obj_t init(void)
|
|||
|
||||
static mp_obj_t show_screen(void)
|
||||
{
|
||||
void pe_enter_graphics_mode(void);
|
||||
pe_enter_graphics_mode();
|
||||
dupdate();
|
||||
pe_debug_run_videocapture();
|
||||
pe_dupdate();
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
#include <gint/drivers/keydev.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void pe_enter_graphics_mode(void);
|
||||
extern void pe_enter_graphics_mode(void);
|
||||
extern void pe_dupdate(void);
|
||||
|
||||
#define FUN_0(NAME) \
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(modgint_ ## NAME ## _obj, modgint_ ## NAME)
|
||||
|
@ -230,8 +231,7 @@ STATIC mp_obj_t modgint_dclear(mp_obj_t arg1)
|
|||
STATIC mp_obj_t modgint_dupdate(void)
|
||||
{
|
||||
pe_enter_graphics_mode();
|
||||
dupdate();
|
||||
pe_debug_run_videocapture();
|
||||
pe_dupdate();
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,11 +109,11 @@ void pe_after_python_exec(
|
|||
/* Command executed regularly during execution */
|
||||
extern void pe_draw(void);
|
||||
extern widget_shell *pe_shell;
|
||||
extern void pe_refresh_graphics(void);
|
||||
extern bool is_refreshed_required;
|
||||
extern void pe_dupdate(void);
|
||||
extern bool pe_dupdate_scheduled;
|
||||
#define MICROPY_VM_HOOK_LOOP \
|
||||
{ if(pe_shell->widget.update) pe_draw(); \
|
||||
if(is_refreshed_required) pe_refresh_graphics(); }
|
||||
if(pe_dupdate_scheduled) pe_dupdate(); }
|
||||
|
||||
/* extra built in names to add to the global namespace
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
|
|
|
@ -15,10 +15,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void pe_schedule_dupdate(void);
|
||||
|
||||
extern font_t numworks;
|
||||
|
||||
static bool is_dwindowed;
|
||||
extern bool is_refreshed_required;
|
||||
|
||||
#define NW_MAX_X 320
|
||||
#define NW_MAX_Y 222
|
||||
|
@ -57,7 +58,7 @@ extern bool is_refreshed_required;
|
|||
// There are possibly some others to be listed correctly
|
||||
|
||||
static int callback(void) {
|
||||
is_refreshed_required = true;
|
||||
pe_schedule_dupdate();
|
||||
return TIMER_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue