Skip to content

Commit

Permalink
GTK 3.23: fix applet size allocation
Browse files Browse the repository at this point in the history
Limit workaround for GTK 3.22 double width/height allocation to GTK 3.22 builds only
  • Loading branch information
lukefromdc committed Jul 21, 2018
1 parent 7369482 commit a130fb0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions libmate-panel-applet/mate-panel-applet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,43 +1055,46 @@ mate_panel_applet_get_preferred_width (GtkWidget *widget,
int *minimum_width,
int *natural_width)
{
MatePanelApplet *applet = MATE_PANEL_APPLET (widget);
gint scale;

GTK_WIDGET_CLASS (mate_panel_applet_parent_class)->get_preferred_width (widget,
minimum_width,
natural_width);

#if !GTK_CHECK_VERSION (3, 23, 0)
MatePanelApplet *applet = MATE_PANEL_APPLET (widget);
if (applet->priv->out_of_process) {
/* Out-of-process applets end up scaled up doubly. We divide by the scale factor to ensure
/* Out-of-process applets end up scaled up doubly with GTK 3.22.
* For these builds divide by the scale factor to ensure
* they are back at their own intended size.
*/
gint scale;
scale = gtk_widget_get_scale_factor (widget);
*minimum_width /= scale;
*natural_width /= scale;
}
#endif
}

static void
mate_panel_applet_get_preferred_height (GtkWidget *widget,
int *minimum_height,
int *natural_height)
{
MatePanelApplet *applet = MATE_PANEL_APPLET (widget);
gint scale;

GTK_WIDGET_CLASS (mate_panel_applet_parent_class)->get_preferred_height (widget,
minimum_height,
natural_height);

#if !GTK_CHECK_VERSION (3, 23, 0)
MatePanelApplet *applet = MATE_PANEL_APPLET (widget);
if (applet->priv->out_of_process) {
/* Out-of-process applets end up scaled up doubly. We divide by the scale factor to ensure
gint scale;
/* Out-of-process applets end up scaled up doubly with GTK 3.22.
* For these builds divide by the scale factor to ensure
* they are back at their own intended size.
*/
scale = gtk_widget_get_scale_factor (widget);
*minimum_height /= scale;
*natural_height /= scale;
}
#endif
}

static GtkSizeRequestMode
Expand Down

0 comments on commit a130fb0

Please sign in to comment.