… | |
… | |
61 | |
61 | |
62 | void |
62 | void |
63 | rxvt_term::resize_scrollbar () |
63 | rxvt_term::resize_scrollbar () |
64 | { |
64 | { |
65 | int delayed_init = 0; |
65 | int delayed_init = 0; |
|
|
66 | int window_sb_x = 0; |
|
|
67 | |
|
|
68 | if (option (Opt_scrollBar_right)) |
|
|
69 | window_sb_x = szHint.width - scrollBar.total_width (); |
66 | |
70 | |
67 | #define R_SCROLLBEG_XTERM 0 |
71 | #define R_SCROLLBEG_XTERM 0 |
68 | #define R_SCROLLEND_XTERM szHint.height |
72 | #define R_SCROLLEND_XTERM szHint.height |
69 | #define R_SCROLLBEG_NEXT 0 |
73 | #define R_SCROLLBEG_NEXT 0 |
70 | #define R_SCROLLEND_NEXT szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \ |
74 | #define R_SCROLLEND_NEXT szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \ |
… | |
… | |
125 | | Button3MotionMask); |
129 | | Button3MotionMask); |
126 | scrollbar_ev.start (display, scrollBar.win); |
130 | scrollbar_ev.start (display, scrollBar.win); |
127 | |
131 | |
128 | delayed_init = 1; |
132 | delayed_init = 1; |
129 | } |
133 | } |
|
|
134 | else |
|
|
135 | XMoveResizeWindow (dpy, scrollBar.win, |
|
|
136 | window_sb_x, 0, |
|
|
137 | scrollBar.total_width (), szHint.height); |
130 | |
138 | |
131 | scrollbar_show (1); |
139 | scrollbar_show (1); |
132 | |
140 | |
133 | if (delayed_init) |
141 | if (delayed_init) |
134 | XMapWindow (dpy, scrollBar.win); |
142 | XMapWindow (dpy, scrollBar.win); |
… | |
… | |
139 | */ |
147 | */ |
140 | int |
148 | int |
141 | rxvt_term::scrollbar_show (int update) |
149 | rxvt_term::scrollbar_show (int update) |
142 | { |
150 | { |
143 | int ret = 0; |
151 | int ret = 0; |
144 | int top, bot, len, adj; |
|
|
145 | |
152 | |
146 | if (!scrollBar.state) |
153 | if (!scrollBar.state) |
147 | return 0; |
154 | return 0; |
148 | |
155 | |
149 | if (update) |
156 | if (update) |
150 | { |
157 | { |
151 | top = view_start - top_row; |
158 | int top = view_start - top_row; |
152 | bot = top + (nrow - 1); |
159 | int bot = top + (nrow - 1); |
153 | len = max (nrow - 1 - top_row, 1); |
160 | int len = max (nrow - 1 - top_row, 1); |
154 | adj = (((bot - top) * scrollbar_size ()) % len) > 0 ? 1 : 0; |
161 | int size = (bot - top) * scrollBar.size (); |
155 | |
162 | |
156 | scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); |
163 | scrollBar.top = (scrollBar.beg + (top * scrollBar.size ()) / len); |
157 | scrollBar.len = ((bot - top) * scrollbar_size ()) / len + |
164 | scrollBar.len = size / len + scrollBar.min_height () + (size % len > 0); |
158 | scrollbar_minheight () + adj; |
|
|
159 | scrollBar.bot = (scrollBar.top + scrollBar.len); |
165 | scrollBar.bot = (scrollBar.top + scrollBar.len); |
160 | /* no change */ |
166 | /* no change */ |
161 | if (scrollBar.top == scrollBar.last_top |
167 | if (scrollBar.top == scrollBar.last_top |
162 | && scrollBar.bot == scrollBar.last_bot |
168 | && scrollBar.bot == scrollBar.last_bot |
163 | && (scrollBar.state == scrollBar.last_state |
169 | && (scrollBar.state == scrollBar.last_state |