domferr / tilingshell

Extend Gnome Shell with advanced tiling window management. Supports multiple monitors, Windows 11 Snap Assistant, Fancy Zones, customised tiling layouts and more.
https://extensions.gnome.org/extension/7065/tiling-shell/
GNU General Public License v2.0
199 stars 3 forks source link

Window dragged by titlebar from a "snapped position" is offset relatively to the mouse #60

Open T3sT3ro opened 5 days ago

T3sT3ro commented 5 days ago

Describe the bug When I try to drag a window by titlebar from the maximized view or from a quarter tiling, the mouse is offset to the right relatively to the window it's dragging.

To Reproduce Steps to reproduce the behavior:

  1. Open the extension settings window
  2. Resize it to around 1/3 width and length of the screen
  3. maximize the window by dragging it to the top of the screen
  4. now, grab the window by the title bar on the right side, right next to the close/maximize/minimize icons

Screenshots https://github.com/domferr/tilingshell/assets/5300963/1115008a-0b52-4e68-980d-73c778780d92

Information (please complete the following):

domferr commented 5 days ago

Hi, thank you for reporting this bug!

It does happen all the time right? Doesn't matter if you grab on the right or on the left?

domferr commented 5 days ago

Uh, since I haven't GNOME 42.9 and I can't reproduce the problem, I have another question: does it happen even if the window IS NOT maximized? Thank you, let's fix this!

T3sT3ro commented 4 days ago

Hi, thank you for reporting this bug!

It does happen all the time right? Doesn't matter if you grab on the right or on the left?

Yes, it happens all the time, although the window is offset to the left, so grabbing by the right side makes it more visible. I noticed that there is a certain region starting from around the midpoint of the titlebar going all the way to the right that makes the bug appear, dragging be the left half of the titlebar seems to work OK.

does it happen even if the window IS NOT maximized?

It happens when I drag the window from any "snapped" position, be it a corner quarter area, maximized, or even the center area in the 1:3:1 vertical layout

As for the repro: maybe you could try reproducing it on a bootable ubuntu from USB or from a VM somehow?

T3sT3ro commented 4 days ago

I have some intuition about why this might be happening: The window that is in the snapped area has certain width, and when it's dragged by the titlebar it's reverting to it's original size. So when the window was initially smaller, and got stretched by snapping to the bigger area (maximized or to a corner area), the mouse "pivot/drag point" is calculated from the area width, and that is then used to offset the now smaller window. I tried eyeball testing it and it seems to be that: when the window is dragged by the title bar from it's snapped position it snaps to the left edge of it's layout area instead, but it should snap to the mouse instead

domferr commented 4 days ago

Thank you for the details, you're awesome! I tried to run a VM, but I didn't get it working for some reasons.

Thanks to the details you shared, I tried to implement a bug fix (but without testing it on GNOME 42). I will try again later this day to run a VM with GNOME 42 (probably Fedora 36).

domferr commented 4 days ago

Ok, it is NOT fixed ahahha I'm able to assign the right offset to the window when it is grabbed, but then for some reasons unknown to me, GNOME 42 reassigns again the old position (which has a bad offset). Indeed in this video, the window gets positioned in the right place for a moment and then its position is set back with a wrong offset. The first time, the position is assigned by Tiling Shell, while the second time by GNOME.

Screencast from 2024-06-28 18-25-19.webm

I'm sorry to say that this needs more time to be fixed. I'm happy that, thanks to you, I can reproduce the problem! Hope to have news soon.

Meanwhile, you can disable from the preferences the feature "Restore window size", that puts the window back to the old size, so you can enjoy Tiling Shell without this bug!

domferr commented 4 days ago

@T3sT3ro I made a bug fix, which solves the problem on my VM with GNOME 42. I leave here the files with the bugfix, so you can try it in advance. If you do, please let me know if it solves the problem!

GNOME.42-44.tilingshell@ferrarodomenico.com.zip

T3sT3ro commented 3 days ago

Hello, I tested the zip you sent and it looks like the initial issue is solved!

I noticed another, maybe related bug, however: if you click and move the mouse fast enough, the window can still be offset for some reason. Almost as if the window position was calculated on a different frame than the drag start. The attached video shows this case in the third attempt (around 00:12, first two attempts look OK)

https://github.com/domferr/tilingshell/assets/5300963/2c607a14-fb80-4110-9a7f-492027357d5c

domferr commented 3 days ago

Thank you @T3sT3ro for testing this out, I'm happy that the main bug is solved. Thanks for the video!