mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 06:47:19 +00:00
[client] egl: add option to set initial scale algorithm
The option is egl:scale. The scale algorithm number is displayed on the alert to make it easier to specify the number for the option.
This commit is contained in:
parent
0512c88ea8
commit
30b5287c38
@ -142,9 +142,10 @@ bool egl_desktop_init(EGL_Desktop ** desktop, EGLDisplay * display)
|
||||
app_registerKeybind(KEY_N, egl_desktop_toggle_nv, *desktop, "Toggle night vision mode");
|
||||
app_registerKeybind(KEY_S, egl_desktop_toggle_scale_algo, *desktop, "Toggle scale algorithm");
|
||||
|
||||
(*desktop)->nvMax = option_get_int("egl", "nvGainMax");
|
||||
(*desktop)->nvGain = option_get_int("egl", "nvGain" );
|
||||
(*desktop)->cbMode = option_get_int("egl", "cbMode" );
|
||||
(*desktop)->nvMax = option_get_int("egl", "nvGainMax");
|
||||
(*desktop)->nvGain = option_get_int("egl", "nvGain" );
|
||||
(*desktop)->cbMode = option_get_int("egl", "cbMode" );
|
||||
(*desktop)->scaleAlgo = option_get_int("egl", "scale" );
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -175,13 +176,23 @@ static const char * egl_desktop_scale_algo_name(int algorithm)
|
||||
}
|
||||
}
|
||||
|
||||
bool egl_desktop_scale_validate(struct Option * opt, const char ** error)
|
||||
{
|
||||
if (opt->value.x_int >= 0 && opt->value.x_int < EGL_SCALE_MAX)
|
||||
return true;
|
||||
|
||||
*error = "Invalid scale algorithm number";
|
||||
return false;
|
||||
}
|
||||
|
||||
void egl_desktop_toggle_scale_algo(int key, void * opaque)
|
||||
{
|
||||
EGL_Desktop * desktop = (EGL_Desktop *)opaque;
|
||||
if (++desktop->scaleAlgo == EGL_SCALE_MAX)
|
||||
desktop->scaleAlgo = 0;
|
||||
|
||||
app_alert(LG_ALERT_INFO, "Scale Algorithm: %s", egl_desktop_scale_algo_name(desktop->scaleAlgo));
|
||||
app_alert(LG_ALERT_INFO, "Scale Algorithm %d: %s", desktop->scaleAlgo,
|
||||
egl_desktop_scale_algo_name(desktop->scaleAlgo));
|
||||
}
|
||||
|
||||
void egl_desktop_free(EGL_Desktop ** desktop)
|
||||
|
@ -32,6 +32,9 @@ enum EGL_DesktopScaleType
|
||||
EGL_DESKTOP_DOWNSCALE,
|
||||
};
|
||||
|
||||
struct Option;
|
||||
bool egl_desktop_scale_validate(struct Option * opt, const char ** error);
|
||||
|
||||
bool egl_desktop_init(EGL_Desktop ** desktop, EGLDisplay * display);
|
||||
void egl_desktop_free(EGL_Desktop ** desktop);
|
||||
|
||||
|
@ -152,6 +152,14 @@ static struct Option egl_options[] =
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 0
|
||||
},
|
||||
{
|
||||
.module = "egl",
|
||||
.name = "scale",
|
||||
.description = "Set the scale algorithm (0 = auto, 1 = nearest, 2 = linear)",
|
||||
.type = OPTION_TYPE_INT,
|
||||
.validator = egl_desktop_scale_validate,
|
||||
.value.x_int = 0
|
||||
},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user