Skip to content
  • Abdo Roig-Maranges's avatar
    adapt view_adjustment callbacks to new document/view separation · 36346362
    Abdo Roig-Maranges authored
    The adjustment callbacks act as an interface between position data in
    the document object, and the adjustments.
    
    We remove the horizontal centering code, as now it is done by
    position_set. Those callbacks should not change the position read from
    the document object in any way.
    
    Also, we split the adjustment_value_changed callback into a vertical and
    an horizontal version. Previously a single callback was reused for both,
    horizontal and vertical. That lead to a subtle problem when coming out
    of index mode. What happened was the following:
    
      1. horizontal adjustment bounds change coming out of index mode. This
         triggers an hadjustment changed signal.
    
      2. the hadjustment_changed callback handles it, and resets the
         hadjustment value, as the bound may have changed. This triggers a
         value_changed event.
    
      3. the value_changed callback handles the event, and captures the
         position for *BOTH*, horizontal and vertical adjustments, saving
         them to the document object.
    
      1..3 is repeated for the vertical adjustment.
    
      Now, if in 3. the horizontal adjustment bounds were not yet updated
      after the index mode, we got ourselves at the wrong vertical position.
    
    This race condition is avoided now because both value_changed callbacks
    *ONLY* handle their own direction, either vertical or horizontal, not
     both.
    36346362