Some hopefully final flat review touch ups.

This commit is contained in:
Storm Dragon committed 2026-10-22 16:39:44 -04:00
1 parent fb2c5b818d
commit d7b1efeba0
5 files changed
+71 -4

No files matched your search

+15
View File
@@ -10,6 +10,8 @@ static gboolean armed;
static unsigned childQueries;
static gboolean slowRanges;
static gint largestRange;
static GHashTable *measuredRanges;
static guint repeatedRanges;
static gboolean lineGeometryOnly;
static gboolean missingGlyph;
static GtkWidget *reviewScroller;
@@ -28,6 +30,13 @@ static void range_extents(AtkText *text, gint start, gint end, AtkCoordType coor
}
if (slowRanges) {
largestRange = MAX(largestRange, end - start);
guint64 key = ((guint64)(guint32)start << 32) | (guint32)end;
if (g_hash_table_contains(measuredRanges, &key)) repeatedRanges++;
else {
guint64 *stored = g_new(guint64, 1);
*stored = key;
g_hash_table_add(measuredRanges, stored);
}
if (end - start > 128) g_usleep(1200000);
}
originalRangeExtents(text, start, end, coordinates, rectangle);
@@ -64,7 +73,11 @@ static gboolean command_ready(GIOChannel *channel, GIOCondition condition, gpoin
printf("count %u\n", childQueries);
} else if (g_str_has_prefix(line, "measure")) {
slowRanges = TRUE;
g_hash_table_remove_all(measuredRanges);
repeatedRanges = 0;
puts("measuring");
} else if (g_str_has_prefix(line, "repeated")) {
printf("repeated %u\n", repeatedRanges);
} else if (g_str_has_prefix(line, "largest")) {
printf("largest %d\n", largestRange);
} else if (g_str_has_prefix(line, "scroll")) {
@@ -92,6 +105,7 @@ int main(int argc, char **argv) {
lineGeometryOnly = linesMode;
missingGlyph = glyphsMode;
gtk_init(&argc, &argv);
measuredRanges = g_hash_table_new_full(g_int64_hash, g_int64_equal, g_free, NULL);
GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "Review cache probe");
gtk_window_set_default_size(GTK_WINDOW(window), 300, 100);
@@ -143,5 +157,6 @@ int main(int argc, char **argv) {
gtk_widget_show_all(window);
gtk_main();
g_io_channel_unref(input);
g_hash_table_unref(measuredRanges);
return 0;
}