I googled "BSD X Window Programming" and stumbled my way into finally getting a window open in pure C. Where on page 17 the phrase ".X Windowing System developed at MIT" hit me and I remembered how I couldn't open up a window and how pissed I was about that, and I thought maybe this was finally the solution! I was reading up on the operating system the Mac is built on - Berkley Software Distribution. I remember seeing this question about a year ago, back when I so desperately wished I could open up a d*** window, googling for days and only finding the type of answers you see above this post. While it's technically possible to do everything this way, you're making it much harder than it ought to be. 90% of that code can be replaced by an xib file, and doing it this way really restricts your app because more advanced features of the Apple development stack really on Objective-C features. Shows our window in the bottom-left hand corner of the screen.Ĭmacs_void_msgSend1(self->window, sel_getUid("makeKeyAndOrderFront:"), self) here we simply add the view to the window.Ĭmacs_void_msgSend1(self->window, sel_getUid("setContentView:"), view) Ĭmacs_simple_msgSend(self->window, sel_getUid("becomeFirstResponder")) Typedef enum NSApplicationActivationPolicy ) $ clang minimal.c -framework Cocoa -o minimal.app Minimal Pure C code to create a window in Cocoa ![]() I did a translation of the accepted answer to Pure C: // based on
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |