Created
May 7, 2016 12:26
-
-
Save rikkimax/5346adffe29856ef296970eb5afcf30e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int callbackGetWindows(HWND hwnd, LPARAM lParam) nothrow { | |
import std.experimental.ui.internal.window; | |
GetWindows* ctx = cast(GetWindows*)lParam; | |
if (!IsWindowVisible(hwnd)) | |
return true; | |
RECT rect; | |
GetWindowRect(hwnd, &rect); | |
if (rect.right - rect.left == 0 || rect.bottom - rect.top == 0) | |
return true; | |
try { | |
WinAPIWindowImpl window = ctx.alloc.make!WinAPIWindowImpl(hwnd, cast(IContext)null, ctx.alloc, ctx.platform); | |
if (ctx.display is null) { | |
ctx.alloc.expandArray(ctx.windows, 1); | |
ctx.windows[$-1] = window; | |
} else { | |
auto display2 = window.display; | |
if (display2 is null) { | |
ctx.alloc.dispose(window); | |
return true; | |
} | |
if (display2.name == ctx.display.name) { | |
ctx.alloc.expandArray(ctx.windows, 1); | |
ctx.windows[$-1] = window; | |
} else | |
ctx.alloc.dispose(window); | |
} | |
} catch(Exception e) {} | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int callbackGetWindows(HWND hwnd, LPARAM lParam) nothrow { | |
import std.experimental.ui.internal.window; | |
GetWindows* ctx = cast(GetWindows*)lParam; | |
if (!IsWindowVisible(hwnd)) | |
return true; | |
RECT rect; | |
GetWindowRect(hwnd, &rect); | |
if (rect.right - rect.left == 0 || rect.bottom - rect.top == 0) | |
return true; | |
try { | |
WinAPIWindowImpl window = ctx.alloc.make!WinAPIWindowImpl(hwnd, cast(IContext)null, ctx.alloc, ctx.platform); | |
if (ctx.display is null) { | |
ctx.alloc.expandArray(ctx.windows, 1); | |
ctx.windows[$-1] = window; | |
} else { | |
IDisplay display2 = (cast(IWindow)window).display; | |
if (display2 is null) { | |
ctx.alloc.dispose(window); | |
return true; | |
} | |
if (display2.name == ctx.display.name) { | |
ctx.alloc.expandArray(ctx.windows, 1); | |
ctx.windows[$-1] = window; | |
} else | |
ctx.alloc.dispose(window); | |
} | |
} catch(Exception e) {} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment