Skip to content
  • Sergio Gómez's avatar
    kiosk-shell: Redesign the function 'find_focus_successor()' · cc837eea
    Sergio Gómez authored and Marius Vlad's avatar Marius Vlad committed
    
    
    The function find_focus_successor() is called when destroying a surface to find
    a successor to the current focus. It, however, has the following issues:
    
    - Its first parameter is the weston layer from which to search for a successor.
      This is an unnecessary flexibility for our use, which only adds complexity to
      the user of the function by having to make a call for each layer. We know
      that we want to search for a successor first in the normal layer, and if that
      fails, then in the inactive layer. So we change the signature of
      find_focus_successor(), removing this first parameter.
    
    - It includes logic to decide whether to do the search or not: if the destroyed
      surface is different from the surface that currently has focus, and if their
      outputs are the same, then abort and don't do the search. This returns NULL to
      the calling function. The problem is that the function also returns NULL if
      it does the search and finds no successor. The distinction for the failing
      reason is lost, and the user of the function needs to add more logic to know
      the reason for failure. To simplify, we take the logic out of
      find_focus_successor() and inside the caller.
    
    - It returns the successor view, although it receives surfaces and the client
      has logic to retrieve the surface corresponding to the returned view. To
      simplify and maintain symmetry, we change the signature so that the function
      returns the surface corresponding to the successor view.
    
    Fixes: #738
    
    Signed-off-by: default avatarSergio Gómez <sergio.g.delreal@gmail.com>
    cc837eea
Loading