Bug 408504 - Krita 4.2.0 window does not tile to left or right side of screen
Summary: Krita 4.2.0 window does not tile to left or right side of screen
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.2.1
Platform: Ubuntu Linux
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-10 00:07 UTC by Chris Van Nooten
Modified: 2019-07-10 14:26 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Van Nooten 2019-06-10 00:07:37 UTC
SUMMARY
Krita 4.2.0 does not tile to left or right side of screen

STEPS TO REPRODUCE
1. Install Krita 4.2 or later on Ubuntu 18.04 or later
2. Open Krita
3. Attempt to tile window left or right (dragging to left or right edge or the keyboard shortcut "winkey + left / right arrow")

OBSERVED RESULT
Does not tile the window to the left or right side of the screen

EXPECTED RESULT
Tile window on left or right side of the screen

SOFTWARE/OS VERSIONS
Linux: Ubuntu 19.04
Qt Version: 5.12.3
Gnome:3.32.1
and
Linux: Ubuntu 18.04
Qt Version: 5.9.5
Gnome:3.28.2

ADDITIONAL INFORMATION
I can still tile on the Krita 4.1.5 app image on both versions of Ubuntu.
"Winkey + Shift + left/right arrow" still allows me to change the monitor position of the window.
Other programs do tile by dragging or the above mentioned shortcut.
Attempted with the kritalime PPA, the snap package, the 4.2.1 (and 0) appimage and the 4.3.0-prealpha from the kritalime PPA, problem persisted across all.
Comment 1 Halla Rempt 2019-06-10 11:48:19 UTC
Hi Chris,

I just tested this on a fresh Ubuntu 19.04 VM and it works for me out of the box with the Krita 4.2.1 appimage. 

