Author Topic: Linux xsession focus issue  (Read 6650 times)

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Linux xsession focus issue
« on: December 23, 2016, 06:05:14 PM »
I recently switched to Mint, and tried to set up a RetroFE xsession today. The .desktop file was easily created, and RetroFE starts properly, but when I return from a game my RetroFE window refuses to take focus. This setup worked perfectly fine on my previous Kubuntu setup. Any ideas what might be causing this problem?

To be clear: this problem only exist if I run RetroFE without a window manager. Under KDE everything works without a hitch.

Tom Acunzo

  • Newbie
  • *
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Linux xsession focus issue
« Reply #1 on: December 24, 2016, 06:49:12 AM »
I'm reminded of this in the old forum. I haven't used Mint linux before but it sounds strange to have the issue without a window manager up. It's like both RetroArch and RetroFE are competing for your console. The open command was real useful for me controlling the foreground swap.

I don't know but it might help to force Full Screen on RetroArch when it launches using RetroArch -f "%ITEM_FILEPATH%".... so there's no chance to try to sub window on exit.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Linux xsession focus issue
« Reply #2 on: December 24, 2016, 08:38:37 AM »
I remember that issue as well, but that was different. In that case, two SDL programs were fighting for input focus. In this case the emulator properly grabs focus when it is started, but RetroFE does not take focus back when I close the emulator. Since there's no window manager I cannot grab focus manually (via mouse or alt-tab) either. So far it's baffling.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Linux xsession focus issue
« Reply #3 on: December 24, 2016, 09:59:42 AM »
It looks like the problem is SDL related, and has to do with keyboard functionality rather than window focus. When I launch an xterm, and launch an SDL program from there (like MAME or RetroFE), and then close that program, my keyboard doesn't work. If I launch a non-SDL program like Firefox in stead, no such problem occurs. It's as if the SDL program grabs the keyboard, and refuses to release it even after it's closed down. Very very odd. It works perfectly well when I use KDE, just not when I don't use a window manager.

Tom Acunzo

  • Newbie
  • *
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Linux xsession focus issue
« Reply #4 on: December 28, 2016, 12:44:18 AM »
That's where the open command comes in handy also mentioned in that trail. A while back in my unix sys admin days I recall launching processes with eval, fork, exec yada and you can have a situation where the closing program inherits the parent shell you'll lose stdin, it takes over the parent pid. See if you can fork the emulator.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Linux xsession focus issue
« Reply #5 on: December 28, 2016, 09:55:32 AM »
I'll play around with it. :) Any idea why this behavior may be different between Kubuntu and Mint KDE?

No luck so far. open uses the virtual terminals in Linux, and kde-open doesn't allow you to target executables...
« Last Edit: December 28, 2016, 03:53:05 PM by Pieter Hulshoff »

Tom Acunzo

  • Newbie
  • *
  • Posts: 31
  • Karma: +0/-0
    • View Profile
Re: Linux xsession focus issue
« Reply #6 on: January 02, 2017, 03:44:46 PM »
I forgot to ask if you were you using RetroArch? There is a flag -D or --detach from the running console. Maybe it will help.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Linux xsession focus issue
« Reply #7 on: January 02, 2017, 04:11:17 PM »
No, mostly MAME, but ppsspp has the same issue.

Sent from my SM-G920F using Tapatalk


Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Linux xsession focus issue
« Reply #8 on: January 26, 2017, 02:53:13 PM »
I've managed to solve this by running a minimal xfce4 session. It's a work-around rather than a solution, but hey: it works. :)

PinealServo

  • Newbie
  • *
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: Linux xsession focus issue
« Reply #9 on: January 26, 2017, 05:43:44 PM »
I ran into the same issue while using the i3 window manager.  I switched to fluxwm (I picked it mostly at random because I knew it was fairly small and I didn't hate it) and it apparently knows how to handle the situation.  In i3, my window would often be shifted up slightly from the bottom due to how it handled the bar there, and I could use the mousewheel on the bar to switch between workspaces; shifting back to the RetroFE workspace would bring the keyboard focus back from limbo. I never did figure out why the window manager itself never recovered the keyboard from the closing SDL app, though.

Whiskerpouches

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Linux xsession focus issue
« Reply #10 on: July 04, 2017, 05:05:28 AM »
Was there any further research into this?  Getting this issue with Arch Linux on Openbox when returning from RetroArch to RetroFE.  It tends to happen after running RetroArch for at least several minutes.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Linux xsession focus issue
« Reply #11 on: July 04, 2017, 06:38:53 AM »
No. 😭
It appears to be a new feature of either SDL or of X. Running a minimal window manager gave me a workaround.

Sent from my SM-G920F using Tapatalk


Whiskerpouches

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Linux xsession focus issue
« Reply #12 on: July 05, 2017, 05:41:57 AM »
It seems that I fixed the issue - I set the config to non-fullscreen, and stretched the window out.  Went through several runs of RetroArch a few minutes at a time, haven't reproduced the problem yet.  I'll report back if it acts up again.

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: Linux xsession focus issue
« Reply #13 on: July 05, 2017, 06:55:05 AM »
That didn't work for me, but I'm glad it does for you. 😀

Sent from my SM-G920F using Tapatalk