mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-11-18 07:52:20 +00:00
Compare commits
7 Commits
B1-rc6
...
Release/B1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
163a2e5d0a | ||
|
|
b979752989 | ||
|
|
8ad2d5f949 | ||
|
|
745ba66119 | ||
|
|
4cf6dec592 | ||
|
|
d7fa0aeff9 | ||
|
|
2def6346e6 |
@@ -14,6 +14,9 @@ if(OPTIMIZE_FOR_NATIVE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
||||
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
||||
|
||||
add_compile_options(
|
||||
"-Wall"
|
||||
"-Werror"
|
||||
|
||||
@@ -24,6 +24,9 @@ add_feature_info(ENABLE_EGL ENABLE_EGL "EGL renderer.")
|
||||
option(ENABLE_CB_X11 "Enable X11 clipboard integration" ON)
|
||||
add_feature_info(ENABLE_CB_X11 ENABLE_CB_X11 "X11 Clipboard Integration.")
|
||||
|
||||
option(ENABLE_BACKTRACE "Enable backtrace support on crash" ON)
|
||||
add_feature_info(ENABLE_BACKTRACE ENABLE_BACKTRACE "Backtrace support.")
|
||||
|
||||
add_compile_options(
|
||||
"-Wall"
|
||||
"-Werror"
|
||||
|
||||
@@ -101,24 +101,25 @@ Command line arguments will override any options loaded from the config files.
|
||||
| app:framePollInterval | | 1000 | How often to check for a frame update in microseconds |
|
||||
|-------------------------------------------------------------------------------------------------------------------------|
|
||||
|
||||
|-------------------------------------------------------------------------------------------------------|
|
||||
| Long | Short | Value | Description |
|
||||
|-------------------------------------------------------------------------------------------------------|
|
||||
| win:title | | Looking Glass (client) | The window title |
|
||||
| win:position | | center | Initial window position at startup |
|
||||
| win:size | | 1024x768 | Initial window size at startup |
|
||||
| win:autoResize | -a | no | Auto resize the window to the guest |
|
||||
| win:allowResize | -n | yes | Aallow the window to be manually resized |
|
||||
| win:keepAspect | -r | yes | Maintain the correct aspect ratio |
|
||||
| win:borderless | -d | no | Borderless mode |
|
||||
| win:fullScreen | -F | no | Launch in fullscreen borderless mode |
|
||||
| win:maximize | -T | no | Launch window maximized |
|
||||
| win:fpsLimit | -K | 200 | Frame rate limit (0 = disable - not recommended) |
|
||||
| win:showFPS | -k | no | Enable the FPS & UPS display |
|
||||
| win:ignoreQuit | -Q | no | Ignore requests to quit (ie: Alt+F4) |
|
||||
| win:noScreensaver | -S | no | Prevent the screensaver from starting |
|
||||
| win:alerts | -q | yes | Show on screen alert messages |
|
||||
|-------------------------------------------------------------------------------------------------------|
|
||||
|-------------------------------------------------------------------------------------------------------------|
|
||||
| Long | Short | Value | Description |
|
||||
|-------------------------------------------------------------------------------------------------------------|
|
||||
| win:title | | Looking Glass (client) | The window title |
|
||||
| win:position | | center | Initial window position at startup |
|
||||
| win:size | | 1024x768 | Initial window size at startup |
|
||||
| win:autoResize | -a | no | Auto resize the window to the guest |
|
||||
| win:allowResize | -n | yes | Aallow the window to be manually resized |
|
||||
| win:keepAspect | -r | yes | Maintain the correct aspect ratio |
|
||||
| win:borderless | -d | no | Borderless mode |
|
||||
| win:fullScreen | -F | no | Launch in fullscreen borderless mode |
|
||||
| win:maximize | -T | no | Launch window maximized |
|
||||
| win:minimizeOnFocusLoss | | yes | Minimize window on focus loss |
|
||||
| win:fpsLimit | -K | 200 | Frame rate limit (0 = disable - not recommended) |
|
||||
| win:showFPS | -k | no | Enable the FPS & UPS display |
|
||||
| win:ignoreQuit | -Q | no | Ignore requests to quit (ie: Alt+F4) |
|
||||
| win:noScreensaver | -S | no | Prevent the screensaver from starting |
|
||||
| win:alerts | -q | yes | Show on screen alert messages |
|
||||
|-------------------------------------------------------------------------------------------------------------|
|
||||
|
||||
|---------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| Long | Short | Value | Description |
|
||||
|
||||
@@ -20,6 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.
|
||||
@@ -17,7 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "spice.h"
|
||||
#include "spice/spice.h"
|
||||
#include "utils.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
|
||||
@@ -175,13 +175,20 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "minimizeOnFocusLoss",
|
||||
.description = "Minimize window on focus loss",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "fpsLimit",
|
||||
.description = "Frame rate limit (0 = disable - not recommended)",
|
||||
.description = "Frame rate limit (0 = disable - not recommended, -1 = auto detect)",
|
||||
.shortopt = 'K',
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 200,
|
||||
.value.x_int = -1,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
@@ -396,6 +403,8 @@ bool config_load(int argc, char * argv[])
|
||||
params.hideMouse = option_get_bool ("input", "hideCursor" );
|
||||
params.mouseSens = option_get_int ("input", "mouseSens" );
|
||||
|
||||
params.minimizeOnFocusLoss = option_get_bool("win", "minimizeOnFocusLoss");
|
||||
|
||||
if (option_get_bool("spice", "enable"))
|
||||
{
|
||||
params.spiceHost = option_get_string("spice", "host");
|
||||
@@ -559,4 +568,4 @@ static char * optScancodeToString(struct Option * opt)
|
||||
char * str;
|
||||
alloc_sprintf(&str, "%d = %s", opt->value.x_int, SDL_GetScancodeName(opt->value.x_int));
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1000,7 +1000,6 @@ int run()
|
||||
state.running = true;
|
||||
state.scaleX = 1.0f;
|
||||
state.scaleY = 1.0f;
|
||||
state.frameTime = 1e9 / params.fpsLimit;
|
||||
|
||||
state.mouseSens = params.mouseSens;
|
||||
if (state.mouseSens < -9) state.mouseSens = -9;
|
||||
@@ -1014,13 +1013,16 @@ int run()
|
||||
if (strcmp(XDG_SESSION_TYPE, "wayland") == 0)
|
||||
{
|
||||
DEBUG_INFO("Wayland detected");
|
||||
int err = setenv("SDL_VIDEODRIVER", "wayland", 1);
|
||||
if (err < 0)
|
||||
if (getenv("SDL_VIDEODRIVER") == NULL)
|
||||
{
|
||||
DEBUG_ERROR("Unable to set the env variable SDL_VIDEODRIVER: %d", err);
|
||||
return -1;
|
||||
int err = setenv("SDL_VIDEODRIVER", "wayland", 1);
|
||||
if (err < 0)
|
||||
{
|
||||
DEBUG_ERROR("Unable to set the env variable SDL_VIDEODRIVER: %d", err);
|
||||
return -1;
|
||||
}
|
||||
DEBUG_INFO("SDL_VIDEODRIVER has been set to wayland");
|
||||
}
|
||||
DEBUG_INFO("SDL_VIDEODRIVER has been set to wayland");
|
||||
}
|
||||
|
||||
// warn about using FPS display until we can fix the font rendering to prevent lag spikes
|
||||
@@ -1099,7 +1101,7 @@ int run()
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (params.fullscreen)
|
||||
if (params.fullscreen || !params.minimizeOnFocusLoss)
|
||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||
|
||||
if (!params.noScreensaver)
|
||||
@@ -1117,6 +1119,26 @@ int run()
|
||||
// ensure renderer viewport is aware of the current window size
|
||||
updatePositionInfo();
|
||||
|
||||
//Auto detect active monitor refresh rate for FPS Limit if no FPS Limit was passed.
|
||||
if (params.fpsLimit == -1)
|
||||
{
|
||||
SDL_DisplayMode current;
|
||||
if (SDL_GetCurrentDisplayMode(SDL_GetWindowDisplayIndex(state.window), ¤t) == 0)
|
||||
{
|
||||
state.frameTime = 1e9 / (current.refresh_rate * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_WARN("Unable to capture monitor refresh rate using the default FPS Limit: 200");
|
||||
state.frameTime = 1e9 / 200;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_INFO("Using the FPS Limit from args: %d", params.fpsLimit);
|
||||
state.frameTime = 1e9 / params.fpsLimit;
|
||||
}
|
||||
|
||||
register_key_binds();
|
||||
|
||||
// set the compositor hint to bypass for low latency
|
||||
@@ -1374,4 +1396,4 @@ int main(int argc, char * argv[])
|
||||
|
||||
config_free();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ struct AppParams
|
||||
bool borderless;
|
||||
bool fullscreen;
|
||||
bool maximize;
|
||||
bool minimizeOnFocusLoss;
|
||||
bool center;
|
||||
int x, y;
|
||||
unsigned int w, h;
|
||||
@@ -129,4 +130,4 @@ struct KeybindHandle
|
||||
|
||||
// forwards
|
||||
extern struct AppState state;
|
||||
extern struct AppParams params;
|
||||
extern struct AppParams params;
|
||||
|
||||
@@ -5,6 +5,10 @@ include_directories(
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
if(ENABLE_BACKTRACE)
|
||||
add_definitions(-DENABLE_BACKTRACE)
|
||||
endif()
|
||||
|
||||
set(COMMON_SOURCES
|
||||
src/stringutils.c
|
||||
src/stringlist.c
|
||||
@@ -27,7 +31,9 @@ if(WIN32)
|
||||
else()
|
||||
set(SOURCES ${COMMON_SOURCES} ${LINUX_SOURCES})
|
||||
add_library(lg_common STATIC ${SOURCES})
|
||||
target_link_libraries(lg_common bfd)
|
||||
if(ENABLE_BACKTRACE)
|
||||
target_link_libraries(lg_common bfd)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(lg_common
|
||||
|
||||
@@ -21,6 +21,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "common/crash.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
#if defined(ENABLE_BACKTRACE)
|
||||
|
||||
#include <execinfo.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -219,4 +221,13 @@ bool installCrashHandler(const char * exe)
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#else //ENABLE_BACKTRACE
|
||||
|
||||
bool installCrashHandler(const char * exe)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user