mirror of https://github.com/adamdruppe/arsd.git
Merge pull request #461 from analogjupiter/despace
Fix tabs/space mixing in sdpy
This commit is contained in:
commit
0fce8ff5e5
141
simpledisplay.d
141
simpledisplay.d
|
@ -2652,23 +2652,23 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
MONITORINFO mi;
|
MONITORINFO mi;
|
||||||
mi.cbSize = MONITORINFO.sizeof;
|
mi.cbSize = MONITORINFO.sizeof;
|
||||||
if (GetWindowPlacement(hwnd, &g_wpPrev) &&
|
if (GetWindowPlacement(hwnd, &g_wpPrev) &&
|
||||||
GetMonitorInfo(MonitorFromWindow(hwnd,
|
GetMonitorInfo(MonitorFromWindow(hwnd,
|
||||||
MONITOR_DEFAULTTOPRIMARY), &mi)) {
|
MONITOR_DEFAULTTOPRIMARY), &mi)) {
|
||||||
SetWindowLong(hwnd, GWL_STYLE,
|
SetWindowLong(hwnd, GWL_STYLE,
|
||||||
dwStyle & ~WS_OVERLAPPEDWINDOW);
|
dwStyle & ~WS_OVERLAPPEDWINDOW);
|
||||||
SetWindowPos(hwnd, HWND_TOP,
|
SetWindowPos(hwnd, HWND_TOP,
|
||||||
mi.rcMonitor.left, mi.rcMonitor.top,
|
mi.rcMonitor.left, mi.rcMonitor.top,
|
||||||
mi.rcMonitor.right - mi.rcMonitor.left,
|
mi.rcMonitor.right - mi.rcMonitor.left,
|
||||||
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
||||||
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SetWindowLong(hwnd, GWL_STYLE,
|
SetWindowLong(hwnd, GWL_STYLE,
|
||||||
dwStyle | WS_OVERLAPPEDWINDOW);
|
dwStyle | WS_OVERLAPPEDWINDOW);
|
||||||
SetWindowPlacement(hwnd, &g_wpPrev);
|
SetWindowPlacement(hwnd, &g_wpPrev);
|
||||||
SetWindowPos(hwnd, null, 0, 0, 0, 0,
|
SetWindowPos(hwnd, null, 0, 0, 0, 0,
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
|
||||||
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else version(X11) {
|
} else version(X11) {
|
||||||
|
@ -2986,8 +2986,8 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
view.setNeedsDisplay(true);
|
view.setNeedsDisplay(true);
|
||||||
|
|
||||||
NSApp.run();
|
NSApp.run();
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
EventLoop el = EventLoop(pulseTimeout, handlePulse);
|
EventLoop el = EventLoop(pulseTimeout, handlePulse);
|
||||||
|
|
||||||
if((blockingMode & BlockingMode.onlyIfNotNested) && el.impl.refcount > 1)
|
if((blockingMode & BlockingMode.onlyIfNotNested) && el.impl.refcount > 1)
|
||||||
|
@ -3136,14 +3136,14 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
||||||
|
|
||||||
/// This will allow you to change OpenGL vsync state.
|
/// This will allow you to change OpenGL vsync state.
|
||||||
final @property void vsync (bool wait) {
|
final @property void vsync (bool wait) {
|
||||||
if (this._closed) return; // window may be closed, but timer is still firing; avoid GLXBadDrawable error
|
if (this._closed) return; // window may be closed, but timer is still firing; avoid GLXBadDrawable error
|
||||||
version(X11) {
|
version(X11) {
|
||||||
setAsCurrentOpenGlContext();
|
setAsCurrentOpenGlContext();
|
||||||
glxSetVSync(display, impl.window, wait);
|
glxSetVSync(display, impl.window, wait);
|
||||||
} else version(Windows) {
|
} else version(Windows) {
|
||||||
setAsCurrentOpenGlContext();
|
setAsCurrentOpenGlContext();
|
||||||
wglSetVSync(wait);
|
wglSetVSync(wait);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set this to `false` if you don't need to do `glFinish()` after `swapOpenGlBuffers()`.
|
/// Set this to `false` if you don't need to do `glFinish()` after `swapOpenGlBuffers()`.
|
||||||
|
@ -17902,7 +17902,7 @@ union XEvent{
|
||||||
static assert(XMappingEvent.sizeof == 56);
|
static assert(XMappingEvent.sizeof == 56);
|
||||||
static assert(XEvent.sizeof == 192);
|
static assert(XEvent.sizeof == 192);
|
||||||
} else version (AArch64) {
|
} else version (AArch64) {
|
||||||
// omit check for aarch64
|
// omit check for aarch64
|
||||||
} else {
|
} else {
|
||||||
static assert(Display.sizeof == 176);
|
static assert(Display.sizeof == 176);
|
||||||
static assert(XPointer.sizeof == 4);
|
static assert(XPointer.sizeof == 4);
|
||||||
|
@ -19150,7 +19150,7 @@ extern(System) nothrow @nogc {
|
||||||
|
|
||||||
|
|
||||||
private __gshared extern(System) BOOL function(int) wglSwapIntervalEXT;
|
private __gshared extern(System) BOOL function(int) wglSwapIntervalEXT;
|
||||||
void wglSetVSync(bool wait) {
|
void wglSetVSync(bool wait) {
|
||||||
if(wglSwapIntervalEXT is null) {
|
if(wglSwapIntervalEXT is null) {
|
||||||
wglSwapIntervalEXT = cast(typeof(wglSwapIntervalEXT)) wglGetProcAddress("wglSwapIntervalEXT");
|
wglSwapIntervalEXT = cast(typeof(wglSwapIntervalEXT)) wglGetProcAddress("wglSwapIntervalEXT");
|
||||||
if(wglSwapIntervalEXT is null)
|
if(wglSwapIntervalEXT is null)
|
||||||
|
@ -23063,20 +23063,20 @@ __gshared bool openGlLibrariesSuccessfullyLoaded = true;
|
||||||
|
|
||||||
private mixin template DynamicLoadSupplementalOpenGL(Iface) {
|
private mixin template DynamicLoadSupplementalOpenGL(Iface) {
|
||||||
// mixin(staticForeachReplacement!Iface);
|
// mixin(staticForeachReplacement!Iface);
|
||||||
static foreach(name; __traits(derivedMembers, Iface))
|
static foreach(name; __traits(derivedMembers, Iface))
|
||||||
mixin("__gshared typeof(&__traits(getMember, Iface, name)) " ~ name ~ ";");
|
mixin("__gshared typeof(&__traits(getMember, Iface, name)) " ~ name ~ ";");
|
||||||
|
|
||||||
void loadDynamicLibrary() @nogc {
|
void loadDynamicLibrary() @nogc {
|
||||||
(cast(void function() @nogc) &loadDynamicLibraryForReal)();
|
(cast(void function() @nogc) &loadDynamicLibraryForReal)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadDynamicLibraryForReal() {
|
void loadDynamicLibraryForReal() {
|
||||||
foreach(name; __traits(derivedMembers, Iface)) {
|
foreach(name; __traits(derivedMembers, Iface)) {
|
||||||
mixin("alias tmp = " ~ name ~ ";");
|
mixin("alias tmp = " ~ name ~ ";");
|
||||||
tmp = cast(typeof(tmp)) glbindGetProcAddress(name);
|
tmp = cast(typeof(tmp)) glbindGetProcAddress(name);
|
||||||
if(tmp is null) throw new Exception("load failure of function " ~ name ~ " from supplemental OpenGL");
|
if(tmp is null) throw new Exception("load failure of function " ~ name ~ " from supplemental OpenGL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/+
|
/+
|
||||||
|
@ -23085,8 +23085,8 @@ private const(char)[] staticForeachReplacement(Iface)() pure {
|
||||||
// just this for gdc 9....
|
// just this for gdc 9....
|
||||||
// when i drop support for it and switch to gdc10, we can put this original back for a slight compile time ram decrease
|
// when i drop support for it and switch to gdc10, we can put this original back for a slight compile time ram decrease
|
||||||
|
|
||||||
static foreach(name; __traits(derivedMembers, Iface))
|
static foreach(name; __traits(derivedMembers, Iface))
|
||||||
mixin("__gshared typeof(&__traits(getMember, Iface, name)) " ~ name ~ ";");
|
mixin("__gshared typeof(&__traits(getMember, Iface, name)) " ~ name ~ ";");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char[] code = new char[](__traits(derivedMembers, Iface).length * 64);
|
char[] code = new char[](__traits(derivedMembers, Iface).length * 64);
|
||||||
|
@ -23099,8 +23099,8 @@ private const(char)[] staticForeachReplacement(Iface)() pure {
|
||||||
pos += what.length;
|
pos += what.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(name; __traits(derivedMembers, Iface)) {
|
foreach(name; __traits(derivedMembers, Iface)) {
|
||||||
append(`__gshared typeof(&__traits(getMember, Iface, "`);
|
append(`__gshared typeof(&__traits(getMember, Iface, "`);
|
||||||
append(name);
|
append(name);
|
||||||
append(`")) `);
|
append(`")) `);
|
||||||
append(name);
|
append(name);
|
||||||
|
@ -23113,13 +23113,13 @@ private const(char)[] staticForeachReplacement(Iface)() pure {
|
||||||
|
|
||||||
private mixin template DynamicLoad(Iface, string library, int majorVersion, alias success) {
|
private mixin template DynamicLoad(Iface, string library, int majorVersion, alias success) {
|
||||||
//mixin(staticForeachReplacement!Iface);
|
//mixin(staticForeachReplacement!Iface);
|
||||||
static foreach(name; __traits(derivedMembers, Iface))
|
static foreach(name; __traits(derivedMembers, Iface))
|
||||||
mixin("__gshared typeof(&__traits(getMember, Iface, name)) " ~ name ~ ";");
|
mixin("__gshared typeof(&__traits(getMember, Iface, name)) " ~ name ~ ";");
|
||||||
|
|
||||||
private __gshared void* libHandle;
|
private __gshared void* libHandle;
|
||||||
private __gshared bool attempted;
|
private __gshared bool attempted;
|
||||||
|
|
||||||
void loadDynamicLibrary() @nogc {
|
void loadDynamicLibrary() @nogc {
|
||||||
(cast(void function() @nogc) &loadDynamicLibraryForReal)();
|
(cast(void function() @nogc) &loadDynamicLibraryForReal)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23130,19 +23130,20 @@ private mixin template DynamicLoad(Iface, string library, int majorVersion, alia
|
||||||
return libHandle !is null;
|
return libHandle !is null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadDynamicLibraryForReal() {
|
void loadDynamicLibraryForReal() {
|
||||||
attempted = true;
|
attempted = true;
|
||||||
version(Posix) {
|
version(Posix) {
|
||||||
import core.sys.posix.dlfcn;
|
import core.sys.posix.dlfcn;
|
||||||
version(OSX) {
|
version(OSX) {
|
||||||
version(X11)
|
version(X11)
|
||||||
libHandle = dlopen("/usr/X11/lib/lib" ~ library ~ ".dylib", RTLD_NOW);
|
libHandle = dlopen("/usr/X11/lib/lib" ~ library ~ ".dylib", RTLD_NOW);
|
||||||
else
|
else
|
||||||
libHandle = dlopen(library ~ ".dylib", RTLD_NOW);
|
libHandle = dlopen(library ~ ".dylib", RTLD_NOW);
|
||||||
} else {
|
} else {
|
||||||
libHandle = dlopen("lib" ~ library ~ ".so", RTLD_NOW);
|
libHandle = dlopen("lib" ~ library ~ ".so", RTLD_NOW);
|
||||||
if(libHandle is null)
|
if(libHandle is null) {
|
||||||
libHandle = dlopen(("lib" ~ library ~ ".so." ~ toInternal!string(majorVersion) ~ "\0").ptr, RTLD_NOW);
|
libHandle = dlopen(("lib" ~ library ~ ".so." ~ toInternal!string(majorVersion) ~ "\0").ptr, RTLD_NOW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* loadsym(void* l, const char* name) {
|
static void* loadsym(void* l, const char* name) {
|
||||||
|
@ -23151,38 +23152,38 @@ private mixin template DynamicLoad(Iface, string library, int majorVersion, alia
|
||||||
return &abort;
|
return &abort;
|
||||||
return dlsym(l, name);
|
return dlsym(l, name);
|
||||||
}
|
}
|
||||||
} else version(Windows) {
|
} else version(Windows) {
|
||||||
import core.sys.windows.winbase;
|
import core.sys.windows.winbase;
|
||||||
libHandle = LoadLibrary(library ~ ".dll");
|
libHandle = LoadLibrary(library ~ ".dll");
|
||||||
static void* loadsym(void* l, const char* name) {
|
static void* loadsym(void* l, const char* name) {
|
||||||
import core.stdc.stdlib;
|
import core.stdc.stdlib;
|
||||||
if(l is null)
|
if(l is null)
|
||||||
return &abort;
|
return &abort;
|
||||||
return GetProcAddress(l, name);
|
return GetProcAddress(l, name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(libHandle is null) {
|
|
||||||
success = false;
|
|
||||||
//throw new Exception("load failure of library " ~ library);
|
|
||||||
}
|
}
|
||||||
foreach(name; __traits(derivedMembers, Iface)) {
|
if(libHandle is null) {
|
||||||
mixin("alias tmp = " ~ name ~ ";");
|
success = false;
|
||||||
tmp = cast(typeof(tmp)) loadsym(libHandle, name);
|
//throw new Exception("load failure of library " ~ library);
|
||||||
if(tmp is null) throw new Exception("load failure of function " ~ name ~ " from " ~ library);
|
}
|
||||||
}
|
foreach(name; __traits(derivedMembers, Iface)) {
|
||||||
}
|
mixin("alias tmp = " ~ name ~ ";");
|
||||||
|
tmp = cast(typeof(tmp)) loadsym(libHandle, name);
|
||||||
|
if(tmp is null) throw new Exception("load failure of function " ~ name ~ " from " ~ library);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void unloadDynamicLibrary() {
|
void unloadDynamicLibrary() {
|
||||||
version(Posix) {
|
version(Posix) {
|
||||||
import core.sys.posix.dlfcn;
|
import core.sys.posix.dlfcn;
|
||||||
dlclose(libHandle);
|
dlclose(libHandle);
|
||||||
} else version(Windows) {
|
} else version(Windows) {
|
||||||
import core.sys.windows.winbase;
|
import core.sys.windows.winbase;
|
||||||
FreeLibrary(libHandle);
|
FreeLibrary(libHandle);
|
||||||
}
|
}
|
||||||
foreach(name; __traits(derivedMembers, Iface))
|
foreach(name; __traits(derivedMembers, Iface))
|
||||||
mixin(name ~ " = null;");
|
mixin(name ~ " = null;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// version(X11)
|
// version(X11)
|
||||||
|
|
Loading…
Reference in New Issue