mirror of https://github.com/adamdruppe/arsd.git
more stuff
This commit is contained in:
parent
3bcce8b478
commit
08e525e2de
|
@ -2662,10 +2662,13 @@ static struct GenericCursor {
|
||||||
struct EventLoop {
|
struct EventLoop {
|
||||||
@disable this();
|
@disable this();
|
||||||
|
|
||||||
|
/// Gets a reference to an existing event loop
|
||||||
static EventLoop get() {
|
static EventLoop get() {
|
||||||
return EventLoop(0, null);
|
return EventLoop(0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Construct an application-global event loop for yourself
|
||||||
|
/// See_Also: [SimpleWindow.setEventHandlers]
|
||||||
this(long pulseTimeout, void delegate() handlePulse) {
|
this(long pulseTimeout, void delegate() handlePulse) {
|
||||||
if(impl is null)
|
if(impl is null)
|
||||||
impl = new EventLoopImpl(pulseTimeout, handlePulse);
|
impl = new EventLoopImpl(pulseTimeout, handlePulse);
|
||||||
|
@ -2693,12 +2696,14 @@ struct EventLoop {
|
||||||
impl.refcount++;
|
impl.refcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Runs the event loop until the whileCondition, if present, returns false
|
||||||
int run(bool delegate() whileCondition = null) {
|
int run(bool delegate() whileCondition = null) {
|
||||||
assert(impl !is null);
|
assert(impl !is null);
|
||||||
impl.notExited = true;
|
impl.notExited = true;
|
||||||
return impl.run(whileCondition);
|
return impl.run(whileCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Exits the event loop
|
||||||
void exit() {
|
void exit() {
|
||||||
assert(impl !is null);
|
assert(impl !is null);
|
||||||
impl.notExited = false;
|
impl.notExited = false;
|
||||||
|
|
Loading…
Reference in New Issue