diff options
author | Po Lu <luangruo@yahoo.com> | 2022-01-25 14:42:33 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-01-25 14:43:12 +0800 |
commit | b373c8ad71eb3877294451af5eb75819c706785a (patch) | |
tree | b9df068be901ccb8cf741e70698a2460b8708b78 /src/gtkutil.c | |
parent | ff63787ea18a27e991052ca04d0de0526ad5ec59 (diff) | |
download | emacs-b373c8ad71eb3877294451af5eb75819c706785a.tar.gz |
Fix tool bar size reporting on GTK when the display is scaled
* src/gtkutil.c (xg_update_tool_bar_sizes): Multiply sizes to
turn them into device pixels.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r-- | src/gtkutil.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index eb148560620..607cf5ee2e4 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -5471,6 +5471,7 @@ xg_update_tool_bar_sizes (struct frame *f) GtkRequisition req; int nl = 0, nr = 0, nt = 0, nb = 0; GtkWidget *top_widget = x->toolbar_widget; + int scale = xg_get_scale (f); gtk_widget_get_preferred_size (GTK_WIDGET (top_widget), NULL, &req); if (x->toolbar_in_hbox) @@ -5479,8 +5480,10 @@ xg_update_tool_bar_sizes (struct frame *f) gtk_container_child_get (GTK_CONTAINER (x->hbox_widget), top_widget, "position", &pos, NULL); - if (pos == 0) nl = req.width; - else nr = req.width; + if (pos == 0) + nl = req.width * scale; + else + nr = req.width * scale; } else { @@ -5488,8 +5491,10 @@ xg_update_tool_bar_sizes (struct frame *f) gtk_container_child_get (GTK_CONTAINER (x->vbox_widget), top_widget, "position", &pos, NULL); - if (pos == 0 || (pos == 1 && x->menubar_widget)) nt = req.height; - else nb = req.height; + if (pos == 0 || (pos == 1 && x->menubar_widget)) + nt = req.height * scale; + else + nb = req.height * scale; } if (nl != FRAME_TOOLBAR_LEFT_WIDTH (f) |