From b3f98343133c162d9aac3a2011153edae478e986 Mon Sep 17 00:00:00 2001 From: o9000 Date: Wed, 17 Jan 2018 05:27:56 +0000 Subject: [PATCH] Scaling support in tint2conf (issue #656) --- src/tint2conf/properties.c | 14 ++++++++++++++ src/tint2conf/properties.h | 1 + src/tint2conf/properties_rw.c | 9 ++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index 1f5961b..cf798a8 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -22,6 +22,7 @@ #include "gradient_gui.h" #include "strlcat.h" +GtkWidget *scale_relative_to_dpi; GtkWidget *panel_width, *panel_height, *panel_margin_x, *panel_margin_y, *panel_padding_x, *panel_padding_y, *panel_spacing; GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, @@ -600,6 +601,19 @@ void create_panel(GtkWidget *parent) "for centered panels, it is evenly distributed on both sides of the panel."), NULL); + row++; + col = 2; + label = gtk_label_new(_("Scale relative to DPI")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_widget_show(label); + gtk_table_attach(GTK_TABLE(table), label, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; + + scale_relative_to_dpi = gtk_spin_button_new_with_range(0, 9000, 1); + gtk_widget_show(scale_relative_to_dpi); + gtk_table_attach(GTK_TABLE(table), scale_relative_to_dpi, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0); + col++; + change_paragraph(parent); label = gtk_label_new(_("Appearance")); diff --git a/src/tint2conf/properties.h b/src/tint2conf/properties.h index ae918ca..67e6a8e 100644 --- a/src/tint2conf/properties.h +++ b/src/tint2conf/properties.h @@ -9,6 +9,7 @@ #include "../launcher/icon-theme-common.h" // panel +extern GtkWidget *scale_relative_to_dpi; extern GtkWidget *panel_width, *panel_height, *panel_margin_x, *panel_margin_y, *panel_padding_x, *panel_padding_y, *panel_spacing; extern GtkWidget *panel_wm_menu, *panel_dock, *panel_autohide, *panel_autohide_show_time, *panel_autohide_hide_time, diff --git a/src/tint2conf/properties_rw.c b/src/tint2conf/properties_rw.c index 62dc719..9883ab6 100644 --- a/src/tint2conf/properties_rw.c +++ b/src/tint2conf/properties_rw.c @@ -378,6 +378,10 @@ void config_write_panel(FILE *fp) (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_saturation)), (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mouse_pressed_icon_brightness))); + fprintf(fp, + "scale_relative_to_dpi = %d\n", + (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(scale_relative_to_dpi))); + fprintf(fp, "\n"); } @@ -1108,7 +1112,10 @@ void add_entry(char *key, char *value) char *value1 = 0, *value2 = 0, *value3 = 0; /* Gradients */ - if (strcmp(key, "gradient") == 0) { + if (strcmp(key, "scale_relative_to_dpi") == 0) { + extract_values(value, &value1, &value2, &value3); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(scale_relative_to_dpi), atoi(value1)); + } else if (strcmp(key, "gradient") == 0) { finalize_gradient(); GradientConfigType t; if (g_str_equal(value, "horizontal"))