]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.1228: scrollbars not flush against the window edges when maximised v8.2.1228
authorBram Moolenaar <Bram@vim.org>
Fri, 17 Jul 2020 18:43:43 +0000 (20:43 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 17 Jul 2020 18:43:43 +0000 (20:43 +0200)
Problem:    Scrollbars not flush against the window edges when maximised.
Solution:   Add padding. (Ken Takata, closes #5602, closes #6466)

16 files changed:
src/gui.c
src/gui_athena.c
src/gui_gtk.c
src/gui_haiku.cc
src/gui_mac.c
src/gui_motif.c
src/gui_photon.c
src/gui_w32.c
src/proto/gui_athena.pro
src/proto/gui_gtk.pro
src/proto/gui_haiku.pro
src/proto/gui_mac.pro
src/proto/gui_motif.pro
src/proto/gui_photon.pro
src/proto/gui_w32.pro
src/version.c

index dc408bb88d8dc69c14091841d37d5e100fa725a8..4981d7331e4d55e2ed75d54da389b4309285edc7 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -1418,11 +1418,13 @@ gui_position_components(int total_width UNUSED)
     if (gui.which_scrollbars[SBAR_BOTTOM])
        gui_mch_set_scrollbar_pos(&gui.bottom_sbar,
                                  text_area_x,
-                                 text_area_y + text_area_height,
+                                 text_area_y + text_area_height
+                                       + gui_mch_get_scrollbar_ypadding(),
                                  text_area_width,
                                  gui.scrollbar_height);
     gui.left_sbar_x = 0;
-    gui.right_sbar_x = text_area_x + text_area_width;
+    gui.right_sbar_x = text_area_x + text_area_width
+                                       + gui_mch_get_scrollbar_xpadding();
 
     --hold_gui_events;
 }
index 6a64de5c112b02d4f57c5e6ef2204717d90dcd25..43847404a35a9909b1b39f8c3483dd6cd3bc3e3f 100644 (file)
@@ -1889,6 +1889,22 @@ gui_mch_set_scrollbar_pos(
     XtManageChild(sb->id);
 }
 
+    int
+gui_mch_get_scrollbar_xpadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
+    int
+gui_mch_get_scrollbar_ypadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
     void
 gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
 {
index fa63bf9101d8f13be259be780415d8bce4c330a1..aaebf305617544db75762349dd88ccd9a93cc6fd 100644 (file)
@@ -1008,6 +1008,22 @@ gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)
        gtk_form_move_resize(GTK_FORM(gui.formwin), sb->id, x, y, w, h);
 }
 
+    int
+gui_mch_get_scrollbar_xpadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
+    int
+gui_mch_get_scrollbar_ypadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
 /*
  * Take action upon scrollbar dragging.
  */
index 78ca7b27adf8a680a74724abc7703b0be70adecc..60926f9be2de2a6b54a7fb40e8d02062959a81ed 100644 (file)
@@ -3665,6 +3665,22 @@ 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
+gui_mch_get_scrollbar_ypadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
 void
 gui_mch_create_scrollbar(
        scrollbar_T *sb,
index 1ca2d56352c3f2738ee0f8c950692e48112cb7c2..b19061705efe507c2ff823603a7637407382f4dc 100644 (file)
@@ -4992,6 +4992,22 @@ gui_mch_set_scrollbar_pos(
 #endif
 }
 
+    int
+gui_mch_get_scrollbar_xpadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
+    int
+gui_mch_get_scrollbar_ypadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
     void
 gui_mch_create_scrollbar(
        scrollbar_T *sb,
index 90c5df98d61572bdf24a311e52a9cd5e6eab86bf..9d13b57b4e351cfe0b24753366f5beea23c754b9 100644 (file)
@@ -1743,6 +1743,22 @@ 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
+gui_mch_get_scrollbar_ypadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
     void
 gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
 {
index 1a7288b6d410c5c2c089d015e6dd109fa8be6008..cdb5e15faf28f9dbe392bbc38a2a02d3c182c86f 100644 (file)
@@ -1758,6 +1758,22 @@ gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)
     PtSetResource(sb->id, Pt_ARG_AREA, &area, 0);
 }
 
+    int
+gui_mch_get_scrollbar_xpadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
+    int
+gui_mch_get_scrollbar_ypadding(void)
+{
+    // TODO: Calculate the padding for adjust scrollbar position when the
+    // Window is maximized.
+    return 0;
+}
+
     void
 gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
 {
index c46cb47691da8fd89038cf1411b6cb7f26b8798f..30ce3eab038122a0831ed388b406cd346e21c795 100644 (file)
@@ -1412,6 +1412,34 @@ gui_mch_set_scrollbar_pos(
                              SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW);
 }
 
+    int
+gui_mch_get_scrollbar_xpadding(void)
+{
+    RECT    rcTxt, rcWnd;
+    int            xpad;
+
+    GetWindowRect(s_textArea, &rcTxt);
+    GetWindowRect(s_hwnd, &rcWnd);
+    xpad = rcWnd.right - rcTxt.right - gui.scrollbar_width
+       - GetSystemMetrics(SM_CXFRAME)
+       - GetSystemMetrics(SM_CXPADDEDBORDER);
+    return (xpad < 0) ? 0 : xpad;
+}
+
+    int
+gui_mch_get_scrollbar_ypadding(void)
+{
+    RECT    rcTxt, rcWnd;
+    int            ypad;
+
+    GetWindowRect(s_textArea, &rcTxt);
+    GetWindowRect(s_hwnd, &rcWnd);
+    ypad = rcWnd.bottom - rcTxt.bottom - gui.scrollbar_height
+       - GetSystemMetrics(SM_CYFRAME)
+       - GetSystemMetrics(SM_CXPADDEDBORDER);
+    return (ypad < 0) ? 0 : ypad;
+}
+
     void
 gui_mch_create_scrollbar(
     scrollbar_T *sb,
index a834dac4a32660ea6e018009db039b1055ba6f3a..e74128b9f5b5cf60747f6b2458f697ff11eacbfd 100644 (file)
@@ -21,6 +21,8 @@ void gui_mch_show_popupmenu(vimmenu_T *menu);
 void gui_mch_def_colors(void);
 void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max);
 void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h);
