mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 19:10:09 +01:00
support Wayland GTK backend in Window.GetHandle
This adds support for getting a Wayland `wl_surface` from `Window.GetHandle`. The behavior of the function is now to return either an X11 window ID or Wayland `wl_surface` if running a GTK build on those backends, return 0 on any other GTK backend, or else return the C++ `GetHandle` result unmodified. This is the simplest fix for the Wayland issue without worrying about breaking existing user code, as this function already failed for any non-X11 GTK build. Returning 0 on non-X11/Wayland GTK platforms sidesteps the issue of making sure e.g. GTK Mac GetHandle returns the same type as native Cocoa Mac GetHandle.
This commit is contained in:
@@ -136,6 +136,16 @@ def run():
|
||||
m1.find('externalLeading').out = True
|
||||
|
||||
c.find('GetHandle').type = 'wxUIntPtr*'
|
||||
c.find('GetHandle').detailedDoc = [
|
||||
"""The returned value differs from the C++ version of GetHandle when \
|
||||
running on the GTK port. When running on Wayland with GTK, this \
|
||||
function returns a `wl_surface` pointer for the native OS window \
|
||||
containing the widget. On X11 with GTK, this returns the X window \
|
||||
ID for the containing window. On any other backend with GTK, this \
|
||||
function returns 0.\n\n"""
|
||||
|
||||
"""On some platforms this may return 0 if the window has not yet been shown."""
|
||||
]
|
||||
c.find('GetHandle').setCppCode("return new wxUIntPtr(wxPyGetWinHandle(self));")
|
||||
|
||||
c.addCppMethod('void*', 'GetGtkWidget', '()', """\
|
||||
|
||||
Reference in New Issue
Block a user