osx stuff

This commit is contained in:
Adam D. Ruppe 2020-01-31 18:30:57 -05:00
parent ca8aa18fd2
commit 96990d94ff
3 changed files with 21 additions and 1 deletions

View File

@ -36,6 +36,8 @@
"targetType": "library",
"importPaths": ["."],
"dflags": ["-mv=arsd.simpledisplay=simpledisplay.d"],
"versions-osx": [ "OSXCocoa", "allow_unimplemented_features", "without_opengl" ],
"lflags-osx": ["-framework", "Cocoa"],
"dependencies": {"arsd-official:color_base":"*"},
"configurations": [
{

View File

@ -5721,7 +5721,8 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
else version(custom_widgets) {
// FIXME
Timer caretTimer;
static if(SimpledisplayTimerAvailable)
Timer caretTimer;
TextLayout textLayout;
void setupCustomTextEditing() {
@ -5801,6 +5802,7 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
auto painter = this.draw();
textLayout.drawCaret(painter);
static if(SimpledisplayTimerAvailable)
if(caretTimer) {
caretTimer.destroy();
caretTimer = null;
@ -5812,6 +5814,7 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
blinkingCaret = false; // if on a remote connection, don't waste bandwidth on an expendable blink
if(blinkingCaret)
static if(SimpledisplayTimerAvailable)
caretTimer = new Timer(500, {
if(parentWindow.win.closed) {
caretTimer.destroy();
@ -5833,6 +5836,7 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
version(custom_widgets) {
auto painter = this.draw();
textLayout.eraseCaret(painter);
static if(SimpledisplayTimerAvailable)
if(caretTimer) {
caretTimer.destroy();
caretTimer = null;

View File

@ -809,6 +809,15 @@ unittest {
}
}
/*
version(OSX) {
version=without_opengl;
version=allow_unimplemented_features;
version=OSXCocoa;
pragma(linkerDirective, "-framework Cocoa");
}
*/
version(without_opengl) {
enum SdpyIsUsingIVGLBinds = false;
} else /*version(Posix)*/ {
@ -992,6 +1001,11 @@ version(Windows)
version(linux)
version = with_timer;
version(with_timer)
enum bool SimpledisplayTimerAvailable = true;
else
enum bool SimpledisplayTimerAvailable = false;
/// If you have to get down and dirty with implementation details, this helps figure out if Windows is available you can `static if(UsingSimpledisplayWindows) ...` more reliably than `version()` because `version` is module-local.
version(Windows)
enum bool UsingSimpledisplayWindows = true;