Commit 967e6a05 authored by Albert Gräf's avatar Albert Gräf
Browse files

Merge branch 'synchronous-getscroll-before-activating' into release_2.15.0

parents 727088f2 b06ca0de
......@@ -6802,6 +6802,21 @@ function gui_canvas_get_overriding_scroll(cid) {
exports.gui_canvas_get_overriding_scroll = gui_canvas_get_overriding_scroll;
/* ico@vt.edu 20200920: this last variant that executes immediately
is needed for g_text.c when one displaces a text object and it
immediately activates and it falls outside the visible canvas bounds
this can trigger the object to have its activated box at an incorrect
location due to asynchronous behavior of other getscroll calls. Having
it here as a separate call as it may prove useful later in other contexts.
*/
function gui_canvas_get_immediate_scroll(cid) {
//post("gui_canvas_get_immediate_scroll");
do_getscroll(cid, 0);
}
exports.gui_canvas_get_immediate_scroll = gui_canvas_get_immediate_scroll;
function do_optimalzoom(cid, hflag, vflag) {
// determine an optimal zoom level that makes the entire patch fit within
// the window
......
......@@ -1474,6 +1474,17 @@ void scrollbar_update(t_glist *glist)
canvas_getscroll(canvas);
}
/* ico@vt.edu 20200920: introduced for situation where getscroll
needs to occur before the next command, e.g. automate. */
void scrollbar_synchronous_update(t_glist *glist)
{
// glist_getcanvas is probably not needed but not before we make
// sure that there are unneded calls of this kind being made by
// non-toplevel objects...
gui_vmess("gui_canvas_get_immediate_scroll",
"x", glist_getcanvas(glist));
}
void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl)
{
wb->w_getrectfn = gr;
......
......@@ -290,6 +290,7 @@ EXTERN const char *iemgui_typeface(t_iemgui *x);
EXTERN void iemgui_class_addmethods(t_class *c);
EXTERN void scrollbar_update(t_glist *glist);
EXTERN void scrollbar_synchronous_update(t_glist *glist);
EXTERN void iemgui_init(t_iemgui *x, t_floatarg f);
EXTERN void iemgui_out_bang(t_iemgui *x, int o, int chk_putin);
......
......@@ -5216,12 +5216,12 @@ void canvas_mouseup(t_canvas *x,
{
/* after motion or resizing, if there's only one text item
selected, activate the text */
scrollbar_synchronous_update(x);
if (x->gl_editor->e_selection &&
!(x->gl_editor->e_selection->sel_next))
{
gobj_activate(x->gl_editor->e_selection->sel_what, x, 1);
}
scrollbar_update(x);
}
else if (x->gl_editor->e_onmotion == MA_SCROLL)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment