Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window top position issue on Elementary OS #91

Open
peteruithoven opened this issue Oct 8, 2017 · 13 comments
Open

Window top position issue on Elementary OS #91

peteruithoven opened this issue Oct 8, 2017 · 13 comments

Comments

@peteruithoven
Copy link

I'm not sure if this is an Quicktile or window manager (Gala from Elementary OS in my case) issue.

When using quicktile and tiling windows to the right part of the screen and having them take up 50% or less of the width of the screen it's positioned behind the top bar for some reason:

screenshot from 2017-10-08 16-36-52

@ssokolow
Copy link
Owner

ssokolow commented Oct 9, 2017

Possibly a bug in calculating the usable area of the screen. (That code is a scary mess that I've been meaning to write tests for and clean up for a while)

I'm trying to deal with a surprise dump of things with deadlines, but could you run QuickTile with --debug, trigger both left-side and right-side tiling, and then paste the resulting terminal output? (Either indented four spaces or with a sequence of three backticks on the lines before and after it.)

@peteruithoven
Copy link
Author

peteruithoven commented Oct 9, 2017

Thanks for the quick reply!

The result of that test:

$ quicktile.py --daemonize --debug
Gtk-Message: Failed to load module "pantheon-filechooser-module"
DEBUG: Received keybind: <Primary><Mod4>Left
DEBUG: Executing command 'left' with arguments (), {}
DEBUG: Operating on window 0x3a000bd with title "Mozilla Firefox Start Page - Mozilla Firefox" and geometry (608, 526, 1874, 1156)
DEBUG:  Window is on monitor 0, which has geometry gtk.gdk.Rectangle(0, 0, 3840, 2160)
DEBUG: Gathered _NET_WM_STRUT_PARTIAL values:
	[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 60, 0, 0, 0, 0, 0, 0, 1919, 0, 0]]
DEBUG: Usable region of monitor calculated as:
	Region: [gtk.gdk.Rectangle(1920, 0, 1920, 60), gtk.gdk.Rectangle(0, 60, 3840, 2100)]
	Rectangle: gtk.gdk.Rectangle(0, 60, 3840, 2100)
DEBUG: Selected preset sequence:
	((0.0, 0.0, 0.5, 1), (0.0, 0.0, 0.3333333333333333, 1), (0.0, 0.0, 0.6666666666666666, 1))
DEBUG: Selected preset sequence resolves to these monitor-relative pixel dimensions:
	[[0, 0, 1920, 2160], [0, 0, 1280, 2160], [0, 0, 2560, 2160]]
DEBUG: Target preset is gtk.gdk.Rectangle(0, 0, 1920, 2160) relative to monitor gtk.gdk.Rectangle(0, 0, 3840, 2160)
DEBUG: Result exceeds usable (non-rectangular) region of desktop. (overlapped a non-fullwidth panel?) Reducing to within largest usable rectangle: gtk.gdk.Rectangle(0, 60, 3840, 2100)
DEBUG: Calling reposition() with default gravity and dimensions (0, 60, 1920, 2100)
DEBUG:  Window is on monitor 0, which has geometry gtk.gdk.Rectangle(0, 0, 3840, 2160)
DEBUG:  Repositioning to (0, 60, 1920, 2100)

DEBUG: Received keybind: <Primary><Mod4>Right
DEBUG: Executing command 'right' with arguments (), {}
DEBUG: Operating on window 0x3a000b2 with title "Mozilla Firefox Start Page - Mozilla Firefox" and geometry (2283, 432, 1264, 1318)
DEBUG:  Window is on monitor 0, which has geometry gtk.gdk.Rectangle(0, 0, 3840, 2160)
DEBUG: Gathered _NET_WM_STRUT_PARTIAL values:
	[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 60, 0, 0, 0, 0, 0, 0, 1919, 0, 0]]
DEBUG: Usable region of monitor calculated as:
	Region: [gtk.gdk.Rectangle(1920, 0, 1920, 60), gtk.gdk.Rectangle(0, 60, 3840, 2100)]
	Rectangle: gtk.gdk.Rectangle(0, 60, 3840, 2100)
