]> granicus.if.org Git - vim/commitdiff
patch 8.2.2709: the GTK GUI has a gap next to the scrollbar v8.2.2709
authorBram Moolenaar <Bram@vim.org>
Sun, 4 Apr 2021 13:57:12 +0000 (15:57 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 4 Apr 2021 13:57:12 +0000 (15:57 +0200)
Problem:    The GTK GUI has a gap next to the scrollbar.
Solution:   Calculate the scrollbar padding for GTK. (closes #8027)

src/gui_gtk.c
src/version.c

index 48910b287391b8c1a7010eaf2c44b3d8e1121d78..c172fa49d0f4058f748204d5548a5154ec9c33fd 100644 (file)
@@ -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;
 }
 
 /*
index 2b0955c5a8feeb907a6bf82d2c9c84d683371987..8a95e67504fea127ea893267b56c434cd7a9a956 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2709,
 /**/
     2708,
 /**/