diff options
author | Victor Kareh <[email protected]> | 2017-12-20 14:03:18 -0500 |
---|---|---|
committer | lukefromdc <[email protected]> | 2018-01-25 20:20:58 -0500 |
commit | 7f99492c269f541c81e4f36742ecc3f0b4ebac04 (patch) | |
tree | e528643e8afb5fab8517c0116700b24ee0e87c26 /mate-panel/panel-widget.c | |
parent | e8f52ab153125b06d0de4847274d29dc0ac951a6 (diff) | |
download | mate-panel-7f99492c269f541c81e4f36742ecc3f0b4ebac04.tar.bz2 mate-panel-7f99492c269f541c81e4f36742ecc3f0b4ebac04.tar.xz |
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 <[email protected]>
Date: Wed Dec 20 14:03:18 2017 -0500
Diffstat (limited to 'mate-panel/panel-widget.c')
-rw-r--r-- | mate-panel/panel-widget.c | 18 |
1 files changed, 12 insertions, 6 deletions
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) |