DEBUG: Selected preset sequence:
	((0.5, 0.0, 0.5, 1), (0.6666666666666667, 0.0, 0.3333333333333333, 1), (0.33333333333333337, 0.0, 0.6666666666666666, 1))
DEBUG: Selected preset sequence resolves to these monitor-relative pixel dimensions:
	[[1920, 0, 1920, 2160], [2560, 0, 1280, 2160], [1280, 0, 2560, 2160]]
DEBUG: Target preset is gtk.gdk.Rectangle(1920, 0, 1920, 2160) relative to monitor gtk.gdk.Rectangle(0, 0, 3840, 2160)
DEBUG: Calling reposition() with default gravity and dimensions (1920, 0, 1920, 2160)
DEBUG:  Window is on monitor 0, which has geometry gtk.gdk.Rectangle(0, 0, 3840, 2160)
DEBUG:  Repositioning to (1920, 0, 1920, 2160)

Diff:
screenshot from 2017-10-10 01 06 17

So with the left one (with the correct height and position) the following is logged, which isn't logged for the right one:

DEBUG: Result exceeds usable (non-rectangular) region of desktop. (overlapped a non-fullwidth panel?) Reducing to within largest usable rectangle: gtk.gdk.Rectangle(0, 60, 3840, 2100)

@peteruithoven
Copy link
Author

I'm running Quicktile v0.2.2 btw

@peteruithoven
Copy link
Author

One hacky partial solution to fix this for the 50% width is to slightly increase the base corner step from 0.5 to something like 0.501
This can be done by changing line 151 from:

    POSITIONS[grav] = [gv(width, 0.5, grav) for width in corner_steps]

To:

    POSITIONS[grav] = [gv(width, 0.501, grav) for width in corner_steps]

@peteruithoven
Copy link
Author

I installed Quicktile v0.3 on another computer with elementary OS and this issue seems solved 🎉 .

@ssokolow
Copy link
Owner

ssokolow commented Jun 8, 2018

As I mentioned in another issue that vanished, this is probably due to a bug-fix in the OS, rather than QuickTile, so I'll leave this open until I have time to try to reproduce it and write regression tests.

@peteruithoven
Copy link
Author

Damn, sorry, just noticed that even though it works on my LoDPI external monitor, the issue still occurs on my main HiDPI laptop screen.

@ssokolow
Copy link
Owner

ssokolow commented Jun 8, 2018

Ooh, that's a problem. I specifically avoid buying HiDPI gear because I consider it a waste to up the number of pixels my GPU has to drive without also upping the number of applications I can fit on screen.

The best I can offer is that, if it's HiDPI-related, it's probably a bug in libwnck for GTK+ 2.x which will go away when I make time to port to Python 3.x and GTK+ 3.x to account for recent *buntu versions dropping the libwnck I currently depend on.

(Because something in QuickTile segfaults the *buntu 14.04 LTS versions of the PyGTK+ porting helpers in PyGI, rewriting for GTK+ 3.x is a big production, and I have other projects which need attention more urgently.)

@ssokolow
Copy link
Owner

There's now a version based on GTK 3 and libwnck 3.x in the gtk3_port branch.

https://github.com/ssokolow/quicktile/tree/gtk3_port

As I still don't have access to HiDPI equipment, can you test and tell me if this is still an issue?

(Just don't use the pip3 URL install method in the README. The URL given is for the master branch which currently still contains the GTK+ 2.x version.)

@kbsali
Copy link

kbsali commented Apr 1, 2020

Hi,
I'm running the latest version of quicktile on ubuntu-mate 19.04 (so with mate Desktop) and when running on dual monitor, the panel on the primary screen is ignored making the top of the windows unavailable.

I've been through most of the issues of the repo (might do with a bit of a cleanup btw! :)), and this one seemed to me like the most related to my issue.

See a screenshot :
2020-04-01_15-14

thanks for you help!

@ssokolow
Copy link
Owner

ssokolow commented Apr 1, 2020

I've been through most of the issues of the repo (might do with a bit of a cleanup btw! :)),

Thanks for reminding me how much time it's been since I added those "needs more info" tags. I'm about to go to bed, but I'll try to find time tomorrow to go through and close the ones that didn't receive a response. (EDIT: Done)

Also, thanks for indirectly reminding me that I still need to write a bug-reporting guide.

Please run QuickTile with the --debug flag, trigger the bug, and paste the DEBUG messages that result. Those will tell me the raw information it's receiving from the desktop about the shapes of the monitors and where the panels are, as well as what geometry it asks the WM to reposition to, so I know whether it's a problem with the data-gathering, a problem with calculating the usable region, or your window manager doing something screwy to the geometry QuickTile asks for.

@kbsali
Copy link

kbsali commented Apr 11, 2020

sorry for the late answer...
Here is the output :

$ /usr/bin/python3 /usr/bin/quicktile --debug move-to-top-left
DEBUG: Loaded monitor geometry: [Rectangle(x=0, y=1080, width=1920, height=1080), Rectangle(x=0, y=0, width=1920, height=1080)]
DEBUG: Gathered _NET_WM_STRUT_PARTIAL value: [StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=1919, bottom_start_x=0, bottom_end_x=0)]
DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=0, y=1080, width=1920, height=1080), Rectangle(x=0, y=0, width=1920, height=1080)], Struts=[StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=1919, bottom_start_x=0, bottom_end_x=0)]>)
DEBUG: Executing command 'move-to-top-left' with arguments (), {}
DEBUG: Loaded monitor geometry: [Rectangle(x=0, y=1080, width=1920, height=1080), Rectangle(x=0, y=0, width=1920, height=1080)]
DEBUG: Gathered _NET_WM_STRUT_PARTIAL value: [StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=1919, bottom_start_x=0, bottom_end_x=0)]
DEBUG: Usable desktop region calculated as: Region(<Monitors=[Rectangle(x=0, y=1080, width=1920, height=1080), Rectangle(x=0, y=0, width=1920, height=1080)], Struts=[StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=1919, bottom_start_x=0, bottom_end_x=0)]>)
DEBUG: Operating on window <Wnck.Window object at 0x7fdcc28a5aa0 (WnckWindow at 0x1e956a0)> with title "/usr/bin/python3 /usr/bin/quicktile --debug move-to-top-left" and geometry Rectangle(x=0, y=1620, width=954, height=526)
DEBUG:  Window is on monitor 0, which has geometry Rectangle(x=0, y=1080, width=1920, height=1080)
DEBUG: Clipping rectangle Rectangle(x=0, y=1080, width=954, height=526)
	to usable region Region(<Monitors=[Rectangle(x=0, y=1080, width=1920, height=1080), Rectangle(x=0, y=0, width=1920, height=1080)], Struts=[StrutPartial(left=0, right=0, top=0, bottom=0, left_start_y=0, left_end_y=0, right_start_y=0, right_end_y=0, top_start_x=0, top_end_x=1919, bottom_start_x=0, bottom_end_x=0)]>)
DEBUG: Calling reposition() with dimensions Rectangle(x=0, y=1080, width=954, height=526)
DEBUG:  Window is on monitor 0, which has geometry Rectangle(x=0, y=1080, width=1920, height=1080)
DEBUG:  Repositioning to Rectangle(x=0, y=1080, width=954, height=526))

FYI the top panel's height is 28px

Thanks!

@ssokolow
Copy link
Owner

ssokolow commented Apr 11, 2020

Ugh. The panel is setting a _NET_WM_STRUT_PARTIAL that is lying to QuickTile and claiming there's one panel 1920px wide and 0px tall.

In other words, it's a bug in your panel. QuickTile is reacting in accordance with the spec because that's what you'd expect for an auto-hiding panel that takes up no space when hidden and overlaps windows when shown.

I'm honestly not sure how I'd fix that aside from maybe allowing a "refuse to overlap this" entry in quicktile.cfg where you specify a window class and any windows which match it have fake _NET_WM_STRUT_PARTIAL exclusions synthesized from their dimensions.

@ssokolow ssokolow added this to the JSON Config milestone Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants