From 7f99492c269f541c81e4f36742ecc3f0b4ebac04 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Wed, 20 Dec 2017 14:03:18 -0500 Subject: Support panel auto-scaling for HiDPI displays *Fix scaling of panel widgets, buttons, and the menu bar *Draw grab handles at the ends of the panel *Fix size of _almost_ all included applets *Fix panel snapping coordinates *Down-scale monitor coordinates to support multi-monitors Author: Victor Kareh Date: Wed Dec 20 14:03:18 2017 -0500 --- mate-panel/panel-widget.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'mate-panel/panel-widget.c') diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c index cedcbb21..ce9d88b0 100644 --- a/mate-panel/panel-widget.c +++ b/mate-panel/panel-widget.c @@ -1214,6 +1214,7 @@ panel_widget_get_preferred_size(GtkWidget *widget, GList *list; GList *ad_with_hints; gboolean dont_fill; + gint scale; g_return_if_fail(PANEL_IS_WIDGET(widget)); g_return_if_fail(minimum_size != NULL); @@ -1231,6 +1232,7 @@ panel_widget_get_preferred_size(GtkWidget *widget, natural_size->height = minimum_size->height; ad_with_hints = NULL; + scale = gtk_widget_get_scale_factor(widget); for (list = panel->applet_list; list!=NULL; list = g_list_next(list)) { AppletData *ad = list->data; @@ -1254,8 +1256,10 @@ panel_widget_get_preferred_size(GtkWidget *widget, else if (panel->packed) { - minimum_size->width += child_min_size.width; - natural_size->width += child_natural_size.width; + /* Just because everything is bigger when scaled up doesn't mean + * that the applets need any less room when the panel is packed. */ + minimum_size->width += child_min_size.width * scale; + natural_size->width += child_natural_size.width * scale; } } else { if (minimum_size->width < child_min_size.width && @@ -1271,8 +1275,10 @@ panel_widget_get_preferred_size(GtkWidget *widget, else if (panel->packed) { - minimum_size->height += child_min_size.height; - natural_size->height += child_natural_size.height; + /* Just because everything is bigger when scaled up doesn't mean + * that the applets need any less room when the panel is packed. */ + minimum_size->height += child_min_size.height * scale; + natural_size->height += child_natural_size.height * scale; } } } @@ -1409,9 +1415,9 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) gtk_widget_set_allocation (widget, allocation); if (gtk_widget_get_realized (widget)) gdk_window_move_resize (gtk_widget_get_window (widget), - allocation->x, + allocation->x, allocation->y, - allocation->width, + allocation->width, allocation->height); if(panel->orient == GTK_ORIENTATION_HORIZONTAL) -- cgit v1.2.1