Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strengthen semantics of child node order #5

Open
io7m opened this issue Jul 11, 2016 · 2 comments
Open

Strengthen semantics of child node order #5

io7m opened this issue Jul 11, 2016 · 2 comments
Assignees

Comments

@io7m
Copy link
Member

io7m commented Jul 11, 2016

With PLACEMENT_TOP_OVERLAP_FRAME, any region of the frame underneath the titlebar will receive mouse events instead of the titlebar. This is in keeping with the component model, but is unfortunate!

@io7m
Copy link
Member Author

io7m commented Jul 11, 2016

It may be worth strengthening the semanics of component selection a bit more. At least, it'd mean that the fix to this is a single line change.

Essentially, what happens now is that when the cursor overlaps a component, each child of that component is checked in turn to see if the cursor overlaps any of them. The idea being that the most specific child components (ie. the leaves of the tree) should receive events first and then pass them back up the tree if they don't handle them. Right now, for a given component c, the algorithm checks each direct child of c, stopping at the first child that matches. The current window implementation attaches components to the root window in this order: frame, titlebar, contentPane. This means that if the frame overlaps something, the frame wins.

    WindowRoot(final String in_text)
    {
      this.setWindow(Optional.of(SyWindowAbstract.this));
      this.setSelectable(false);

      this.titlebar = new Titlebar(in_text);
      this.frame = new Frame();
      this.content_pane = new ContentPane();

      final JOTreeNodeType<SyComponentType> node = this.node();
      node.childAdd(this.frame.node());
      node.childAdd(this.titlebar.node());
      node.childAdd(this.content_pane.node());
    }

The "fix" (read: workaround that depends on undeclared semantics) is to add the titlebar first.

@io7m
Copy link
Member Author

io7m commented Jul 13, 2016

It feels like the most recently added component should take priority. It has nicer properties such as being able to make a component take priority by simply detaching and re-adding it. If the first component takes priority, then either an extra API needs to be added (via jorchard) to add a component as the first child of a tree node, or all components must be removed and re-added to change the priority.

Unfortunately, this means that the way jorchard presents child nodes needs to be updated...

io7m added a commit that referenced this issue Jul 13, 2016
... Until a better solution comes along.

Affects #5
@io7m io7m changed the title Frame can make titlebar unclickable Strengthen semantics of child node order Jul 20, 2016
@io7m io7m self-assigned this Jul 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant