From rpmohn at waxandwane.org Fri Dec 3 20:26:11 2021 From: rpmohn at waxandwane.org (Ross Mohn) Date: Fri, 03 Dec 2021 20:26:11 -0000 Subject: [Tickit-dev] Return values for Tickit callback functions Message-ID: <01687e9f-9786-e9c3-0b5a-a7a43ece13a2@waxandwane.org> The callback functions in libtickit all have a declared return type of int, and I see the examples mostly return 1, sometimes 0. I didn't find documentation of the use of these return values, though I might have just missed it. Are theses return values used and, if so, what are their meanings? $ grep "typedef.*Fn(" /usr/local/include/tickit.h typedef int TickitPenEventFn(TickitPen *tt, TickitEventFlags flags, void *info, void *user); typedef int TickitTermEventFn(TickitTerm *tt, TickitEventFlags flags, void *info, void *user); typedef int TickitWindowEventFn(TickitWindow *win, TickitEventFlags flags, void *info, void *user); typedef int TickitCallbackFn(Tickit *t, TickitEventFlags flags, void *info, void *user); Thanks -Ross -- Ross Mohn OpenPGP: 0xFBB698141F0A6737 http://waxandwane.org/ From rpmohn at waxandwane.org Mon Dec 6 13:51:31 2021 From: rpmohn at waxandwane.org (Ross Mohn) Date: Mon, 06 Dec 2021 13:51:31 -0000 Subject: [Tickit-dev] Return values for Tickit callback functions In-Reply-To: <01687e9f-9786-e9c3-0b5a-a7a43ece13a2@waxandwane.org> References: <01687e9f-9786-e9c3-0b5a-a7a43ece13a2@waxandwane.org> Message-ID: Answering my own question, the return code is not used, at least at this time :-) ??? static void invoke_watch(TickitWatch *watch, TickitEventFlags flags, void *info) ??? { ??? ? (*watch->fn)(watch->t, flags, info, watch->user); ??? ... On 12/3/21 3:06 PM, Ross Mohn wrote: > The callback functions in libtickit all have a declared return type of > int, and I see the examples mostly return 1, sometimes 0. I didn't > find documentation of the use of these return values, though I might > have just missed it. Are theses return values used and, if so, what > are their meanings? > > > $ grep "typedef.*Fn(" /usr/local/include/tickit.h > typedef int TickitPenEventFn(TickitPen *tt, TickitEventFlags flags, > void *info, void *user); > typedef int TickitTermEventFn(TickitTerm *tt, TickitEventFlags flags, > void *info, void *user); > typedef int TickitWindowEventFn(TickitWindow *win, TickitEventFlags > flags, void *info, void *user); > typedef int TickitCallbackFn(Tickit *t, TickitEventFlags flags, void > *info, void *user); > > Thanks -Ross From rpmohn at waxandwane.org Wed Dec 8 00:27:14 2021 From: rpmohn at waxandwane.org (Ross Mohn) Date: Wed, 08 Dec 2021 00:27:14 -0000 Subject: [Tickit-dev] Identifying terminals that support 24bit colours (RGB8) Message-ID: <965953e0-a54b-5068-ff19-4f83784028ab@waxandwane.org> Hi, would you consider this small patch to the start() function in termdriver-xterm.c? I've tested it on several terminal emulators with the demo-rgb8 example and it seems to fix things. Here's a diff: ??? diff --git a/src/termdriver-xterm.c b/src/termdriver-xterm.c ??? index 1368f4d..d7823b9 100644 ??? --- a/src/termdriver-xterm.c ??? +++ b/src/termdriver-xterm.c ??? @@ -474,6 +474,11 @@ static void start(TickitTermDriver *ttd) ??? ?? // whether it understands : to separate sub-params ??? ?? tickit_termdrv_write_strf(ttd, "\e[38;5;255m\e[38:2:0:1:2m\eP$qm\e\\\e[m"); ??? +? struct XTermDriver *xd = (struct XTermDriver *)ttd; ??? +? const char *colorterm = getenv("COLORTERM"); ??? +? if (colorterm && (strstr(colorterm, "truecolor") || strstr(colorterm, "24bit"))) ??? +??? xd->cap.rgb8 = 1; ??? + ??? ?? /* Some terminals (e.g. xfce4-terminal) don't understand DECRQM and print ??? ??? * the raw bytes directly as output, while still claiming to be TERM=xterm ??? ??? * It doens't hurt at this point to clear the current line just in case. Thank you. -Ross -- Ross Mohn OpenPGP: 0xFBB698141F0A6737 http://waxandwane.org/