changeset 24337:1abd0fc18bcd v8.2.2709

patch 8.2.2709: the GTK GUI has a gap next to the scrollbar Commit: https://github.com/vim/vim/commit/26af8e54ff0d423b7258ef84d175c8570740629a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 4 15:57:12 2021 +0200 patch 8.2.2709: the GTK GUI has a gap next to the scrollbar Problem: The GTK GUI has a gap next to the scrollbar. Solution: Calculate the scrollbar padding for GTK. (closes https://github.com/vim/vim/issues/8027)
author Bram Moolenaar <Bram@vim.org>
date Sun, 04 Apr 2021 16:00:03 +0200
parents c910dbe56313
children 79fa98c31b45
files src/gui_gtk.c src/version.c
diffstat 2 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -1011,17 +1011,29 @@ gui_mch_set_scrollbar_pos(scrollbar_T *s
     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;
 }
 
 /*
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2709,
+/**/
     2708,
 /**/
     2707,