diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index a735f9a0..c1982efe 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -414,7 +414,8 @@ This option can be specified multiple times. `-dpi` *number* Override the default DPI setting. -If set to `0` it tries to auto-detect based on monitor. +If set to `0` it tries to auto-detect based on X11 screen size. (Similar to i3 and GTK) +If set to `1` it tries to auto-detect based on monitor (rofi is displayed on) size. (Similar to latest QT5) ### PATTERN setting diff --git a/doc/rofi.1 b/doc/rofi.1 index d7f40cd9..07cb3a9c 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -672,7 +672,7 @@ This option can be specified multiple times\. \fB\-dpi\fR \fInumber\fR . .P -Override the default DPI setting\. If set to \fB0\fR it tries to auto\-detect based on monitor\. +Override the default DPI setting\. If set to \fB0\fR it tries to auto\-detect based on X11 screen size\. (Similar to i3 and GTK) If set to \fB1\fR it tries to auto\-detect based on monitor (rofi is displayed on) size\. (Similar to latest QT5) . .SS "PATTERN setting" \fB\-terminal\fR diff --git a/source/view.c b/source/view.c index 24ea9bcf..0371504e 100644 --- a/source/view.c +++ b/source/view.c @@ -209,7 +209,7 @@ static void menu_capture_screenshot ( void ) fprintf ( stderr, color_green "Storing screenshot %s\n"color_reset, fpath ); cairo_status_t status = cairo_surface_write_to_png ( CacheState.edit_surf, fpath ); if ( status != CAIRO_STATUS_SUCCESS ) { - fprintf ( stderr, "Failed to produce screenshot '%s', got error: '%s'\n", filename, + fprintf ( stderr, "Failed to produce screenshot '%s', got error: '%s'\n", fpath, cairo_status_to_string ( status ) ); } g_free ( fpath ); @@ -671,14 +671,14 @@ void __create_window ( MenuFlags menu_flags ) CacheState.flags = menu_flags; monitor_active ( &( CacheState.mon ) ); // Setup dpi - if ( config.dpi > 0 ) { + 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 ); } - else if ( config.dpi == 0 ) { + else if ( config.dpi == 0 || config.dpi == 1 ) { // Auto-detect mode. double dpi = 96; - if ( CacheState.mon.mh > 0 ) { + if ( CacheState.mon.mh > 0 && config.dpi == 1 ) { dpi = ( CacheState.mon.h * 25.4 ) / (double) ( CacheState.mon.mh ); } else {