ch11ng / exwm

Emacs X Window Manager
2.85k stars 134 forks source link

Keyboard grabbing isn't restored after exiting from fullscreen #494

Closed jvshahid closed 5 years ago

jvshahid commented 6 years ago

Reproduction steps:

  1. start google-chrome (in line-mode)
  2. goto youtube.com
  3. play a video in full screen
  4. exit fullscreen

Actual behavior:

all simulation keys don't work and keyboard grabbing is disabled

Expected behavior:

simulation keys continue to work after exiting fullscreen

It looks like this commit dff1ef6a3c36fd7d8b3a3bafbd66a91b8e576b26 got rid of exwm--keyboard-grabbed and introduced the following change in exwm-layout-unset-fullscreen:

     (set-window-dedicated-p (get-buffer-window) nil)
-    (when exwm--keyboard-grabbed
+    (when (eq 'line-mode (exwm-input--current-input-mode))

but (exwm-input--current-input-mode) always evaluates to char-mode after exiting from fullscreen since `exwm-layout-set-fullscreen always release the keyboard as shown below:

(cl-defun exwm-layout-set-fullscreen (&optional id)
  "Make window ID fullscreen."
  ....
  (set-window-dedicated-p (get-buffer-window) t)
    (cl-pushnew xcb:Atom:_NET_WM_STATE_FULLSCREEN exwm--ewmh-state))
    (exwm-input--release-keyboard exwm--id))))
medranocalvo commented 6 years ago

Indeed. Thank you for the detailed report. Please, test #495.

jvshahid commented 6 years ago

thanks @medranocalvo for the prompt response. #495 indeed fixes my issue.

medranocalvo commented 6 years ago

Good. I'm trying to merge it into master to get wider testing.

WJCFerguson commented 6 years ago

It fixes the problem for me (thanks!), but /while/ in fullscreen, the simulation keys don't work. I'll continue running from this branch.

jvshahid commented 6 years ago

@WJCFerguson i think that is expected. EXWM releases the keyboard grab while in fullscreen mode. I don't think that behavior changed in the commit I linked to in the original bug report.

medranocalvo commented 6 years ago

@jvshahid, @WJCFerguson: it's in master now; please track that branch. I'll leave this ticket open until next release. @WJCFerguson: please open a new ticket, It might be posible to add that feature.

WJCFerguson commented 6 years ago

I'm on master - just FYI, I'm really not sure if this is related, but twice today I've had Emacs crash on me. syslog has (both times):

Oct 26 12:34:00 <<hostname>> gnome-flashback[31776]: GdkWindow 0x1600022 unexpectedly destroyed
Oct 26 12:34:00 <<hostname>> gnome-flashback[31776]: GdkWindow 0x160001c unexpectedly destroyed
Oct 26 12:34:00 <<hostname>> gnome-flashback[31776]: GdkWindow 0x1600027 unexpectedly destroyed
Oct 26 12:34:00 <<hostname>> gnome-flashback[31776]: The program 'gnome-flashback' received an X Window System error.#012This probably reflects a bug in the program.#012The error was 'RenderBadPicture (invalid Picture parameter)'.#012  (Details: serial 25881 error_code 143 request_code 139 (RENDER) minor_code 7)#012  (Note to programmers: normally, X errors are reported asynchronously;#012   that is, you will receive the error a while after causing it.#012   To debug your program, run it with the GDK_SYNCHRONIZE environment#012   variable to change this behavior. You can then get a meaningful#012   backtrace from your debugger if you break on the gdk_x_error() function.)
Oct 26 12:34:00 <<hostname>> kernel: [15392.754556] traps: gnome-flashback[31776] trap int3 ip:7f6127599cc1 sp:7ffe738aa370 error:0 in libglib-2.0.so.0.5600.2[7f6127548000+113000]
Oct 26 12:34:00 <<hostname>> exwm-gnome-flashback.desktop[31774]: Aborted (core dumped)
Oct 26 12:34:00 <<hostname>> exwm-gnome-flashback.desktop[31774]: method return time=1540571640.836357 sender=:1.16 -> destination=:1.90 serial=299 reply_serial=2
Oct 26 12:34:00 <<hostname>> gnome-session[31493]: gnome-session-binary[31493]: WARNING: Application 'gnome-flashback.desktop' killed by signal 5
Oct 26 12:34:00 <<hostname>> gnome-session-binary[31493]: WARNING: Application 'gnome-flashback.desktop' killed by signal 5

I'm running exwm under Gnome using the gnome-flashback desktop, so there are lots of variables here apart from exwm, but I thought I'd post it in case that means anything to you. I haven't suffered crashes before.

medranocalvo commented 6 years ago

@WJCFerguson: well, I can't think of any way this could be related, but I've been wrong before. I'd say open a ticket if you keep having those. You could try reverting to an older EXWM and see whether it happens as well.

ch11ng commented 6 years ago

@WJCFerguson Please file a new issue to address that crash problem. It looks we might unexpectedly destroy some X window belonging to Gnome (if it's reparented to some X window we created). Also the possible steps to reproduce it.

baums commented 6 years ago

Just to add that I have the same problem in Firefox 63.0 since upgrading to EXWM 0.20. I have not tested whether the current master branch fixes it, but hope for the next release.

ch11ng commented 6 years ago

@baums This sounds like the same issue resolved by #495. The fix is already on master and will be included in the next release.

WJCFerguson commented 6 years ago

Regarding my core dump, I'll submit an issue if I get anything reproducible. It hasn't happened since. Thanks!

medranocalvo commented 5 years ago

495 was merged and released long ago. Please, reopen if you still find issues.