From: Romano <unobe@cpan.org>
To: 9fans <9fans@9fans.net>
Subject: Re: [9fans] drawterm with HIDPI support for macOS
Date: Sat, 27 Dec 2025 10:49:24 -0800 [thread overview]
Message-ID: <c4387f85-1c10-4866-ac3f-d63dd4e4881f@app.fastmail.com> (raw)
In-Reply-To: <CAP6exYLCAJC3FU_9p6H9pW+t1=K46z_M1OGebTwZ17-DyvrY6Q@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5505 bytes --]
While on the topic of macOS drawterm, I had posted this patch in August on the 9front mailing list. Not sure if it would be useful with the original drawterm but posting in just in case. I've been running the below patch for a year now when connecting from a Mac, and it's improved my experience.
From: Romano <me+git@fallglow.com>
Date: Mon, 12 Aug 2024 23:44:17 +0000
Subject: [PATCH] osx-cocoa: make riow more operational
* map command key to mod4 so riow can be used
* update submenu shortcuts to not overlap with riow f and h hotkeys
* when cmd-q is pressed, show confirmation modal
---
diff 7fee327ee530409dee0d36cb258927934ba97aff a4bc9df7035a513262d563d29a0be7fdcdeb2b4c
--- a/gui-cocoa/screen.m
+++ b/gui-cocoa/screen.m
@@ -310,13 +310,29 @@
cpubody();
}
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
+{
+ if([sender mainWindow] == nil)
+ return NSTerminateNow;
+
+ NSAlert *alert = [[NSAlert alloc] init];
+ [alert setMessageText:@"Really quit drawterm?"];
+ [alert addButtonWithTitle:@"Yes"];
+ [alert addButtonWithTitle:@"Cancel"];
+ [alert setAlertStyle:NSAlertStyleCritical];
+ int choice = [alert runModal];
+ if(choice == NSAlertFirstButtonReturn)
+ return NSTerminateNow;
+ return NSTerminateCancel;
+}
+
- (void) applicationDidFinishLaunching:(NSNotification *)aNotification
{
LOG(@"BEGIN");
NSMenu *sm = [NSMenu new];
- [sm addItemWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"];
- [sm addItemWithTitle:@"Hide" action:@selector(hide:) keyEquivalent:@"h"];
+ [sm addItemWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"F"];
+ [sm addItemWithTitle:@"Hide" action:@selector(hide:) keyEquivalent:@"H"];
[sm addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
NSMenu *m = [NSMenu new];
[m addItemWithTitle:@"DEVDRAW" action:NULL keyEquivalent:@""];
@@ -549,11 +565,13 @@
}else
kbdkey(Kalt, 1);
}
- if((x & NSEventModifierFlagCommand) != 0)
+ if((x & NSEventModifierFlagCommand) != 0){
if(u){
u |= 4;
[self sendmouse:u];
- }
+ }else
+ kbdkey(Kmod4, 1);
+ }
if((x & ~_mods & NSEventModifierFlagCapsLock) != 0)
kbdkey(Kcaps, 1);
if((~x & _mods & NSEventModifierFlagShift) != 0)
@@ -568,6 +586,8 @@
_breakcompose = NO;
}
}
+ if((~x & NSEventModifierFlagCommand) != 0)
+ kbdkey(Kmod4, 0);
if((~x & _mods & NSEventModifierFlagCapsLock) != 0)
kbdkey(Kcaps, 0);
_mods = x;
@@ -585,6 +605,10 @@
if((_mods & NSEventModifierFlagOption) != 0){
kbdkey(Kalt, 0);
_mods ^= NSEventModifierFlagOption;
+ }
+ if((_mods & NSEventModifierFlagCommand) != 0){
+ kbdkey(Kmod4, 0);
+ _mods ^= NSEventModifierFlagCommand;
}
}
--
⑨
On Fri, Dec 26, 2025, at 7:54 PM, ron minnich wrote:
> as usual, on mac, the path did not run smooth.
>
> I'm attaching the two commits I made to your changes to get it to build. The problems I hit (all OSX problems) were so strange -- "you don't want to know"
>
> They're nasty hacks, I think you can make them better, I just wanted to give you a look at what I had to do.
>
> Just doing a straight build got me strange errors a the link step that looked like library corruption, OR a bad binary architecture ID -- not sure.
>
> apologies in advance for this not very nice 2 patches.
>
> note that I used zig cc -- it just works better for me.
>
> The -fno-sanitize=undefined is needed because there are lots of little bits of code in drawterm that do things that are no longer freely accepted, e.g.
> arithmetic on null pointer in qstrfmt and
> ulong = (int << 24)
> which expressions that arive from:
> ulong = (uchar << 24)
> uchar is promoted to int, << 24 on int is not defined behavior.
>
> There are also lots of gcc-isms in the code around struct member init, which maybe ought to be fixed.
>
> These problems are in the original as well.
>
> Finally, I have to try to remember a plan 9 host I can log into :-)
> Thanks, Rui, I can already see your drawterm is way better that the standard one on my mac. I hope your changes get upstream.
>
> On Thu, Dec 18, 2025 at 5:52 AM Rui Carmo <rui.carmo@gmail.com> wrote:
>> A quick heads up that I tried using drawterm on a modern Mac and was sorely miffed that I couldn’t adjust pixel density/scaling (and hence font size, which on modern displays appears as if scaled for ants), so I forked it in mild but controlled anger and bewilderment and did some patching:
>>
>> https://github.com/rcarmo/drawterm
>>
>> https://github.com/rcarmo/drawterm/commit/0b5788f3601f6d5bd28c70519b4f4605f8e551d9#diff-e4e63e048e3749f2de0f385f6355ffc1a0f79254a740477abc8b40eac9d794b2
>>
>> Take it with the usual “works for me” disclaimer.
>>
>> Thanks,
>>
>> R.
>>
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions <https://9fans.topicbox.com/groups/9fans> + participants <https://9fans.topicbox.com/groups/9fans/members> + delivery options <https://9fans.topicbox.com/groups/9fans/subscription> Permalink <https://9fans.topicbox.com/groups/9fans/T199d5de5c52dd71b-M0dbd0a65ae3616709adb127c>
>
> *Attachments:*
> • 0002-scripts-for-using-ZIG.patch
> • 0001-fix-makefiles-for-zig-cc.patch
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T199d5de5c52dd71b-Mea12243cd2b4032fe66c2b9d
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[-- Attachment #2: Type: text/html, Size: 7987 bytes --]
next prev parent reply other threads:[~2025-12-27 19:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 12:37 [9fans] drawterm with HIDPI support for macOS Rui Carmo
2025-12-27 3:54 ` ron minnich
2025-12-27 18:49 ` Romano [this message]
2025-12-28 14:00 ` Rui Carmo
2025-12-28 14:02 ` Rui Carmo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c4387f85-1c10-4866-ac3f-d63dd4e4881f@app.fastmail.com \
--to=unobe@cpan.org \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).