mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-12 01:38:29 +12:00
Linux: Add CMake find module for wayland + make wayland optional (#572)
This commit is contained in:
parent
aea9f5b966
commit
fcab8f8f1a
12 changed files with 64 additions and 16 deletions
|
@ -150,6 +150,9 @@ target_link_libraries(CemuGui PRIVATE
|
|||
if(ENABLE_WXWIDGETS AND UNIX AND NOT APPLE)
|
||||
# PUBLIC because gdk/gdkkeysyms.h is included in guiWrapper.h
|
||||
target_link_libraries(CemuGui PUBLIC GTK3::gtk)
|
||||
if (ENABLE_WAYLAND)
|
||||
target_link_libraries(CemuGui PRIVATE Wayland::client)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
#include "gui/helpers/wxWayland.h"
|
||||
#endif
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
VulkanCanvas::VulkanCanvas(wxWindow* parent, const wxSize& size, bool is_main_window)
|
||||
|
@ -14,7 +18,7 @@ VulkanCanvas::VulkanCanvas(wxWindow* parent, const wxSize& size, bool is_main_wi
|
|||
{
|
||||
WindowHandleInfo& canvasMain = gui_getWindowInfo().canvas_main;
|
||||
gui_initHandleContextFromWxWidgetsWindow(canvasMain, this);
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
if(canvasMain.backend == WindowHandleInfo::Backend::WAYLAND)
|
||||
{
|
||||
m_subsurface = std::make_unique<wxWlSubsurface>(this);
|
||||
|
@ -65,7 +69,7 @@ void VulkanCanvas::OnPaint(wxPaintEvent& event)
|
|||
|
||||
void VulkanCanvas::OnResize(wxSizeEvent& event)
|
||||
{
|
||||
#if BOOST_OS_LINUX
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
if(m_subsurface)
|
||||
{
|
||||
int32_t x,y;
|
||||
|
|
|
@ -6,14 +6,11 @@
|
|||
|
||||
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h"
|
||||
#include <set>
|
||||
#if BOOST_OS_LINUX
|
||||
#include "gui/helpers/wxWayland.h"
|
||||
#endif
|
||||
|
||||
class VulkanCanvas : public IRenderCanvas, public wxWindow
|
||||
{
|
||||
#if BOOST_OS_LINUX
|
||||
std::unique_ptr<wxWlSubsurface> m_subsurface;
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
std::unique_ptr<class wxWlSubsurface> m_subsurface;
|
||||
#endif
|
||||
public:
|
||||
VulkanCanvas(wxWindow* parent, const wxSize& size, bool is_main_window);
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkwindow.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#ifdef HAS_WAYLAND
|
||||
#include <gdk/gdkwayland.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "gui/wxgui.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
|
@ -219,16 +221,18 @@ void gui_initHandleContextFromWxWidgetsWindow(WindowHandleInfo& handleInfoOut, c
|
|||
cemuLog_log(LogType::Force, "Unable to get xlib display");
|
||||
}
|
||||
}
|
||||
else if(GDK_IS_WAYLAND_WINDOW(gdkWindow))
|
||||
else
|
||||
#ifdef HAS_WAYLAND
|
||||
if(GDK_IS_WAYLAND_WINDOW(gdkWindow))
|
||||
{
|
||||
handleInfoOut.backend = WindowHandleInfo::Backend::WAYLAND;
|
||||
handleInfoOut.surface = gdk_wayland_window_get_wl_surface(gdkWindow);
|
||||
handleInfoOut.display = gdk_wayland_display_get_wl_display(gdkDisplay);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Unsuported GTK backend");
|
||||
|
||||
}
|
||||
#else
|
||||
handleInfoOut.handle = wxw->GetHandle();
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#if BOOST_OS_LINUX
|
||||
#include "xcb/xproto.h"
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <wayland-client.h>
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_MACOS
|
||||
|
@ -29,9 +28,10 @@ struct WindowHandleInfo
|
|||
// XCB (not used by GTK so we cant retrieve these without making our own window)
|
||||
//xcb_connection_t* xcb_con{};
|
||||
//xcb_window_t xcb_window{};
|
||||
// Wayland
|
||||
wl_display* display;
|
||||
wl_surface* surface;
|
||||
#ifdef HAS_WAYLAND
|
||||
struct wl_display* display;
|
||||
struct wl_surface* surface;
|
||||
#endif // HAS_WAYLAND
|
||||
#else
|
||||
void* handle;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue