ch11ng / exwm

Emacs X Window Manager
2.85k stars 134 forks source link

Fickering on workspace change #449

Closed memeplex closed 5 years ago

memeplex commented 6 years ago

It's my first day with exwm so this may be something that you all known and live with, but just in case I'm going to ask. When switching workspaces some unpleasant virtual artefacts appear, some black flickering for a moment as the screen is being redrawn. I tried with compton, also setting the root window background to my default face background, but to no avail. Is it unavoidable? Is not that it has any functional impact, it's just rather ugly.

memeplex commented 6 years ago

In fact, with compton the flickering turns grey as the compton background while starting. Also the first time I enter a workspace I can notice a new emacs frame starting with some geometry and then maximizing.

It seems to me that if I could say exwm: start emacs maximized and use this background color for the root window, for each new workspace, then the ugly artefacts would be less noticeable.

memeplex commented 6 years ago

Ok, for anybody interested in this: --vsync opengl improves a lot on the switching flicker! (and maybe --vsync-aggressive help a bit more, but I can't really tell).

There is still the problem of emacs resizing the first time I enter a workspace, but this is much less annoying since it's just the first time. Anyway, if you have any suggestion it would be of course much appreciated. What I did (without any success) for now is:

  1. Add Emacs.fullscreen: maximized to my resources file, but this is for the first frame only.

  2. Add (add-to-list 'default-frame-alist '(fullscreen . maximized)) to my emacs initialization, but this seems to take effect too late, after the frame is already displayed.

ch11ng commented 6 years ago

It sounds like the 'vsync trick' works for you so I'd skip that part.

It appears the full screen switch relies on a window manager to work. But here we are the window manager so the switch does not seem to make any difference. Besides there is no way to precisely specify the size of Emacs frames on startup. So we end up living with the 'splash screen'. You can alleviate that by specifying something like -g 1x1-10000-10000 when starting Emacs though.

medranocalvo commented 6 years ago

I think we can improve the initial resizing issue by setting default-frame-alist. This will not help for multiple monitors, perhaps setting the right geometry in exwm-workspace--x-create-frame would be better.

I think that the flickering is due to workspaces being enabled/disabled in a non-optimal order. As far as I can see the following patch fixes the issue (no time for a pull request right now):

diff --git i/exwm-workspace.el w/exwm-workspace.el
index 1034966..c8a98fb 100644
--- i/exwm-workspace.el
+++ w/exwm-workspace.el
@@ -547,8 +547,8 @@ for internal use only."
          ((not active-old)
           (exwm-workspace--set-active frame t))
          ((equal output-old output-new)
-          (exwm-workspace--set-active old-frame nil)
           (exwm-workspace--set-active frame t)
+          (exwm-workspace--set-active old-frame nil)
           (setq workspaces-to-hide (list old-frame)))
          (active-new)
          (t
ch11ng commented 6 years ago

I think we can improve the initial resizing issue by setting default-frame-alist. This will not help for multiple monitors, perhaps setting the right geometry in exwm-workspace--x-create-frame would be better.

Or if users do care about that we can make a 'splash window' to on top of a frame being created.

As far as I can see the following patch fixes the issue

That makes a lot more sense.

medranocalvo commented 6 years ago

@memeplex, please try #488 and report back. Does it help with flickering? Still have to look into the resizing issue, especially with regards to RandR.

medranocalvo commented 5 years ago

Merged long ago and working since. Reopen you still find issues.