mirror of https://github.com/adamdruppe/arsd.git
make mac allow X again via -version=ArsdNoCocoa
This commit is contained in:
parent
6b3aba5374
commit
de5c8055cf
79
core.d
79
core.d
|
|
@ -119,21 +119,24 @@ version(ArsdUseCustomRuntime)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
version(D_OpenD) {
|
version(ArsdNoCocoa) {
|
||||||
version(OSX)
|
} else {
|
||||||
version=OSXCocoa;
|
version(D_OpenD) {
|
||||||
version(iOS)
|
version(OSX)
|
||||||
version=OSXCocoa;
|
version=OSXCocoa;
|
||||||
} else version(DigitalMars) {
|
version(iOS)
|
||||||
version(OSX)
|
version=OSXCocoa;
|
||||||
version=OSXCocoa;
|
} else version(DigitalMars) {
|
||||||
version(iOS)
|
version(OSX)
|
||||||
version=OSXCocoa;
|
version=OSXCocoa;
|
||||||
} else version(LDC) {
|
version(iOS)
|
||||||
version(OSX)
|
version=OSXCocoa;
|
||||||
version=OSXCocoa;
|
} else version(LDC) {
|
||||||
version(iOS)
|
version(OSX)
|
||||||
version=OSXCocoa;
|
version=OSXCocoa;
|
||||||
|
version(iOS)
|
||||||
|
version=OSXCocoa;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
version = HasFile;
|
version = HasFile;
|
||||||
|
|
@ -145,7 +148,7 @@ else
|
||||||
version = HasTimer;
|
version = HasTimer;
|
||||||
version(linux)
|
version(linux)
|
||||||
version = HasTimer;
|
version = HasTimer;
|
||||||
version(OSXCocoa)
|
version(OSX)
|
||||||
version = HasTimer;
|
version = HasTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,7 +239,11 @@ version(Emscripten) {
|
||||||
// THIS FILE DOESN'T ACTUALLY EXIST, WE NEED TO MAKE IT
|
// THIS FILE DOESN'T ACTUALLY EXIST, WE NEED TO MAKE IT
|
||||||
import core.sys.openbsd.sys.event;
|
import core.sys.openbsd.sys.event;
|
||||||
} else version(OSX) {
|
} else version(OSX) {
|
||||||
version=Arsd_core_dispatch;
|
version(ArsdNoCocoa) {
|
||||||
|
version=Arsd_core_kqueue;
|
||||||
|
} else {
|
||||||
|
version=Arsd_core_dispatch;
|
||||||
|
}
|
||||||
|
|
||||||
import core.sys.darwin.sys.event;
|
import core.sys.darwin.sys.event;
|
||||||
} else version(iOS) {
|
} else version(iOS) {
|
||||||
|
|
@ -5427,6 +5434,8 @@ class Timer {
|
||||||
|
|
||||||
auto el = getThisThreadEventLoop(EventLoopType.Ui);
|
auto el = getThisThreadEventLoop(EventLoopType.Ui);
|
||||||
unregisterToken = el.addCallbackOnFdReadable(fd, new CallbackHelper(&trigger));
|
unregisterToken = el.addCallbackOnFdReadable(fd, new CallbackHelper(&trigger));
|
||||||
|
} else version(Arsd_core_kqueue) {
|
||||||
|
this.ident = ++identTicker;
|
||||||
} else throw new NotYetImplementedException();
|
} else throw new NotYetImplementedException();
|
||||||
// FIXME: freebsd 12 has timer_fd and netbsd 10 too
|
// FIXME: freebsd 12 has timer_fd and netbsd 10 too
|
||||||
}
|
}
|
||||||
|
|
@ -5462,6 +5471,17 @@ class Timer {
|
||||||
if(timerfd_settime(fd, 0, &value, null) == -1) {
|
if(timerfd_settime(fd, 0, &value, null) == -1) {
|
||||||
throw new ErrnoApiException("couldn't change pulse timer", errno);
|
throw new ErrnoApiException("couldn't change pulse timer", errno);
|
||||||
}
|
}
|
||||||
|
} else version(Arsd_core_kqueue) {
|
||||||
|
// FIXME
|
||||||
|
|
||||||
|
auto el = cast(CoreEventLoopImplementation) getThisThreadEventLoop();
|
||||||
|
|
||||||
|
kevent_t ev;
|
||||||
|
|
||||||
|
cbh = new CallbackHelper(&trigger);
|
||||||
|
|
||||||
|
EV_SET(&ev, this.ident, EVFILT_TIMER, EV_ADD | EV_ENABLE | EV_CLEAR | (repeats ? 0 : EV_ONESHOT), NOTE_USECONDS, 1000 * intervalInMilliseconds, cast(void*) cbh);
|
||||||
|
ErrnoEnforce!kevent(el.kqueuefd, &ev, 1, null, 0, null);
|
||||||
} else {
|
} else {
|
||||||
throw new NotYetImplementedException();
|
throw new NotYetImplementedException();
|
||||||
}
|
}
|
||||||
|
|
@ -5524,7 +5544,7 @@ class Timer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
version(Windows) {} else {
|
version(Windows) {} else version(Arsd_core_kqueue) {} else {
|
||||||
ICoreEventLoop.UnregisterToken unregisterToken;
|
ICoreEventLoop.UnregisterToken unregisterToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5539,26 +5559,24 @@ class Timer {
|
||||||
void destroy() {
|
void destroy() {
|
||||||
version(Windows) {
|
version(Windows) {
|
||||||
cbh.release();
|
cbh.release();
|
||||||
} else {
|
|
||||||
unregisterToken.unregister();
|
|
||||||
}
|
|
||||||
|
|
||||||
version(Windows) {
|
|
||||||
staticDestroy(handle);
|
staticDestroy(handle);
|
||||||
handle = null;
|
handle = null;
|
||||||
} else version(linux) {
|
} else version(linux) {
|
||||||
|
unregisterToken.unregister();
|
||||||
staticDestroy(fd);
|
staticDestroy(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
|
} else version(Arsd_core_kqueue) {
|
||||||
} else throw new NotYetImplementedException();
|
} else throw new NotYetImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
~this() {
|
~this() {
|
||||||
version(Windows) {} else
|
version(Windows) {
|
||||||
|
if(handle)
|
||||||
|
cleanupQueue.queue!staticDestroy(handle);
|
||||||
|
} else version(linux) {
|
||||||
cleanupQueue.queue!unregister(unregisterToken);
|
cleanupQueue.queue!unregister(unregisterToken);
|
||||||
version(Windows) { if(handle)
|
if(fd != -1)
|
||||||
cleanupQueue.queue!staticDestroy(handle);
|
cleanupQueue.queue!staticDestroy(fd);
|
||||||
} else version(linux) { if(fd != -1)
|
|
||||||
cleanupQueue.queue!staticDestroy(fd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5621,6 +5639,7 @@ class Timer {
|
||||||
if(this.lastEventLoopRoundTriggered == eventLoopRound)
|
if(this.lastEventLoopRoundTriggered == eventLoopRound)
|
||||||
return; // never try to actually run faster than the event loop
|
return; // never try to actually run faster than the event loop
|
||||||
lastEventLoopRoundTriggered = eventLoopRound;
|
lastEventLoopRoundTriggered = eventLoopRound;
|
||||||
|
} else version(Arsd_core_kqueue) {
|
||||||
} else throw new NotYetImplementedException();
|
} else throw new NotYetImplementedException();
|
||||||
|
|
||||||
if(onPulse)
|
if(onPulse)
|
||||||
|
|
@ -5642,6 +5661,10 @@ class Timer {
|
||||||
CallbackHelper cbh;
|
CallbackHelper cbh;
|
||||||
} else version(linux) {
|
} else version(linux) {
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
} else version(Arsd_core_kqueue) {
|
||||||
|
int ident;
|
||||||
|
static int identTicker;
|
||||||
|
CallbackHelper cbh;
|
||||||
} else static if(UseCocoa) {
|
} else static if(UseCocoa) {
|
||||||
} else static assert(0, "timer not supported");
|
} else static assert(0, "timer not supported");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1164,17 +1164,19 @@ unittest {
|
||||||
|
|
||||||
import arsd.core;
|
import arsd.core;
|
||||||
|
|
||||||
version(D_OpenD) {
|
version(ArsdNoCocoa) {
|
||||||
version(OSX)
|
|
||||||
version=OSXCocoa;
|
|
||||||
version(iOS)
|
|
||||||
version=OSXCocoa;
|
|
||||||
} else {
|
} else {
|
||||||
version(OSX) version(DigitalMars) version=OSXCocoa;
|
version(D_OpenD) {
|
||||||
|
version(OSX)
|
||||||
|
version=OSXCocoa;
|
||||||
|
version(iOS)
|
||||||
|
version=OSXCocoa;
|
||||||
|
} else {
|
||||||
|
version(OSX) version(DigitalMars) version=OSXCocoa;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
version(Emscripten) {
|
version(Emscripten) {
|
||||||
version=allow_unimplemented_features;
|
version=allow_unimplemented_features;
|
||||||
version=without_opengl;
|
version=without_opengl;
|
||||||
|
|
@ -4415,6 +4417,10 @@ struct EventLoopImpl {
|
||||||
|
|
||||||
void delegate(int) signalHandler;
|
void delegate(int) signalHandler;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
version(Posix) {
|
||||||
|
static import unix = core.sys.posix.unistd;
|
||||||
|
}
|
||||||
|
|
||||||
version(X11) {
|
version(X11) {
|
||||||
int pulseFd = -1;
|
int pulseFd = -1;
|
||||||
|
|
@ -4624,7 +4630,7 @@ struct EventLoopImpl {
|
||||||
ref int customEventFDRead() { return SimpleWindow.customEventFDRead; }
|
ref int customEventFDRead() { return SimpleWindow.customEventFDRead; }
|
||||||
version(Posix)
|
version(Posix)
|
||||||
ref int customEventFDWrite() { return SimpleWindow.customEventFDWrite; }
|
ref int customEventFDWrite() { return SimpleWindow.customEventFDWrite; }
|
||||||
version(linux)
|
version(Posix)
|
||||||
ref int customSignalFD() { return SimpleWindow.customSignalFD; }
|
ref int customSignalFD() { return SimpleWindow.customSignalFD; }
|
||||||
version(Windows)
|
version(Windows)
|
||||||
ref auto customEventH() { return SimpleWindow.customEventH; }
|
ref auto customEventH() { return SimpleWindow.customEventH; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue