(Some) X window managers deliberately use off-screen windows

February 15, 2024

I mentioned recently that the X Window System allows you to position (X) windows so that they're partially or completely off the screen (when I wrote about how I accidentally put some icons off screen). Some window managers, such as fvwm, actually make significant use of this X capability.

To start with, windows can be off screen in any direction, because X permits negative coordinates for window locations (both horizontally and vertically). Since the top left of the screen is 0, 0 in the coordinate system, windows with a negative X are often said to be off screen to the left, and ones with a negative Y are off screen 'above', to go with a large enough positive X being 'to the right' and a positive Y being 'below'. If a window is completely off the screen, its relative location is in some sense immaterial, but this makes it easier to talk about some other things.

(Windows can also be partially off screen, in which case it does matter that negative Y is 'above' and negative X is 'left', because the bottom or the right part of such a window is what will be visible on screen.)

Fvwm has a concept of a 'virtual desktop' that can be larger than your physical display (or displays added together), normally expressed in units of your normal monitor configuration; for example, my virtual desktop is three wide by two high, creating six of what Fvwm calls pages. Fvwm calls the portion of the virtual desktop that you can see the viewport, and many people (me included) keep the viewport aligned with pages. You can then talk about things like flipping between pages, which is technically moving the viewport to or between pages.

When you change pages or in general move the viewport, Fvwm changes the X position of windows so that they are in the right (pixel) spot relative to the new page. For instance, if you have a 1280 pixel wide display and a window positioned with its left edge at 0, then you move one Fvwm page to your right, Fvwm changes the window's X coordinate to be -1280. If you want, you can then use X tools or other means to move the window around on its old page, and when you flip back to the page Fvwm will respect that new location. If you move the window to be 200 pixels away from the left edge, making it's X position -1080, when you change back to that page Fvwm will put the window's left edge at an X position of 200 pixels.

This is an elegant way to avoid having to keep track of the nominal position of off-screen windows; you just have X do it for you. If you have a 1280 x 1024 display and you move one page to the left, you merely add 1280 pixels to the X position of the (X) windows being displayed. Windows on the old page will now be off screen, while windows on the new page will come back on screen.

I think most X desktop environments and window managers have moved away from this simple and brute force approach to handle windows that are off screen because you've moved your virtual screen or workspace or whatever the environment's term is. I did a quick test in Cinnamon, and it didn't seem to change window positions this way.

(There are other ways in X to make windows disappear and reappear, so Cinnamon is using one of them.)


Comments on this page:

By Thomas Adam at 2024-02-16 12:59:40:

Uh huh.

It's important to draw the distinction between pages and desks as fvwm sees them.

With pages (and hence the current desk -- there's always at least one desk defined), all windows on that desk are mapped.

With multiple desks, windows on other desks other than the current desk being viewed are unmapped. In this way, it means the effect of viewing all windows across pages for that desk makes sense, without other windows from other desks "interfering". This is how fvwm2 works, and also fvwm3 with "DesktopConfiguration global".

In fvwm3 however, if one uses "DesktopConfiguration per-monitor", this rule breaks that model -- if were to use the "Scroll" command to move around pages incrementally, you'll find those window locations overlap windows on other desks.

Written on 15 February 2024.
« Understanding a recent optimization to Go's reflect.TypeFor
Options for genuine ECC RAM on the desktop in (early) 2024 »

Page tools: View Source, View Normal.
Search:
Login: Password:

Last modified: Thu Feb 15 22:51:41 2024
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.