Optimize kernel-to-userspace battery life across CAMSS, SPI runtime PM, dwm, NeoUI, and plugins

This commit is contained in:
Luxferre committed 2026-11-01 11:56:28 +02:00
1 parent f112b6ae72
commit 456d3fbc42
60 files changed
+409 -91

No files matched your search

+5 -2
View File
@@ -56,9 +56,12 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
- Added a dedicated **Ringtone Viewer (`RingtoneView`)** to **file manager (`xfiles`)** for `.nrt`, `.rtttl`, `.rtx`, `.emy`, and `.imy` files, displaying melody metadata, a graphical piano-roll pitch contour, a scrollable note sequence, live audio preview (`*` / `Center OK`), `Left`/`Right` folder stepping, **Left softkey (`Set Ring`)** to set as the call ringtone, **`#`** to set as the notification/SMS sound, and **Actions** menu items (`Preview Ringtone`, `Set as Ringtone`, `Set as Notif / SMS Sound`, `Open in Ringtones App`, `Play in Music Player`, `View Ringtone Text`, `Edit in Text Editor`), plus `.nrt`/`.rtttl`/`.rtx`/`.emy`/`.imy` playback in `xmusic`.
- Expanded **ringtones manager (`xringtones`)** to 3 tabs (`1:Ringtone`, `2:Notif/SMS`, `3:Settings`, plus `xringtones --notif` and **Notification Sound** in the `Notifs` menu) with a dedicated **Notification / SMS Sound** configuration (`~/.config/sxmo/notif_sound` and `SXMO_TEXTSOUND` in `~/.config/sxmo/ringsettings`, including `None (Mute Sound)`) wired directly into the system notification manager (`sxmo_notifs.sh`, `sxmo_hook_notification.sh`, `sxmo_hook_sms.sh`, `xirc`, and `xtox`) and incoming call ringer (`sxmo_hook_ring.sh`).
- **Battery and idle power optimizations**:
- Added `msm8905_cam_hw_deinit()` to the rear camera kernel driver (`src/msm8905-cam/msm8905-cam.c`) and wired it into `streamoff`, last-file-handle `release`, and module `exit` so closing `xcamera` (or stopping V4L2 streaming) immediately stops the CSI-2 stream, asserts sensor hardware standby (`GPIO_CAM_RESET=0`, `GPIO_CAM_STANDBY=0`, `GPIO_CAM_VDIG=0`, `GPIO_CAM_MCLK0=0x0001`), gates all 20 `CAMSS` `CBCR` branch clocks and 6 `RCG` roots (`200 MHz` `vfe0` / `csi0` / `camss_top_ahb` and `24 MHz` `mclk0`), releases `SMMU` vote clocks, and powers down the `VFE GDSC` domain.
- Enabled `workqueue.power_efficient=Y` and `printk.console_suspend=Y` in `/etc/local.d/10-power-save.start`, lowered `78b9000.spi` runtime PM `autosuspend_delay_ms` from `1000 ms` to `50 ms`, enabled runtime PM (`power/control=auto`) across `1c00000.gpu`, `*.spi`, `*.sdhci`, and `*.serial`, and removed the legacy `ttyMSM0` serial `getty` rule from `scripts/configure-rootfs-from-scratch.sh`.
- Added VM writeback (`dirty_writeback_centisecs=6000`), `printk` throttling, `sched_autogroup_enabled=0`, `nmi_watchdog=0`, `schedutil` governor rate-limit tuning (`rate_limit_us=2000`, fixing the 6.44s default caused by `qcom-cpufreq` `UINT_MAX` transition latency so cores downclock to `200 MHz` within `2 ms`), Wi-Fi powersave (`iw dev wlan0 set power_save on`), USB/platform runtime PM (`power/control = auto`), and automatic unbinding of the `7864900.sdhci` microSD host controller when no card is inserted (along with `bias-pull-up` on `sdc2-cd-off-state` and unified Adreno 304 GPU / IOMMU device-tree nodes across all 5 device `.dts`/`.dtb` files).
- Replaced the 120ms busy-wait loop in `gps.so` (`OsmTileCache::workerLoop`) with `std::condition_variable`, cached Dual-SIM status in `/tmp/sxmo_dsds_active` to avoid repeated `qmicli` wakes on single-SIM setups, increased the DSDS idle `select()` timeout to `300s`, and set display framebuffer `bl_power = 4` (`FB_BLANK_POWERDOWN`) whenever the screen is blanked.
- Increased `conky` desktop clock refresh interval to `15.0s` and froze `conky` (`SIGSTOP`/`SIGCONT`) whenever the screen is off or locked, replaced polling in `sxmo_modemmonitor.sh` with event-driven `dbus-monitor`, skipped redundant `sxmo_hook_statusbar.sh` updates while `screenoff` or locked, and drained queued X11 `UnmapNotify` events in `neoui_hide()` so all resident DWM plugins sleep at `0%` CPU when hidden.
- Replaced the 120ms busy-wait loop in `gps.so` (`OsmTileCache::workerLoop`) with `std::condition_variable`, cached Dual-SIM status in `/tmp/sxmo_dsds_active` to avoid repeated `qmicli` wakes on single-SIM setups, set the DSDS `msm-modem-uim-selection` `select()` timeout to infinite (`None`, pure `AF_QIPCRTR` event-driven wait) while the screen is locked and `600s` when unlocked, and set display framebuffer `bl_power = 4` (`FB_BLANK_POWERDOWN`) across `dwm`, `locker.so`, and `sxmo_wm.sh` whenever the screen is blanked.
- Added `neoui_next_timeout_ms()` to `libneoui.so`, wired GLib `GMainContext` file descriptors and `"load-failed"` / `closeWindow()` load-stop handling into `webarchy.so` (along with `NO_AT_BRIDGE=1` and `GTK_A11Y=none`), added `inotify` directory watching to `sms.so`, and eliminated idle periodic `poll()` timers across `dialer.so`, `calllog.so`, `contacts.so`, `sms.so`, `xdrawer.so`, `locker.so`, `email.so`, `irc.so`, `smallweb.so`, `tox.so`, `sip.so`, and `webarchy.so` so visible and background plugins sleep at `0%` CPU unless a transient timer (`softkey` chord, multi-tap window, or toast expiry) is active.
- Increased `conky` desktop clock refresh interval to `15.0s` and froze `conky` (`SIGSTOP`/`SIGCONT`) whenever the screen is off or locked (`sxmo_hook_screenoff.sh`, `sxmo_hook_lock.sh`, `dwm`, and `locker.so`), skipped `dwm` `drawbar()` Xorg/Glamor/SPI redraws and `sxmo_hook_statusbar.sh` process spawns whenever `bl_power != 0` or `/tmp/bananarchy_screen_locked` exists (with immediate bar refresh on wake/unlock), wrapped background spawns in double-fork subshells `( ... & )` across `bananarchy-x11-session.sh`, `sxmo_modemmonitor.sh`, `sxmo_hook_start.sh`, `sxmo_hook_postwake.sh`, and `msm-modem-uim-selection` to eliminate zombie child accumulation, and drained queued X11 `UnmapNotify` events in `neoui_hide()` so all resident DWM plugins sleep at `0%` CPU when hidden.
- **Universal Power button (`dmenu power`) access and ReMEdy `Call (green)` pause menu**:
- Updated `dwm`, `dmenu`, `xdrawer`, `libneoui.so`, `sxmo_multikey.sh`, all standalone Xlib DWM plugins, and standalone games (`scoundrel`, `gambatte`, `remedy`) so pressing **End / Power (red)** (`XF86PowerOff`, keycode `124`) from any active window or menu immediately opens (or toggles) the system **Power menu (`dmenu power`)** while mapped **Call (green)** (`XF86Phone` / `XF86PickupPhone`) and `500 ms` **Right softkey** hold in `remedy` open the **ReMEdy Pause Menu**.
+1
View File
@@ -272,6 +272,7 @@ int neoui_clear_toast(void);
#### Event loop, keypad, and multi-tap input
```c
int neoui_poll_event(int timeout_ms);
int neoui_next_timeout_ms(int default_timeout_ms);
int neoui_event_key(void);
int neoui_event_keycode(void);
int neoui_event_keysym(void);
@@ -12,6 +12,22 @@ fi
{ echo 6000 > /proc/sys/vm/dirty_expire_centisecs; } 2>/dev/null || true
{ echo 0 > /proc/sys/kernel/nmi_watchdog; } 2>/dev/null || true
{ echo "1 4 1 4" > /proc/sys/kernel/printk; } 2>/dev/null || true
{ echo Y > /sys/module/workqueue/parameters/power_efficient; } 2>/dev/null || true
{ echo Y > /sys/module/printk/parameters/console_suspend; } 2>/dev/null || true
# Lower SPI controller (78b9000.spi) runtime PM autosuspend from 1000 ms to 50 ms
# and ensure runtime PM auto-suspend is enabled across SoC buses
for spi_dev in /sys/devices/platform/soc@0/*.spi; do
if [ -d "$spi_dev/power" ]; then
{ echo 50 > "$spi_dev/power/autosuspend_delay_ms"; } 2>/dev/null || true
{ echo auto > "$spi_dev/power/control"; } 2>/dev/null || true
fi
done
for pm_dev in /sys/devices/platform/soc@0/1c00000.gpu /sys/devices/platform/soc@0/*.sdhci /sys/devices/platform/soc@0/*.serial /sys/devices/platform/soc@0/*.serial/*; do
if [ -w "$pm_dev/power/control" ]; then
{ echo auto > "$pm_dev/power/control"; } 2>/dev/null || true
fi
done
# Tune CPUFreq schedutil governor for rapid downclocking to 200 MHz at idle
# (qcom-cpufreq reports transition_latency=UINT_MAX, causing schedutil rate_limit_us
@@ -115,7 +115,7 @@ trap 'rm -f "$SESSION_PID_FILE"; pkill -P $$ >/dev/null 2>&1 || true; exit 0' IN
pkill -9 -x conky >/dev/null 2>&1 || true
rm -rf /tmp/sxmo_conky_time_state /tmp/sxmo_conky_restart.lock
DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
sxmo_hook_start.sh >/tmp/sxmo_hook_start.log 2>&1 </dev/null &
( sxmo_hook_start.sh >/tmp/sxmo_hook_start.log 2>&1 </dev/null & )
first_iter=1
while [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" = "$$" ]; do
@@ -140,14 +140,14 @@ while [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" = "$$" ]; do
*) WP_FLAG="--bg-fill" ;;
esac
fi
feh --no-fehbg "$WP_FLAG" "$WP_FILE" >/dev/null 2>&1 </dev/null &
( feh --no-fehbg "$WP_FLAG" "$WP_FILE" >/dev/null 2>&1 </dev/null & )
if [ "$first_iter" = "0" ]; then
pkill -x conky >/dev/null 2>&1 || true
sleep 0.05
pkill -9 -x conky >/dev/null 2>&1 || true
rm -rf /tmp/sxmo_conky_time_state /tmp/sxmo_conky_restart.lock
DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
pidof -s fcitx5 >/dev/null 2>&1 || superctl start fcitx5 >/dev/null 2>&1 || /usr/bin/bananarchy-fcitx5.sh </dev/null &
pidof -s fcitx5 >/dev/null 2>&1 || superctl start fcitx5 >/dev/null 2>&1 || ( /usr/bin/bananarchy-fcitx5.sh </dev/null & )
fi
first_iter=0
dwm >/tmp/dwm.log 2>&1 || true
Binary file not shown.
+8 -6
View File
@@ -93,36 +93,38 @@ mainloop() {
while read -r line; do
case "$line" in
signal*"interface=org.freedesktop.ModemManager1.Modem.Voice"*"member=CallAdded"*)
sxmo_modem.sh checkforincomingcalls &
( sxmo_modem.sh checkforincomingcalls & )
;;
signal*"interface=org.freedesktop.ModemManager1.Modem.Messaging"*"member=Added"*)
sxmo_modem.sh checkfornewtexts &
( sxmo_modem.sh checkfornewtexts & )
;;
signal*"path=/org/freedesktop/ModemManager1/SMS/"*"member=PropertiesChanged"*)
sxmo_modem.sh checkfornewtexts &
( sxmo_modem.sh checkfornewtexts & )
;;
signal*"path=/org/freedesktop/ModemManager1/Call/"*"member=PropertiesChanged"*)
sxmo_modem.sh checkforfinishedcalls &
( sxmo_modem.sh checkforfinishedcalls & )
;;
signal*"interface=org.freedesktop.ModemManager1.Modem;"*"member=StateChanged"*)
read -r oldstate || true
read -r newstate || true
read -r reason || true
(
(
sxmo_hook_modem.sh "$(statenumtoname "$oldstate")" \
"$(statenumtoname "$newstate")" \
"$(echo "$reason" | sed 's/uint32 //')"
sxmo_hook_statusbar.sh modem
) &
)
;;
signal*"path=/org/freedesktop/ModemManager1/Modem/"*"member=PropertiesChanged"*)
MODEM="$(echo "$line" | awk -F'[;=]' '{print $6}')"
;;
*"string \"NetworkNotification\""*)
[ -n "${MODEM:-}" ] && sxmo_ussd.sh "$MODEM" "NetworkNotification" "" &
[ -n "${MODEM:-}" ] && ( sxmo_ussd.sh "$MODEM" "NetworkNotification" "" & )
;;
*"string \"NetworkRequest\""*)
[ -n "${MODEM:-}" ] && sxmo_ussd.sh "$MODEM" "NetworkRequest" "" &
[ -n "${MODEM:-}" ] && ( sxmo_ussd.sh "$MODEM" "NetworkRequest" "" & )
;;
esac
done &
+3
View File
@@ -46,6 +46,9 @@ xorgdisplay() {
if [ -w /sys/class/backlight/backlight/brightness ]; then
printf '0\n' > /sys/class/backlight/backlight/brightness 2>/dev/null || true
fi
if [ -w /sys/class/backlight/backlight/bl_power ]; then
printf '4\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true
fi
xset s off s noblank >/dev/null 2>&1 || true
;;
on)
+1
View File
@@ -281,6 +281,7 @@ int neoui_clear_toast(void);
// 5. Event Loop, Keypad & Multi-Tap Input Management
// ---------------------------------------------------------------------------
int neoui_poll_event(int timeout_ms);
int neoui_next_timeout_ms(int default_timeout_ms);
int neoui_event_key(void);
int neoui_event_keycode(void);
int neoui_event_keysym(void);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2052,6 +2052,12 @@ PY
exec python3 - << 'PY'
import datetime, os, select, socket, struct, subprocess, sys, time
try:
while os.waitpid(-1, os.WNOHANG)[0] > 0:
pass
except Exception:
pass
AF_QIPCRTR = 42
QRTR_PORT_CTRL = 0xfffffffe
QRTR_TYPE_NEW_SERVER = 4
@@ -2187,12 +2193,16 @@ def run_user_cmd(cmd_str, extra_env=None):
env["PATH"] = "/usr/share/sxmo/default_hooks:/usr/bin:/bin:/usr/sbin:/sbin"
if extra_env:
env.update(extra_env)
subprocess.Popen(
["su", "-m", "user", "-c", f"export DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/10000 HOME=/home/user PATH=/usr/share/sxmo/default_hooks:/usr/bin:/bin:/usr/sbin:/sbin; {cmd_str}"],
try:
p = subprocess.Popen(
["su", "-m", "user", "-c", f"export DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/10000 HOME=/home/user PATH=/usr/share/sxmo/default_hooks:/usr/bin:/bin:/usr/sbin:/sbin; ({cmd_str}) >/dev/null 2>&1 &"],
env=env,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
p.wait(timeout=2.0)
except Exception:
pass
def send_fifo(fifo_path, line):
try:
@@ -2795,8 +2805,10 @@ while True:
poll_timeout = 1.0
elif multipart_buf:
poll_timeout = 2.0
elif os.path.exists("/tmp/bananarchy_screen_locked"):
poll_timeout = None
else:
poll_timeout = 300.0
poll_timeout = 600.0
r, _, _ = select.select([ws, vs], [], [], poll_timeout)
got_voice_ind = False
events = []
@@ -15,6 +15,7 @@ cur_state=""
[ "$cur_state" = "unlock" ] && exit 0
printf '1\n' > /tmp/bananarchy_screen_locked
pkill -STOP -x conky 2>/dev/null || true
if [ -z "$SXMO_DISABLE_LEDS" ]; then
sxmo_led.sh blink red blue &
@@ -10,11 +10,11 @@
. sxmo_common.sh
# Create xdg user directories, such as ~/Pictures
[ -d "$HOME/Pictures" ] || xdg-user-dirs-update &
[ -d "$HOME/Pictures" ] || ( xdg-user-dirs-update & )
# Ensure fontconfig cache is valid without forcing a full rescan on every boot
if command -v fc-cache > /dev/null && [ -z "$(ls -A /var/cache/fontconfig 2>/dev/null)" ]; then
fc-cache >/dev/null 2>&1 &
( fc-cache >/dev/null 2>&1 & )
fi
if ! superctl status > /dev/null 2>&1; then
@@ -45,11 +45,13 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
# monitor for headphone for statusbar
superctl start sxmo_soundmonitor
(
(
sleep 1
sxmo_audio.sh device apply >/dev/null 2>&1 || true
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
) &
)
fi
# Periodically update some status bar components
@@ -101,7 +103,7 @@ fi
pidof -s conky >/dev/null 2>&1 || DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
if [ -f /tmp/bananarchy_screen_locked ]; then
pkill -STOP -x conky 2>/dev/null || true
xlocker wake >/dev/null 2>&1 &
( xlocker wake >/dev/null 2>&1 & )
fi
# It watch network changes and update the status bar icon by example
@@ -112,6 +114,8 @@ superctl start sxmo_notificationmonitor
# Pre-warm app and script menu caches in background
(
(
sxmo_hook_apps.sh >/dev/null 2>&1 || true
sxmo_hook_scripts.sh >/dev/null 2>&1 || true
) &
) &
)
@@ -501,27 +501,43 @@ set_inputmethod() {
sxmobar -a input-method 5 "$im_mode"
}
is_screen_dark() {
_st=""
[ -r "$SXMO_STATE" ] && { read -r _st < "$SXMO_STATE" 2>/dev/null || true; }
_bl=1
[ -r /sys/class/backlight/backlight/brightness ] && { read -r _bl < /sys/class/backlight/backlight/brightness 2>/dev/null || _bl=1; }
if [ "$_st" = "screenoff" ] || [ "${_bl:-1}" -le 0 ] 2>/dev/null; then
return 0
fi
return 1
}
sxmo_debug "$@"
case "$1" in
network)
is_screen_dark && exit 0
shift
set_network "$@"
;;
battery)
is_screen_dark && exit 0
shift
set_battery "$@"
;;
time)
is_screen_dark && exit 0
set_time 1
;;
modem|volume|state|notifications|notch|inputmethod)
modem|volume)
is_screen_dark && exit 0
set_"$1"
;;
state|notifications|notch|inputmethod)
set_"$1"
;;
state_change)
set_state
cur_st=""
[ -r "$SXMO_STATE" ] && { read -r cur_st < "$SXMO_STATE" 2>/dev/null || true; }
if [ "$cur_st" != "screenoff" ]; then
if ! is_screen_dark; then
set_time
set_inputmethod
if [ -z "$SXMO_NO_MODEM" ]; then
@@ -532,10 +548,7 @@ case "$1" in
fi
;;
periodics) # 60 s loop
cur_st=""
[ -r "$SXMO_STATE" ] && { read -r cur_st < "$SXMO_STATE" 2>/dev/null || true; }
cur_bl="$(cat /sys/class/backlight/backlight/brightness 2>/dev/null || echo 1)"
if [ "$cur_st" = "screenoff" ] || [ "${cur_bl:-1}" -le 0 ] 2>/dev/null || [ -f /tmp/bananarchy_screen_locked ]; then
if is_screen_dark || [ -f /tmp/bananarchy_screen_locked ]; then
exit 0
fi
set_time
@@ -569,6 +582,6 @@ case "$1" in
;;
esac
if [ "${SXMO_WM:-dwm}" = "dwm" ] && command -v xsetroot >/dev/null 2>&1; then
if ! is_screen_dark && [ "${SXMO_WM:-dwm}" = "dwm" ] && command -v xsetroot >/dev/null 2>&1; then
DISPLAY="${DISPLAY:-:0}" xsetroot -name "$(sxmo_status.sh)" 2>/dev/null || true
fi
@@ -15,6 +15,7 @@ fi
sxmo_wm.sh display on
pkill -CONT -x conky 2>/dev/null || true
( sxmo_hook_statusbar.sh state_change >/dev/null 2>&1 & )
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
sxmo_wm.sh inputevent touchscreen on
fi
Binary file not shown.
Binary file not shown.
+1
View File
@@ -281,6 +281,7 @@ int neoui_clear_toast(void);
// 5. Event Loop, Keypad & Multi-Tap Input Management
// ---------------------------------------------------------------------------
int neoui_poll_event(int timeout_ms);
int neoui_next_timeout_ms(int default_timeout_ms);
int neoui_event_key(void);
int neoui_event_keycode(void);
int neoui_event_keysym(void);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-4
View File
@@ -235,10 +235,6 @@ EOF
touch "$ROOTFS/run/openrc/shutdowntime"
dbus-uuidgen --ensure="$ROOTFS/etc/machine-id"
if grep -q "^#ttyS0::respawn:/sbin/getty" "$ROOTFS/etc/inittab"; then
sed -i 's|^#ttyS0::respawn:/sbin/getty.*|ttyMSM0::respawn:/sbin/getty -L 115200 ttyMSM0 vt100|' "$ROOTFS/etc/inittab"
fi
for mod in panel_mipi_dbi leds_msm8905_torch msm8905-cam; do
if ! grep -qx "$mod" "$ROOTFS/etc/modules" 2>/dev/null; then
echo "$mod" >> "$ROOTFS/etc/modules"
+9 -2
View File
@@ -1079,9 +1079,16 @@ int calllog_run_main(int argc, char** argv) {
int timeoutMs = -1;
if (visible) {
timeoutMs = 200;
if (!initialSoftkeysReleased) {
timeoutMs = 40;
}
if (softkeyDeadlineMs > 0) {
timeoutMs = static_cast<int>(std::max<int64_t>(5, softkeyDeadlineMs - nowMs()));
int rem = static_cast<int>(std::max<int64_t>(5, softkeyDeadlineMs - nowMs()));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (!toastMsg.empty() && toastUntilMs > 0) {
int rem = static_cast<int>(std::max<int64_t>(5, toastUntilMs - nowMs()));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
}
+20 -6
View File
@@ -1712,20 +1712,34 @@ int runContactsApp(int argc, char** argv) {
render();
}
if (visible && !statusMsg.empty() && statusUntilMs > 0 &&
nowMs() >= statusUntilMs) {
statusMsg.clear();
statusUntilMs = 0;
render();
}
int timeoutMs = -1;
if (visible) {
timeoutMs = 200;
if (!initialSoftkeysReleased) {
timeoutMs = 40;
}
if (softkeyDeadlineMs > 0) {
timeoutMs =
int rem =
static_cast<int>(std::max<int64_t>(5, softkeyDeadlineMs - nowMs()));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (zeroHeld) {
int64_t rem = 420 - (nowMs() - zeroPressMs);
timeoutMs = std::min(timeoutMs, static_cast<int>(std::max<int64_t>(5, rem)));
int rem = static_cast<int>(std::max<int64_t>(5, 420 - (nowMs() - zeroPressMs)));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (mode == ViewMode::Edit && lastTapDigit != -1) {
int64_t rem = 851 - (nowMs() - lastTapMs);
timeoutMs = std::min(timeoutMs, static_cast<int>(std::max<int64_t>(5, rem)));
int rem = static_cast<int>(std::max<int64_t>(5, 851 - (nowMs() - lastTapMs)));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (!statusMsg.empty() && statusUntilMs > 0) {
int rem = static_cast<int>(std::max<int64_t>(5, statusUntilMs - nowMs()));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
}
+9 -4
View File
@@ -1037,11 +1037,16 @@ int dialer_run_main(int argc, char** argv) {
int timeoutMs = -1;
if (visible) {
timeoutMs = 200;
if (!initialSoftkeysReleased) {
timeoutMs = 40;
}
if (softkeyDeadlineMs > 0) {
timeoutMs = static_cast<int>(std::max<int64_t>(5, softkeyDeadlineMs - nowMs()));
} else if (zeroHeld) {
timeoutMs = 25;
int rem = static_cast<int>(std::max<int64_t>(5, softkeyDeadlineMs - nowMs()));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (zeroHeld) {
int rem = static_cast<int>(std::max<int64_t>(5, 420 - (nowMs() - zeroPressMs)));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
}
+1 -1
View File
@@ -1093,7 +1093,7 @@ int email_run_main(int argc, char** argv) {
struct pollfd pfds[2] {};
pfds[0] = { ConnectionNumber(neo.dpy), POLLIN, 0 };
pfds[1] = { fifoFd, POLLIN, 0 };
int timeoutMs = visible ? (neoui_input_is_tap_active() ? 150 : 1000) : -1;
int timeoutMs = visible ? neoui_next_timeout_ms(-1) : -1;
::poll(pfds, (fifoFd >= 0) ? 2 : 1, timeoutMs);
}
+1 -1
View File
@@ -1208,7 +1208,7 @@ int irc_run_main(int argc, char** argv) {
pfds.push_back({ s.net->fd(), POLLIN, 0 });
}
}
int timeoutMs = visible ? (neoui_input_is_tap_active() ? 150 : 1000) : -1;
int timeoutMs = visible ? neoui_next_timeout_ms(-1) : -1;
::poll(pfds.data(), static_cast<nfds_t>(pfds.size()), timeoutMs);
}
+3 -4
View File
@@ -897,17 +897,16 @@ int locker_run_main(int argc, char** argv) {
}
}
if (visible) {
if (visible && !isScreenBlanked()) {
if (!isCallActiveOrRingingFast() && !grabHeld) {
grabLockerInput();
}
if (!isScreenBlanked()) {
render();
}
}
int timeoutMs = -1;
if (visible && !isCallActiveOrRingingFast() && !grabHeld) {
if (visible && !isScreenBlanked() && !isCallActiveOrRingingFast() &&
!grabHeld) {
timeoutMs = 35;
} else if (visible && !isScreenBlanked()) {
int64_t now = nowMs();
+1 -1
View File
@@ -3964,7 +3964,7 @@ int sip_run_main(int argc, char** argv) {
if (callState == SipCallState::Active || callState == SipCallState::Outgoing) {
timeoutMs = 150;
} else if (visible) {
timeoutMs = neoui_input_is_tap_active() ? 150 : 1000;
timeoutMs = neoui_next_timeout_ms(anyEnabled ? 15000 : -1);
} else if (anyEnabled) {
timeoutMs = 15000;
}
+1 -1
View File
@@ -1047,7 +1047,7 @@ int smallweb_run_main(int argc, char** argv) {
struct pollfd pfds[2] {};
pfds[0] = { ConnectionNumber(neo.dpy), POLLIN, 0 };
pfds[1] = { fifoFd, POLLIN, 0 };
int timeoutMs = visible ? (neoui_input_is_tap_active() ? 150 : 1000) : -1;
int timeoutMs = visible ? neoui_next_timeout_ms(-1) : -1;
::poll(pfds, (fifoFd >= 0) ? 2 : 1, timeoutMs);
}
+64 -14
View File
@@ -6,6 +6,7 @@
#include <X11/Xutil.h>
#include <pango/pangoxft.h>
#include <poll.h>
#include <sys/inotify.h>
#include <sys/wait.h>
#include <clocale>
#include <mutex>
@@ -234,7 +235,7 @@ int runSmsApp(int argc, char** argv) {
}
};
auto reloadAllData = [&](bool force = false) {
auto reloadAllData = [&](bool force = false) -> bool {
bool cChanged = contactsStamp.checkAndUpdate(getContactsFilePath());
bool lChanged = modemLogStamp.checkAndUpdate(getModemLogFilePath());
bool bChanged = blockFileStamp.checkAndUpdate(getBlockFilePath());
@@ -258,7 +259,9 @@ int runSmsApp(int argc, char** argv) {
std::max(0, static_cast<int>(threadMessages.size()) - 1);
}
}
return true;
}
return false;
};
reloadAllData(true);
@@ -1337,10 +1340,21 @@ int runSmsApp(int argc, char** argv) {
}
int xfd = ConnectionNumber(dpy);
int inotifyFd = ::inotify_init1(IN_NONBLOCK | IN_CLOEXEC);
if (inotifyFd >= 0) {
ContactBook::ensureParentDir(getModemLogFilePath());
ContactBook::ensureParentDir(getBlockedModemLogFilePath());
::inotify_add_watch(inotifyFd, getModemLogDirPath().c_str(),
IN_MODIFY | IN_CLOSE_WRITE | IN_MOVED_TO | IN_CREATE | IN_DELETE);
::inotify_add_watch(inotifyFd, getBlockDirPath().c_str(),
IN_MODIFY | IN_CLOSE_WRITE | IN_MOVED_TO | IN_CREATE | IN_DELETE);
}
while (gRunning) {
for (const auto& cmd : readFifoLines(fifoFd)) {
if (cmd == "NOP") {
continue;
} else if (cmd == "REFRESH") {
if (reloadAllData(false) && visible) drawUI();
} else if (cmd == "RELOAD_THEME") {
pt.reload();
reloadAllData(true);
@@ -1721,26 +1735,48 @@ int runSmsApp(int argc, char** argv) {
drawUI();
}
int64_t bannerDeadline = 0;
bool bannerExpired = false;
{
std::lock_guard<std::mutex> lk(sendMutex);
if (!statusBanner.empty() && statusBannerUntilMs > 0) {
if (tNow >= statusBannerUntilMs) {
statusBanner.clear();
statusBannerUntilMs = 0;
bannerExpired = true;
} else {
bannerDeadline = statusBannerUntilMs;
}
}
}
if (visible && bannerExpired) {
drawUI();
}
int timeoutMs = -1;
if (visible) {
timeoutMs = 250;
if (!initialSoftkeysReleased) {
timeoutMs = 40;
}
if (softkeyPending != 0) {
timeoutMs = std::min(timeoutMs,
std::max(1, static_cast<int>(softkeyDeadlineMs - tNow)));
int rem = std::max(1, static_cast<int>(softkeyDeadlineMs - tNow));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (zeroHeld) {
timeoutMs = std::min(
timeoutMs,
std::max(1, static_cast<int>((zeroPressMs + 420) - tNow)));
int rem = std::max(1, static_cast<int>((zeroPressMs + 420) - tNow));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (mode == ViewMode::Compose && lastTapDigit != -1) {
timeoutMs = std::min(
timeoutMs,
std::max(1, static_cast<int>(851 - (tNow - lastTapMs))));
int rem = std::max(1, static_cast<int>(851 - (tNow - lastTapMs)));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
if (bannerDeadline > 0) {
int rem = std::max(1, static_cast<int>(bannerDeadline - tNow));
timeoutMs = (timeoutMs < 0) ? rem : std::min(timeoutMs, rem);
}
}
struct pollfd pfds[3];
struct pollfd pfds[4];
int nfds = 0;
pfds[nfds++] = {xfd, POLLIN, 0};
int fifoIdx = -1;
@@ -1753,12 +1789,19 @@ int runSmsApp(int argc, char** argv) {
pipeIdx = nfds;
pfds[nfds++] = {notifyPipe[0], POLLIN, 0};
}
int inotifyIdx = -1;
if (inotifyFd >= 0 && visible) {
inotifyIdx = nfds;
pfds[nfds++] = {inotifyFd, POLLIN, 0};
}
int pr = ::poll(pfds, nfds, timeoutMs);
if (pr > 0) {
if (fifoIdx >= 0 && (pfds[fifoIdx].revents & POLLIN)) {
for (const auto& cmd : readFifoLines(fifoFd)) {
if (cmd == "RELOAD_THEME") {
if (cmd == "REFRESH") {
if (reloadAllData(false) && visible) drawUI();
} else if (cmd == "RELOAD_THEME") {
pt.reload();
reloadAllData(true);
if (visible) drawUI();
@@ -1782,12 +1825,19 @@ int runSmsApp(int argc, char** argv) {
}
drawUI();
}
} else if (pr == 0 && visible) {
reloadAllData(false);
if (inotifyIdx >= 0 && (pfds[inotifyIdx].revents & POLLIN)) {
char ibuf[512];
while (::read(inotifyFd, ibuf, sizeof(ibuf)) > 0) {
}
if (reloadAllData(false) && visible) {
drawUI();
}
}
}
}
hideWindow();
if (inotifyFd >= 0) ::close(inotifyFd);
if (fifoFd >= 0) ::close(fifoFd);
if (notifyPipe[0] >= 0) ::close(notifyPipe[0]);
if (notifyPipe[1] >= 0) ::close(notifyPipe[1]);
+5 -1
View File
@@ -938,7 +938,11 @@ int tox_run_main(int argc, char** argv) {
if (ctx.inCall && ctx.callActive) {
timeoutMs = 20;
} else if (visible) {
timeoutMs = neoui_input_is_tap_active() ? 100 : 200;
int baseTimeout = shouldIterateTox
? static_cast<int>(std::clamp<uint32_t>(
tox_iteration_interval(tox), 250, 1000))
: -1;
timeoutMs = neoui_next_timeout_ms(baseTimeout);
} else if (shouldIterateTox) {
timeoutMs = static_cast<int>(
std::clamp<uint32_t>(tox_iteration_interval(tox), 250, 1000));
+99 -9
View File
@@ -772,6 +772,26 @@ gboolean onPermissionRequest(WebKitWebView*,
return TRUE;
}
gboolean onLoadFailed(WebKitWebView* webView,
WebKitLoadEvent,
gchar* failingUri,
GError* error,
gpointer userData) {
auto* st = static_cast<BrowserRuntimeState*>(userData);
if (st) {
st->isLoading = false;
if (error && error->message) {
st->statusMsg = std::string("Load failed: ") + error->message;
} else if (failingUri) {
st->statusMsg = std::string("Failed: ") + failingUri;
} else {
st->statusMsg = "Load failed";
}
}
(void)webView;
return FALSE;
}
gboolean onWebProcessTerminated(WebKitWebView* webView,
WebKitWebProcessTerminationReason,
gpointer userData) {
@@ -806,6 +826,8 @@ bool initBrowserEngine(BrowserRuntimeState& st, const std::string& userAgent) {
// Hardware acceleration & Cortex-A7 / 512 MB RAM environment tuning
::setenv("GDK_BACKEND", "x11", 1);
::setenv("GTK_THEME", "Adwaita:dark", 1);
::setenv("NO_AT_BRIDGE", "1", 1);
::setenv("GTK_A11Y", "none", 1);
::setenv("WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS", "1", 1);
::setenv("WEBKIT_DISABLE_COMPOSITING_MODE", "0", 0);
::setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "0", 0);
@@ -844,8 +866,6 @@ bool initBrowserEngine(BrowserRuntimeState& st, const std::string& userAgent) {
g_object_unref(cssProv);
}
ensureAlsaMultimediaRouting();
// Configure 160 MB memory pressure limit for WebKit processes on 512 MB phone
WebKitMemoryPressureSettings* mp = webkit_memory_pressure_settings_new();
webkit_memory_pressure_settings_set_memory_limit(mp, 160);
@@ -954,6 +974,7 @@ bool initBrowserEngine(BrowserRuntimeState& st, const std::string& userAgent) {
st.webView = WEBKIT_WEB_VIEW(wvWidget);
g_signal_connect(st.webView, "load-changed", G_CALLBACK(onLoadChanged), &st);
g_signal_connect(st.webView, "load-failed", G_CALLBACK(onLoadFailed), &st);
g_signal_connect(st.webView, "notify::uri", G_CALLBACK(onNotifyUriOrTitle), &st);
g_signal_connect(st.webView, "notify::title", G_CALLBACK(onNotifyUriOrTitle), &st);
g_signal_connect(st.webView, "notify::estimated-load-progress",
@@ -1346,6 +1367,10 @@ int webarchy_run_main(int argc, char** argv) {
infoModalOpen = false;
chordPrefix.clear();
if (br.initialized && br.webView) {
if (br.isLoading) {
webkit_web_view_stop_loading(br.webView);
br.isLoading = false;
}
evalJs(br, "try{document.querySelectorAll('audio,video').forEach(function(m){m.pause();});}catch(e){}");
webkit_web_view_set_is_muted(br.webView, TRUE);
}
@@ -1864,16 +1889,81 @@ int webarchy_run_main(int argc, char** argv) {
}
}
struct pollfd pfds[2] {};
pfds[0] = { ConnectionNumber(neo.dpy), POLLIN, 0 };
pfds[1] = { fifoFd, POLLIN, 0 };
GMainContext* gctx = g_main_context_default();
gint maxPriority = 0;
gint glibTimeout = -1;
std::vector<GPollFD> gpfds;
bool useGlibPoll = br.initialized && (visible || br.isLoading);
if (useGlibPoll) {
if (g_main_context_prepare(gctx, &maxPriority)) {
glibTimeout = 0;
}
gpfds.resize(16);
gint nf = g_main_context_query(gctx, maxPriority, &glibTimeout,
gpfds.data(), static_cast<gint>(gpfds.size()));
if (nf > static_cast<gint>(gpfds.size())) {
gpfds.resize(nf);
nf = g_main_context_query(gctx, maxPriority, &glibTimeout,
gpfds.data(), nf);
}
gpfds.resize(std::max(0, nf));
}
std::vector<struct pollfd> pfds;
pfds.reserve(2 + gpfds.size());
pfds.push_back({ ConnectionNumber(neo.dpy), POLLIN, 0 });
if (fifoFd >= 0) {
pfds.push_back({ fifoFd, POLLIN, 0 });
}
size_t glibOffset = pfds.size();
for (const GPollFD& gp : gpfds) {
pfds.push_back({ gp.fd, static_cast<short>(gp.events), 0 });
}
int timeoutMs = -1;
if (visible) {
timeoutMs = 25;
} else if (br.initialized && br.isLoading) {
timeoutMs = 100;
neo.bindAsActiveContext();
timeoutMs = neoui_next_timeout_ms(-1);
if (isPhonePasscodeLocked() && !mutedByLock) {
timeoutMs = 0;
} else if (mutedByLock && (timeoutMs < 0 || timeoutMs > 250)) {
timeoutMs = 250;
}
}
if (useGlibPoll && glibTimeout >= 0) {
if (timeoutMs < 0 || glibTimeout < timeoutMs) {
timeoutMs = glibTimeout;
}
}
::poll(pfds.data(), static_cast<nfds_t>(pfds.size()), timeoutMs);
if (useGlibPoll) {
for (size_t i = 0; i < gpfds.size(); ++i) {
gpfds[i].revents = static_cast<gushort>(pfds[glibOffset + i].revents);
}
std::string prevUrl = br.currentUrl;
std::string prevTitle = br.currentTitle;
std::string prevStatus = br.statusMsg;
bool prevLoading = br.isLoading;
if (g_main_context_check(gctx, maxPriority, gpfds.data(),
static_cast<gint>(gpfds.size()))) {
g_main_context_dispatch(gctx);
}
if (br.htmlInputPending) {
br.htmlInputPending = false;
promptModalOpen = true;
promptIsAddressBar = false;
promptIsCustomUa = false;
promptTitle = "Input: " + br.htmlInputLabel;
neoui_input_reset(br.htmlInputValue.c_str());
if (visible) render();
} else if (visible &&
(br.currentUrl != prevUrl || br.currentTitle != prevTitle ||
br.statusMsg != prevStatus || br.isLoading != prevLoading)) {
render();
}
}
::poll(pfds, (fifoFd >= 0) ? 2 : 1, timeoutMs);
}
if (fifoFd >= 0) ::close(fifoFd);
+65 -1
View File
@@ -400,6 +400,49 @@ static void msm8905_cam_enable_clocks(struct msm8905_cam_dev *cam)
}
}
static void msm8905_cam_hw_deinit(struct msm8905_cam_dev *cam)
{
ssize_t i;
if (!cam->hw_initialized)
return;
/* 1. Stop ISPIF and sensor MIPI CSI-2 stream */
cam_w32(cam->camss_base, ISPIF_BASE + 0x248U, 0xaaaaaaaaU);
wmb();
gc23xx_stream_off(cam);
usleep_range(600, 900);
/* 2. Place sensor in hardware power-down and disable MCLK0 output */
cam_gpio_out(cam, GPIO_CAM_RESET, false);
cam_gpio_out(cam, GPIO_CAM_STANDBY, false);
cam_gpio_out(cam, GPIO_CAM_VDIG, false);
cam_gpio_cfg(cam, GPIO_CAM_MCLK0, 0x0001U);
/* 3. Gate CAMSS branch clocks in reverse order */
for (i = (ssize_t)ARRAY_SIZE(camss_cbcr_offsets) - 1; i >= 0; i--) {
u32 off = camss_cbcr_offsets[i];
cam_w32(cam->gcc_base, off, cam_r32(cam->gcc_base, off) & ~1U);
}
wmb();
/* 4. Gate CAMSS RCG roots (MCLK0 and CSI/VFE RCGs) */
cam_w32(cam->gcc_base, 0x52000U, 0x0U);
cam_w32(cam->gcc_base, 0x4e000U, 0x0U);
cam_w32(cam->gcc_base, 0x4f020U, 0x0U);
cam_w32(cam->gcc_base, 0x4e020U, 0x0U);
cam_w32(cam->gcc_base, 0x58000U, 0x0U);
cam_w32(cam->gcc_base, 0x5a000U, 0x0U);
/* 5. Release SMMU vote clocks and power down VFE GDSC */
cam_w32(cam->gcc_base, 0x4500cU, cam_r32(cam->gcc_base, 0x4500cU) & ~0x3202U);
cam_w32(cam->gcc_base, 0x58034U, cam_r32(cam->gcc_base, 0x58034U) | 1U);
wmb();
cam->hw_initialized = false;
cam->streaming = false;
}
static int msm8905_cam_hw_init(struct msm8905_cam_dev *cam)
{
size_t i;
@@ -921,6 +964,7 @@ static int msm8905_cam_streamoff(struct file *file, void *priv,
cam->streaming = false;
for (idx = 0; idx < CAM_MAX_MMAP_BUFS; idx++)
cam->buf_queued[idx] = false;
msm8905_cam_hw_deinit(cam);
return 0;
}
@@ -994,10 +1038,29 @@ static __poll_t msm8905_cam_poll(struct file *file, poll_table *wait)
return EPOLLIN | EPOLLRDNORM;
}
static int msm8905_cam_release(struct file *file)
{
struct msm8905_cam_dev *cam = video_drvdata(file);
bool is_last;
u32 idx;
int ret;
mutex_lock(&cam->lock);
is_last = v4l2_fh_is_singular_file(file);
ret = v4l2_fh_release(file);
if (is_last) {
for (idx = 0; idx < CAM_MAX_MMAP_BUFS; idx++)
cam->buf_queued[idx] = false;
msm8905_cam_hw_deinit(cam);
}
mutex_unlock(&cam->lock);
return ret;
}
static const struct v4l2_file_operations msm8905_cam_fops = {
.owner = THIS_MODULE,
.open = v4l2_fh_open,
.release = v4l2_fh_release,
.release = msm8905_cam_release,
.read = msm8905_cam_read,
.mmap = msm8905_cam_mmap,
.poll = msm8905_cam_poll,
@@ -1135,6 +1198,7 @@ static void __exit msm8905_cam_exit(void)
video_unregister_device(&cam->vdev);
v4l2_device_unregister(&cam->v4l2_dev);
msm8905_cam_hw_deinit(cam);
iounmap(cam->vbif_base);
iounmap(cam->camss_base);
iounmap(cam->tlmm_base);
+41 -14
View File
@@ -2709,6 +2709,31 @@ int neoui_clear_toast(void) {
// 5. Event Loop, Keypad & Multi-Tap Input Management
// ---------------------------------------------------------------------------
int neoui_next_timeout_ms(int default_timeout_ms) {
NeoContext* ctx = ensureCtx();
int waitMs = default_timeout_ms;
int64_t now = bananarchy::monotonicMs();
if (ctx->visible && ctx->grabYielded) {
if (waitMs < 0 || waitMs > 100) waitMs = 100;
}
if (ctx->softkeyPending != 0) {
int rem = static_cast<int>(
std::max<int64_t>(1, ctx->softkeyDeadlineMs - now));
if (waitMs < 0 || rem < waitMs) waitMs = rem;
}
if (ctx->tapActive) {
int rem = static_cast<int>(
std::max<int64_t>(1, (ctx->lastTapMs + 850) - now));
if (waitMs < 0 || rem < waitMs) waitMs = rem;
}
if (ctx->toastUntilMs > 0) {
int rem = static_cast<int>(
std::max<int64_t>(1, ctx->toastUntilMs - now));
if (waitMs < 0 || rem < waitMs) waitMs = rem;
}
return waitMs;
}
int neoui_poll_event(int timeout_ms) {
NeoContext* ctx = ensureCtx();
ctx->lastEventType = NEO_EV_NONE;
@@ -2763,6 +2788,14 @@ int neoui_poll_event(int timeout_ms) {
return NEO_EV_EXPOSE;
}
// Check if toast expired
if (ctx->toastUntilMs > 0 && now >= ctx->toastUntilMs) {
ctx->toastUntilMs = 0;
ctx->toastMsg.clear();
ctx->lastEventType = NEO_EV_EXPOSE;
return NEO_EV_EXPOSE;
}
// Check if pending softkey chord timer expired -> emit single softkey
if (ctx->softkeyPending != 0 && now >= ctx->softkeyDeadlineMs) {
int pend = ctx->softkeyPending;
@@ -2932,20 +2965,7 @@ int neoui_poll_event(int timeout_ms) {
if (imm != NEO_EV_NONE) return imm;
// Calculate effective poll timeout
int waitMs = timeout_ms;
if (ctx->visible && ctx->grabYielded && waitMs != 0) {
if (waitMs < 0 || waitMs > 100) waitMs = 100;
}
if (ctx->softkeyPending != 0) {
int rem = static_cast<int>(
std::max<int64_t>(1, ctx->softkeyDeadlineMs - bananarchy::monotonicMs()));
if (waitMs < 0 || rem < waitMs) waitMs = rem;
}
if (ctx->tapActive) {
int rem = static_cast<int>(
std::max<int64_t>(1, (ctx->lastTapMs + 850) - bananarchy::monotonicMs()));
if (waitMs < 0 || rem < waitMs) waitMs = rem;
}
int waitMs = (timeout_ms == 0) ? 0 : neoui_next_timeout_ms(timeout_ms);
struct pollfd pfds[2];
int nfds = 0;
@@ -3004,6 +3024,13 @@ int neoui_poll_event(int timeout_ms) {
return NEO_EV_EXPOSE;
}
if (ctx->toastUntilMs > 0 && now >= ctx->toastUntilMs) {
ctx->toastUntilMs = 0;
ctx->toastMsg.clear();
ctx->lastEventType = NEO_EV_EXPOSE;
return NEO_EV_EXPOSE;
}
ovEv = syncOverlayGrabState();
int postEv = processNextXEvent();
if (postEv != NEO_EV_NONE) return postEv;
+1
View File
@@ -281,6 +281,7 @@ int neoui_clear_toast(void);
// 5. Event Loop, Keypad & Multi-Tap Input Management
// ---------------------------------------------------------------------------
int neoui_poll_event(int timeout_ms);
int neoui_next_timeout_ms(int default_timeout_ms);
int neoui_event_key(void);
int neoui_event_keycode(void);
int neoui_event_keysym(void);
+3
View File
@@ -1274,6 +1274,8 @@ set_hw_backlight(int on)
read_sysfs_str(cfgpath, cur, sizeof(cur));
}
write_sysfs_str("/sys/class/leds/white:kbd_backlight/brightness", (cur[0] != '\0') ? cur : "255");
if (selmon && drw)
drawbar(selmon);
} else {
read_sysfs_str("/sys/class/backlight/backlight/brightness", cur, sizeof(cur));
if (atoi(cur) >= 1) {
@@ -3580,6 +3582,7 @@ updatestatus(void)
len = strlen(stext);
while (len > 0 && (stext[len - 1] == ' ' || stext[len - 1] == '\n' || stext[len - 1] == '\r'))
stext[--len] = '\0';
if (!is_screen_off())
drawbar(selmon);
}
+1 -1
View File
@@ -1293,7 +1293,7 @@ static int xdrawer_run_main(int argc, char** argv) {
}
}
int timeoutMs = visible ? (initialKeysReleased ? 250 : 40) : -1;
int timeoutMs = visible ? (initialKeysReleased ? -1 : 40) : -1;
struct pollfd pfds[2] {};
pfds[0].fd = xfd;
pfds[0].events = POLLIN;