shoes / shoes3

a tiny graphical app kit for ruby
http://walkabout.mvmanila.com
Other
179 stars 19 forks source link

adding a check to see if we are running Gnome/gtk in Wayland #422

Closed tuttza closed 5 years ago

tuttza commented 5 years ago

I found that the hard coded offsets work when using Wayland in Fedora(I also assume this would also work for others that are using Gnome 3.24 with Wayland as well), but the offset doesn't work when using Gnome 3.24 but using x11. So I added an additional check to look at the $XDG_SESSION_TYPE environment variable this returns a string of x11 or wayland depending on what your desktop session is running. In most cases I assume this would return x11 since most Linux desktop environments use x11 anyways.

With this minor change the window doesn't get locked into the top left hand corner, and you can resize the window by double clicking the title bar. You can also move the window around with the title bar (and not the menu bar, though that still works too!)

ccoupe commented 5 years ago

This will likely change. Wayland maybe the best determinant for now, but I'd like to find or synthesis something less coarse. It should be something we can get of Gtk or the desktop. Windows 10 and Gtk 3.24 has this problem and it probably doesn't return 'wayland'.

tuttza commented 5 years ago

I completely agree, I figured this would get us going for now. I will dig through the GTK docs to find a more concrete way of handling this.

ccoupe commented 5 years ago

I've moved the checks into a call once function and a static var. You'll want to pull the changes. FWIW, my VM for Fedora says it's wayland so its possible Windows does too. I don't have a copy of Win 10 yet.