coelckers / prboom-plus

This is a cleaned up copy of the PrBoom+ SVN repository as a courtesy for those interested in forking that port
295 stars 118 forks source link

Alt-Tab not working at all in Linux #375

Open MarkJeronimus opened 3 years ago

MarkJeronimus commented 3 years ago

I cannot alt-tab out of the game as long as the game is set to full-screen. This is a deal-breaker for me as it would mean I'd have to either exit or go into settings and toggle full-screen, every time I want to do something else like type something in discord.

I compiled 26um (from the release section) and f5ba5a39ad596af681ed3102fed5f28cc685089c, and both seem to suffer from this. It doesn't matter if I use 16bit, 32bit or OpenGL mode.

I don't know if it's a problem specific to my PC (as I see no one else complaining about this) because I don't have a second Linux PC. Please assist me, and yourself, in tracing this problem to the root cause. I already set up a working vscode project.

[edit] Added logs. I hope it's not too spammy.

I'm using Ubuntu 18.04 with Unity on XOrg.

cmake:

mark@mark-pc-2019:~/Apps/umapinfo/build$ make clean
mark@mark-pc-2019:~/Apps/umapinfo/build$ cmake .. -DCMAKE_BUILD_TYPE=Release
-- Could NOT find LibMad (missing: LIBMAD_LIBRARIES LIBMAD_INCLUDE_DIRS) 
-- Could NOT find FluidSynth (missing: FLUIDSYNTH_LIBRARIES FLUIDSYNTH_INCLUDE_DIR) 
-- Could NOT find Dumb
-- Could NOT find Ogg (missing: OGG_LIBRARY OGG_INCLUDE_DIR) 
-- Could NOT find Vorbis (missing: VORBIS_LIBRARY VORBIS_INCLUDE_DIR) 
-- Could NOT find PortMidi (missing: PORTMIDI_LIBRARIES PORTMIDI_INCLUDE_DIR) 
-- Found ALSA: /usr/lib/x86_64-linux-gnu/libasound.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mark/Apps/umapinfo/build

make

