Fixes hi-dpi on Windows
- Fixes incorrect install path for icons - Fixes incorrect font size conversion from "Pango units" (updates some comments) - Fixes incorrect volume icon in directory browser
This commit is contained in:
parent
2cd6ba96ca
commit
35ce0d1227
@ -368,6 +368,8 @@ if(NOT DEFINED ICONSDIR)
|
||||
else()
|
||||
set(ICONSDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
|
||||
endif()
|
||||
else()
|
||||
set(ICONSDIR "${DATADIR}/icons")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -314,8 +314,10 @@ void DirBrowser::row_expanded (const Gtk::TreeModel::iterator& iter, const Gtk::
|
||||
|
||||
expandSuccess = true;
|
||||
|
||||
// Update row icon
|
||||
// Update row icon (only if row icon is not a volume one or is empty)
|
||||
if (iter->get_value(dtColumns.icon_name) == closedfolder || iter->get_value(dtColumns.icon_name) == "") {
|
||||
iter->set_value(dtColumns.icon_name, openfolder);
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gio::FileMonitor> monitor = dir->monitor_directory ();
|
||||
iter->set_value (dtColumns.monitor, monitor);
|
||||
@ -324,8 +326,10 @@ void DirBrowser::row_expanded (const Gtk::TreeModel::iterator& iter, const Gtk::
|
||||
|
||||
void DirBrowser::row_collapsed (const Gtk::TreeModel::iterator& iter, const Gtk::TreeModel::Path& path)
|
||||
{
|
||||
// Update row icon
|
||||
// Update row icon (only if row icon is not a volume one)
|
||||
if (iter->get_value(dtColumns.icon_name) == openfolder) {
|
||||
iter->set_value(dtColumns.icon_name, closedfolder);
|
||||
}
|
||||
}
|
||||
|
||||
void DirBrowser::updateDir (const Gtk::TreeModel::iterator& iter)
|
||||
|
@ -30,9 +30,7 @@
|
||||
*
|
||||
* About Pango size convention (for font):
|
||||
* Pango size can be expressed in two different units:
|
||||
* - Absolute size (i.e. "px"): If size is int type, absolute size is given in "Pango unit"
|
||||
* shall be divided by Pango::SCALE (i.e. 1024) to get "px". If size is double, absolute
|
||||
* is already given in "px".
|
||||
* - Absolute size (i.e. "px")
|
||||
* - Non-absolute size (i.e. "pt"): The default resolution is 72 DPI (i.e. pt per inch). To
|
||||
* convert the size to "px", use the following formula:
|
||||
* "size in px" = "size in pt" * ("device resolution" / 72) * "device scale"
|
||||
|
@ -195,14 +195,14 @@ RTWindow::RTWindow ()
|
||||
Pango::FontDescription pfd = style->get_font(Gtk::STATE_FLAG_NORMAL);
|
||||
|
||||
if (pfd.get_set_fields() & Pango::FONT_MASK_SIZE) {
|
||||
const int fontSize = pfd.get_size();
|
||||
int fontSize = pfd.get_size();
|
||||
const bool isAbsoluteFontSize = pfd.get_size_is_absolute();
|
||||
int newFontSize;
|
||||
|
||||
if (isAbsoluteFontSize) {
|
||||
// Absolute size is defined in "Pango units" and shall be divided by
|
||||
// Pango::SCALE to get "px"
|
||||
newFontSize = fontSize / Pango::SCALE;
|
||||
fontSize = fontSize / Pango::SCALE;
|
||||
|
||||
#ifndef __APPLE__
|
||||
// Guessing that pixel size is given for a 96 DPI reference:
|
||||
@ -213,12 +213,16 @@ RTWindow::RTWindow ()
|
||||
// Refer to https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/quartz/gdkscreen-quartz.c
|
||||
const double newFontScale = 1.;
|
||||
#endif
|
||||
newFontSize = static_cast<int>(newFontSize * newFontScale + 0.5);
|
||||
newFontSize = static_cast<int>(fontSize * newFontScale + 0.5);
|
||||
|
||||
if (rtengine::settings->verbose) {
|
||||
printf("\"Default\" absolute font size(%d)\n", newFontSize);
|
||||
}
|
||||
} else {
|
||||
// Non-absolute size is defined in "Pango units" and shall be divided by
|
||||
// Pango::SCALE to get "px"
|
||||
fontSize = fontSize / Pango::SCALE;
|
||||
|
||||
// Non-absolute size is defined in "pt" and shall be converted to "px"
|
||||
newFontSize = static_cast<int>(fontSize * fontScale + 0.5);
|
||||
|
||||
|
@ -195,8 +195,7 @@ void SHCSelector::updateBackBuffer()
|
||||
|
||||
// update font
|
||||
fontd.set_weight (Pango::WEIGHT_NORMAL);
|
||||
// Absolute size is defined in "Pango units" and shall be multiplied by
|
||||
// Pango::SCALE from "px"
|
||||
|
||||
const double fontSize = static_cast<double>(h) * 0.8; // pt
|
||||
// Converting font size to "px" based on DPI and scale
|
||||
#ifndef __APPLE__
|
||||
|
Loading…
x
Reference in New Issue
Block a user