mirror of https://github.com/davatorium/rofi.git
[View] Scaling via GDK_SCALE mess
This commit is contained in:
parent
141bd3d197
commit
9c3d141511
|
@ -155,4 +155,5 @@ Settings config = {
|
|||
/** fallback icon */
|
||||
.application_fallback_icon = NULL,
|
||||
/** refilter limit */
|
||||
.refilter_timeout_limit = 8192};
|
||||
.refilter_timeout_limit = 8192,
|
||||
.scale = 1.0};
|
||||
|
|
|
@ -181,6 +181,8 @@ typedef struct {
|
|||
/** refilter timeout limit, when more then these entries,go into timeout mode.
|
||||
*/
|
||||
unsigned int refilter_timeout_limit;
|
||||
|
||||
double scale;
|
||||
} Settings;
|
||||
|
||||
/** Default number of lines in the list view */
|
||||
|
|
|
@ -415,7 +415,8 @@ static void help_print_mode_not_found(const char *mode) {
|
|||
}
|
||||
static void help_print_no_arguments(void) {
|
||||
|
||||
GString *emesg = g_string_new("<span size=\"x-large\">Rofi is unsure what to show.</span>\n\n");
|
||||
GString *emesg = g_string_new(
|
||||
"<span size=\"x-large\">Rofi is unsure what to show.</span>\n\n");
|
||||
g_string_append(emesg, "Please specify the mode you want to show.\n\n");
|
||||
g_string_append(
|
||||
emesg, " <b>rofi</b> -show <span color=\"green\">{mode}</span>\n\n");
|
||||
|
@ -786,6 +787,14 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
if (g_getenv("GDK_SCALE") != NULL) {
|
||||
const char *scale = g_getenv("GDK_SCALE");
|
||||
errno = 0;
|
||||
double scaled = g_ascii_strtod(scale, NULL);
|
||||
if (scaled > 0 && errno == 0) {
|
||||
config.scale = scaled;
|
||||
}
|
||||
}
|
||||
|
||||
if (find_arg("-rasi-validate") >= 0) {
|
||||
char *str = NULL;
|
||||
|
|
|
@ -1319,7 +1319,7 @@ RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget,
|
|||
}
|
||||
static int get_pixels(RofiDistanceUnit *unit, RofiOrientation ori) {
|
||||
int val = unit->distance;
|
||||
|
||||
val *= config.scale;
|
||||
if (unit->type == ROFI_PU_EM) {
|
||||
val = unit->distance * textbox_get_estimated_char_height();
|
||||
} else if (unit->type == ROFI_PU_CH) {
|
||||
|
|
|
@ -812,10 +812,10 @@ void __create_window(MenuFlags menu_flags) {
|
|||
if (config.dpi > 1) {
|
||||
PangoFontMap *font_map = pango_cairo_font_map_get_default();
|
||||
pango_cairo_font_map_set_resolution((PangoCairoFontMap *)font_map,
|
||||
(double)config.dpi);
|
||||
(double)config.dpi * config.scale);
|
||||
} else if (config.dpi == 0 || config.dpi == 1) {
|
||||
// Auto-detect mode.
|
||||
double dpi = 96;
|
||||
double dpi = 96 * config.scale;
|
||||
if (CacheState.mon.mh > 0 && config.dpi == 1) {
|
||||
dpi = (CacheState.mon.h * 25.4) / (double)(CacheState.mon.mh);
|
||||
} else {
|
||||
|
@ -832,6 +832,9 @@ void __create_window(MenuFlags menu_flags) {
|
|||
PangoFontMap *font_map = pango_cairo_font_map_get_default();
|
||||
config.dpi =
|
||||
pango_cairo_font_map_get_resolution((PangoCairoFontMap *)font_map);
|
||||
config.dpi *= config.scale;
|
||||
pango_cairo_font_map_set_resolution((PangoCairoFontMap *)font_map,
|
||||
(double)config.dpi * config.scale);
|
||||
}
|
||||
// Setup font.
|
||||
// Dummy widget.
|
||||
|
|
Loading…
Reference in New Issue