mark@mark-pc-2019:~/Apps/umapinfo/build$ make 2>/dev/null
[  1%] Building C object data/CMakeFiles/rdatawad.dir/rd_main.c.o
[  2%] Building C object data/CMakeFiles/rdatawad.dir/rd_util.c.o
[  3%] Building C object data/CMakeFiles/rdatawad.dir/rd_output.c.o
[  3%] Building C object data/CMakeFiles/rdatawad.dir/rd_sound.c.o
[  4%] Building C object data/CMakeFiles/rdatawad.dir/rd_palette.c.o
[  5%] Building C object data/CMakeFiles/rdatawad.dir/rd_graphic.c.o
[  6%] Linking C executable rdatawad
[  6%] Built target rdatawad
[  6%] Building C object src/CMakeFiles/prboom-plus-game-server.dir/d_server.c.o
[  7%] Building C object src/CMakeFiles/prboom-plus-game-server.dir/SDL/i_network.c.o
[  8%] Building C object src/CMakeFiles/prboom-plus-game-server.dir/POSIX/i_system.c.o
[  9%] Linking C executable ../prboom-plus-game-server
[  9%] Built target prboom-plus-game-server
[  9%] Generating ../prboom-plus.wad
[  9%] Built target prboomwad
[  9%] Building C object src/CMakeFiles/prboom-plus.dir/am_map.c.o
[ 10%] Building C object src/CMakeFiles/prboom-plus.dir/doomdef.c.o
[ 11%] Building C object src/CMakeFiles/prboom-plus.dir/doomstat.c.o
[ 11%] Building C object src/CMakeFiles/prboom-plus.dir/dstrings.c.o
[ 12%] Building C object src/CMakeFiles/prboom-plus.dir/d_deh.c.o
[ 13%] Building C object src/CMakeFiles/prboom-plus.dir/d_items.c.o
[ 14%] Building C object src/CMakeFiles/prboom-plus.dir/d_main.c.o
[ 14%] Building C object src/CMakeFiles/prboom-plus.dir/e6y.c.o
[ 15%] Building C object src/CMakeFiles/prboom-plus.dir/f_finale.c.o
[ 16%] Building C object src/CMakeFiles/prboom-plus.dir/f_finale2.c.o
[ 17%] Building C object src/CMakeFiles/prboom-plus.dir/f_wipe.c.o
[ 17%] Building C object src/CMakeFiles/prboom-plus.dir/g_game.c.o
[ 18%] Building C object src/CMakeFiles/prboom-plus.dir/g_overflow.c.o
[ 19%] Building C object src/CMakeFiles/prboom-plus.dir/hu_lib.c.o
[ 20%] Building C object src/CMakeFiles/prboom-plus.dir/hu_stuff.c.o
[ 20%] Building C object src/CMakeFiles/prboom-plus.dir/hu_tracers.c.o
[ 21%] Building C object src/CMakeFiles/prboom-plus.dir/info.c.o
[ 22%] Building C object src/CMakeFiles/prboom-plus.dir/i_capture.c.o
[ 22%] Building C object src/CMakeFiles/prboom-plus.dir/i_glob.c.o
[ 23%] Building C object src/CMakeFiles/prboom-plus.dir/i_pcsound.c.o
[ 24%] Building C object src/CMakeFiles/prboom-plus.dir/lprintf.c.o
[ 25%] Building C object src/CMakeFiles/prboom-plus.dir/md5.c.o
[ 25%] Building C object src/CMakeFiles/prboom-plus.dir/m_argv.c.o
[ 26%] Building C object src/CMakeFiles/prboom-plus.dir/m_bbox.c.o
[ 27%] Building C object src/CMakeFiles/prboom-plus.dir/m_cheat.c.o
[ 28%] Building C object src/CMakeFiles/prboom-plus.dir/m_menu.c.o
[ 28%] Building C object src/CMakeFiles/prboom-plus.dir/m_misc.c.o
[ 29%] Building C object src/CMakeFiles/prboom-plus.dir/m_random.c.o
[ 30%] Building C object src/CMakeFiles/prboom-plus.dir/p_ceilng.c.o
[ 31%] Building C object src/CMakeFiles/prboom-plus.dir/p_checksum.c.o
[ 31%] Building C object src/CMakeFiles/prboom-plus.dir/p_doors.c.o
[ 32%] Building C object src/CMakeFiles/prboom-plus.dir/p_enemy.c.o
[ 33%] Building C object src/CMakeFiles/prboom-plus.dir/p_floor.c.o
[ 34%] Building C object src/CMakeFiles/prboom-plus.dir/p_genlin.c.o
[ 34%] Building C object src/CMakeFiles/prboom-plus.dir/p_inter.c.o
[ 35%] Building C object src/CMakeFiles/prboom-plus.dir/p_lights.c.o
[ 36%] Building C object src/CMakeFiles/prboom-plus.dir/p_map.c.o
[ 36%] Building C object src/CMakeFiles/prboom-plus.dir/p_maputl.c.o
[ 37%] Building C object src/CMakeFiles/prboom-plus.dir/p_mobj.c.o
[ 38%] Building C object src/CMakeFiles/prboom-plus.dir/p_plats.c.o
[ 39%] Building C object src/CMakeFiles/prboom-plus.dir/p_pspr.c.o
[ 39%] Building C object src/CMakeFiles/prboom-plus.dir/p_saveg.c.o
[ 40%] Building C object src/CMakeFiles/prboom-plus.dir/p_setup.c.o
[ 41%] Building C object src/CMakeFiles/prboom-plus.dir/p_sight.c.o
[ 42%] Building C object src/CMakeFiles/prboom-plus.dir/p_spec.c.o
[ 42%] Building C object src/CMakeFiles/prboom-plus.dir/p_switch.c.o
[ 43%] Building C object src/CMakeFiles/prboom-plus.dir/p_telept.c.o
[ 44%] Building C object src/CMakeFiles/prboom-plus.dir/p_tick.c.o
[ 45%] Building C object src/CMakeFiles/prboom-plus.dir/p_user.c.o
[ 45%] Building C object src/CMakeFiles/prboom-plus.dir/r_bsp.c.o
[ 46%] Building C object src/CMakeFiles/prboom-plus.dir/r_data.c.o
[ 47%] Building C object src/CMakeFiles/prboom-plus.dir/r_demo.c.o
[ 47%] Building C object src/CMakeFiles/prboom-plus.dir/r_draw.c.o
[ 48%] Building C object src/CMakeFiles/prboom-plus.dir/r_filter.c.o
[ 49%] Building C object src/CMakeFiles/prboom-plus.dir/r_fps.c.o
[ 50%] Building C object src/CMakeFiles/prboom-plus.dir/r_main.c.o
[ 50%] Building C object src/CMakeFiles/prboom-plus.dir/r_patch.c.o
[ 51%] Building C object src/CMakeFiles/prboom-plus.dir/r_plane.c.o
[ 52%] Building C object src/CMakeFiles/prboom-plus.dir/r_segs.c.o
[ 53%] Building C object src/CMakeFiles/prboom-plus.dir/r_sky.c.o
[ 53%] Building C object src/CMakeFiles/prboom-plus.dir/r_things.c.o
[ 54%] Building CXX object src/CMakeFiles/prboom-plus.dir/scanner.cpp.o
[ 55%] Building C object src/CMakeFiles/prboom-plus.dir/sc_man.c.o
[ 56%] Building C object src/CMakeFiles/prboom-plus.dir/sounds.c.o
[ 56%] Building C object src/CMakeFiles/prboom-plus.dir/statdump.c.o
[ 57%] Building C object src/CMakeFiles/prboom-plus.dir/st_lib.c.o
[ 58%] Building C object src/CMakeFiles/prboom-plus.dir/st_stuff.c.o
[ 59%] Building C object src/CMakeFiles/prboom-plus.dir/s_advsound.c.o
[ 59%] Building C object src/CMakeFiles/prboom-plus.dir/s_sound.c.o
[ 60%] Building C object src/CMakeFiles/prboom-plus.dir/tables.c.o
[ 61%] Building CXX object src/CMakeFiles/prboom-plus.dir/umapinfo.cpp.o
[ 61%] Building C object src/CMakeFiles/prboom-plus.dir/version.c.o
[ 62%] Building C object src/CMakeFiles/prboom-plus.dir/v_video.c.o
[ 63%] Building C object src/CMakeFiles/prboom-plus.dir/wi_stuff.c.o
[ 64%] Building C object src/CMakeFiles/prboom-plus.dir/w_wad.c.o
[ 64%] Building C object src/CMakeFiles/prboom-plus.dir/z_bmalloc.c.o
[ 65%] Building C object src/CMakeFiles/prboom-plus.dir/z_zone.c.o
[ 66%] Building C object src/CMakeFiles/prboom-plus.dir/d_client.c.o
[ 67%] Building C object src/CMakeFiles/prboom-plus.dir/w_mmap.c.o
[ 67%] Building C object src/CMakeFiles/prboom-plus.dir/memio.c.o
[ 68%] Building C object src/CMakeFiles/prboom-plus.dir/mus2mid.c.o
[ 69%] Building C object src/CMakeFiles/prboom-plus.dir/SDL/i_joy.c.o
[ 70%] Building C object src/CMakeFiles/prboom-plus.dir/SDL/i_main.c.o
[ 70%] Building C object src/CMakeFiles/prboom-plus.dir/SDL/i_network.c.o
[ 71%] Building C object src/CMakeFiles/prboom-plus.dir/SDL/i_sound.c.o
[ 72%] Building C object src/CMakeFiles/prboom-plus.dir/SDL/i_sshot.c.o
[ 72%] Building C object src/CMakeFiles/prboom-plus.dir/SDL/i_system.c.o
[ 73%] Building C object src/CMakeFiles/prboom-plus.dir/SDL/i_video.c.o
[ 74%] Building C object src/CMakeFiles/prboom-plus.dir/PCSOUND/pcsound.c.o
[ 75%] Building C object src/CMakeFiles/prboom-plus.dir/PCSOUND/pcsound_linux.c.o
[ 75%] Building C object src/CMakeFiles/prboom-plus.dir/PCSOUND/pcsound_sdl.c.o
[ 76%] Building C object src/CMakeFiles/prboom-plus.dir/PCSOUND/pcsound_win32.c.o
[ 77%] Building C object src/CMakeFiles/prboom-plus.dir/TEXTSCREEN/txt_sdl.c.o
[ 78%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/dbopl.c.o
[ 78%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/dumbplayer.c.o
[ 79%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/flplayer.c.o
[ 80%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/madplayer.c.o
[ 81%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/midifile.c.o
[ 81%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/opl.c.o
[ 82%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/oplplayer.c.o
[ 83%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/opl_queue.c.o
[ 84%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/portmidiplayer.c.o
[ 84%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/alsaplayer.c.o
[ 85%] Building C object src/CMakeFiles/prboom-plus.dir/MUSIC/vorbisplayer.c.o
[ 86%] Building C object src/CMakeFiles/prboom-plus.dir/gl_clipper.c.o
[ 86%] Building C object src/CMakeFiles/prboom-plus.dir/gl_detail.c.o
[ 87%] Building C object src/CMakeFiles/prboom-plus.dir/gl_drawinfo.c.o
[ 88%] Building C object src/CMakeFiles/prboom-plus.dir/gl_fbo.c.o
[ 89%] Building C object src/CMakeFiles/prboom-plus.dir/gl_gamma.c.o
[ 89%] Building C object src/CMakeFiles/prboom-plus.dir/gl_hires.c.o
[ 90%] Building C object src/CMakeFiles/prboom-plus.dir/gl_hqresize.c.o
[ 91%] Building C object src/CMakeFiles/prboom-plus.dir/gl_light.c.o
[ 92%] Building C object src/CMakeFiles/prboom-plus.dir/gl_main.c.o
[ 92%] Building C object src/CMakeFiles/prboom-plus.dir/gl_map.c.o
[ 93%] Building C object src/CMakeFiles/prboom-plus.dir/gl_missingtexture.c.o
[ 94%] Building C object src/CMakeFiles/prboom-plus.dir/gl_opengl.c.o
[ 95%] Building C object src/CMakeFiles/prboom-plus.dir/gl_preprocess.c.o
[ 95%] Building C object src/CMakeFiles/prboom-plus.dir/gl_shader.c.o
[ 96%] Building C object src/CMakeFiles/prboom-plus.dir/gl_shadow.c.o
[ 97%] Building C object src/CMakeFiles/prboom-plus.dir/gl_sky.c.o
[ 97%] Building C object src/CMakeFiles/prboom-plus.dir/gl_texture.c.o
[ 98%] Building C object src/CMakeFiles/prboom-plus.dir/gl_vertex.c.o
[ 99%] Building C object src/CMakeFiles/prboom-plus.dir/gl_wipe.c.o
[100%] Linking CXX executable ../prboom-plus
[100%] Built target prboom-plus

run:

mark@mark-pc-2019:~/Apps/umapinfo/build$ ./prboom-plus
M_LoadDefaults: Load system defaults.
 default file: /home/mark/.prboom-plus/prboom-plus.cfg
 found prboom-plus.wad

PrBoom-Plus vum (https://github.com/coelckers/prboom-plus)
 found /home/mark/.prboom-plus/doom.wad
IWAD found: /home/mark/.prboom-plus/doom.wad
PrBoom-Plus (built Aug  5 2021 11:38:09), playing: DOOM 2: Hell on Earth
PrBoom-Plus is released under the GNU General Public license v2.0.
You are welcome to redistribute it under certain conditions.
It comes with ABSOLUTELY NO WARRANTY. See the file COPYING for details.
V_Init: allocate screens.
V_InitMode: using 32 bit video mode
I_CalculateRes: trying to optimize screen pitch
 test case for pitch=6720 is processed 21134 times for 100 msec
 test case for pitch=6752 is processed 49814 times for 100 msec
 optimized screen pitch is 6752
I_InitScreenResolution: Using resolution 1680x1050
 found prboom-plus.wad
D_InitNetGame: Checking for network game.
W_Init: Init WADfiles.
 adding /home/mark/.prboom-plus/doom.wad
 adding prboom-plus.wad
W_InitCache

M_Init: Init miscellaneous info.
SetRatio: width/height parameters 1680x1050
SetRatio: storage aspect ratio 8:5
SetRatio: assuming square pixels
SetRatio: display aspect ratio 8:5
SetRatio: overruled by user configuration setting
SetRatio: revised display aspect ratio 16:9
SetRatio: gl_ratio 2.133334
SetRatio: multiplier 3/4
R_Init: Init DOOM refresh daemon - 
R_LoadTrigTables: Endianness...ok.
R_InitData: Textures Flats Sprites 
R_Init: R_InitPlanes R_InitLightTables R_InitSkyMap R_InitTranslationsTables R_InitPatches 
P_Init: Init Playloop state.
I_Init: Setting up machine state.
I_InitSound:  configured audio device with 1024 samples/slice
alsaplayer: Trying to open ALSA output port
alsaplayer: Successfully opened port: 0
alsaplay_refresh_outputs: output #0: (14:0) Midi Through
I_InitSound: sound module ready
S_Init: Setting up sound.
S_Init: default sfx volume 1
HU_Init: Setting up heads up display.
I_InitGraphics: 1680x1050
I_UpdateVideoMode: 0x1001, SDL buffer, direct access
SetRatio: width/height parameters 1680x1050
SetRatio: storage aspect ratio 8:5
SetRatio: assuming square pixels
SetRatio: display aspect ratio 8:5
SetRatio: overruled by user configuration setting
SetRatio: revised display aspect ratio 16:9
SetRatio: gl_ratio 2.133334
SetRatio: multiplier 3/4
ST_Init: Init status bar.
Exp_RegisterSongEx: Couldn't find preferred music player vorbis player in list
  (typo or support not included at compile time)
Exp_RegisterSongEx: Couldn't find preferred music player mad mp3 player in list
  (typo or support not included at compile time)
Exp_RegisterSongEx: Couldn't find preferred music player dumb tracker player in list
  (typo or support not included at compile time)
Exp_RegisterSongEx: Using player opl2 synth player
I_ShutdownSound: 
PrBoom-Plus vum (https://github.com/coelckers/prboom-plus)
fabiangreffrath commented 3 years ago

Are you using "exclusive fullscreen" mode or are you running this in "desktop fullscreen" mode?

MarkJeronimus commented 3 years ago

desktop fullscreen

fabiangreffrath commented 3 years ago

Then... this shoudn't happen. Do you happen to use Wayland instead of X11 or some exotic (tiling?) window manager?

MarkJeronimus commented 3 years ago

Xorg as stated in the OP.

Aallright, searching for "desktop fullscreen" lead me to i_video.c, in which I started poking around.

I'm not too familiar with SDL2, bit this "hack" seems to work for me and I haven't yet found any side-effects:

      // Prevent executing action on Alt-Tab
      if (Event->key.keysym.sym == SDLK_TAB)
      {
        DeactivateMouse(); // Added (line 262)
        break;
      }
fabiangreffrath commented 3 years ago

Ah, cool! I wonder why SDL eats Alt-Tab at all.

MarkJeronimus commented 3 years ago

Adding SDL_SetRelativeMouseMode(SDL_TRUE); right after DeactivateMouse and stepping over it with the debugger, causes alt-tab to be eaten again, but I can still do everything else in vscode with the keyboard.

fabiangreffrath commented 3 years ago

Sorry, but I just checked with my Debian testing/unstable system and could not reproduce this.