To: vim_dev@googlegroups.com Subject: Patch 8.2.1228 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1228 Problem: Scrollbars not flush against the window edges when maximised. Solution: Add padding. (Ken Takata, closes #5602, closes #6466) Files: 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 *** ../vim-8.2.1227/src/gui.c 2020-06-01 14:07:44.265545890 +0200 --- src/gui.c 2020-07-17 20:41:03.316946330 +0200 *************** *** 1418,1428 **** 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_width, gui.scrollbar_height); gui.left_sbar_x = 0; ! gui.right_sbar_x = text_area_x + text_area_width; --hold_gui_events; } --- 1418,1430 ---- if (gui.which_scrollbars[SBAR_BOTTOM]) gui_mch_set_scrollbar_pos(&gui.bottom_sbar, text_area_x, ! 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_mch_get_scrollbar_xpadding(); --hold_gui_events; } *** ../vim-8.2.1227/src/gui_athena.c 2020-04-06 22:12:57.137652853 +0200 --- src/gui_athena.c 2020-07-17 20:41:03.320946321 +0200 *************** *** 1889,1894 **** --- 1889,1910 ---- 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) { *** ../vim-8.2.1227/src/gui_gtk.c 2020-04-06 22:12:57.137652853 +0200 --- src/gui_gtk.c 2020-07-17 20:41:03.320946321 +0200 *************** *** 1008,1013 **** --- 1008,1029 ---- 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. */ *** ../vim-8.2.1227/src/gui_haiku.cc 2020-05-03 22:57:26.973427368 +0200 --- src/gui_haiku.cc 2020-07-17 20:41:03.320946321 +0200 *************** *** 3665,3670 **** --- 3665,3686 ---- } } + 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, *** ../vim-8.2.1227/src/gui_mac.c 2020-05-30 21:52:49.238816739 +0200 --- src/gui_mac.c 2020-07-17 20:41:03.320946321 +0200 *************** *** 4992,4997 **** --- 4992,5013 ---- #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, *** ../vim-8.2.1227/src/gui_motif.c 2020-05-16 14:01:48.117547771 +0200 --- src/gui_motif.c 2020-07-17 20:41:03.320946321 +0200 *************** *** 1743,1748 **** --- 1743,1764 ---- } } + 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) { *** ../vim-8.2.1227/src/gui_photon.c 2020-01-26 21:59:25.624718145 +0100 --- src/gui_photon.c 2020-07-17 20:41:03.320946321 +0200 *************** *** 1758,1763 **** --- 1758,1779 ---- 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) { *** ../vim-8.2.1227/src/gui_w32.c 2020-07-16 22:30:27.874455428 +0200 --- src/gui_w32.c 2020-07-17 20:41:03.320946321 +0200 *************** *** 1412,1417 **** --- 1412,1445 ---- 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, *** ../vim-8.2.1227/src/proto/gui_athena.pro 2019-12-12 12:55:40.000000000 +0100 --- src/proto/gui_athena.pro 2020-07-17 20:41:03.320946321 +0200 *************** *** 21,26 **** --- 21,28 ---- 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); *** ../vim-8.2.1227/src/proto/gui_gtk.pro 2019-12-12 12:55:39.000000000 +0100 --- src/proto/gui_gtk.pro 2020-07-17 20:41:03.320946321 +0200 *************** *** 9,14 **** --- 9,16 ---- 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); *** ../vim-8.2.1227/src/proto/gui_haiku.pro 2020-04-23 15:41:21.867364624 +0200 --- src/proto/gui_haiku.pro 2020-07-17 20:41:03.320946321 +0200 *************** *** 33,38 **** --- 33,40 ---- 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); *** ../vim-8.2.1227/src/proto/gui_mac.pro 2019-06-14 21:31:34.000000000 +0200 --- src/proto/gui_mac.pro 2020-07-17 20:41:03.320946321 +0200 *************** *** 36,41 **** --- 36,43 ---- 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); *** ../vim-8.2.1227/src/proto/gui_motif.pro 2019-12-12 12:55:39.000000000 +0100 --- src/proto/gui_motif.pro 2020-07-17 20:41:03.320946321 +0200 *************** *** 23,28 **** --- 23,30 ---- 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); *** ../vim-8.2.1227/src/proto/gui_photon.pro 2019-12-12 12:55:41.000000000 +0100 --- src/proto/gui_photon.pro 2020-07-17 20:41:03.320946321 +0200 *************** *** 18,23 **** --- 18,25 ---- 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); *** ../vim-8.2.1227/src/proto/gui_w32.pro 2019-12-12 12:55:40.000000000 +0100 --- src/proto/gui_w32.pro 2020-07-17 20:41:03.320946321 +0200 *************** *** 14,19 **** --- 14,21 ---- 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); *** ../vim-8.2.1227/src/version.c 2020-07-17 20:35:00.857574357 +0200 --- src/version.c 2020-07-17 20:43:12.876671024 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1228, /**/ -- hundred-and-one symptoms of being an internet addict: 31. You code your homework in HTML and give your instructor the URL. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///