bakkeby/patches

fakefullscreen window

explosion-mental opened this issue · 24 comments

Hey again, I'm having this problem for a while now but I haven't pay attention to much. I only like to have fakefullscreen by default on firefox, then I fullscreen something within the browser and it works fine but then if you tried to fullscreen again the fakefullscreen window isn't resize correctly (on the botton right weridly).
Just today before making this issue I copied your RULE macro and use it on my rules array and it is nice to have, so thanks.

Are you using the dwm-fakefullscreenclient-6.2.diff patch?

If so then I'd very much recommend the dwm-fullscreen-compilation-6.2.diff patch instead as there are so many odd fullscreen issues that can occur depending on how and what order things happen and this patch has been both rigorously tested and polished. There is also a small writeup on the wiki page.

sorry, yes I'm using the fullscreen-compilation patch with the rules complementary one. It seems that this only happen on the broswser.
Also I don't know where to ask this, what about sxiv-flexipatch?

You say that you have had this issue for a while, when did you take the patch. There was a fix that was added about three months ago for an issue similar to what you describe.

Otherwise do you have more detailed instructions for how to replicate? From what I understood you have first firefox in fake fullscreen, then you force it to go full-fullscreen using the dwm keybinding, then you exit full-fullscreen using the same keybinding and firefox goes back to tiled again (and back to fake fullscreen), just that the window content has not resized.

As for sxiv-flexipatch, are there any patches for sxiv?

Okay. First fullscreen something within the browser itself (the issue is not about togglefake or fullscreen, im using the isfakefullscreen rule on firefox). On the fullscreened window exit fullscreen by pressing Escape or whatever. Now you have your browser at the initial state (not fakefullscreenEd), now enter fullscreen (fakefullscreen) withing the browser again. What I get is a fakefullscreen but its not resized properly, and this doesn't change until restart or on exit (the only time it is properly resized is the first time, always).
And yes I doble check that everything is exactly like the dwm-fullscreen-compilation-6.2.diff , I even added a function (I'm assuming) on my dwm which I didn't have for some reason ' static void enternotify(XEvent *e) ' which was on the diff. Nothing changed tho.

And yes there are a few, I don't think you need a lot on an image viewer but I'm having fun tinkering with it, see my repo on it or search sxiv patches when bored.

It seems that enternotify was deleted because I didn't want to focus windows by the mouse, I'm trying the warp patch but I like my mouse hidden. Is there any issue if I delete enternotify?

sxiv, I had no idea that there were so many patches available for it. I guess I should take sxiv-flexipatch into consideration.

As for your fullscreen issue, I like interesting puzzles :) I tried your build of dwm in Xephyr and I was not able to replicate the behaviour you describe.

It should be fine to remove enternotify if you don't want focus to follow the mouse, it really shouldn't make any difference in terms of how fullscreen behaves.

The fake fullscreen is just a flag really that can be toggled on and off using the fakefullscreen function. In practice setting the flag using the rule is the same as enabling fake fullscreen using the fakefullscreen, then exiting fullscreen via the application (browser in this case).

Since you explicitly don't use enternotify I would recommend that you also revert this hack:

- XSync(dpy, False);
+ if (c->fakefullscreen == 1)
+ /* Exception: if the client was in actual fullscreen and we exit out to fake fullscreen
+ * mode, then the focus would drift to whichever window is under the mouse cursor at the
+ * time. To avoid this we pass True to XSync which will make the X server disregard any
+ * other events in the queue thus cancelling the EnterNotify event that would otherwise
+ * have changed focus. */
+ XSync(dpy, True);
+ else
+ XSync(dpy, False);

As the text says it is a hack / workaround to avoid focus drifting to the window beneath the cursor when exiting full-fullscreen, at the cost of ignoring other events in the queue. It is the only thing I can think of that could be causing you trouble.

I started sxiv-flexipatch, will add more patches as I go along. You probably have some that you'd recommend I recon.

That's really weird, I should have said that when "refreshing" the tag/window (toggling on and off gaps, changing tags and even sending the window to another tag) the fullscreen window geometry is fine.
Also diff resizeclient reverted but not any change.

Edit: How do you start my dwm without the script I use? did it crash or something?(dwm_random_wall001, I dot't like to see the initial colors)

As for sxiv it's a little program and I'm tempted to make little patches I suggest the same for you. I'm making an issue on it for the patches that I have tho. Also there are some things that could be done better like the config file, idk if you mess with that.

@bakkeby

As for your fullscreen issue, I like interesting puzzles :) I tried your build of dwm in Xephyr and I was not able to replicate the behaviour you describe.

here, a puzzle
I applied the fullscreen compilation patch.
default binds for togglefullscreen and togglefakefullscreen

>Clean reboot, startx, open browser with video and 2 more terminals

>fullscreen the video, video is fullscreen ok

>do a togglefakefullscreen

>fullscreen video, ok fake fullscreen working fine.

Catch: can't focus other windows. It's stuck, MODKEY+j or k, doesn't work.

So I guess that's wrong lol.

With firefox or anything else that is the behavior but now testing another browser there's an interesting behavior.

with google chrome, if I togglefakefullscreen I still get stuck.
But then if I toggle it again I can finaly focus other windows.

Everything works fine and resizes acoordingly if I move it around.
Only thing is if I get out of the faked fullscreen and fullscreen it again, it will be real fullscreen.

If I do that with firefox, the double toggle, it simply leaves the fake fullscreen.

Weird stuff.. But anyway the thing that is annoying me is the focus locked with fake fullscreen.
Can't get out of it. I have to focus other windows with the mouse. If I accidentally focus the faked fullscreen I get locked again.

