Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Close button hidden after taking screenshot under kwin #588

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

Closed
fabianski7 opened this issue Feb 20, 2021 · 15 comments
Closed

Close button hidden after taking screenshot under kwin #588

fabianski7 opened this issue Feb 20, 2021 · 15 comments
Assignees
Labels

Comments

@fabianski7
Copy link
Contributor

This is a rather strange bug that I initially thought about reporting on bugs.kde.org, but ksnip is the only application where this is happening.

The bug looks like this

  1. The minimized start option in the systray is active
  2. After opening, I use a global hotkey to take a screenshot
  3. When ksnip is opened with the screenshot, the close button is partially hidden
Screenshot

spectacle_20210220_165950

Video
simplescreenrecorder2-2021-02-20_13.06.35.mp4

This does not happen when ksnip is opened directly (without taking a screenshot).
And if the window is resized to a larger size, the button is shown.

@DamirPorobic
Copy link
Member

That part of the window is not ksnip responsibility, it should be window manager responsibility. I believe I have seen this on other windows, for me it occurs often for CLion windows when started and I thought it was some strange KDE usability thing.

Can you please check with KDE if that issue was reported there already?

@fabianski7
Copy link
Contributor Author

I'll try to talk to some KDE developer. Sorry for bugging your software

@Xarkam
Copy link

Xarkam commented Mar 19, 2021

Hello,

Sorry to comment on a closed issue, but I have doubts about a kwin bug.

I have observed this behavior:

I make ksnip appear by double clicking on the systray icon.
An image is present, the titlebar buttons are all present.
When I close the image, the ksnip window resizes and at that point, the close icon in the titlebar disappears.

I had this kind of problem before with Rider and it was not a problem with kwin but directly in Rider. Maximizing Rider's window made the close icon disappear.

@DamirPorobic
Copy link
Member

DamirPorobic commented Mar 19, 2021

Hey Benjamin, no need to be sorry, I'll open the bug again if there is something we can do.

I'm still not convinced that this is not a kwin issue because:

  1. ksnip doesn't know about any window frames, there might not be a frame at all as far as ksnip is concerned. We cannot influence the behavior directly, only by asking the manager nicely and hope it honers our request. In this case we resize ourselves and hope that the window manager knows how to draw the border around our widget.
  2. The issue only happens with kwin as far as I know.
  3. It happens with other applications too, like Rider or CLion (ok, both from JetBrains).

Anyways, my whining around doesn't help us here. Do you have the kwin issue that was logged for this? Maybe we can find a workaround.

@DamirPorobic DamirPorobic reopened this Mar 19, 2021
@DamirPorobic DamirPorobic self-assigned this Mar 19, 2021
@DamirPorobic DamirPorobic changed the title Title bar with the close button hidden Close button hidden after taking screenshot under kwin Mar 19, 2021
@Xarkam
Copy link

Xarkam commented Mar 19, 2021

Hi @DamirPorobic before opening an issue i asked the question in the reddit kde sub. I await a response from them.

@DamirPorobic
Copy link
Member

I think I found what is triggering this issue, it's a workaround for Qt that allows us to return to the initial minimal size after for example closing all tabs. We set temporarily a fixed size, resize, then revert back to adjustable size:

mMainLayout->setSizeConstraint(QLayout::SetFixedSize); 
QMainWindow::adjustSize();
mMainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);

Removing the first line fixes the issue. I think the problem comes from the first line changing the available buttons on the title bar, with fixed size you probably have only two, minimize and close but not maximize because the size if fixed. Then we adjust the size, the frame size is calculated together with the position for the buttons which is probably frame width minus size of two buttons, that's where kwin starts drawing the buttons. Next, we make the window resizeable again, now we have three buttons again, the maximize button comes between the minimize and close button but kwin doesn't recalculate the starting position for the buttons and tries to squeeze three buttons where are only two supposed to be. IMHO kwin should recalculate the button position whenever the button count changes.

@Xarkam
Copy link

Xarkam commented Mar 19, 2021

Yes, that would make sense. Maybe we should open an issue on bugs.kde.org to find out if there is another way to do it.

@DamirPorobic
Copy link
Member

DamirPorobic commented Mar 19, 2021

I have logged a KDE issue for this https://bugs.kde.org/show_bug.cgi?id=434620

I'm also linking your reddit post here for reference https://www.reddit.com/r/kde/comments/m8c88r/no_titlebar_close_button_on_ksnip_after_capture/grguguy/?newUser=true

I have also tried some workarounds to fix this behavior but non seem to work unfortunately. Let's see what the KDE guys say.

@Xarkam
Copy link

Xarkam commented Mar 19, 2021

Nice. We just have to wait :)

@DamirPorobic
Copy link
Member

Ok, maybe I did found an improvement. On my KDE Plasma the close button is visible after taking screenshots and hidden only after closing all tabs. Not perfect but better then what we had earlier. Can you test if you see an improvement, just give the CI some time to build the packages.

@DamirPorobic DamirPorobic added bug and removed finding labels Mar 19, 2021
@Xarkam
Copy link

Xarkam commented Mar 19, 2021

I'm testing this on Monday :)

@fabianski7
Copy link
Contributor Author

what version of plasma and kwin are you using?
since the last updates i haven't had this problem anymore

@Xarkam
Copy link

Xarkam commented Mar 19, 2021

what version of plasma and kwin are you using?
since the last updates i haven't had this problem anymore

Me, I use kde neon. This use latest version of kde plasme, qt framework, etc...

@Xarkam
Copy link

Xarkam commented Mar 22, 2021

I have the button as described above.

@DamirPorobic
Copy link
Member

Ok, I'm going to close this issue as I don't expected any feedback soon from the KDE guys. When somethings happens later on I'll take care of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants