Skip to content
  • Carlos Garnacho's avatar
    widget: Change GtkCapturePhase behavior in event controllers' handling · 505efbb3
    Carlos Garnacho authored
    Previously, there would be globally just a capture and a bubble phase,
    with the event just going down the hierarchy once, and the up once.
    GTK_PHASE_TARGET actually meaning "run within event handlers", so in
    a hierarchy of 3 widgets, emission would be:
    
      Capture(C)
      Capture(B)
      Capture(A)
      Target(A) (if event handlers allow)
      Bubble(A)
      Target(B) (if event handlers allow)
      Bubble(B)
      Target(C) (if event handlers allow)
      Bubble(C)
    
    This commit changes this behavior and uses GTK_PHASE_TARGET in a less
    misleading way, running only on the widget that was meant to receive
    the event. And GTK_PHASE_BUBBLE has taken over the execution place of
    GTK_PHASE_TARGET, so the emission remains:
    
      Capture(C)
      Capture(B)
      Capture(A)
      Target(A)
      Bubble(A) (if event handlers allow)
      Bubble(B) (...)
      Bubble(C) (...)
    
    As it was, GTK_PHASE_BUBBLE was useful for running event controllers
    paralelly to event handlers, without modifying a single line in those.
    For those mixed scenarios, Any of the other phases will have to be
    used at discretion, or the event handlers eventually changed to chain
    up and let the default event handlers in GtkWidget to be run.
    505efbb3