Skip to content

Fixed positioning #306

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

Open
kusti8 opened this issue Mar 22, 2018 · 12 comments · May be fixed by #332
Open

Fixed positioning #306

kusti8 opened this issue Mar 22, 2018 · 12 comments · May be fixed by #332
Milestone

Comments

@kusti8
Copy link

kusti8 commented Mar 22, 2018

Hi,

For proton-native, I want to incorporate Yoga Layout, which I can do on the JS side without adding extra dependencies here, but I would need a way to fixed position place widgets using x and y coordinates. I've been playing around with GTK, and I got it working here: https://github.com/kusti8/libui, but I don't know how to do that for Windows or for Mac. This would be more of a substitute for Grid and make it a lot easier to use and more stable.

Thanks,
Gustav

@andlabs
Copy link
Owner

andlabs commented Mar 22, 2018

Interesting that you did it with GTK+, as that's the one toolkit that already provides grids (and the uiGrid API is based on GtkGrid)... I'll look through all this (including yoga itself) later.

@cody271
Copy link
Contributor

cody271 commented Mar 23, 2018

@kusti8,

Your uiFixed container control looks good to me, but examples/layout-test/main.c is missing in that commit. (Also your uiFixedSignature isn't valid ASCII, maybe use something like 0x46697864, which is "Fixd".)

A while back, I actually looked into adding support for Yoga into libui as well. Though I gave up on it because the Yoga native C API is not documented at all. Only supporting Yoga from within JS would be fine I guess. Let me know if I can help on this.

@andlabs
Copy link
Owner

andlabs commented Mar 23, 2018

I've historically had problems with GtkFixed and background drawing under certain themes. In this case I'd just use a custom GtkContainer subclass to do all the work. I can write that myself, should I decide to have uiCustomContainer at all...

@kusti8
Copy link
Author

kusti8 commented Mar 23, 2018 via email

@cody271
Copy link
Contributor

cody271 commented Mar 23, 2018

@andlabs GtkFixed is pretty straightforward. What would we actually do differently here?

@kusti8 Yoga would definitely be optional. My recommendation is to focus on getting Yoga from JS to work with your uiFixed and libui-node on just GTK+. Don't worry about the Mac and Windows implementations yet, we can flush out uiFixed once this all works and is useful.

@kusti8
Copy link
Author

kusti8 commented Mar 23, 2018

Yeah good idea. @parro-it any thoughts ? What do you think about integrating it into libui-node vs into proton-native?

@andlabs
Copy link
Owner

andlabs commented Mar 23, 2018

is now considering calling libui's next build system "cake"

@cody271 you will have to go back into the really early git history of package ui itself for the answers. I think I also have a Stack Overflow question on the issue as well.

Will respond to the rest later.

@parro-it
Copy link
Contributor

Yeah good idea. @parro-it any thoughts ? What do you think about integrating it into libui-node vs into proton-native?

I don't know yoga, I have to look at how it works... I saw there are some related packages on npm, maybe we can use them...

@parro-it
Copy link
Contributor

Regarding where to put them, if there is a compilation phase required to use Yoga, I think libui-node could be a better choice, because otherwise we will have to prepare proton prebuilt binaries too.

@parro-it
Copy link
Contributor

I saw yoga already have official bindings fir js, and they use nbind as libui-node does.

So, I think we can either use it as is on proton side, or include theirs cpp sources in libui-node and produce a single library.

@kusti8
Copy link
Author

kusti8 commented Mar 23, 2018

It would be nice to have a single library, but I think we need to do it in JS on the proton side. It's going to get hard to integrate libui's current layout and yoga layout. On the proton-native I can just make the entire thing fixed and only rely on Fixed.

We would need to expose the minimum size functions for every component because yoga needs to know the dimensions of every component.

@kusti8
Copy link
Author

kusti8 commented Apr 3, 2018

I've made a PR #332 with all of my changes, for Linux, Windows and Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants