mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Update DPI detection method.
This commit is contained in:
parent
2306e58a25
commit
46db427735
3 changed files with 7 additions and 6 deletions
|
@ -414,7 +414,8 @@ This option can be specified multiple times.
|
||||||
`-dpi` *number*
|
`-dpi` *number*
|
||||||
|
|
||||||
Override the default DPI setting.
|
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
|
### PATTERN setting
|
||||||
|
|
||||||
|
|
|
@ -672,7 +672,7 @@ This option can be specified multiple times\.
|
||||||
\fB\-dpi\fR \fInumber\fR
|
\fB\-dpi\fR \fInumber\fR
|
||||||
.
|
.
|
||||||
.P
|
.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"
|
.SS "PATTERN setting"
|
||||||
\fB\-terminal\fR
|
\fB\-terminal\fR
|
||||||
|
|
|
@ -209,7 +209,7 @@ static void menu_capture_screenshot ( void )
|
||||||
fprintf ( stderr, color_green "Storing screenshot %s\n"color_reset, fpath );
|
fprintf ( stderr, color_green "Storing screenshot %s\n"color_reset, fpath );
|
||||||
cairo_status_t status = cairo_surface_write_to_png ( CacheState.edit_surf, fpath );
|
cairo_status_t status = cairo_surface_write_to_png ( CacheState.edit_surf, fpath );
|
||||||
if ( status != CAIRO_STATUS_SUCCESS ) {
|
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 ) );
|
cairo_status_to_string ( status ) );
|
||||||
}
|
}
|
||||||
g_free ( fpath );
|
g_free ( fpath );
|
||||||
|
@ -671,14 +671,14 @@ void __create_window ( MenuFlags menu_flags )
|
||||||
CacheState.flags = menu_flags;
|
CacheState.flags = menu_flags;
|
||||||
monitor_active ( &( CacheState.mon ) );
|
monitor_active ( &( CacheState.mon ) );
|
||||||
// Setup dpi
|
// Setup dpi
|
||||||
if ( config.dpi > 0 ) {
|
if ( config.dpi > 1 ) {
|
||||||
PangoFontMap *font_map = pango_cairo_font_map_get_default ();
|
PangoFontMap *font_map = pango_cairo_font_map_get_default ();
|
||||||
pango_cairo_font_map_set_resolution ( (PangoCairoFontMap *) font_map, (double) config.dpi );
|
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.
|
// Auto-detect mode.
|
||||||
double dpi = 96;
|
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 );
|
dpi = ( CacheState.mon.h * 25.4 ) / (double) ( CacheState.mon.mh );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue