Allow pivoting STRUTs for panels in the middle of virtual screens on some WMs

This commit is contained in:
Chris Billington
2019-02-24 21:58:35 +00:00
committed by Chris
parent 4dafea185f
commit 2b0f6a9869
10 changed files with 67 additions and 33 deletions

View File

@@ -25,8 +25,8 @@
GtkWidget *scale_relative_to_dpi, *scale_relative_to_screen_height;
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,
*panel_autohide_size;
GtkWidget *panel_wm_menu, *panel_dock, *panel_pivot_struts, *panel_autohide, *panel_autohide_show_time,
*panel_autohide_hide_time, *panel_autohide_size;
GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type,
*panel_combo_monitor;
GtkWidget *panel_window_name, *disable_transparency;
@@ -1015,6 +1015,27 @@ void create_panel(GtkWidget *parent)
"The exact behavior depends on the window manager and its configuration."),
NULL);
row++;
col = 2;
label = gtk_label_new(_("Pivot reserved space"));
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++;
panel_pivot_struts = gtk_check_button_new();
gtk_widget_show(panel_pivot_struts);
gtk_table_attach(GTK_TABLE(table), panel_pivot_struts, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0);
col++;
gtk_tooltips_set_tip(tooltips,
panel_pivot_struts,
_("If enabled, the space reserved for the panel (if \"Maximised windows\" is set to "
"match the panel size or hidden panel size) will be given to the window manager as if "
"the panel were the opposite orientation (horizontal vs vertical) than it actually is. "
"On some window managers this allows placing a panel in the middle of the virtual screen, "
"e.g. on the bottom edge of the top screen in a vertical dual-monitor setup."),
NULL);
row++;
col = 2;
label = gtk_label_new(_("Panel layer"));

View File

@@ -12,8 +12,8 @@
extern GtkWidget *scale_relative_to_dpi, *scale_relative_to_screen_height;
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,
*panel_autohide_size;
extern GtkWidget *panel_wm_menu, *panel_dock, *panel_pivot_struts, *panel_autohide, *panel_autohide_show_time,
*panel_autohide_hide_time, *panel_autohide_size;
extern GtkWidget *panel_combo_strut_policy, *panel_combo_layer, *panel_combo_width_type, *panel_combo_height_type,
*panel_combo_monitor;
extern GtkWidget *panel_window_name, *disable_transparency;

View File

@@ -295,6 +295,7 @@ void config_write_panel(FILE *fp)
fprintf(fp, "panel_background_id = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(panel_background)));
fprintf(fp, "wm_menu = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_wm_menu)) ? 1 : 0);
fprintf(fp, "panel_dock = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_dock)) ? 1 : 0);
fprintf(fp, "panel_pivot_struts = %d\n", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(panel_pivot_struts)) ? 1 : 0);
fprintf(fp, "panel_position = ");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(screen_position[POS_BLH]))) {
@@ -1384,6 +1385,8 @@ void add_entry(char *key, char *value)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_wm_menu), atoi(value));
} else if (strcmp(key, "panel_dock") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_dock), atoi(value));
} else if (strcmp(key, "panel_pivot_struts") == 0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(panel_pivot_struts), atoi(value));
} else if (strcmp(key, "panel_layer") == 0) {
if (strcmp(value, "bottom") == 0)
gtk_combo_box_set_active(GTK_COMBO_BOX(panel_combo_layer), 2);