1612 Commits

Author SHA1 Message Date
Sergey Bugaev
f965e69721 Implement basic NSSavePanel & NSOpenPanel-s directly in Cocoa
The upstream Cocotron assumes that the implementation of the file panels
is provided by the display, i.e. by the native toolkit. That is what we
ultimately want as well, but we're far from being there yet, and we also
don't want to make any toolkit a hard requirement.

So in order to have our cake and eat it too, these panel implementations
are designed work entirely inside Cocoa but also let the display provide
a native implementation instead if one is available.
2018-12-17 00:34:31 +03:00
Sergey Bugaev
26a2c08c8b Fix NSTableView rendering zero-sized rows
There's no reason to reallocate the row heights cache here.
2018-12-17 00:34:31 +03:00
Sergey Bugaev
a924c352f5 Fix always reporting left mouse button
This makes right-clicking and scrolling work.
2018-12-17 00:34:31 +03:00
Sergey Bugaev
ff314703cd Add NSEventTypeOtherMouseUp 2018-12-17 00:34:31 +03:00
Sergey Bugaev
c95aecf2a3 Actually propagate setAcceptsMouseMovedEvents to XSelectInput()
X11Display already has the code to drop mouse moved events in case
the window does not want them; but we weren't getting the events in
the first place because they were filtered out on the server side.

Fixes, among other things, NSMenu not reacting to clicks properly,
because it was assuming the clicked item was not the selected one
as it could not see the mouse hovering over it.
2018-12-17 00:34:31 +03:00
Sergey Bugaev
1403e9700b Fix -[NSApp runModalForWindow:] hanging
There's no need to additionally spin the run loop since runModalSession: does that
already, in a proper way (that is via nextEventMatchingMask:untilDate:inMode:dequeue:]),
and spinning the run loop directly prevents AppKit from getting its events.
2018-12-16 23:56:58 +03:00
Sergey Bugaev
6474bcd088 NSInteger-ization
See https://github.com/darlinghq/darling/issues/418
2018-12-16 23:54:57 +03:00
Sergey Bugaev
0b5ea84d65 Modernize/improve NSEventType/NSEventMask 2018-11-27 22:33:48 +03:00
Sergey Bugaev
73d36fa841 Add a bunch of NSImageName's
These are just the strings, the images themselves are still missing.
2018-11-27 22:33:48 +03:00
Sergey Bugaev
4c46590230 Implement dynamic loading of AppKit backends
At the moment, there's only one, X11.backend
2018-11-27 22:33:48 +03:00
Sergey Bugaev
29c1349bc6 Fix deallocating an X11Display 2018-11-27 22:33:48 +03:00
Sergey Bugaev
4287f05174 Turn backend-specific CG*() functions into NSDisplay methods
As they are so clearly meant to be. This is also a prerequisite for building
the X11 backend as a separate dynamically loaded Mach-O and loading many such
backends at the same time.
2018-11-27 22:33:48 +03:00
Sergey Bugaev
ba12e65f5a Split X11.subproj into X11.backend and Linux.subproj (FreeType, fontconfig)
Also, drop unused NSOpenGLDrawable_X11, O2Context_cairo and O2Surface_cairo.
2018-11-27 22:25:54 +03:00
Sergey Bugaev
9622fe5236 Pretend to have arbitrary font families like we do for individual fonts already 2018-11-27 22:25:54 +03:00
Sergey Bugaev
18ffffb795 Fix loading the first main menu item
localizedInfoDictionary can be nil if the corresponding localization is missing; you have
to either account for that by falling back to infoDictionary, or use objectForInfoDictionaryKey:
which (in addition to being more concise than [[localizedInfoDictionary] objectForKey:]) implements
automatical fallback to the non-localized dictionary.
2018-11-27 22:25:54 +03:00
Sergey Bugaev
4558f13663 Install some more nibs 2018-11-27 22:25:54 +03:00
Sergey Bugaev
3752636e4f Fix resizing X11Window-s 2018-09-12 09:25:27 +03:00
Sergey Bugaev
e3bb5c9196 CGFloat/O2Float-ization
See darlinghq/darling#418
2018-09-12 09:25:27 +03:00
Sergey Bugaev
e2b11f541c Install NSButtonCell_disclosure resources 2018-09-09 22:09:03 +03:00
Sergey Bugaev
078fe9beb7 De-NSInteger-ize {CG,O2}FontGetGlyphAdvances()
Turns out it didn't just break the build (269215f670),
it was actually *wrong*; the Apple's version uses a plain int (not even a CFIndex) for some reason. Do the same in O2FontGetGlyphAdvances(),
but keep the internal ivar as an NSInteger array pointer; we're making a copy in O2FontGetGlyphAdvances() anyway.
2018-09-08 14:06:56 +03:00
Sergey Bugaev
f0589098ad Do not cast SEL to id
This only happens to work because they are of the same size (pointer).
2018-09-02 23:26:23 +03:00
Sergey Bugaev
d5ecefdc80 Add a few system colors
See commit e0cbc2b84387bc251799eea34ca5f0900cd883a8
2018-09-02 23:25:39 +03:00
Sergey Bugaev
098332d8ee Rewrite FreeType bitmap rendering; now with horizontal clipping support
And much nicer code, too.
2018-09-02 23:24:30 +03:00
Sergey Bugaev
8b1f575427 Disable threaded animation of NSProgressIndicator
The way it's implemented it doesn't work and it's unclear how it is supposed to.
2018-09-02 23:23:12 +03:00
Sergey Bugaev
b4de5dabd8 Style up pushed buttons
See commit 5352e472c9978d9dde5c03ea99c11e9958941b39
2018-09-02 23:21:59 +03:00
Sergey Bugaev
7215911cb6 Support CFBundleTypeExtensions=* 2018-09-02 23:21:39 +03:00
Sergey Bugaev
6caf1a0d99 Include the objc runtime header where needed 2018-09-02 23:20:29 +03:00
Sergey Bugaev
1b93004304 Only invoke updateCell: if the controlView responds to it
Otherwise, simply mark it as needing display.
Also, make sure to do all of this when setting an attributed string value.
2018-09-02 23:18:02 +03:00
Sergey Bugaev
a66dd5efba NSInteger-ization & CGFloat/O2Float-ization
See https://github.com/darlinghq/darling/issues/418
2018-09-02 23:14:39 +03:00
Sergey Bugaev
6b789836a8 Fix X11Display ignoring buffered events
-[X11Display processPendingEvnets], which dequeues events from the X11 event queue,
converts them to NSEvents and finally enqueues into the NSDisplay event queue, was
only invoked as a result of the X11 socket becoming readable during an iteration of
NSRunLoop. However, events can arrive and be queued by libX11 as a result of some
other interactions with X11, such as querying the mouse position, in which case the
socket won't be readable, but libX11 will still contain queued events.

