Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

yampa-gui: Nested Dynamic Windowing System Library #260

Closed
Cajunvoodoo opened this issue Apr 13, 2023 · 2 comments
Closed

yampa-gui: Nested Dynamic Windowing System Library #260

Cajunvoodoo opened this issue Apr 13, 2023 · 2 comments

Comments

@Cajunvoodoo
Copy link

Inspired by windowing systems like Xmonad and the GUIs of the Yampa arcade, a robust, extensible, and dynamic windowing system would be a great addition to Yampa's capabilities.

I came up with a rough plan of capabilities a window must have along with a number of hurdles.
Capabilities:

  1. A window responds to inputs and passes that to its children
  2. A window can be focused or unfocused to allow for routing input correctly
  3. Windows may be arbitrarily nested and have arbitrarily many children (that are also windows)
  4. A window may output events to the parent (like destruction and creation of self and siblings respectively) or for more complex behavior
  5. A window may have zero children (e.g. a button or a text box) and can hold data relevant to its function
  6. A window must have a Picture element (yampa-gloss) that describes its appearance

When I was thinking it over, windows reminded me of dpSwitch. The hurdle I came across was routing and the nested nature of windows; how do we nest dpSwitches (child windows) inside another dpSwitch (the parent window)?

Another conceptual challenge i came across was data relevant to specific children. Here's a contrived but salient example:

┌──────────────────────────────────────┐
│  ┌────────────────────────────────┐  │
│  │          Count: n              │  │
│  ├────────────────┬───────────────┤  │
│  │                │               │  │
│  │   I'm a blank  │               │  │
│  │     window!    │               │  │
│  ├────────────────┤               │  │
│  │                │               │  │
│  │ ┌────────────┐ │  ┌──────────┐ │  │
│  │ │┼──────────┼│ │  │          │ │  │
│  │ ││          ││ │  │ Bigger   │ │  │
│  │ ││Big Button││ │  │ Button   │ │  │
│  │ ││ Click to ││ │  │ Click to │ │  │
│  │ ││ Decrement││ │  │ Increment│ │  │
│  │ ├┴──────────┴┤ │  │          │ │  │
│  │ │            │ │  │          │ │  │
│  │ │ Also Empty │ │  └──────────┘ │  │
│  │ ├────────────┤ │               │  │
│  │ │  Empty! :3 │ │               │  │
│  │ └────────────┘ │               │  │
│  │                │               │  │
│  └────────────────┴───────────────┘  │
└──────────────────────────────────────┘

This window can be described by the following tree:

               parentWindow
                   |
                 window
               /   |   \
              /    |    \
       win_l  winCount   win_r
      /    |     |          |-> incrementButton -> onClick increment
     /     |   count
    |    blank
   botLeftTriWindow
  /     |          \
"also" "empty :3"   \
                     \
                    winButtonHolder
                       |
                      decrementButton -> onClick decrement

In this example, the count is shared by all of the children of window (and all of its children too). When clicking the buttons, the count would be incremented or decremented, despite being nested so deeply in a child window. But parentWindow may not care about the state window holds. And what if winCount counted some other value alongside count that neither win_l nor win_r needed to manage? What type would these windows have? How should the events of the children be routed in a clean and comprehensible (not to mention extensible and modifiable) manner?

Once these issues related to the structure of the core systems are ironed out, a minimal working implementation could be written and features could be added from there (which all sounds like a lot of fun!).

I think Yampa has the capability to create an excellent interactive GUI system. yampa-gloss provides a great base to build this library off of.

@ivanperez-keera
Copy link
Owner

ivanperez-keera commented Apr 17, 2023

It would be really cool to make this happen. Now, implementing a full GUI library is a big undertaking! There are some prior work that I think would be important to take into account. Some of it may offer insights of where pitfalls and opportunities may lie. Other may present tradeoffs:

@ivanperez-keera
Copy link
Owner

I'm turning this into a discussion for now. I think it's a better place to explore and propose ideas. Once we have a more concrete plan, we can create the issue or issues that will address the proposed change.

Repository owner locked and limited conversation to collaborators Apr 24, 2023
@ivanperez-keera ivanperez-keera converted this issue into discussion #264 Apr 24, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants