Ensure we know for sure if scrollbar widget will want to scroll us. Avoid double xy to offset conversion.
This commit is contained in:
parent
7a0b347563
commit
d252896953
|
@ -264,8 +264,11 @@ static bool textarea_scroll_visible(struct textarea *ta)
|
||||||
/* If scrolled, set new pos. */
|
/* If scrolled, set new pos. */
|
||||||
if (xs != ta->scroll_x && ta->bar_x != NULL) {
|
if (xs != ta->scroll_x && ta->bar_x != NULL) {
|
||||||
scrollbar_set(ta->bar_x, xs, false);
|
scrollbar_set(ta->bar_x, xs, false);
|
||||||
ta->scroll_x = scrollbar_get_offset(ta->bar_x);
|
xs = scrollbar_get_offset(ta->bar_x);
|
||||||
scrolled = true;
|
if (xs != ta->scroll_x) {
|
||||||
|
ta->scroll_x = xs;
|
||||||
|
scrolled = true;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (ta->flags & TEXTAREA_MULTILINE && ta->bar_x == NULL &&
|
} else if (ta->flags & TEXTAREA_MULTILINE && ta->bar_x == NULL &&
|
||||||
ta->scroll_x != 0) {
|
ta->scroll_x != 0) {
|
||||||
|
@ -291,8 +294,11 @@ static bool textarea_scroll_visible(struct textarea *ta)
|
||||||
/* If scrolled, set new pos. */
|
/* If scrolled, set new pos. */
|
||||||
if (ys != ta->scroll_y && ta->bar_y != NULL) {
|
if (ys != ta->scroll_y && ta->bar_y != NULL) {
|
||||||
scrollbar_set(ta->bar_y, ys, false);
|
scrollbar_set(ta->bar_y, ys, false);
|
||||||
ta->scroll_y = scrollbar_get_offset(ta->bar_y);
|
ys = scrollbar_get_offset(ta->bar_y);
|
||||||
scrolled = true;
|
if (ys != ta->scroll_y) {
|
||||||
|
ta->scroll_y = ys;
|
||||||
|
scrolled = true;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (ta->bar_y == NULL && ta->scroll_y != 0) {
|
} else if (ta->bar_y == NULL && ta->scroll_y != 0) {
|
||||||
ta->scroll_y = 0;
|
ta->scroll_y = 0;
|
||||||
|
@ -1673,10 +1679,10 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse,
|
||||||
/* mouse button pressed above the text area, move caret */
|
/* mouse button pressed above the text area, move caret */
|
||||||
if (mouse & BROWSER_MOUSE_PRESS_1) {
|
if (mouse & BROWSER_MOUSE_PRESS_1) {
|
||||||
if (!(ta->flags & TEXTAREA_READONLY)) {
|
if (!(ta->flags & TEXTAREA_READONLY)) {
|
||||||
textarea_set_caret_xy(ta, x, y);
|
|
||||||
|
|
||||||
textarea_get_xy_offset(ta, x, y, &b_off, &c_off);
|
textarea_get_xy_offset(ta, x, y, &b_off, &c_off);
|
||||||
ta->drag_start_char = c_off;
|
ta->drag_start_char = c_off;
|
||||||
|
|
||||||
|
textarea_set_caret(ta, c_off);
|
||||||
}
|
}
|
||||||
if (ta->sel_start != -1) {
|
if (ta->sel_start != -1) {
|
||||||
/* remove selection */
|
/* remove selection */
|
||||||
|
|
Loading…
Reference in New Issue