Fix build w/wxUSE_GLCANVAS_EGL=0, on Fedora
Disable the EGL subsurface move backport for Wayland GLCanvas if the wx config sets wxUSE_GLCANVAS_EGL=0 (off.) This fixes the build failure on Fedora. To fix the functionality, however, they need to enable the EGL GLCanvas in their wx builds. Also use a different hack to access the private wxGLCanvasEGL member using template instantiation instead of redefining a keyword as a macro. Refer #1028 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
3c41b68d51
commit
8e4acfc91d
|
@ -318,7 +318,6 @@ else()
|
||||||
set(WX_TEST_CONSOLE_APP "
|
set(WX_TEST_CONSOLE_APP "
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <wx/wxprec.h>
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -459,7 +458,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if(NOT DEFINED WX_HAS_OPENGL)
|
if(NOT DEFINED WX_HAS_OPENGL)
|
||||||
check_cxx_source_compiles("
|
check_cxx_source_compiles("
|
||||||
#include <wx/wxprec.h>
|
#include <wx/wx.h>
|
||||||
#include <wx/config.h>
|
#include <wx/config.h>
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,26 @@ bool IsWayland() { return GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default()); }
|
||||||
// Temporary hack to backport 800d6ed69b from wxWidgets until 3.2.2 is released.
|
// Temporary hack to backport 800d6ed69b from wxWidgets until 3.2.2 is released.
|
||||||
#ifdef WAYLAND_MOVE_SUBSURFACE_BACKPORT
|
#ifdef WAYLAND_MOVE_SUBSURFACE_BACKPORT
|
||||||
#include <wayland-egl.h>
|
#include <wayland-egl.h>
|
||||||
#define private public
|
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
#undef private
|
|
||||||
|
|
||||||
void MoveWaylandSubsurface(wxGLCanvas* win)
|
wl_subsurface* wxGLCanvasEGL::* private_ptr;
|
||||||
|
|
||||||
|
template <auto Ptr>
|
||||||
|
struct accessor {
|
||||||
|
static int force_init;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <auto Ptr>
|
||||||
|
int accessor<Ptr>::force_init = ((private_ptr = Ptr), 0);
|
||||||
|
|
||||||
|
template struct accessor<&wxGLCanvasEGL::m_wlSubsurface>;
|
||||||
|
|
||||||
|
void MoveWaylandSubsurface(wxGLCanvasEGL* win)
|
||||||
{
|
{
|
||||||
if (!IsWayland()) return;
|
if (!IsWayland()) return;
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
gdk_window_get_origin(win->GTKGetDrawingWindow(), &x, &y);
|
gdk_window_get_origin(win->GTKGetDrawingWindow(), &x, &y);
|
||||||
wl_subsurface_set_position(win->m_wlSubsurface, x, y);
|
wl_subsurface_set_position(win->*private_ptr, x, y);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <wx/config.h>
|
#include <wx/config.h>
|
||||||
|
|
||||||
class wxGLCanvas; // Forward declare.
|
class wxGLCanvas; // Forward declare.
|
||||||
|
class wxGLCanvasEGL;
|
||||||
|
|
||||||
#if defined(__WXGTK__)
|
#if defined(__WXGTK__)
|
||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
|
@ -21,11 +22,11 @@ constexpr bool IsWayland() { return false; }
|
||||||
#endif // wayland
|
#endif // wayland
|
||||||
|
|
||||||
// Temporary hack to backport 800d6ed69b from wxWidgets until 3.2.2 is released.
|
// Temporary hack to backport 800d6ed69b from wxWidgets until 3.2.2 is released.
|
||||||
#if defined(__WXGTK__) && defined(HAVE_EGL) && wxCHECK_VERSION(3, 2, 0) && !wxCHECK_VERSION(3, 2, 2)
|
#if defined(__WXGTK__) && defined(HAVE_EGL) && wxCHECK_VERSION(3, 2, 0) && !wxCHECK_VERSION(3, 2, 2) && wxUSE_GLCANVAS_EGL
|
||||||
|
|
||||||
#define WAYLAND_MOVE_SUBSURFACE_BACKPORT
|
#define WAYLAND_MOVE_SUBSURFACE_BACKPORT
|
||||||
|
|
||||||
void MoveWaylandSubsurface(wxGLCanvas* win);
|
void MoveWaylandSubsurface(wxGLCanvasEGL* win);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
// Licence: wxWidgets licence
|
// Licence: wxWidgets licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
#include <wx/wx.h>
|
||||||
#include "wx/wxprec.h"
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
#ifndef WX_WXHEAD_H
|
#ifndef WX_WXHEAD_H
|
||||||
#define WX_WXHEAD_H
|
#define WX_WXHEAD_H
|
||||||
|
|
||||||
// For compilers that support precompilation, includes <wx/wx.h>.
|
|
||||||
#include <wx/wxprec.h>
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for all others, include the necessary headers (this file is usually all you
|
|
||||||
// need because it includes almost all "standard" wxWidgets headers)
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
// The following are not pulled in by wx.h
|
// The following are not pulled in by wx.h
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue