mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[client] all: add screen rotation support win:rotate
Currently only supports EGL, if there is enough demand for OpenGL support this can be added later. Closes #231
This commit is contained in:
@@ -38,6 +38,9 @@ static bool optSizeParse (struct Option * opt, const char * str);
|
||||
static StringList optSizeValues (struct Option * opt);
|
||||
static char * optSizeToString (struct Option * opt);
|
||||
static char * optScancodeToString(struct Option * opt);
|
||||
static bool optRotateParse (struct Option * opt, const char * str);
|
||||
static StringList optRotateValues (struct Option * opt);
|
||||
static char * optRotateToString (struct Option * opt);
|
||||
|
||||
static void doLicense();
|
||||
|
||||
@@ -234,6 +237,15 @@ static struct Option options[] =
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = false,
|
||||
},
|
||||
{
|
||||
.module = "win",
|
||||
.name = "rotate",
|
||||
.description = "Rotate the displayed image",
|
||||
.type = OPTION_TYPE_CUSTOM,
|
||||
.parser = optRotateParse,
|
||||
.getValues = optRotateValues,
|
||||
.toString = optRotateToString
|
||||
},
|
||||
|
||||
// input options
|
||||
{
|
||||
@@ -664,3 +676,46 @@ static char * optScancodeToString(struct Option * opt)
|
||||
alloc_sprintf(&str, "%d = %s", opt->value.x_int, SDL_GetScancodeName(opt->value.x_int));
|
||||
return str;
|
||||
}
|
||||
|
||||
static bool optRotateParse(struct Option * opt, const char * str)
|
||||
{
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
if (strcasecmp(str, "up" ) == 0) params.winRotate = LG_ROTATE_UP;
|
||||
else if (strcasecmp(str, "down" ) == 0) params.winRotate = LG_ROTATE_DOWN;
|
||||
else if (strcasecmp(str, "left" ) == 0) params.winRotate = LG_ROTATE_LEFT;
|
||||
else if (strcasecmp(str, "right") == 0) params.winRotate = LG_ROTATE_RIGHT;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static StringList optRotateValues(struct Option * opt)
|
||||
{
|
||||
StringList sl = stringlist_new(false);
|
||||
|
||||
stringlist_push(sl, "UP" );
|
||||
stringlist_push(sl, "DOWN" );
|
||||
stringlist_push(sl, "LEFT" );
|
||||
stringlist_push(sl, "RIGHT");
|
||||
|
||||
return sl;
|
||||
}
|
||||
|
||||
static char * optRotateToString(struct Option * opt)
|
||||
{
|
||||
const char * str;
|
||||
switch(params.winRotate)
|
||||
{
|
||||
case LG_ROTATE_UP : str = "UP" ; break;
|
||||
case LG_ROTATE_DOWN : str = "DOWN" ; break;
|
||||
case LG_ROTATE_LEFT : str = "LEFT" ; break;
|
||||
case LG_ROTATE_RIGHT: str = "RIGHT"; break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return strdup(str);
|
||||
}
|
||||
|
@@ -379,6 +379,7 @@ static int cursorThread(void * unused)
|
||||
cursorType,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
params.winRotate,
|
||||
cursor->pitch,
|
||||
data)
|
||||
)
|
||||
@@ -558,6 +559,8 @@ static int frameThread(void * unused)
|
||||
frame->width, frame->height,
|
||||
frame->stride, frame->pitch);
|
||||
|
||||
lgrFormat.rotate = params.winRotate;
|
||||
|
||||
if (!g_state.lgr->on_frame_format(g_state.lgrData, lgrFormat, useDMA))
|
||||
{
|
||||
DEBUG_ERROR("renderer failed to configure format");
|
||||
|
@@ -95,53 +95,54 @@ struct AppState
|
||||
|
||||
struct AppParams
|
||||
{
|
||||
bool autoResize;
|
||||
bool allowResize;
|
||||
bool keepAspect;
|
||||
bool forceAspect;
|
||||
bool dontUpscale;
|
||||
bool borderless;
|
||||
bool fullscreen;
|
||||
bool maximize;
|
||||
bool minimizeOnFocusLoss;
|
||||
bool center;
|
||||
int x, y;
|
||||
unsigned int w, h;
|
||||
int fpsMin;
|
||||
bool showFPS;
|
||||
bool useSpiceInput;
|
||||
bool useSpiceClipboard;
|
||||
const char * spiceHost;
|
||||
unsigned int spicePort;
|
||||
bool clipboardToVM;
|
||||
bool clipboardToLocal;
|
||||
bool scaleMouseInput;
|
||||
bool hideMouse;
|
||||
bool ignoreQuit;
|
||||
bool noScreensaver;
|
||||
bool grabKeyboard;
|
||||
bool grabKeyboardOnFocus;
|
||||
SDL_Scancode escapeKey;
|
||||
bool ignoreWindowsKeys;
|
||||
bool showAlerts;
|
||||
bool captureOnStart;
|
||||
bool quickSplash;
|
||||
bool alwaysShowCursor;
|
||||
bool autoResize;
|
||||
bool allowResize;
|
||||
bool keepAspect;
|
||||
bool forceAspect;
|
||||
bool dontUpscale;
|
||||
bool borderless;
|
||||
bool fullscreen;
|
||||
bool maximize;
|
||||
bool minimizeOnFocusLoss;
|
||||
bool center;
|
||||
int x, y;
|
||||
unsigned int w, h;
|
||||
int fpsMin;
|
||||
bool showFPS;
|
||||
LG_RendererRotate winRotate;
|
||||
bool useSpiceInput;
|
||||
bool useSpiceClipboard;
|
||||
const char * spiceHost;
|
||||
unsigned int spicePort;
|
||||
bool clipboardToVM;
|
||||
bool clipboardToLocal;
|
||||
bool scaleMouseInput;
|
||||
bool hideMouse;
|
||||
bool ignoreQuit;
|
||||
bool noScreensaver;
|
||||
bool grabKeyboard;
|
||||
bool grabKeyboardOnFocus;
|
||||
SDL_Scancode escapeKey;
|
||||
bool ignoreWindowsKeys;
|
||||
bool showAlerts;
|
||||
bool captureOnStart;
|
||||
bool quickSplash;
|
||||
bool alwaysShowCursor;
|
||||
|
||||
unsigned int cursorPollInterval;
|
||||
unsigned int framePollInterval;
|
||||
bool allowDMA;
|
||||
unsigned int cursorPollInterval;
|
||||
unsigned int framePollInterval;
|
||||
bool allowDMA;
|
||||
|
||||
bool forceRenderer;
|
||||
unsigned int forceRendererIndex;
|
||||
bool forceRenderer;
|
||||
unsigned int forceRendererIndex;
|
||||
|
||||
const char * windowTitle;
|
||||
bool mouseRedraw;
|
||||
int mouseSens;
|
||||
bool mouseSmoothing;
|
||||
bool rawMouse;
|
||||
bool autoCapture;
|
||||
bool captureInputOnly;
|
||||
const char * windowTitle;
|
||||
bool mouseRedraw;
|
||||
int mouseSens;
|
||||
bool mouseSmoothing;
|
||||
bool rawMouse;
|
||||
bool autoCapture;
|
||||
bool captureInputOnly;
|
||||
};
|
||||
|
||||
struct CBRequest
|
||||
|
Reference in New Issue
Block a user