Composition blocking on Linux

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
ventyl
Prole
Posts: 1
Joined: Sun Jul 26, 2020 8:26 pm

Composition blocking on Linux

Post by ventyl »

Hello,
by default all SDL (therefore all love2d) applications sends a hint to the system to bypass the compositor. When making program in C/C++ this behavior can be changed via following line in code:

Code: Select all

SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
Can this be done in simple way in lua?
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Composition blocking on Linux

Post by ReFreezed »

You can access SDL functions through the FFI module. Should be pretty simple to do.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

Re: Composition blocking on Linux

Post by AuahDark »

At conf.lua:

Code: Select all

local ffi = require("ffi")

ffi.cdef[[
int setenv(const char*, const char*, int);
]]

ffi.C.setenv("SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR", "0")
Untested, but 100% not work in Windows.
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
Shadowblitz16
Citizen
Posts: 73
Joined: Wed Oct 28, 2015 11:18 pm

Re: Composition blocking on Linux

Post by Shadowblitz16 »

This doesn't seem to work for me on kubuntu 20.04.
The compositor still gets turned off and graphical glitches still happen.

I also tried doing...

Code: Select all

if love.system.getOS() == "linux" then
    local ffi = require("ffi")

    ffi.cdef[[
    int setenv(const char*, const char*, int);
    ]]

    ffi.C.setenv("SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR", "0")
end
same result.
User avatar
Froyok
Prole
Posts: 27
Joined: Tue Nov 16, 2021 4:53 pm
Contact:

Re: Composition blocking on Linux

Post by Froyok »

Looks like it's working for me with Löve 11.3 on my Linux (Manjaro 5.15.12) using:

conf.lua

Code: Select all

function love.conf( Settings )
	local FFI = require("ffi")

	if FFI.os == "Linux" then
		FFI.cdef[[
			int setenv(const char*, const char*, int);
		]]

		FFI.C.setenv( "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR", "0", 1 )
	end

	-- The rest of your conf stuff below...
	Settings.console = true
end
Post Reply

Who is online

Users browsing this forum: No registered users and 88 guests