In general, window management isn't something Krita does itself; that's up to the window manager, and we cannot influence it at all: it's hard to imagine how this could be an actual bug in Krita itself.
Comment 2 Chris Van Nooten 2019-06-10 16:37:23 UTC
(In reply to Boudewijn Rempt from comment #1)
> Hi Chris,
> 
> I just tested this on a fresh Ubuntu 19.04 VM and it works for me out of the
> box with the Krita 4.2.1 appimage. 
> 
> In general, window management isn't something Krita does itself; that's up
> to the window manager, and we cannot influence it at all: it's hard to
> imagine how this could be an actual bug in Krita itself.

Hello Rempt,

Thank you for taking the time to reply, your reply gave me the impression it might have been an issue with configuration files left from previous installation unfortunately when I attempted myself to run Krita 4.2.1 app image in a clean 19.04 VM it still exhibited the exact same result.

While I understand that windows management is not something krita controls, the oddity is that only 1 other program acts this way, namely Steam and even there the newly introduced chat client acts normal, meaning clearly it is an issue with the Steam client main window and not the window manager as every other program (chrome, firefox, blender etc etc) acts as it should.

As does the older Krita 4.1.5 again on 2 separate machines. Meaning something in Krita 4.2.0 and onward has changed that affected this behavior as reverting to an older version fixes it.

With your idea of utilizing a VM I also tested on Fedora Workstation 30, which also has Gnome 3.32.1, just to make sure it is not Ubuntu specific.
I still get the same issue, if you want I can document it by screen recording.
Comment 3 Halla Rempt 2019-06-11 11:52:08 UTC
Yes, maybe make a screen recording, because I just cannot reproduce this issue, and I also cannot understand how it could possibly have something to do with Krita.
Comment 4 Chris Van Nooten 2019-06-11 19:20:28 UTC
(In reply to Boudewijn Rempt from comment #3)
> Yes, maybe make a screen recording, because I just cannot reproduce this
> issue, and I also cannot understand how it could possibly have something to
> do with Krita.

Here is the google drive link to a video exposing the problem:
https://drive.google.com/file/d/1CKdow15qDB5QBW5zXT8KgKQ83V5W645K/view?usp=sharing

Ironically I found the problem just after uploading it, Krita 4.2.0 and beyond takes up more than half the screen space on 1080P with the minimum width just like the main Steam Window does, when you use the default Windows manager it seems that you cannot tile windows that have a larger minimum width than half the screen would be (so for me less than 960 pixels), 4.1.5 takes what seems to be only 1/3th of the screen at the smallest width, thus I could tile it while 4.2.0 takes about 6/10th at the smallest width resulting in this behaviour.

My guess is that you have a 4K or a 1440P screen and that the minimum width is a set pixel value as opposed to a percentage , at least that is my theory why you couldn't replicate it.
Considering how inadequate my knowledge on CPP, QT5 and the Krita source code is, I do not know which commit changed this value let alone where it is stored, but I think it is a save bet that the problem lies here.
Comment 5 Chris Van Nooten 2019-06-14 19:36:37 UTC
Update:
So after sharpening my C++ skills, I went into the source code in search of answers. A very noticeable thing to me was that the largest difference in UI from 4.1 to 4.2 was the inclusion of the news widget, I took a 4.2.0-prealpha commit that existed before the addition of the newswidget and after compiling I could still tile the window.

I took the branch eb93795423ff8b59aa6d6cc88feb534f4e4672a1, which should be the one the newswidget was added, after compiling it and running I was indeed unable to tile the window, however by simply changing the minimumSize Property for recentDocumentsListView from 300 to 250 inside the KisWelcomPage.UI I was able to tile the window, however if I change my resolution to something lower or even turn off "Auto hide the dock" I am unable to tile again.

I wanted to test this in the Master branch but with both the Master Branch and the Krita 4.2 branch I kept getting:
[  8%] Linking CXX shared module kritalcmsengine.so
[  8%] Built target kritalcmsengine
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Which is odd as building with the commit header above worked fine even after I switched back. Using "rm -rf build" and building from scratch did not resolve the issue. I will try again later using the official KDE repository as opposed to the Github mirror.

Regardless the addition of the newswidget seemed to have affected the minimum width and in turn the ability to tile the window on the 1920X1080 and below display setting at least in Gnome, I also noticed that by leaving out the "Enabled" text I could make the window even smaller and tile with the dock not hiding, a proposition would be to substitute it with "Show" or perhaps setting it as an item below the "News" title.
I would commit this myself but as I cannot build using the master I rather not commit untested code even if it is a UI change (and I don't know if this will be seen as proper cause for it).
Comment 6 Halla Rempt 2019-06-21 08:31:49 UTC
Hm, if I make my display really tine (1280xsomething), I can still tile the window to the left. The landing page gets distorted a lot and labels overwrite each other, but it's still tiling.
Comment 7 Halla Rempt 2019-06-21 08:37:39 UTC
If I make the Ubuntu vm really small, it doesn't work. It's as if the Gnome window manager checks the window's preferred minimum size, while Plasma's kwin forces the window to be as small is kwin wants it to be. 

I'm not really sure what to do here. We cannot detect that the user wants to make the window smaller than its preferres size before it the user tries to do that, and if the window manager refuses to make the window smaller, krita will never know about it. Maybe we can put the central widget in a scroll area...
Comment 8 Halla Rempt 2019-07-10 14:08:20 UTC
Git commit b1cdd068348243337a96e30d615f363ac4419d5e by Boudewijn Rempt.
Committed on 10/07/2019 at 14:07.
Pushed by rempt into branch 'master'.

Put the hello widget in a scroller

So it doesn't affect the minimum width of the main window.

M  +9    -1    libs/ui/KisMainWindow.cpp

https://invent.kde.org/kde/krita/commit/b1cdd068348243337a96e30d615f363ac4419d5e
Comment 9 Halla Rempt 2019-07-10 14:26:24 UTC
Git commit 7dc3527003b9c81533bca8399da257eebda07759 by Boudewijn Rempt.
Committed on 10/07/2019 at 14:26.
Pushed by rempt into branch 'krita/4.2'.

Put the hello widget in a scroller

So it doesn't affect the minimum width of the main window.

M  +9    -1    libs/ui/KisMainWindow.cpp

https://invent.kde.org/kde/krita/commit/7dc3527003b9c81533bca8399da257eebda07759