From dd0df51ba364437102a2d795db99634e7d89c28c Mon Sep 17 00:00:00 2001 From: FreeSlave Date: Fri, 11 Mar 2016 22:14:10 +0300 Subject: [PATCH 1/5] Fix window redrawing (#197) --- src/dlangui/platforms/sdl/sdlapp.d | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d index 7749e565..62a5d28f 100644 --- a/src/dlangui/platforms/sdl/sdlapp.d +++ b/src/dlangui/platforms/sdl/sdlapp.d @@ -1068,6 +1068,9 @@ class SDLPlatform : Platform { break; case SDL_WINDOWEVENT_RESTORED: debug(DebugSDL) Log.d("SDL_WINDOWEVENT_RESTORED"); + version(linux) { //not sure if needed on Windows or OSX. Also need to check on FreeBSD + w.redraw(); + } break; case SDL_WINDOWEVENT_ENTER: debug(DebugSDL) Log.d("SDL_WINDOWEVENT_ENTER"); From fed4712085effa568979c586e65072647b12dec4 Mon Sep 17 00:00:00 2001 From: FreeSlave Date: Fri, 11 Mar 2016 22:26:35 +0300 Subject: [PATCH 2/5] Redraw on window exposed too --- src/dlangui/platforms/sdl/sdlapp.d | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dlangui/platforms/sdl/sdlapp.d b/src/dlangui/platforms/sdl/sdlapp.d index 62a5d28f..52147f4c 100644 --- a/src/dlangui/platforms/sdl/sdlapp.d +++ b/src/dlangui/platforms/sdl/sdlapp.d @@ -1056,6 +1056,9 @@ class SDLPlatform : Platform { break; case SDL_WINDOWEVENT_EXPOSED: debug(DebugSDL) Log.d("SDL_WINDOWEVENT_EXPOSED"); + version(linux) { + w.redraw(); + } break; case SDL_WINDOWEVENT_MOVED: debug(DebugSDL) Log.d("SDL_WINDOWEVENT_MOVED"); From 1af52fee307279a1e936fdaa561d2296fa1102ab Mon Sep 17 00:00:00 2001 From: FreeSlave Date: Sat, 12 Mar 2016 00:55:14 +0300 Subject: [PATCH 3/5] Fix version typos. Collect exception from isDir in listDirectory (it throws if examined path does not exist). Sort directories and files (dirEntries don't always return sorted list, it's platform dependant) --- src/dlangui/core/files.d | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/dlangui/core/files.d b/src/dlangui/core/files.d index ac9b2f44..3924d9d2 100644 --- a/src/dlangui/core/files.d +++ b/src/dlangui/core/files.d @@ -119,7 +119,7 @@ struct RootEntry { @property RootEntry[] getRootPaths() { RootEntry[] res; res ~= RootEntry(RootEntryType.HOME, homePath); - version (posix) { + version (Posix) { res ~= RootEntry(RootEntryType.ROOT, "/", "File System"d); } version (Windows) { @@ -192,10 +192,12 @@ bool filterFilename(in string filename, in string[] filters) pure nothrow { Returns true if directory exists and listed successfully, false otherwise. */ bool listDirectory(in string dir, in bool includeDirs, in bool includeFiles, in bool showHiddenFiles, in string[] filters, ref DirEntry[] entries, in bool showExecutables = false) { - entries.length = 0; - - if (!isDir(dir)) { + + import std.exception : collectException; + bool dirExists; + collectException(dir.isDir, dirExists); + if (!dirExists) { return false; } @@ -216,6 +218,8 @@ bool listDirectory(in string dir, in bool includeDirs, in bool includeFiles, in files ~= e; } } + dirs.sort!((a,b) => filenameCmp!(std.path.CaseSensitive.no)(a,b) < 0); + files.sort!((a,b) => filenameCmp!(std.path.CaseSensitive.no)(a,b) < 0); if (includeDirs) foreach(DirEntry e; dirs) entries ~= e; @@ -228,7 +232,7 @@ bool listDirectory(in string dir, in bool includeDirs, in bool includeFiles, in passed = e.name.endsWith(".exe") || e.name.endsWith(".EXE") || e.name.endsWith(".cmd") || e.name.endsWith(".CMD") || e.name.endsWith(".bat") || e.name.endsWith(".BAT"); - } else version (posix) { + } else version (Posix) { // execute permission for others passed = (e.attributes & attr_mask) != 0; } else version(OSX) { From f4b28764b3072b58df60faaed2396a99858bbd90 Mon Sep 17 00:00:00 2001 From: FreeSlave Date: Sat, 12 Mar 2016 00:56:20 +0300 Subject: [PATCH 4/5] In example1: Fix All files filter to match files without extension. Add Executable files filter --- examples/example1/src/example1.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/example1/src/example1.d b/examples/example1/src/example1.d index c4d9dc46..cb08fdb0 100644 --- a/examples/example1/src/example1.d +++ b/examples/example1/src/example1.d @@ -352,9 +352,10 @@ extern (C) int UIAppMain(string[] args) { UIString caption; caption = "Open Text File"d; FileDialog dlg = new FileDialog(caption, window, null); - dlg.addFilter(FileFilterEntry(UIString("FILTER_ALL_FILES", "All files (*.*)"d), "*.*")); + dlg.addFilter(FileFilterEntry(UIString("FILTER_ALL_FILES", "All files (*)"d), "*")); dlg.addFilter(FileFilterEntry(UIString("FILTER_TEXT_FILES", "Text files (*.txt)"d), "*.txt")); dlg.addFilter(FileFilterEntry(UIString("FILTER_SOURCE_FILES", "Source files"d), "*.d;*.dd;*.c;*.cc;*.cpp;*.h;*.hpp")); + dlg.addFilter(FileFilterEntry(UIString("FILTER_EXECUTABLE_FILES", "Executable files"d), "*", true)); //dlg.filterIndex = 2; dlg.dialogResult = delegate(Dialog dlg, const Action result) { if (result.id == ACTION_OPEN.id) { From 6872d1ed0114a357a62dfb556118b04c797c559e Mon Sep 17 00:00:00 2001 From: FreeSlave Date: Sat, 12 Mar 2016 03:29:26 +0300 Subject: [PATCH 5/5] Add sdl configuration for example1 --- examples/example1/dub.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/example1/dub.json b/examples/example1/dub.json index d69f0dfe..9d70d235 100644 --- a/examples/example1/dub.json +++ b/examples/example1/dub.json @@ -17,5 +17,16 @@ "dependencies": { "dlangui": {"path": "../../"} - } + }, + "configurations" : [ + { + "name" : "default", + }, + { + "name" : "sdl", + "subConfigurations" : { + "dlangui" : "sdl" + } + } + ] }