Page 1 of 1

Composition blocking on Linux

Posted: Sun Jul 26, 2020 8:46 pm
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?

Re: Composition blocking on Linux

Posted: Mon Jul 27, 2020 4:29 am
by ReFreezed
You can access SDL functions through the FFI module. Should be pretty simple to do.

Re: Composition blocking on Linux

Posted: Tue Aug 04, 2020 11:41 am
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.

Re: Composition blocking on Linux

Posted: Sun Dec 19, 2021 5:22 pm
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.

Re: Composition blocking on Linux

Posted: Thu Jan 06, 2022 5:11 pm
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