Ah right, I see.

All of my patches are on top of dwm 6.2, but you are most likely using the latest from master.

There is a patch called alwaysfullscreen which prevents focus change with focusstack (which is what you call with MOD+j and MOD+k) if the client is fullscreen.

https://dwm.suckless.org/patches/alwaysfullscreen/dwm-alwaysfullscreen-20160713-56a31dc.diff

-	if (!selmon->sel)
+	if (!selmon->sel || selmon->sel->isfullscreen)

I think you may want to change that to:

if (!selmon->sel || (selmon->sel->isfullscreen && !selmon->sel->fakefullscreen))

Yep, that did it. You always answer with the solution so fast lol. I appreciate it. Thanks for the attention

That's really weird, I should have said that when "refreshing" the tag/window (toggling on and off gaps, changing tags and even sending the window to another tag) the fullscreen window geometry is fine.
Also diff resizeclient reverted but not any change.

Edit: How do you start my dwm without the script I use? did it crash or something?(dwm_random_wall001, I dot't like to see the initial colors)

Ok a little update. I think this has something to do with firefox. I'm on a different machine and distro lol. The fakefullscreen works great on Brave but on firefox it still doesn't resize it correctly, weird. I will close this since I use mpv for youtube.

I started sxiv-flexipatch, will add more patches as I go along. You probably have some that you'd recommend I recon.

Can you enable issues pls, too noob to pull request.

I have enabled issues now, wasn't aware that it was disabled.

Wow, such a long time.. I think I found what was bodering me at this moment

Edit: No this is another problem(?)

This line:

resizeclient(c, c->x, c->y, c->w, c->h);

resizes the client for magiK resons mentioned in the comments (bc browsers change the ui in fullscreen). In any way, I noticed that for some reason this werks fine in whatever situation but... when there is only one client shown (?): ie having only one client in a tag or using the monocle layout or derivatives that only show one client.
I'm not sure if this is a compatibility issue with vanitygaps, but I simply rearrange(c->mon) the layout and seems to fix it.

Do you have any clear steps for how to replicate this issue you are seeing?

mind taking a look? If so I made a repo with stock dwm and fullscreen-compilation + rules patches
https://github.com/explosion-mental/dwm-fakefullscreen/

I'm not seeing what I mentioned above (looks to be a problem with gaps..), but I do C the problem I mentioned like months ago.

Steps:

  1. Check the class of Firefox with xprop, on my end is firefox so I change it on config.h, make sure is isfakefullscreen to 1.
  2. open dwm (startx)
  3. open firefox with dmenu (alt+p)
  4. go to tag 9, where is firefox (a default rule)
  5. spawn two new terminal clients, for visualization (alt+enter)
  6. (I've tested this with youtube so..) go to youtube.com and play whatever video, click the button of the media player in youtube to fullscreen the video
  7. You will see the window is not resized correctly

(seems like it takes the oldstate anyway?..)

Normal Window: (no fullscreen)

normalwin

Fullscreen Window:

fullscreenwin

In case it isn't clear, the client has the fakefullscreen rule flag.

Hi @explosion-mental,

I first tried replicating this in my own build following those steps and I could not, then I cloned the https://github.com/explosion-mental/dwm-fakefullscreen/ build and following those steps I again could not replicate the issue with those steps - even using that particular shorty baldy video :)

But I figured it out in any case. In your demonstration screenshots you have already made firefox go into fullscreen by pressing F11 (hence the address bar, tabs, etc. are not showing).

When you now click the fullscreen rectangle in the video itself firefox thinks "oh, I am already in fullscreen and in fullscreen I surely take up all the space available on the monitor, so let's just resize the video according to the screen resolution" and you get that oversized video. A later resize or arrange indeed fixes that as a resize request is being sent to the window.

This is an issue with firefox that you can't really address with a patch for dwm - and the reason for this is that when the firefox window is in fullscreen (via F11) and you press that fullscreen rectangle in the video then there is no _NET_WM_STATE_FULLSCREEN change (or any events whatsoever) being sent to the X server (and in turn dwm) hence there is nothing to react to. If firefox is a normal window (not fullscreen with F11) and you hit the fullscreen rectangle within YouTube then it sends a fullscreen state change event and it should resize correctly.

I tried the same with Google Chrome and this also does not send another fullscreen state change when you hit the fullscreen rectangle within a YouTube video, but it seems to be retaining the constraints of the window when showing the video rather than assuming the whole monitor width at its disposal. I presume this behaviour might be the same for other Chromium based browsers as well.

I also tried the firefox kiosk mode (with the --kiosk parameter) and it is baffling to me that firefox does not support YouTube videos going into fullscreen view while in this mode.

Hmmm, I use a custom css to hide the bar https://github.com/explosion-mental/rice/blob/main/.mozilla/firefox/XXXX.default/chrome/userChrome.css
it wasnt fullscreened.

Let me try it with chrome based.

That's an interesting hack. I tried that and I can replicate the issue the same as you. With that hack the F11 button does nothing (as in there is no _NET_WM_STATE_FULLSCREEN change events) and neither does clicking the fullscreen rectangle in the YouTube video. So it is similar to the kiosk mode with the exception that clicking the fullscreen rectangle in the YouTube video does something.

hmm thats interesting indeed. ctrl+l or F6 to activate the bar, the UI of the bar does change tho..
I will be testing this on chromium based soon, prob werks tho.

On the other side, would there be a workaround for this?

Edit: sorry for the late response

This looks to be a --kiosk or the like problem, the patch is fine. Sorry for reopening this, the issue is in the window not sending the fs thing to the window manager.