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 <[email protected]> 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 <[email protected]> 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
