diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-31 15:23:54 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-31 15:23:54 +0300 |
commit | 96fa736afa07458271d345486ab7efdc44f98c32 (patch) | |
tree | 17040222fed1130031c4076dbb075eed07e8d94a | |
parent | 49d98b968281fb26cb14586e3e781585f74e506f (diff) |
Linux: Window restore workaround; revealing directories
-rw-r--r-- | src/app.c | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -130,6 +130,14 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
130 | int w, h, x, y; | 130 | int w, h, x, y; |
131 | SDL_GetWindowSize(d->window->win, &w, &h); | 131 | SDL_GetWindowSize(d->window->win, &w, &h); |
132 | SDL_GetWindowPosition(d->window->win, &x, &y); | 132 | SDL_GetWindowPosition(d->window->win, &x, &y); |
133 | #if defined (iPlatformLinux) | ||
134 | /* Workaround for window position being unaffected by decorations on creation. */ { | ||
135 | int bl, bt; | ||
136 | SDL_GetWindowBordersSize(d->window->win, &bt, &bl, NULL, NULL); | ||
137 | x -= bl; | ||
138 | y -= bt; | ||
139 | } | ||
140 | #endif | ||
133 | appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y); | 141 | appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y); |
134 | appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar)); | 142 | appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar)); |
135 | } | 143 | } |
@@ -838,11 +846,19 @@ void revealPath_App(const iString *path) { | |||
838 | } | 846 | } |
839 | iRelease(f); | 847 | iRelease(f); |
840 | #elif defined (iPlatformLinux) | 848 | #elif defined (iPlatformLinux) |
841 | { | 849 | iFileInfo *inf = iClob(new_FileInfo(path)); |
842 | String path = (fileOrFolder.isDirectory() ? fileOrFolder.toString() | 850 | iRangecc target; |
843 | : fileOrFolder.fileNamePath().toString()); | 851 | if (isDirectory_FileInfo(inf)) { |
844 | CommandLine({"/usr/bin/xdg-open", path}).execute(); | 852 | target = range_String(path); |
853 | } | ||
854 | else { | ||
855 | target = dirName_Path(path); | ||
845 | } | 856 | } |
857 | iProcess *proc = new_Process(); | ||
858 | setArguments_Process( | ||
859 | proc, iClob(newStringsCStr_StringList("/usr/bin/xdg-open", cstr_Rangecc(target), NULL))); | ||
860 | start_Process(proc); | ||
861 | iRelease(proc); | ||
846 | #else | 862 | #else |
847 | iAssert(0 /* File revealing not implemented on this platform */); | 863 | iAssert(0 /* File revealing not implemented on this platform */); |
848 | #endif | 864 | #endif |