Fix this by invoking -[X11Display processPendingEvnets] an additional time before
delegating to super's implementation which spins the loop; this way the NSDisplay
implementation can observe pending events in the event queue and deliver them
immediately.
2018-08-18 13:13:07 +03:00
Lubos Dolezel
9585490b67 Raise if a CGL context cannot be created 2018-08-14 21:40:04 +02:00
Lubos Dolezel
04280a8d90 Add stubs and other things for The Unarchiver 2018-08-14 17:54:53 +02:00
Lubos Dolezel
abcd7e4f5e Use proper retain/release order in NSMenuTemplate 2018-08-14 17:06:35 +02:00
Lubos Dolezel
8f295595e0 Legacy nib decoding initial work 2018-08-14 17:00:24 +02:00
Lubos Dolezel
95d4f03ccc Add NSErrors definitions 2018-08-14 14:44:48 +02:00
Andrew Hyatt
d454865baf
Move NSFileWrapper to Foundation 2018-08-13 21:08:07 -04:00
Sergey Bugaev
99d231c295 Stop calling __NSInitializeProcess explicitly
We're going to make it a constructor instead; this way it will get called
even if the app doesn't use NSApplicationMain().
2018-08-11 08:20:36 +03:00
Sergey Bugaev
3102591f57 Implement [NSBundle(NSNibLoading) loadNibNamed:owner:topLevelObjects:] 2018-08-11 08:20:36 +03:00
Sergey Bugaev
b53e44baa6 Make NSClassSwapper work with classes that don't implement initWithCoder: 2018-08-11 08:20:36 +03:00
Sergey Bugaev
7fb9afaafb Stub [NSColorPickerColorList setColor:] 2018-08-11 08:20:36 +03:00
Sergey Bugaev
4372d3fe0d Enable NSColorPickerColorList
It's disabled for years now with a comment saying:
"// Disabled to see if it fixes a nib instantiation issue"

We haven't seen any nib crashes related to this in Darling, so enable it.
2018-08-11 08:20:36 +03:00
Sergey Bugaev
f2d15eda94 Implement support for app-specific fonts
Fixes darlinghq/darling#408
2018-08-11 08:20:36 +03:00
Sergey Bugaev
7891d109c3 Implement vertical clipping of text 2018-08-11 08:20:36 +03:00
Sergey Bugaev
acfd82532a Fix calculating event location in pop up menus 2018-08-11 08:20:36 +03:00
Sergey Bugaev
953444b5f7 Implement [X11Display mouseLocation] 2018-08-11 08:20:36 +03:00
Sergey Bugaev
21ec7d7897 Warn when failing to connect to an X11 display
This serves to remind me to export a working DISPLAY.
2018-08-11 08:20:36 +03:00
Sergey Bugaev
384f244502 Stub out [NSWorkspace runningApplications] 2018-08-11 08:20:36 +03:00
Sergey Bugaev
d0744752c1 Implement [NSColor colorWithWhite:alpha:] 2018-08-11 08:20:36 +03:00
Sergey Bugaev
52ce417ce5 Add several missing API stubs 2018-08-11 08:20:36 +03:00
Sergey Bugaev
39e172a560 Implement support for cell-less controls 2018-08-11 08:20:36 +03:00