This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I'm thinking these two will resolve themselves when the others do? There | |
// doesn't seem to be an explicit way to make a window not key besides replacing | |
// it with another window, or closing it. | |
[...] | |
-> _keyWindow | |
-> MyWindow | |
[...] | |
-> NSDragDestination (_window) | |
-> MyWindow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// # To test (macOS only) | |
// - Copy the contents of this file into a file called main.m | |
// - Run `clang main.m -fobjc-arc -xobjective-c++ -framework Cocoa && ./a.out` | |
// in bash | |
// - Send me: | |
// + The copy pasted console output from the run | |
// + Your macOS version (Apple > About This Mac) | |
// + Your clang version (`clang --version`) | |
// + Whether or not your computer has a Touch Bar | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc refresh_rate.m -framework Cocoa -framework CoreVideo && ./a.out | |
// | |
// Prints the refresh rate of your main screen...I think. | |
#import <Cocoa/Cocoa.h> | |
#import <Carbon/Carbon.h> | |
int main() { | |
NSScreen *screen = [NSScreen mainScreen]; | |
CGDirectDisplayID id = (CGDirectDisplayID)[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// *DISCLAIMER IF YOU FOUND THIS VIA GOOGLE: I'm at the time of writing still figuring this out, it | |
// works for me but I don't actually know if it's correct yet* | |
// | |
// This is a minimal example of how one might accept text entry in Cocoa in an OpenGL app or | |
// such. Unlike using `[event characters]`, it ignores unprintable keys such as the arrow keys. It | |
// also allows you to type accents and such, e.g. `alt+e o`. This example contains no error | |
// checking, and the only way to exit it is to kill it from the command line. | |
// | |
// To execute it, run: | |
// `$ gcc minimal_cocoa_gl_text_entry.m -framework Cocoa && ./a.out` |