Check for wx < 3.2.2 for EGL move fix backport

When executing the EGL subsurface move backport fix, check for loaded
library version < 3.2.2 so as not to execute an unnecessary EGL
subsurface move operation on versions which will already have the fix.

References #1028

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2023-02-01 04:58:56 +00:00
parent 1fb18b320f
commit be1e5ca18c
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 12 additions and 3 deletions

View File

@ -12,6 +12,7 @@ bool IsWayland() { return GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default()); }
#ifdef WAYLAND_MOVE_SUBSURFACE_BACKPORT
#include <wayland-egl.h>
#include <wx/glcanvas.h>
#include <wx/utils.h>
wl_subsurface* wxGLCanvasEGL::* private_ptr;
@ -29,8 +30,16 @@ void MoveWaylandSubsurface(wxGLCanvasEGL* win)
{
if (!IsWayland()) return;
int x, y;
gdk_window_get_origin(win->GTKGetDrawingWindow(), &x, &y);
wl_subsurface_set_position(win->*private_ptr, x, y);
// Check for 3.2.2 at runtime as well, because an app may have been
// compiled against 3.2.0 or 3.2.1 but running with 3.2.2 after a distro
// upgrade.
auto&& wxver = wxGetLibraryVersionInfo();
int&& major = wxver.GetMajor(), minor = wxver.GetMinor(), micro = wxver.GetMicro();
if (!(major > 3 || (major == 3 && (minor > 2 || (minor == 2 && micro >= 2))))) {
int x, y;
gdk_window_get_origin(win->GTKGetDrawingWindow(), &x, &y);
wl_subsurface_set_position(win->*private_ptr, x, y);
}
}
#endif