fltk / fltk

FLTK - Fast Light Tool Kit - https://github.com/fltk/fltk - cross platform GUI development
https://www.fltk.org
Other
1.64k stars 265 forks source link

[FEATURE] Wayland layer shell protocol support #593

Closed ngortheone closed 1 year ago

ngortheone commented 1 year ago

Is it possible to use wayland's layer shell with fltk? Layer Shell is wlroots protocol that allows an application to occupy an exclusive area on the screen (overlay, anchored to screen anchors etc.). This is highly useful for building shell components like bars, panels, login screens, etc.

Protocol description https://wayland.app/protocols/wlr-layer-shell-unstable-v1 https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/protocol/wlr-layer-shell-unstable-v1.xml

Demo of the protocol by Drew DeVault: https://www.youtube.com/watch?v=VuRXHJu5Kmg

Similar GTK project, that adds layer shell to gtk3 https://github.com/wmww/gtk-layer-shell

An example panel project that uses gtk-layer-shell https://github.com/Alexays/Waybar

Theoretically this shouldn't be very difficult. An existing xdg-tooplevel window surface is upgraded to the new role - layer shell. But I don't know fltk well enough if this is easily doable.

Thanks

ManoloFLTK commented 1 year ago

I don't think this request fits with FLTK's general aims because FLTK features must be expressible in Unix, Linux, Windows and macOS. Moreover, I read that the layer shell is not supported by the Mutter Wayland compositor. This feature appears therefore too specialized for FLTK.

ngortheone commented 1 year ago

@ManoloFLTK is it possible for fltk programmer to get a raw window handle (wayland surface in case of wayland driver) and to the wayland server instance/socket?

This could enable programmers to use layer-shell protocol without explicit support in fltk. Programmers could write their own code to change the role of the surface.

similar discussion: https://github.com/slint-ui/slint/discussions/1765

MoAlyousef commented 1 year ago

On wayland, FLTL exposes fl_wl_surface() and fl_wl_display(), maybe these can be used for layer shell support in user code?

ManoloFLTK commented 1 year ago

As @MoAlyousef writes, FLTK gives public access to a few internal objects of its Wayland platform. Please, read here for a list of all functions with that purpose.

Function fl_wl_surface() gives access to the surface of a window FLTK has previously created. I suspect it might be too late to change its role. That's where function fl_wl_compositor() might be handy to construct a fresh wl_surface with struct wl_surface *my_wl_surface = wl_compositor_create_surface(fl_wl_compositor(());