Merge branch 'gtk-x-checks-simplify'
Simplify X11 checks and make them work when using Wayland-only GTK. See https://github.com/wxWidgets/wxWidgets/pull/2261
This commit is contained in:
@@ -46,5 +46,6 @@ endif ()
|
||||
include(CheckSymbolExists)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${GTK3_INCLUDE_DIRS})
|
||||
check_symbol_exists(GDK_WINDOWING_WAYLAND "gdk/gdk.h" wxHAVE_GDK_WAYLAND)
|
||||
check_symbol_exists(GDK_WINDOWING_X11 "gdk/gdk.h" wxHAVE_GDK_X11)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)
|
||||
|
@@ -69,12 +69,6 @@ set(wxTOOLKIT_INCLUDE_DIRS)
|
||||
set(wxTOOLKIT_LIBRARIES)
|
||||
set(wxTOOLKIT_VERSION)
|
||||
|
||||
if(UNIX AND NOT APPLE AND NOT WIN32)
|
||||
find_package(X11 REQUIRED)
|
||||
list(APPEND wxTOOLKIT_INCLUDE_DIRS ${X11_INCLUDE_DIR})
|
||||
list(APPEND wxTOOLKIT_LIBRARIES ${X11_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WXGTK)
|
||||
if(WXGTK4)
|
||||
set(gtk_lib GTK4)
|
||||
@@ -121,6 +115,15 @@ if(WXGTK)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# We need X11 for non-GTK Unix ports (X11, Motif) and for GTK with X11
|
||||
# support, but not for Wayland-only GTK (which is why we have to do this after
|
||||
# find_package(GTKx) above, as this is what sets wxHAVE_GDK_X11).
|
||||
if(UNIX AND NOT APPLE AND NOT WIN32 AND (WXX11 OR WXMOTIF OR (WXGTK AND wxHAVE_GDK_X11)))
|
||||
find_package(X11 REQUIRED)
|
||||
list(APPEND wxTOOLKIT_INCLUDE_DIRS ${X11_INCLUDE_DIR})
|
||||
list(APPEND wxTOOLKIT_LIBRARIES ${X11_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(WXQT)
|
||||
set(QT_COMPONENTS Core Widgets Gui OpenGL Test)
|
||||
foreach(QT_COMPONENT ${QT_COMPONENTS})
|
||||
|
@@ -13,8 +13,6 @@
|
||||
// for compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#include "wx/unix/utilsx11.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/app.h"
|
||||
@@ -26,16 +24,6 @@
|
||||
#include "wx/apptrait.h"
|
||||
#include "wx/private/launchbrowser.h"
|
||||
|
||||
#ifdef __VMS
|
||||
#pragma message disable nosimpint
|
||||
#endif
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#ifdef __VMS
|
||||
#pragma message enable nosimpint
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#ifdef __WXGTK20__
|
||||
#include "wx/gtk/private/wrapgtk.h"
|
||||
@@ -45,20 +33,31 @@
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#define wxHAS_X11_SUPPORT
|
||||
#endif
|
||||
GdkWindow* wxGetTopLevelGDK();
|
||||
GtkWidget* wxGetTopLevelGTK();
|
||||
#endif
|
||||
|
||||
#ifdef GTK_CHECK_VERSION
|
||||
#if GTK_CHECK_VERSION(3,4,0)
|
||||
#define wxHAS_GETKEYSTATE_GTK
|
||||
#endif //GTK+ 3.4
|
||||
#endif
|
||||
#else
|
||||
// When not using GTK we always use X11, as we don't support anything else.
|
||||
#define wxHAS_X11_SUPPORT
|
||||
#endif // GTK
|
||||
|
||||
// Only X11 backend is supported for wxGTK here (GTK < 2 has no others)
|
||||
#if !defined(__WXGTK__) || \
|
||||
(!defined(__WXGTK20__) || defined(GDK_WINDOWING_X11))
|
||||
#ifdef wxHAS_X11_SUPPORT
|
||||
|
||||
#include "wx/unix/utilsx11.h"
|
||||
|
||||
#ifdef __VMS
|
||||
#pragma message disable nosimpint
|
||||
#endif
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
#ifdef __VMS
|
||||
#pragma message enable nosimpint
|
||||
#endif
|
||||
|
||||
// Various X11 Atoms used in this file:
|
||||
static Atom _NET_WM_STATE = 0;
|
||||
@@ -2595,7 +2594,7 @@ static bool wxGetKeyStateX11(wxKeyCode key)
|
||||
return (key_vector[keyCode >> 3] & (1 << (keyCode & 7))) != 0;
|
||||
}
|
||||
|
||||
#endif // !defined(__WXGTK__) || defined(GDK_WINDOWING_X11)
|
||||
#endif // wxHAS_X11_SUPPORT
|
||||
|
||||
// We need to use GDK functions when using wxGTK with a non-X11 backend, the
|
||||
// X11 code above can't work in this case.
|
||||
@@ -2649,9 +2648,9 @@ bool wxGetKeyState(wxKeyCode key)
|
||||
}
|
||||
#endif // GTK+ 3.4+
|
||||
|
||||
#if !defined(__WXGTK__) || \
|
||||
(!defined(__WXGTK20__) || defined(GDK_WINDOWING_X11))
|
||||
return wxGetKeyStateX11(key);
|
||||
#ifdef wxHAS_X11_SUPPORT
|
||||
if ( wxGetKeyStateX11(key) )
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user