ssokolow / quicktile

Adds window-tiling hotkeys to any X11 desktop. (An analogue to WinSplit Revolution for people who don't want to use Compiz Grid)
https://ssokolow.com/quicktile/
GNU General Public License v2.0
869 stars 78 forks source link

Incorrect Monitor Geometry #115

Closed jacklumber closed 4 years ago

jacklumber commented 4 years ago

Such a convenient quick way to manage windows, thank you!

Using on a laptop it works perfectly, when I connected an external monitor (4k TV) and selected only the external monitor to be used it seems like QuickTile is only using the top left quadrant as the tiling right only moves to the center of the screen and tiling bottom to half way down.

inxi -S Kernel: 4.15.0-88-generic x86_64 bits: 64 Desktop: Xfce 4.14.1 Distro: Linux Mint 19.3 Tricia

xdpyinfo | grep -B 2 resolution screen #0: dimensions: 3840x2160 pixels (1016x572 millimeters) resolution: 96x96 dots per inch

./quicktile.sh --daemonize --debug DEBUG: Loaded monitor geometry: [Rectangle(x=0, y=0, width=1920, height=1080)]

Please let me know what other details I need to provide or how I can help solve this issue. Thanks.

ssokolow commented 4 years ago

Are you running the 4K TV with 2x scaling? I have a likely fix for your problem that I got side-tracked from merging into master. Try the hidpi_fix branch and let me know if that works as expected.

Here's how the problem I suspect you're encountering works:

  1. I don't have any monitors bigger than 1920x1080 and certainly no HiDPI monitors and issue #113 introduced me to the discovery that GDK and libWnck handle HiDPI differently.
  2. libWnck, being concerned with window management across the whole desktop, which could be made up of varying DPI monitors, works in device pixel coordinates. If the screen is 4K, the API call to reposition a window expects dimensions in 4K.
  3. libWnck doesn't have API calls to get monitor rectangles, so I rely on GDK for that.
  4. GDK is normally used for writing more ordinary applications, so it pre-scales coordinates so that something HiDPI-unaware that gets scaled up will continue to Just Work™.
  5. Because of this, if you're running a 4K with 2x scaling and ask GDK what the monitor rectangle is, it reports 1920x1080 rather than 3840x2160.
  6. The hidpi_fix branch adds calls to explicitly translate between device and application pixels when making GDK calls.

If it seems to work for you, please test it as thoroughly as you can so I have that little bit of extra confirmation that I didn't introduce any bugs before I merge the branch to master.

ssokolow commented 4 years ago

The hidpi_fix branch has now been merged to master and I'm going to assume that fixes your problem for lack of a reply.

jacklumber commented 3 years ago

Sorry just saw this! No scaling but the problem no longer occurred after setting a 4K resolution with via xrandr. Thank you for the support! Would you like me to verify the latest on master doesn't have the above issue using 2X scaling?

ssokolow commented 3 years ago

Sorry just saw this!

That's OK. I'm sure I have plenty of other things which I lost track of, so I can sympathize.

Would you like me to verify the latest on master doesn't have the above issue using 2X scaling?

A test would be appreciated since I still don't have any HiDPI hardware to test with myself.