GTK scroll size in gvim

I managed to get the scrollbars to be slightly smaller than usual. However, I am unable to get the parent widget to scale to the correct size. The image below shows what I mean and shows the contents of my ~ / .gtkrc-2.0 ....

What am I missing?

gvim image

And here is the copied snippet ~ / .gtkrc-2.0:

style "neverness" {
    GtkScrollbar::activate-slider = 1
    GtkScrollbar::trough-border = 0
    GtkScrollbar::slider-width = 9
    GtkScrollbar::min-slider-length = 36
    GtkScrollbar::has-forward-stepper = 1
    GtkScrollbar::has-backward-stepper = 1
}

class "GtkScrollbar" style "neverness"
class "GtkHScrollbar" style "neverness"
class "GtkVScrollbar" style "neverness"

      

Vim version:

; vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Feb 21 2013 17:41:49)
Included patches: 1-831
Compiled by yann@nightwatch.neverness.org
Big version with GTK2 GUI.  Features included (+) or not (-):
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         -profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    
+farsi           +mouse_netterm   +syntax          
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/home/yann/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12   -I/usr/local/include  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim   -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl    -L/usr/lib64/python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic    

      

+3


source to share


1 answer


This is not caused by GTK +; it is called by vim.

See vim73 / src / gui.c: gui_init_check ():

gui.scrollbar_width = gui.scrollbar_height = SB_DEFAULT_WIDTH;

      

This meaning comes from gui.h:

#define SB_DEFAULT_WIDTH 16

      

Later, gui_position_components () does the following:

gui.right_sbar_x = text_area_x + text_area_width;

      

And gui_update_scrollbars () does it:



gui_mch_set_scrollbar_pos(&wp->w_scrollbars[SBAR_RIGHT],
                          gui.right_sbar_x, y,
                          gui.scrollbar_width, h);

      

which runs as

gtk_form_move_resize(GTK_FORM(gui.formwin), sb->id, x, y, w, h);

      

That GtkForm is a custom widget implemented in vim itself; see gui_gtk_f.c:

void
gtk_form_move_resize(GtkForm *form, GtkWidget *widget,
                     gint x, gint y, gint w, gint h)
{
    widget->requisition.width  = w;
    widget->requisition.height = h;

    gtk_form_move(form, widget, x, y);
}

      

Later, the code in gtk_form_position_child () just grabs the widget-> claim and uses it to allocate the children.

The GtkVScrollbar sees that it is allocated more horizontal space than it needs (i.e. SB_DEFAULT_WIDTH = 16) and centers on its distribution. This is the extra space you see around the scroll bar.

Vim doesn't have to customize the internals - widget widgets. Instead, it should store the values ​​it needs somewhere (perhaps in a GtkFormChild structure) and use them. Also, it should be able to use GTK + native size to get the desired scrollbar width.

+2


source







All Articles