diff options
author | falkTX <falktx@gmail.com> | 2018-01-01 12:41:10 +0100 |
---|---|---|
committer | falkTX <falktx@gmail.com> | 2018-01-01 12:41:10 +0100 |
commit | 0393d1e42956ea707488be47f82d65c6cbd20a4d (patch) | |
tree | ba729b6c658eacffa5355eb5f2d4821bbd935a20 /dgl/src | |
parent | a186f083ca010739b73c13bc75b0973264871de2 (diff) |
Add DGL_FILE_BROWSER_DISABLED to optionaly disable file browser
Diffstat (limited to 'dgl/src')
-rw-r--r-- | dgl/src/Window.cpp | 14 | ||||
-rw-r--r-- | dgl/src/pugl/pugl_x11.c | 6 |
2 files changed, 17 insertions, 3 deletions
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index 059eae89..2ed4c1fa 100644 --- a/dgl/src/Window.cpp +++ b/dgl/src/Window.cpp @@ -196,7 +196,9 @@ struct Window::PrivateData { puglSetSpecialFunc(fView, onSpecialCallback); puglSetReshapeFunc(fView, onReshapeCallback); puglSetCloseFunc(fView, onCloseCallback); +#ifndef DGL_FILE_BROWSER_DISABLED puglSetFileSelectedFunc(fView, fileBrowserSelectedCallback); +#endif puglCreateWindow(fView, nullptr); @@ -1022,10 +1024,12 @@ struct Window::PrivateData { handlePtr->onPuglClose(); } +#ifndef DGL_FILE_BROWSER_DISABLED static void fileBrowserSelectedCallback(PuglView* view, const char* filename) { handlePtr->fSelf->fileBrowserSelected(filename); } +#endif #undef handlePtr @@ -1085,9 +1089,10 @@ void Window::repaint() noexcept // (void)name; // } +#ifndef DGL_FILE_BROWSER_DISABLED bool Window::openFileBrowser(const FileBrowserOptions& options) { -#ifdef SOFD_HAVE_X11 +# ifdef SOFD_HAVE_X11 using DISTRHO_NAMESPACE::String; // -------------------------------------------------------------------------- @@ -1145,11 +1150,12 @@ bool Window::openFileBrowser(const FileBrowserOptions& options) // show return (x_fib_show(pData->xDisplay, pData->xWindow, /*options.width*/0, /*options.height*/0) == 0); -#else +# else // not implemented return false; -#endif +# endif } +#endif bool Window::isVisible() const noexcept { @@ -1280,9 +1286,11 @@ void Window::onClose() { } +#ifndef DGL_FILE_BROWSER_DISABLED void Window::fileBrowserSelected(const char*) { } +#endif bool Window::handlePluginKeyboard(const bool press, const uint key) { diff --git a/dgl/src/pugl/pugl_x11.c b/dgl/src/pugl/pugl_x11.c index 60be55e7..ebd5a7b3 100644 --- a/dgl/src/pugl/pugl_x11.c +++ b/dgl/src/pugl/pugl_x11.c @@ -41,9 +41,11 @@ #include "pugl/pugl_internal.h" +#ifndef DGL_FILE_BROWSER_DISABLED #define SOFD_HAVE_X11 #include "../sofd/libsofd.h" #include "../sofd/libsofd.c" +#endif struct PuglInternalsImpl { Display* display; @@ -339,7 +341,9 @@ puglDestroy(PuglView* view) return; } +#ifndef DGL_FILE_BROWSER_DISABLED x_fib_close(view->impl->display); +#endif destroyContext(view); XDestroyWindow(view->impl->display, view->impl->win); @@ -477,6 +481,7 @@ puglProcessEvents(PuglView* view) while (XPending(view->impl->display) > 0) { XNextEvent(view->impl->display, &event); +#ifndef DGL_FILE_BROWSER_DISABLED if (x_fib_handle_events(view->impl->display, &event)) { const int status = x_fib_status(); @@ -495,6 +500,7 @@ puglProcessEvents(PuglView* view) } break; } +#endif if (event.xany.window != view->impl->win && (view->parent == 0 || event.xany.window != (Window)view->parent)) { |