Skip to content

Commit

Permalink
wm: stop blackout/flash on desktop linux
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Oct 14, 2023
1 parent 02c9c0f commit 75ea199
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/wm.sdl.v
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ pub fn (mut wm WM) init() ! {
wm.shy.assert_api_init()
mut s := wm.shy

// SDL debug info, must be called before sdl.init
$if debug ? {
if s.config.debug {
s.log.gdebug('${@STRUCT}.${@FN}', 'debug on')
sdl.log_set_all_priority(sdl.LogPriority.debug)
}
}

s.log.gdebug('${@STRUCT}.${@FN}', '')

$if linux {
Expand All @@ -23,6 +31,13 @@ pub fn (mut wm WM) init() ! {
// sdl.set_hint(sdl.hint_video_x11_xrandr.str,'1'.str)
// sdl.set_hint(sdl.hint_render_scale_quality.str, '1'.str )
// sdl.set_hint(sdl.hint_video_highdpi_disabled.str, '0'.str)
//
// Stop the big "blackout/flash" on Linux desktops
if !sdl.set_hint(sdl.hint_video_x11_net_wm_bypass_compositor.str, '0'.str) {
sdl_error_msg := unsafe { cstring_to_vstring(sdl.get_error()) }
s.log.gerror('${@STRUCT}.${@FN}', 'SDL: ${sdl_error_msg}')
return error('SDL could not bypass compositor, SDL says:\n${sdl_error_msg}')
}
}

$if windows {
Expand All @@ -33,14 +48,6 @@ pub fn (mut wm WM) init() ! {
sdl.set_hint(sdl.hint_windows_disable_thread_naming.str, '1'.str)
}

// SDL debug info, must be called before sdl.init
$if debug ? {
if s.config.debug {
s.log.gdebug('${@STRUCT}.${@FN}', 'debug on')
sdl.log_set_all_priority(sdl.LogPriority.debug)
}
}

mut init_flags := u32(sdl.init_video)
$if wasm32_emscripten {
init_flags = init_flags | u32(sdl.init_gamecontroller)
Expand Down

0 comments on commit 75ea199

Please sign in to comment.