From 1f0a4cbe76681eb504ffa61faaf5147342bdb683 Mon Sep 17 00:00:00 2001 From: noah Date: Thu, 24 Sep 2026 10:03:58 -0600 Subject: [PATCH] fix(gui): health icon tooltips never showed -- tip area used wrong coordinates Round 19 #2. The health-icon hover tooltips never appeared because the GTK query-tooltip handler built the per-icon "tip area" from gtk_tree_view_get_cell_area (BIN-WINDOW coordinates) and passed it to gtk_tooltip_set_tip_area, which expects WIDGET coordinates. The area was offset upward by the column-header height, so it did not contain the pointer, and GTK suppresses any tooltip whose tip area excludes the cursor -- so nothing showed. The Errors column worked because it sets no tip area. Prior fixes (rounds 15/18/19) only tuned the icon slot math, which was already correct; the coordinate-system mismatch was the actual cause. Convert the slot rectangle from bin-window to widget coordinates with gtk_tree_view_convert_bin_window_to_widget_coords before gtk_tooltip_set_tip_area. The slot hit-test (block_left/adv, in bin-window coords) is unchanged and still matches DrawShape's uniform health-icon advance. wx-rs patch 0005. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Djv3oncM4LxTS5tb61Ako6 --- .../0005-health-tooltip-widget-coords.patch | 39 +++++++++++++++++++ .../cpp_src/widgets_bridge.cpp | 16 +++++++- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 thirdparty/wx-rs/patches/0005-health-tooltip-widget-coords.patch diff --git a/thirdparty/wx-rs/patches/0005-health-tooltip-widget-coords.patch b/thirdparty/wx-rs/patches/0005-health-tooltip-widget-coords.patch new file mode 100644 index 00000000..1c8eb143 --- /dev/null +++ b/thirdparty/wx-rs/patches/0005-health-tooltip-widget-coords.patch @@ -0,0 +1,39 @@ +Subject: [PATCH 0005] health tooltips: convert tip area to widget coordinates + +Round 19 #2 (the real fix). The GtkTreeView "query-tooltip" handler for the Health +column set a per-icon tip area from gtk_tree_view_get_cell_area, whose rectangle is +in BIN-WINDOW coordinates, but gtk_tooltip_set_tip_area expects WIDGET coordinates. +The area was therefore offset upward by the column-header height, so it did not +contain the pointer -- and GTK suppresses a tooltip whose tip area excludes the +cursor. That is why the health icon tooltips never appeared, while the Errors column +(which sets no tip area) worked. Convert the slot rectangle back to widget +coordinates with gtk_tree_view_convert_bin_window_to_widget_coords before setting it. + +diff --git a/cpp_src/widgets_bridge.cpp b/cpp_src/widgets_bridge.cpp +index ba9f1c04..6d09ccb7 100644 +--- a/cpp_src/widgets_bridge.cpp ++++ b/cpp_src/widgets_bridge.cpp +@@ -1019,9 +1019,21 @@ static gboolean dvlc_query_tooltip(GtkWidget* tv, gint x, gint y, gboolean keybo + // or moves the tooltip as the pointer crosses from one icon to the next -- the + // old tooltip just stays put with stale text. Setting a per-slot area makes GTK + // hide + re-show + reposition the tooltip for each icon. ++ // ++ // CRITICAL (round 19 #2, the reason the health tooltips never showed): the slot ++ // geometry above (block_left, crect) is in BIN-WINDOW coordinates (what ++ // gtk_tree_view_get_cell_area and get_path_at_pos use), but ++ // gtk_tooltip_set_tip_area expects WIDGET coordinates. Feeding it bin-window ++ // coords offsets the area upward by the header height, so it does not contain ++ // the pointer -- and GTK then suppresses the tooltip entirely (it only shows a ++ // tooltip whose tip area contains the cursor). The Errors column worked because ++ // it sets no tip area. Convert the slot rect back to widget coordinates. ++ gint area_wx = 0, area_wy = 0; ++ gtk_tree_view_convert_bin_window_to_widget_coords( ++ GTK_TREE_VIEW(tv), block_left + slot * adv, crect.y, &area_wx, &area_wy); + GdkRectangle area; +- area.x = block_left + slot * adv; +- area.y = crect.y; ++ area.x = area_wx; ++ area.y = area_wy; + area.width = adv; + area.height = crect.height; + gtk_tooltip_set_tip_area(tooltip, &area); diff --git a/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp b/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp index ba9f1c04..6d09ccb7 100644 --- a/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp +++ b/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp @@ -1019,9 +1019,21 @@ static gboolean dvlc_query_tooltip(GtkWidget* tv, gint x, gint y, gboolean keybo // or moves the tooltip as the pointer crosses from one icon to the next -- the // old tooltip just stays put with stale text. Setting a per-slot area makes GTK // hide + re-show + reposition the tooltip for each icon. + // + // CRITICAL (round 19 #2, the reason the health tooltips never showed): the slot + // geometry above (block_left, crect) is in BIN-WINDOW coordinates (what + // gtk_tree_view_get_cell_area and get_path_at_pos use), but + // gtk_tooltip_set_tip_area expects WIDGET coordinates. Feeding it bin-window + // coords offsets the area upward by the header height, so it does not contain + // the pointer -- and GTK then suppresses the tooltip entirely (it only shows a + // tooltip whose tip area contains the cursor). The Errors column worked because + // it sets no tip area. Convert the slot rect back to widget coordinates. + gint area_wx = 0, area_wy = 0; + gtk_tree_view_convert_bin_window_to_widget_coords( + GTK_TREE_VIEW(tv), block_left + slot * adv, crect.y, &area_wx, &area_wy); GdkRectangle area; - area.x = block_left + slot * adv; - area.y = crect.y; + area.x = area_wx; + area.y = area_wy; area.width = adv; area.height = crect.height; gtk_tooltip_set_tip_area(tooltip, &area);