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

Setting Window Position / Location when launching #53

Open
itsyoshio opened this issue Jul 14, 2023 · 13 comments
Open

Setting Window Position / Location when launching #53

itsyoshio opened this issue Jul 14, 2023 · 13 comments

Comments

@itsyoshio
Copy link

How can i set the location, where the GUI will spawn (on any or a specific OS)?
At best i'd like to Center it on the Screen.

On my Mac the Gui always spawns in the botton left corner (what i assume to be 0,0), however it's also moved down by half its height.

image

Thanks

@AndyObtiva
Copy link
Owner

In case you noticed in the commit I tied to this Issue on Jul 14 ("Add window position methods and position changed event"), this is an upcoming feature that is coming to LibUI soon. Once it is released, I will be able to include it in Glimmer DSL for LibUI.

@nexxus-vi
Copy link

Hi @AndyObtiva, is this feature live for Glimmer DSL for LibUI?

@AndyObtiva
Copy link
Owner

I just saw this email. Sorry, I had a crazy few weeks as I was moving.

I am not home right now, but I will look into this on my laptop as soon as I get home just to be sure.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Nov 14, 2024

Sorry about the delay. I was prepping for my trip to Chicago all of last week to give a 2-hour workshop at RubyConf 2024 tomorrow on How To Build Basic Desktop Applications in Ruby.

The answer to your question is yes and no.

There is a newer version of the libui binding that supports setting the window position, but it is still in pre mode. Unfortunately, when I tested it, it had a bug caused by the underlying libui-ng C library, which still hasn't been fixed: libui-ng/libui-ng#252

The current final version of the libui binding (0.1.2), which is included in glimmer-dsl-libui, does not support setting the window position.

So, we need to wait some more before we get window positioning support as the C libui-ng bug mentioned above has to be fixed first.

I am sorry again about the delay. For whatever reason, the C libui-ng project slowed down in its maintenance significantly. I hope it would pick up pace again eventually.

In the meantime, my recommendation will be to check out other Glimmer alternatives, like the new Glimmer DSL for WX (wxWidgets): https://github.com/AndyObtiva/glimmer-dsl-wx. The library is still very new and incomplete, but it supports cross-platform native GUI, so once all Glimmer features are added (like component support, scaffolding, and data-binding) it should become the future of native GUI development in MRI Ruby (CRuby) given that wxWidgets is a very mature GUI toolkit and is 100% feature complete (as opposed to LibUI, which is an incomplete alpha). Glimmer DSL for LibUI will continue to get maintained, but there are no guarantees as to when more features are added to its underlying C libui-ng library.

@petabyt
Copy link

petabyt commented Nov 14, 2024

If you're interested, I have an experimental fork where I've merged PR 261 and added some other features/tweaks:
https://github.com/petabyt/libui-dev

@kojix2
Copy link
Contributor

kojix2 commented Nov 23, 2024

@petabyt
Thank you for your comment. I will consider releasing a pre-version gem (Ruby package) that contains the shared library downloaded from the libui-dev release page.

@petabyt
Copy link

petabyt commented Nov 23, 2024

The one from the release page is old, it needs to be updated. Would x86_64 Mac/Linux/win be fine? I could probably also do arm64 Linux.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Nov 23, 2024

I just noticed I added the wrong link for Glimmer DSL for wxWidgets in my last comment. Here is the right one: https://github.com/AndyObtiva/glimmer-dsl-wx

@petabyt We currently have support for Mac x86_64 & Mac ARM64, Linux x86_64, and Windows x86_64 (we had WIndows x86_32 in the past too I believe, but I don't think it's maintained anymore, and it is not required anymore anyways). There was some effort on supporting Linux ARM64 (e.g. Raspberry Pi) in the Ruby libui binding, but it hasn't been finished yet as far as I know: kojix2/LibUI#47

@petabyt
Copy link

petabyt commented Nov 28, 2024

@kojix2 Added a new release: https://github.com/petabyt/libui-dev/releases/tag/5-beta

@kojix2
Copy link
Contributor

kojix2 commented Dec 2, 2024

Thank you.
I will add libui-dev to the Rakefile and release a pre gem packing libui-dev.

@kojix2
Copy link
Contributor

kojix2 commented Dec 5, 2024

@petabyt
I Added a task to the Ruby LibUI Rakefile (which is a helper script similar to Makefile) to download the libui-dev shared libraries.

If there is a shared library for Windows, that would be even better.

https://github.com/petabyt/libui-dev/blob/d48d00cbf00f41b030480d45aea752d8572662ff/.github/workflows/build.yml#L59

https://github.com/kojix2/libui-ng/blob/f0d51c1fa8997de833cb70ec53186cce711dfa42/.github/workflows/pre-build.yml#L56

In the Northern Hemisphere, the days are colder, and sunsets come earlier. Wishing everyone warmth and wellness.

@petabyt
Copy link

petabyt commented Dec 5, 2024

Would some kind of nightly release be better? Or is there a better way of publishing builds?

@kojix2
Copy link
Contributor

kojix2 commented Dec 6, 2024

image

Artifacts uploaded by GitHub Actions will be available for download via nightly.link.
So you don't have to worry about nightly builds.
Just maintain your CI and we'll be happy.

https://github.com/oprypin/nightly.link

I learned this approach using the “nightly.link” service from cody, the developer of libui-ng.

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

No branches or pull requests

5 participants