3v1n0

Untitled

Feb 13th, 2026
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 6.18 KB | None | 0 0
  1. From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <[email protected]>
  2. Date: Fri, 13 Feb 2026 19:13:40 +0100
  3. Subject: display: Add setting to configure X11 apps scaling
  4.  
  5. X11 applications appearance may now be scaled by just stretching their
  6. look or using the X11 native scaling.
  7.  
  8. This is not something we may know preemptively, so we need to add a
  9. configuration setting to make such old applications usable in some
  10. contexts.
  11.  
  12. Bug-Ubuntu: https://bugs.launchpad.net/mutter/+bug/2110515
  13. ---
  14. panels/display/cc-display-panel.blp |  8 +++++++
  15.  panels/display/cc-display-panel.c   | 46 +++++++++++++++++++++++++++++++++++++
  16.  2 files changed, 54 insertions(+)
  17.  
  18. diff --git a/panels/display/cc-display-panel.blp b/panels/display/cc-display-panel.blp
  19. index f40b2cf..c22576b 100644
  20. --- a/panels/display/cc-display-panel.blp
  21. +++ b/panels/display/cc-display-panel.blp
  22. @@ -107,6 +107,14 @@ template $CcDisplayPanel: $CcPanel {
  23.            visible: false;
  24.          }
  25.  
  26. +        Adw.PreferencesGroup {
  27. +          Adw.SwitchRow scale_legacy_apps_row {
  28. +            title: C_("display setting", "Automatically Scale _Legacy Applications (X11)");
  29. +            subtitle: C_("display setting", "Use built-in scaling in legacy applications for better appearance. Some apps may not scale at all.");
  30. +            use-underline: true;
  31. +          }
  32. +        }
  33. +
  34.          Adw.PreferencesGroup {
  35.            $CcListRow night_light_row {
  36.              /* Translators: This is the redshift functionality where we suppress blue light when the sun has gone down */
  37. diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
  38. index d9de82c..9763e50 100644
  39. --- a/panels/display/cc-display-panel.c
  40. +++ b/panels/display/cc-display-panel.c
  41. @@ -43,6 +43,9 @@
  42.  
  43.  #define DISPLAY_SCHEMA   "org.gnome.settings-daemon.plugins.color"
  44.  
  45. +#define MUTTER_WAYLAND_SCHEMA "org.gnome.mutter.wayland"
  46. +#define MUTTER_XWAYLAND_SCALING_FACTOR "xwayland-scaling-factor"
  47. +
  48.  #define DISPLAY_CONFIG_JOIN_NAME "join"
  49.  #define DISPLAY_CONFIG_CLONE_NAME "clone"
  50.  
  51. @@ -73,6 +76,8 @@ struct _CcDisplayPanel
  52.    CcNightLightPage *night_light_page;
  53.    CcListRow        *night_light_row;
  54.  
  55. +  GtkWidget        *scale_legacy_apps_row;
  56. +
  57.    UpClient *up_client;
  58.    gboolean lid_is_closed;
  59.  
  60. @@ -101,6 +106,7 @@ struct _CcDisplayPanel
  61.    GtkShortcut *escape_shortcut;
  62.  
  63.    GSettings           *display_settings;
  64. +  GSettings           *mutter_wayland_settings;
  65.  };
  66.  
  67.  enum {
  68. @@ -436,6 +442,7 @@ cc_display_panel_dispose (GObject *object)
  69.    g_clear_object (&self->up_client);
  70.  
  71.    g_clear_object (&self->shell_proxy);
  72. +  g_clear_object (&self->mutter_wayland_settings);
  73.  
  74.    g_signal_handlers_disconnect_by_data (toplevel, self);
  75.  
  76. @@ -602,6 +609,7 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
  77.    gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, escape_shortcut);
  78.    gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, night_light_page);
  79.    gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, night_light_row);
  80. +  gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, scale_legacy_apps_row);
  81.    gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, primary_display_row);
  82.    gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, single_display_settings_group);
  83.  
  84. @@ -727,6 +735,7 @@ rebuild_ui (CcDisplayPanel *self)
  85.    guint n_usable_outputs;
  86.    GList *outputs, *l;
  87.    CcDisplayConfigType type;
  88. +  gboolean any_scaled = FALSE;
  89.  
  90.    if (!cc_display_config_manager_get_apply_allowed (self->manager))
  91.      {
  92. @@ -750,6 +759,7 @@ rebuild_ui (CcDisplayPanel *self)
  93.  
  94.    if (!self->current_config)
  95.      {
  96. +      gtk_widget_set_visible (self->scale_legacy_apps_row, FALSE);
  97.        self->rebuilding_counter--;
  98.        return;
  99.      }
  100. @@ -774,6 +784,9 @@ rebuild_ui (CcDisplayPanel *self)
  101.              adw_combo_row_set_selected (self->primary_display_row,
  102.                                          g_list_model_get_n_items (G_LIST_MODEL (self->primary_display_list)) - 1);
  103.  
  104. +          if (!G_APPROX_VALUE (cc_display_monitor_get_scale (output), 1.0, FLT_EPSILON))
  105. +            any_scaled = TRUE;
  106. +
  107.            /* Ensure that an output is selected; note that this doesn't ensure
  108.             * the selected output is any useful (i.e. when switching types).
  109.             */
  110. @@ -820,6 +833,8 @@ rebuild_ui (CcDisplayPanel *self)
  111.  
  112.    cc_panel_set_selected_type (self, type);
  113.  
  114. +  gtk_widget_set_visible (self->scale_legacy_apps_row, any_scaled);
  115. +
  116.    self->rebuilding_counter--;
  117.    update_apply_button (self);
  118.  }
  119. @@ -1053,6 +1068,28 @@ session_bus_ready (GObject        *source,
  120.                             G_CONNECT_SWAPPED);
  121.  }
  122.  
  123. +static gboolean
  124. +get_automatic_xwayland_scaling_factor (GValue   *value,
  125. +                                       GVariant *variant,
  126. +                                       gpointer  data)
  127. +{
  128. +  gboolean enabled;
  129. +
  130. +  enabled = G_APPROX_VALUE (g_variant_get_double (variant), 0.0, FLT_EPSILON);
  131. +
  132. +  g_value_set_boolean (value, enabled);
  133. +
  134. +  return TRUE;
  135. +}
  136. +
  137. +static GVariant *
  138. +set_automatic_xwayland_scaling_factor (const GValue       *value,
  139. +                                       const GVariantType *expected_type,
  140. +                                       gpointer            data)
  141. +{
  142. +  return g_variant_new_double (g_value_get_boolean (value) ? 0.0 : 1.0);
  143. +}
  144. +
  145.  static void
  146.  cc_display_panel_init (CcDisplayPanel *self)
  147.  {
  148. @@ -1136,6 +1173,15 @@ cc_display_panel_init (CcDisplayPanel *self)
  149.                             self,
  150.                             G_CONNECT_SWAPPED);
  151.    on_night_light_enabled_changed_cb (self);
  152. +
  153. +  self->mutter_wayland_settings = g_settings_new (MUTTER_WAYLAND_SCHEMA);
  154. +  g_settings_bind_with_mapping (self->mutter_wayland_settings,
  155. +                                MUTTER_XWAYLAND_SCALING_FACTOR,
  156. +                                self->scale_legacy_apps_row, "active",
  157. +                                G_SETTINGS_BIND_DEFAULT,
  158. +                                get_automatic_xwayland_scaling_factor,
  159. +                                set_automatic_xwayland_scaling_factor,
  160. +                                NULL, NULL);
  161.  }
  162.  
  163.  CcDisplayConfigManager *
  164.  
Advertisement
Add Comment
Please, Sign In to add comment