git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

Cocoa/NSToolbarItem+NoOverflow.m

      1 #import <AppKit/AppKit.h>
      2 #import <objc/runtime.h>
      3 
      4 static id nop(id self, SEL _cmd)
      5 {
      6     return nil;
      7 }
      8 
      9 static double minSize(id self, SEL _cmd)
     10 {
     11     return 80.0;
     12 }
     13 
     14 @implementation NSToolbarItem (NoOverflow)
     15 
     16 + (void)load
     17 {
     18     // Prevent collapsing toolbar items into menu items, they don't work in that form
     19     method_setImplementation(class_getInstanceMethod(self, @selector(menuFormRepresentation)), (IMP)nop);
     20     // Prevent over-agressive collapsing of the Printer Feed menu
     21     method_setImplementation(class_getInstanceMethod(NSClassFromString(@"NSToolbarTitleView"), @selector(minSize)), (IMP)minSize);
     22 }
     23 
     24 @end

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.