]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong v8.2.4320
authorqsmodo <75080827+qsmodo@users.noreply.github.com>
Mon, 7 Feb 2022 15:57:50 +0000 (15:57 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Feb 2022 15:57:50 +0000 (15:57 +0000)
Problem:    Athena and Motif: when maximized scrollbar position is wrong.
Solution:   Implement the scrollbar padding functions. (closes #9712)

src/gui_athena.c
src/gui_motif.c
src/version.c

index db13bd34f7a56a3a5990e91fb7da4b78f0af9115..6cbabf81d2e65a5ce75310822e78800afdbca679 100644 (file)
@@ -1894,17 +1894,27 @@ gui_mch_set_scrollbar_pos(
     int
 gui_mch_get_scrollbar_xpadding(void)
 {
-    // TODO: Calculate the padding for adjust scrollbar position when the
-    // Window is maximized.
-    return 0;
+    int xpad;
+    Dimension tw, ww;
+    Position  tx;
+
+    XtVaGetValues(textArea, XtNwidth, &tw, XtNx, &tx, NULL);
+    XtVaGetValues(vimShell, XtNwidth, &ww, NULL);
+    xpad = ww - tw - tx - gui.scrollbar_width;
+    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;
+    Dimension th, wh;
+    Position  ty;
+
+    XtVaGetValues(textArea, XtNheight, &th, XtNy, &ty, NULL);
+    XtVaGetValues(vimShell, XtNheight, &wh, NULL);
+    ypad = wh - th - ty - gui.scrollbar_height;
+    return (ypad < 0) ? 0 : ypad;
 }
 
     void
index 8328045babea908d6fb750f7ececde9f095b4459..ef3747d8d2c4a587cbcfb8004c142b983ea3ba5d 100644 (file)
@@ -1745,17 +1745,27 @@ gui_mch_set_scrollbar_pos(
     int
 gui_mch_get_scrollbar_xpadding(void)
 {
-    // TODO: Calculate the padding for adjust scrollbar position when the
-    // Window is maximized.
-    return 0;
+    int xpad;
+    Dimension tw, ww;
+    Position  tx;
+
+    XtVaGetValues(textArea, XtNwidth, &tw, XtNx, &tx, NULL);
+    XtVaGetValues(vimShell, XtNwidth, &ww, NULL);
+    xpad = ww - tw - tx - gui.scrollbar_width;
+    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;
+    Dimension th, wh;
+    Position  ty;
+
+    XtVaGetValues(textArea, XtNheight, &th, XtNy, &ty, NULL);
+    XtVaGetValues(vimShell, XtNheight, &wh, NULL);
+    ypad = wh - th - ty - gui.scrollbar_height;
+    return (ypad < 0) ? 0 : ypad;
 }
 
     void
index 3535adbeefcae607d943de66f0b72de1292c018a..4fdeb2fdeb29e5061061e1eaad37f4a197d65f26 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4320,
 /**/
     4319,
 /**/