Files
DroidDeck/tools/tests/pointer_release_harness.c
MaxsTechReview c5577478ca chore: remove source comments and unused code, translate every missing string (#1965)
* chore(i18n): translate every missing string in all locales

Adds the 87 strings the bottom-screen Dashboard and in-game stats pages
introduced to all 32 locales, plus the 51 older settings strings Japanese
and the 50 Chinese locales were still missing. Every locale now has all
3456 translatable strings with the same placeholders as English.

Also translates 36 entries that were still English where the language
does not use the English word, and makes es-419 touch_app_id use the same
%1$s placeholder as English.

* chore(patches): drop comments from the lines downstream patches add

Removes comment lines and trailing comments from lines our patches add,
with hunk headers recounted. Lines that a later patch uses as context
and the upstream backport 0123 are left as they are.

The gamescope, FEX, proot and xodus series still apply to their pinned
sources, and the patched trees differ only in those comments.
test_hud_frames now finds the HUD writer by its first declaration.

* docs: credit Greenlight, Better xCloud, viture-v2, GameNative and DiRTTelemetryErrorFix

These were credited only in source headers and NOTICE files.

* chore: remove source comments and unused functions

Removes explanatory comments from first-party Kotlin, Java, C, C++,
Rust, TypeScript, Python, shell, Gradle, CMake and workflow files.
License and attribution headers stay, and vendored third-party trees,
generated files and license files are untouched. A shellcheck directive
is kept, and udevmon's fallthrough comments became fallthrough attributes.

Syntax trees and token streams match the previous sources apart from the
comments and Python docstrings. Module docstrings that argparse prints
are kept, and device-smoke.sh prints the same --help text from a heredoc.

Also removes 37 functions and 4 fields that nothing referenced.

* chore: remove comments from the Syncthing integration and the latest main sources

* docs: credit Syncthing and the syncthing-android fork

* chore(i18n): translate the Syncthing strings in all locales

The 107 strings the Syncthing integration added are now in all 32 locales.
sync_web_path_locked names the Syncthing tab by its label.

* docs: credit @xXJSONDeruloXx for the HUD metric readers

The CPU, GPU load, thermal and battery readers come from their
PerformanceHudView pull requests #777, #877, #991, #1406 and #1573.
The FusionHUD credit line is unchanged.

* docs: credit the HUD metric readers to @xXJSONDeruloXx's work
2026-11-01 16:27:27 -05:00

87 lines
3.8 KiB
C

#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define WL_POINTER_BUTTON_STATE_RELEASED 0
#define WL_POINTER_FRAME_SINCE_VERSION 5
struct wl_resource { int version, releases, frames; uint32_t held; };
struct seat_pointer { struct wl_resource *ptr, *focus; };
static struct seat_pointer g_ptrs[3];
static int g_nptrs = 3;
static void *g_grab, *g_display;
static unsigned motion_calls, flushes;
static uint32_t now_ms(void) { return 42; }
static uint32_t wl_display_next_serial(void *d) { (void)d; return 1; }
static int wl_resource_get_version(struct wl_resource *r) { return r->version; }
static void wl_pointer_send_frame(struct wl_resource *r) { r->frames++; }
static void wl_display_flush_clients(void *d) { (void)d; flushes++; }
static void wl_pointer_send_button(struct wl_resource *r, uint32_t serial,
uint32_t t, uint32_t button, uint32_t state) {
(void)serial; (void)t;
assert(state == WL_POINTER_BUTTON_STATE_RELEASED);
r->held &= ~(1u << (button - 0x110));
r->releases++;
}
static void pointer_input(double x, double y, int relative, uint32_t button, int pressed) {
assert(x == 0 && y == 0 && relative == 1 && button >= 0x110 && button <= 0x112);
assert(pressed == 1);
motion_calls++;
}
#include "pointer_button.inc"
#define BTN_LEFT 0x110
#define MAX_TOUCH_POINTS 2
struct touch_point { int pointer_fallback; };
static struct touch_point g_touch_points[MAX_TOUCH_POINTS];
struct seat_touch { struct wl_resource *touch, *focus; };
static struct seat_touch g_touches[1];
static int g_ntouches = 1, cancels;
static void wl_touch_send_cancel(struct wl_resource *r) { (void)r; cancels++; }
#include "touch_cancel_all.inc"
int main(int argc, char **argv) {
assert(argc == 2);
struct wl_resource surface = {0};
struct wl_resource a = {.version = 5, .held = 7};
struct wl_resource b = {.version = 4, .held = 7};
struct wl_resource other = {.version = 5, .held = 7};
g_ptrs[0] = (struct seat_pointer){&a, &surface};
g_ptrs[1] = (struct seat_pointer){&b, &surface};
g_ptrs[2] = (struct seat_pointer){&other, NULL};
g_grab = &surface;
if (!strcmp(argv[1], "fallback") || !strcmp(argv[1], "native")) {
int fallback = !strcmp(argv[1], "fallback");
g_touches[0] = (struct seat_touch){&a, &surface};
g_touch_points[0].pointer_fallback = fallback;
touch_cancel_all();
assert(!motion_calls && cancels == 1 && !g_touches[0].focus);
assert(!g_touch_points[0].pointer_fallback);
assert(a.releases == fallback && a.held == (fallback ? 6u : 7u));
for (uint32_t button = 0x110; button <= 0x112; button++) pointer_button(button, 0);
assert(!motion_calls && !a.held && !b.held && !g_grab);
} else if (!strcmp(argv[1], "press")) {
pointer_button(0x110, 1);
assert(motion_calls == 1 && !a.releases && g_grab == &surface);
} else if (!strcmp(argv[1], "unfocused")) {
g_ptrs[0].focus = g_ptrs[1].focus = NULL;
pointer_button(0x110, 0);
assert(!motion_calls && !a.releases && !b.releases && !other.releases);
assert(!g_grab);
} else if (!strcmp(argv[1], "cleanup")) {
for (uint32_t button = 0x110; button <= 0x112; button++) pointer_button(button, 0);
assert(!motion_calls && !a.held && !b.held && other.held == 7);
assert(a.releases == 3 && b.releases == 3 && !other.releases);
assert(!g_grab && flushes == 3);
} else {
assert(!strcmp(argv[1], "focused"));
a.held = b.held = 1;
pointer_button(0x110, 0);
assert(!motion_calls && !a.held && !b.held);
assert(a.releases == 1 && b.releases == 1 && !other.releases);
assert(a.frames == 1 && !b.frames && !other.frames);
assert(g_ptrs[0].focus == &surface && g_ptrs[1].focus == &surface);
assert(!g_grab && flushes == 1);
}
puts("PASS");
}