Desktop labels keep the old DPI after a gtk-xft-dpi change
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
Direzione di ricerca
Start in libnemo-private/nemo-icon-container.c and read style_updated() plus nemo_icon_container_invalidate_labels() to understand how the desktop container refreshes label layouts. The issue proposes updating the Pango context resolution in the desktop branch; it also flags font options as a possible related update. Done means desktop labels use the new DPI after an XSETTINGS change without restarting nemo-desktop; the GTK reproduction supports the approach, but the issue reports no Nemo build test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Distribution
Ubuntu 26.04, Unity session (X11). nemo-desktop draws the desktop.
Package version
6.4.5 (the same code is in master). GTK 3.24.52.
Frequency
Always
Bug description
The desktop icon labels do not follow a runtime change of gtk-xft-dpi. The labels keep the DPI that was active when nemo-desktop started. The icons and other windows use the new DPI.
On a real login this occurs when nemo-desktop starts before the XSETTINGS manager. GTK then uses Xft.dpi from the X resources. A HiDPI greeter can leave Xft.dpi: 192 there. The settings daemon then publishes 96 dpi, but the desktop labels stay at 2x until nemo-desktop restarts.
Steps to reproduce
- Start
Xvfb :94 -screen 0 1600x900x24 -noreset. - Run
printf 'Xft.dpi: 192\n' | xrdb -nocpp -mergeon:94. - Start nemo-desktop on
:94withdesktop-layout 'true::true'and the computer, home and trash icons visible. - Publish XSETTINGS with
Xft/DPI= 98304 (96 dpi). GTK reportsgtk-xft-dpi96 after this step. - Compare the labels before and after step 4. Then restart nemo-desktop.
| State | gtk-xft-dpi |
"Home" label |
|---|---|---|
Start, no XSETTINGS, Xft.dpi: 192 |
192 | 72x20 px |
| After XSETTINGS 96 dpi | 96 | 72x20 px |
| After restart of nemo-desktop | 96 | 36x10 px |
Expected behavior
The "Home" label is 36x10 px after step 4, without a restart.
Additional information
style_updated() in libnemo-private/nemo-icon-container.c does not chain up for the desktop container:
/* Don't chain up to parent, if this is a desktop container,
* because that resets the background of the window.
*/
if (!nemo_icon_container_get_is_desktop (container)) {
GTK_WIDGET_CLASS (nemo_icon_container_parent_class)->style_updated (widget);
}
The default GtkWidget handler updates the Pango context of the widget, including its resolution. Without the chain-up, the desktop container keeps the old resolution. nemo_icon_container_invalidate_labels() then creates the new layouts from the same old context.
Minimal GTK reproduction, same setup as above (start with Xft.dpi: 192, then publish XSETTINGS 96 dpi):
before XSETTINGS: gtk-xft-dpi 192.0 | no chain-up 192.0 | chain-up 192.0 | no chain-up + set_resolution 192.0
after XSETTINGS: gtk-xft-dpi 96.0 | no chain-up 192.0 | chain-up 96.0 | no chain-up + set_resolution 96.0
The three widgets are Gtk.DrawingArea subclasses. The "no chain-up" widget overrides do_style_updated with an empty function. The values are PangoCairo.context_get_resolution (widget.get_pango_context ()).
Possible fix: update the resolution of the Pango context in the desktop branch, without the chain-up that resets the background.
if (!nemo_icon_container_get_is_desktop (container)) {
GTK_WIDGET_CLASS (nemo_icon_container_parent_class)->style_updated (widget);
} else {
pango_cairo_context_set_resolution (gtk_widget_get_pango_context (widget),
gdk_screen_get_resolution (gtk_widget_get_screen (widget)));
}
The GTK reproduction confirms this approach. It is not tested in a nemo build. The font options of the context can need the same update (pango_cairo_context_set_font_options() with gdk_screen_get_font_options()).
A change of the text scaling factor in Cinnamon also changes Xft/DPI at runtime, so the desktop labels can show the same problem there. This is not tested.
- Lingua principale
- C
- Stelle
- 1.6k
- Fork
- 387
- Merge medio
- 2g 19h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di linuxmint/nemo
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Copy dialog: Enter key accidentally cancels file copyForse già presa @jackjusko l’ha presa 3 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
linuxmint/nemo#3838 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
linuxmint/nemo#3805 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di linuxmint/nemo
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
389ds/389-ds-base#8152 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition rootForse già presa @tuhaihe l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/cloudberry#2356 ·
I maintainer di solito rispondono entro 2 giorni
-
windows-artifacts: the win-arm64 job uses a Visual Studio generator missing from windows-11-armAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100