linuxmint / cinnamon-desktop

The cinnamon-desktop library (and common settings schemas for the cinnamon desktop)
GNU General Public License v2.0
187 stars 63 forks source link

gnome-rr-config.c writes localized floating point representations into config files #171

Open xax opened 3 years ago

xax commented 3 years ago

c-s-d/xrandx from cinnamon-settings-daemon uses libcinnamon-desktop's gnome-rr-config.c to read and write from configuration files cinnamon-monitors.xml and/or monitors.xml.

The scaling key is a double or float and gets written localized, thus with a decimal comma , in case of a German locale. That is probably not intended (and perhaps cause of dpi/scaling settings not sticking with my setup).

mtwebster commented 3 years ago

Leave it to an American to neglect to take this into consideration. :)

While I'll probably change this and force a period regardless of locale, I can't seem to reproduce any issue with loading the file - the parse function also takes the locale into account - If I switch to de_DE.UTF-8 and set a display configuration, I get a comma (<scale>0,750000</scale>). If I log out and back in, it gets parsed correctly at login.

Can your paste the output from the locale command?

If you set the configuration in display settings, close it, reopen and check the settings again, do they match?

The only thing I can think is for some reason the program that applies the configuration at startup (csd-xrandr) is running with a different locale than display settings. If you hand-edit the entries in cinnamon-monitors.xml to use a period, does the correct configuration get applied at startup?

Thanks

edit: Can you also share your cinnamon-monitors.xml (with your desired configuration). There could be something else causing csd-xrandr to reject it and revert to auto-detect.

xax commented 3 years ago

Yes, my problem perhaps isn't directly related to this issue. (But it should be fixed anyways, I think.)

Early stages of system startup (grub stage, ecryptfs, ..) might actually run in a default locale -- I should investigate that. lightdm runs de_DE, it appears.

locale output is

LANG=de_DE.UTF-8
LANGUAGE=de_DE
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=

cinnamon-monitors.xml is given below; first config is the desired setup using builtin laptop screen plus a Thunderbolt docking station; second config is the standalone laptop.

<monitors version="1">
  <configuration>
      <clone>no</clone>
      <base_scale>2</base_scale>
      <output name="eDP-1">
          <vendor>AUO</vendor>
          <product>0x2036</product>
          <serial>0x00000000</serial>
          <width>2560</width>
          <height>1440</height>
          <rate>60,011000</rate>
          <x>0</x>
          <y>0</y>
          <scale>1,495327</scale>
          <rotation>normal</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>yes</primary>
      </output>
      <output name="DP-1">
      </output>
      <output name="HDMI-1">
      </output>
      <output name="DP-2">
      </output>
      <output name="HDMI-2">
      </output>
      <output name="DP-1-1">
      </output>
      <output name="DP-1-2">
      </output>
      <output name="DP-1-3">
          <vendor>IVM</vendor>
          <product>0x5620</product>
          <serial>0x0000006b</serial>
          <width>1920</width>
          <height>1080</height>
          <rate>60,000000</rate>
          <x>3424</x>
          <y>0</y>
          <scale>1,250000</scale>
          <rotation>normal</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>no</primary>
      </output>
  </configuration>
  <configuration>
      <clone>no</clone>
      <base_scale>2</base_scale>
      <output name="eDP-1">
          <vendor>AUO</vendor>
          <product>0x2036</product>
          <serial>0x00000000</serial>
          <width>2560</width>
          <height>1440</height>
          <rate>60,011000</rate>
          <x>0</x>
          <y>0</y>
          <scale>1,495334</scale>
          <rotation>normal</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>yes</primary>
      </output>
      <output name="DP-1">
      </output>
      <output name="HDMI-1">
      </output>
      <output name="DP-2">
      </output>
      <output name="HDMI-2">
      </output>
  </configuration>

</monitors> 

After reboot, the cinnamon-monitors.xml still looks the same, but the scaling is wrong and display settings panel shows initial scaling 2x (correct) and scaling 74% (wrong, should be 149%) all of a sudden.

~/csd-xrandr.log logged:

STARTING XRANDR PLUGIN
State of screen at startup:
        Screen min(320, 200), max(16384, 16384), change=16295 = config=16295
        cloned: no
        eDP-1: 2560x1440@60 +0+0 (Laptop) (primary output)
        DP-1: disconnected
        HDMI-1: disconnected
        DP-2: disconnected
        HDMI-2: disconnected
State of screen after initial configuration:
        Screen min(320, 200), max(16384, 16384), change=16295 = config=16295
        cloned: no
        eDP-1: 2560x1440@60 +0+0 (Laptop) (primary output)
        DP-1: disconnected
        HDMI-1: disconnected
        DP-2: disconnected
        HDMI-2: disconnected
Got RANDR event with timestamps change=25611 > config=16295
  Ignoring event since change >= config
Got RANDR event with timestamps change=25611 > config=16295
  Ignoring event since change >= config
Got RANDR event with timestamps change=25611 > config=16295
  Ignoring event since change >= config
Got RANDR event with timestamps change=3683644619 > config=16295
  Ignoring event since change >= config
Got RANDR event with timestamps change=3683644619 > config=16295
  Ignoring event since change >= config

I guess it's more for a new issue to be discussed with csd-xrandr, then.