From 685ee2f230c5cb016b30941a1a0d70d7c1ce7b44 Mon Sep 17 00:00:00 2001
From: Deuce <shurd@sasktel.net>
Date: Sat, 3 Jun 2023 02:07:10 -0400
Subject: [PATCH] Finally got ChromeOS icon/toltip working!

It appears its matching based on the class, not the application.
Since this was hard-coded to CIOLIB based on the idea of using
resources to customize all CIOLIB windows, this didn't match the
SyncTERM .desktop file, so ChromeOS assumed it was "something else"

Add yet another ciolib_initial_* variable to set this, and she's
finally good!
---
 src/conio/ciolib.c      | 1 +
 src/conio/ciolib.h      | 1 +
 src/conio/x_events.c    | 2 +-
 src/syncterm/syncterm.c | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/conio/ciolib.c b/src/conio/ciolib.c
index f2683b17a1..f125994810 100644
--- a/src/conio/ciolib.c
+++ b/src/conio/ciolib.c
@@ -93,6 +93,7 @@ CIOLIBEXPORT enum ciolib_scaling ciolib_initial_scaling_type = CIOLIB_SCALING_IN
 CIOLIBEXPORT const void * ciolib_initial_icon = syncicon64;
 CIOLIBEXPORT size_t ciolib_initial_icon_width = SYNCICON64_WIDTH;
 CIOLIBEXPORT const char *ciolib_initial_program_name = "CIOLIB";
+CIOLIBEXPORT const char *ciolib_initial_program_class = "CIOLIB";
 CIOLIBEXPORT const uint32_t *ciolib_r2yptr;
 CIOLIBEXPORT const uint32_t *ciolib_y2rptr;
 
diff --git a/src/conio/ciolib.h b/src/conio/ciolib.h
index a1986ff045..c4f7442160 100644
--- a/src/conio/ciolib.h
+++ b/src/conio/ciolib.h
@@ -420,6 +420,7 @@ CIOLIBEXPORTVAR enum ciolib_scaling ciolib_initial_scaling_type;
 CIOLIBEXPORTVAR const void * ciolib_initial_icon;
 CIOLIBEXPORTVAR size_t ciolib_initial_icon_width;
 CIOLIBEXPORTVAR const char *ciolib_initial_program_name;
+CIOLIBEXPORTVAR const char *ciolib_initial_program_class;
 CIOLIBEXPORTVAR const uint32_t *ciolib_r2yptr;
 CIOLIBEXPORTVAR const uint32_t *ciolib_y2rptr;
 
diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index 64b817421b..4d0d87a19e 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -582,7 +582,7 @@ static int init_window()
 	classhints=x11.XAllocClassHint();
 	if (classhints) {
 		classhints->res_name = ciolib_initial_program_name;
-		classhints->res_class = "CIOLIB";
+		classhints->res_class = ciolib_initial_program_class;
 	}
 	wmhints=x11.XAllocWMHints();
 	wmhints->flags = 0;
diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c
index b3db3c9075..f3d3b9fbd4 100644
--- a/src/syncterm/syncterm.c
+++ b/src/syncterm/syncterm.c
@@ -1561,6 +1561,7 @@ main(int argc, char **argv)
 	ciolib_initial_icon_width = syncterm_icon.width;
 	ciolib_initial_scaling = settings.scaling_factor;
 	ciolib_initial_program_name = "syncterm";
+	ciolib_initial_program_class = "SyncTERM";
 	ciolib_mode = settings.output_mode;
 	if (settings.startup_mode != SCREEN_MODE_CURRENT)
 		text_mode = screen_to_ciolib(settings.startup_mode);
-- 
GitLab