summaryrefslogtreecommitdiff
path: root/src/gui_gtk.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-04-04 15:57:12 +0200
committerBram Moolenaar <Bram@vim.org>2021-04-04 15:57:12 +0200
commit26af8e54ff0d423b7258ef84d175c8570740629a (patch)
tree082b59d3be9124ed2e78b62a3b95c2cc659519bf /src/gui_gtk.c
parent3a6aadb3289be5114db6cce1c8c18b3f5f14d17c (diff)
downloadvim-git-26af8e54ff0d423b7258ef84d175c8570740629a.tar.gz
patch 8.2.2709: the GTK GUI has a gap next to the scrollbarv8.2.2709
Problem: The GTK GUI has a gap next to the scrollbar. Solution: Calculate the scrollbar padding for GTK. (closes #8027)
Diffstat (limited to 'src/gui_gtk.c')
-rw-r--r--src/gui_gtk.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index 48910b287..c172fa49d 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -1011,17 +1011,29 @@ gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)
int
gui_mch_get_scrollbar_xpadding(void)
{
- // TODO: Calculate the padding for adjust scrollbar position when the
- // Window is maximized.
- return 0;
+ int xpad;
+#if GTK_CHECK_VERSION(3,0,0)
+ xpad = gtk_widget_get_allocated_width(gui.formwin)
+ - gtk_widget_get_allocated_width(gui.drawarea) - gui.scrollbar_width;
+#else
+ xpad = gui.formwin->allocation.width - gui.drawarea->allocation.width
+ - gui.scrollbar_width;
+#endif
+ return (xpad < 0) ? 0 : xpad;
}
int
gui_mch_get_scrollbar_ypadding(void)
{
- // TODO: Calculate the padding for adjust scrollbar position when the
- // Window is maximized.
- return 0;
+ int ypad;
+#if GTK_CHECK_VERSION(3,0,0)
+ ypad = gtk_widget_get_allocated_height(gui.formwin)
+ - gtk_widget_get_allocated_height(gui.drawarea) - gui.scrollbar_height;
+#else
+ ypad = gui.formwin->allocation.height - gui.drawarea->allocation.height
+ - gui.scrollbar_height;
+#endif
+ return (ypad < 0) ? 0 : ypad;
}
/*