Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions libs/openFrameworks/app/ofAppGLFWWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,27 @@
#include <GLFW/glfw3native.h>
#endif

#include <cstdlib>

using std::numeric_limits;
using std::shared_ptr;
using std::vector;

namespace of{
namespace priv{
bool InitGLFW(){
#if defined(TARGET_LINUX) && defined(GLFW_PLATFORM_X11)
// GLFW 3.4+ auto-detects Wayland when $WAYLAND_DISPLAY is set,
// Force the X11 backend so XWayland bridges us into the Wayland
// session transparently — no sudo required.
#if defined(TARGET_LINUX) && defined(GLFW_PLATFORM_WAYLAND) && defined(GLFW_PLATFORM_X11)
const char *waylandDisplay = getenv("WAYLAND_DISPLAY");
if (waylandDisplay && waylandDisplay[0] != '\0') {
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
if (glfwInit()) {
return true;
}
glfwTerminate();
ofLogNotice("ofAppGLFWWindow") << "Wayland init failed, trying X11";
}
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);

@ofTheo ofTheo Aug 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the GLFW_PLATFORM_WAYLAND lines above can't be approved as Native Wayland breaks core ofSetWindowPos ofSetWindowShape functionality.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test it out. Yeah moved to draft

#elif defined(TARGET_LINUX) && defined(GLFW_PLATFORM_X11)
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
#endif
return glfwInit();
Expand Down
3 changes: 2 additions & 1 deletion libs/openFrameworks/utils/ofConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ enum ofTargetPlatform{
#elif defined (__ANDROID__)
#define TARGET_ANDROID
#define TARGET_OPENGLES
//#elif defined(__ARMEL__)
#elif defined(__aarch64__) || defined(__ARM64__)
#define TARGET_LINUX // desktop GLFW (X11/Wayland), not EGL/GLES armv6/v7
#elif defined(__ARM__)
#define TARGET_LINUX
#define TARGET_OPENGLES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ PLATFORM_CFLAGS += -pipe
# Note: Leave a leading space when adding list items with the += operator
################################################################################

PLATFORM_PKG_CONFIG_LIBRARIES += glesv1_cm
PLATFORM_PKG_CONFIG_LIBRARIES += glesv2
PLATFORM_PKG_CONFIG_LIBRARIES += egl
# GLFW + desktop GL (X11/Wayland), same as linux64 — not EGL/GLES like armv6/v7


################################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,15 @@ ifneq ($(LINUX_ARM),1)
PLATFORM_PKG_CONFIG_LIBRARIES += gl
PLATFORM_PKG_CONFIG_LIBRARIES += glu
PLATFORM_PKG_CONFIG_LIBRARIES += glew
# GLFW 3.4 static lib on desktop linux (x86_64 and aarch64) is built with
# both X11 and Wayland objects. Pull the Wayland link deps when present
# so that backend can actually resolve; X11 libs are already listed above.
GLFW_WL_PKGS := wayland-client wayland-cursor wayland-egl xkbcommon libdecor-0
ifeq ($(CROSS_COMPILING),1)
$(foreach pkg,$(GLFW_WL_PKGS),$(if $(shell export PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR); pkg-config --exists $(pkg) && echo 1),$(eval PLATFORM_PKG_CONFIG_LIBRARIES += $(pkg))))
else
$(foreach pkg,$(GLFW_WL_PKGS),$(if $(shell pkg-config --exists $(pkg) && echo 1),$(eval PLATFORM_PKG_CONFIG_LIBRARIES += $(pkg))))
endif
endif


Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/archlinux/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

ROOT=$(cd $(dirname $0); pwd -P)

pacman -S --needed make pkgconf gcc openal glm glew freeglut gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-libav opencv libxcursor assimp glfw-x11 uriparser curl pugixml rtaudio poco brotli gum
pacman -S --needed make pkgconf gcc openal glm glew freeglut gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-libav opencv libxcursor assimp glfw-x11 uriparser curl pugixml rtaudio poco brotli gum wayland libxkbcommon libdecor

exit_code=$?
if [ $exit_code != 0 ]; then
Expand Down
Loading