+int gui_mch_get_scrollbar_xpadding(void);
+int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 void gui_mch_destroy_scrollbar(scrollbar_T *sb);
index 319e27d79b47dad01f99d236c273c8809996c5c9..7b87ba00bdb79a896ec5a8d4ce676055fb081a51 100644 (file)
@@ -9,6 +9,8 @@ void gui_mch_menu_set_tip(vimmenu_T *menu);
 void gui_mch_destroy_menu(vimmenu_T *menu);
 void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max);
 void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h);
+int gui_mch_get_scrollbar_xpadding(void);
+int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 void gui_mch_destroy_scrollbar(scrollbar_T *sb);
 char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter);
index f392233311c0e76e75811c442a3e84d547424ef0..51ee93ad70ddb523d5d1e361173816b20663f802 100644 (file)
@@ -33,6 +33,8 @@ void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag);
 void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, int val, int size, int max);
 
 void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h);
+int gui_mch_get_scrollbar_xpadding(void);
+int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 void gui_mch_destroy_scrollbar(scrollbar_T *sb);
 
index a36ad903cf47af835c517275a1d1a14e827c292f..1fa34532b270159784c43652196245d213537b6b 100644 (file)
@@ -36,6 +36,8 @@ void gui_mch_set_text_area_pos(int x, int y, int w, int h);
 void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag);
 void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max);
 void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h);
+int gui_mch_get_scrollbar_xpadding(void);
+int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 void gui_mch_destroy_scrollbar(scrollbar_T *sb);
 int gui_mch_adjust_charheight(void);
index 493f5e78ced6fb53f03c36ef7c2326c7fa68f083..ccbdc0a29ee6b3fbc5f5669f73d3160b9208a71e 100644 (file)
@@ -23,6 +23,8 @@ void gui_mch_show_popupmenu(vimmenu_T *menu);
 void gui_mch_def_colors(void);
 void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max);
 void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h);
+int gui_mch_get_scrollbar_xpadding(void);
+int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 void gui_mch_destroy_scrollbar(scrollbar_T *sb);
index 9fcc51264e0f375d8bc9d427ca6aaa15a41a01bc..5fcc9ba8d8ea38a4d6111e2c90fb324e46fb2044 100644 (file)
@@ -18,6 +18,8 @@ void gui_mch_set_foreground(void);
 void gui_mch_settitle(char_u *title, char_u *icon);
 void gui_mch_set_scrollbar_thumb(scrollbar_T *sb, int val, int size, int max);
 void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h);
+int gui_mch_get_scrollbar_xpadding(void);
+int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag);
 void gui_mch_destroy_scrollbar(scrollbar_T *sb);
index 4ead92e74099624b15ecbaaacb183f6ecad7d429..68e45b31517d981cc1458c4fd5ada2fcb22a3b31 100644 (file)
@@ -14,6 +14,8 @@ void gui_mch_set_winpos(int x, int y);
 void gui_mch_set_text_area_pos(int x, int y, int w, int h);
 void gui_mch_enable_scrollbar(scrollbar_T *sb, int flag);
 void gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h);
+int gui_mch_get_scrollbar_xpadding(void);
+int gui_mch_get_scrollbar_ypadding(void);
 void gui_mch_create_scrollbar(scrollbar_T *sb, int orient);
 int gui_mch_adjust_charheight(void);
 GuiFont gui_mch_get_font(char_u *name, int giveErrorIfMissing);
index d585377a50bd8d8ba298d0c6241235fd7651660f..388cd16d2903ce88b1e585a383b223d3c17813d5 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1228,
 /**/
     1227,
 /**/