Package release ZIPs, streamline docs, and backport X11 DPMS/lock fixes
- Streamline README, INSTALL, MANUAL, ARCHITECTURE, and POWER-OPTIMIZATION docs - Add release ZIP packager (package-image.sh, scripts/package-release-zip.py, rebuild-image.sh --package) with sanitized rootfs, SHA256SUMS, and FLASH-INSTRUCTIONS.txt - Add automatic offline MT6797 firmware ext4 injection in flash-mtk.py and scripts/extract-vendor-fw.py - Backport X11 DPMS wake + XResetScreenSaver in geminux-powerd and _GEMINUX_LOCK_READY + grab-first sync in geminux-lock, rebuild aarch64 prebuilts, and expand tests
This commit is contained in:
1 parent
5472d4273a
commit
180d0a91e6
18 files changed
+1242
-480
No files matched your search
@@ -10,6 +10,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#define HIT_UNLOCK 1
|
||||
#define HIT_CLEAR 2
|
||||
@@ -24,7 +25,10 @@ typedef struct {
|
||||
int last_yday;
|
||||
int timer_ms;
|
||||
int ready_fd;
|
||||
int ready_wait_ms;
|
||||
bool grabbed;
|
||||
bool drawn;
|
||||
bool ready_published;
|
||||
bool checking;
|
||||
} lock_state_t;
|
||||
|
||||
@@ -99,25 +103,45 @@ static void attempt_unlock(lock_state_t *st) {
|
||||
gemui_request_redraw(st->app);
|
||||
}
|
||||
|
||||
static void on_timer(gemui_app_t *app, void *ud) {
|
||||
lock_state_t *st = ud;
|
||||
static void publish_lock_ready(lock_state_t *st) {
|
||||
if (!st->ready_published) {
|
||||
Display *dpy = gemui_display(st->app);
|
||||
Window win = gemui_window(st->app);
|
||||
if (dpy && win) {
|
||||
Atom ready_atom = XInternAtom(dpy, "_GEMINUX_LOCK_READY", False);
|
||||
unsigned long val = 1UL;
|
||||
XChangeProperty(dpy, win, ready_atom, XA_CARDINAL, 32, PropModeReplace,
|
||||
(const unsigned char *)&val, 1);
|
||||
XSync(dpy, False);
|
||||
}
|
||||
st->ready_published = true;
|
||||
}
|
||||
if (st->ready_fd >= 0) {
|
||||
ssize_t wr = write(st->ready_fd, "1", 1);
|
||||
(void)wr;
|
||||
close(st->ready_fd);
|
||||
st->ready_fd = -1;
|
||||
int next_ms = st->grabbed ? 15000 : 250;
|
||||
if (st->timer_ms != next_ms) {
|
||||
st->timer_ms = next_ms;
|
||||
gemui_set_timer_ms(app, next_ms, on_timer, st);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void on_timer(gemui_app_t *app, void *ud) {
|
||||
lock_state_t *st = ud;
|
||||
if (!st->grabbed) {
|
||||
st->grabbed = gemui_grab_input(app);
|
||||
if (st->grabbed && st->timer_ms != 15000) {
|
||||
st->timer_ms = 15000;
|
||||
gemui_set_timer_ms(app, 15000, on_timer, st);
|
||||
}
|
||||
if (st->ready_fd >= 0) {
|
||||
st->ready_wait_ms += st->timer_ms;
|
||||
if ((st->drawn && (st->grabbed || st->ready_wait_ms >= 600)) ||
|
||||
st->ready_wait_ms >= 1500) {
|
||||
publish_lock_ready(st);
|
||||
}
|
||||
} else if (!st->ready_published && st->drawn && st->grabbed) {
|
||||
publish_lock_ready(st);
|
||||
}
|
||||
int next_ms = (st->ready_fd >= 0) ? 25 : (st->grabbed ? 15000 : 250);
|
||||
if (st->timer_ms != next_ms) {
|
||||
st->timer_ms = next_ms;
|
||||
gemui_set_timer_ms(app, next_ms, on_timer, st);
|
||||
}
|
||||
char prev_bat[96];
|
||||
snprintf(prev_bat, sizeof(prev_bat), "%s", st->bat_text);
|
||||
@@ -134,6 +158,7 @@ static void on_timer(gemui_app_t *app, void *ud) {
|
||||
|
||||
static void on_draw(gemui_app_t *app, cairo_t *cr, int w, int h, void *ud) {
|
||||
lock_state_t *st = ud;
|
||||
st->drawn = true;
|
||||
const gemui_theme_t *t = gemui_theme(app);
|
||||
|
||||
gemui_fill_rect(cr, (gemui_rect_t){0, 0, w, h}, t->bg_main);
|
||||
@@ -242,10 +267,12 @@ int main(void) {
|
||||
|
||||
gemui_handlers_t h = { .on_draw = on_draw, .on_key = on_key, .on_ptr = on_ptr };
|
||||
gemui_set_handlers(st.app, &h, &st);
|
||||
/* Signal readiness after the first on_draw + XFlush completes on Xorg. */
|
||||
st.timer_ms = (st.ready_fd >= 0) ? 20 : (st.grabbed ? 15000 : 250);
|
||||
/* Signal readiness after first draw + input grab completes on Xorg. */
|
||||
st.timer_ms = (st.ready_fd >= 0) ? 25 : (st.grabbed ? 15000 : 250);
|
||||
gemui_set_timer_ms(st.app, st.timer_ms, on_timer, &st);
|
||||
int rc = gemui_run(st.app);
|
||||
volatile unsigned char *pw_wipe = (volatile unsigned char *)st.password;
|
||||
for (size_t i = 0; i < sizeof(st.password); i++) pw_wipe[i] = 0;
|
||||
gemui_ungrab_input(st.app);
|
||||
gemui_destroy(st.app);
|
||||
return rc;
|
||||
|
||||
Reference in new issue
Block a user