diff --git a/client/include/interface/displayserver.h b/client/include/interface/displayserver.h index 8c2e72d5..af0577e8 100644 --- a/client/include/interface/displayserver.h +++ b/client/include/interface/displayserver.h @@ -69,7 +69,6 @@ typedef struct LG_DSInitParams bool resizable; bool borderless; bool maximize; - bool minimizeOnFocusLoss; // if true the renderer requires an OpenGL context bool opengl; @@ -158,10 +157,11 @@ struct LG_DisplayServerOps /* wait for the specified time without blocking UI processing/event loops */ void (*wait)(unsigned int time); - /* get/set the window dimensions */ + /* get/set the window dimensions & state */ void (*setWindowSize)(int x, int y); bool (*getFullscreen)(void); void (*setFullscreen)(bool fs); + void (*minimize)(void); /* clipboard support, optional, if not supported set to NULL */ bool (*cbInit)(void); @@ -213,6 +213,7 @@ struct LG_DisplayServerOps assert((x)->wait ); \ assert((x)->setWindowSize ); \ assert((x)->setFullscreen ); \ - assert((x)->getFullscreen ); + assert((x)->getFullscreen ); \ + assert((x)->minimize ); #endif diff --git a/client/src/app.c b/client/src/app.c index 96e6a14e..25d80a7b 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -67,7 +67,11 @@ void app_handleFocusEvent(bool focused) { g_state.focused = focused; if (!core_inputEnabled()) + { + if (!focused && g_params.minimizeOnFocusLoss) + g_state.ds->minimize(); return; + } if (!focused) { @@ -81,6 +85,9 @@ void app_handleFocusEvent(bool focused) if (!g_params.showCursorDot) g_state.ds->showPointer(false); + + if (g_params.minimizeOnFocusLoss) + g_state.ds->minimize(); } g_cursor.realign = true; diff --git a/client/src/main.c b/client/src/main.c index adf28d74..594c2ce9 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -765,7 +765,6 @@ static int lg_run(void) .resizable = g_params.allowResize, .borderless = g_params.borderless, .maximize = g_params.maximize, - .minimizeOnFocusLoss = g_params.minimizeOnFocusLoss, .opengl = needsOpenGL };