Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Add Wayland support for Window.GetHandle

Open unawarez opened this issue 8 months ago • 2 comments

Fixes #1217

This PR adds support for getting a wl_surface from Window.GetHandle when running on GTK+Wayland. This patch was originally more complicated by trying to support all the GTK windowing backends. Now, any GTK backend besides X11 or Wayland will return 0. This is less confusing than trying to figure out and match the return type of C++ GetHandle on Windows/Mac/etc in the unlikely case someone uses the GTK port on those platforms. This maintains backwards compatibility because up to now, GetHandle failed and returned 0 on any non-X11 GTK backend.

I tested on Wayland and X11 on current Arch with Python 3.12. Both work (at least, return a nonzero number) as long as you call frame.Show() before calling frame.GetHandle(). Also confirmed ARM Mac without GTK hasn't broken. I was not able to test Windows.

Suggestions welcome!

unawarez avatar Jun 13 '24 04:06 unawarez