Bug 463581 - Magic lamp effects folds the window around a horizontal line
Summary: Magic lamp effects folds the window around a horizontal line
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (show other bugs)
Version: 5.26.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-29 08:25 UTC by yunusaydin590
Modified: 2023-05-18 23:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.27.6


Attachments
Video for demonstrating the effect (28 bytes, text/plain)
2022-12-29 08:30 UTC, yunusaydin590
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yunusaydin590 2022-12-29 08:25:56 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Go to System Settings > Workspace Behavior > Desktop Effects
2. Enable Magic Lamp under Appearance and click apply
3. Try to minimize a window

OBSERVED RESULT
The window that I'm trying to minimize just folds around a random horizontal line

EXPECTED RESULT
Working magic lamp effect

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch linux x86_64 6.1.1-arch1-1
(available in About System)
KDE Plasma Version: 5.26.4-1
KDE Frameworks Version: 5.101.0-1 
Qt Version: 5.15.7

ADDITIONAL INFORMATION
I've also tried yet-another-magic-lamp from zzag. It didn't work either. It just slid the window to the bottom.
Comment 1 yunusaydin590 2022-12-29 08:30:30 UTC
Created attachment 154875 [details]
Video for demonstrating the effect
Comment 2 Nate Graham 2023-01-06 21:25:49 UTC
Do you have multiple monitors, or did you at some point in the recent past?

Are you using X11 or Wayland?

If you're using X11, do you have the PLASMA_USE_QT_SCALING environment variable set in your environment?
Comment 3 yunusaydin590 2023-01-07 06:59:30 UTC
(In reply to Nate Graham from comment #2)
> Do you have multiple monitors, or did you at some point in the recent past?
> 
> Are you using X11 or Wayland?
> 
> If you're using X11, do you have the PLASMA_USE_QT_SCALING environment
> variable set in your environment?

1) No I've never connected another monitor
2) I am using X11
3) Nope, I don't have that variable

By the way I've check this again yesterday and it seems like update fixed it. I'm on 5.26.5 right now.
Comment 4 Nate Graham 2023-01-09 17:44:00 UTC
Ok, thanks.
Comment 5 Vlad Zahorodnii 2023-05-15 16:41:39 UTC
Git commit 124d9154087537b927953abaec90450df2ac8f85 by Vlad Zahorodnii.
Committed on 15/05/2023 at 16:31.
Pushed by vladz into branch 'master'.

effects/magiclamp: Improve animation direction heuristic

If the panel is placed between two outputs, the magic lamp can pick
wrong direction and the animation will look bad.

This change improves the direction heuristic by making it analyze the
position of the center point of the screen where the window is relative
to the center point of the icon in the task manager.

The screen center is used instead of the window center in order to
properly handle edge cases such as where the window center is offscreen.

For example, if the panel is vertical (e.g. it's attached to the left
side of a monitor), the magic lamp will pick the following directions:

- if the window is to the left side of the panel, the window will be
  animated so it moves to the right hand side
- if the window is to the right side of the panel, the window will be
  animated so it moves to the left hand side

Without this change, the window will always move to the left hand side.

M  +4    -4    src/plugins/magiclamp/magiclamp.cpp

https://invent.kde.org/plasma/kwin/commit/124d9154087537b927953abaec90450df2ac8f85
Comment 6 Vlad Zahorodnii 2023-05-16 06:19:24 UTC
Git commit 575f56b5e6bebc3861cde28631acc3b927c310e1 by Vlad Zahorodnii.
Committed on 16/05/2023 at 06:02.
Pushed by vladz into branch 'Plasma/5.27'.

effects/magiclamp: Improve animation direction heuristic

If the panel is placed between two outputs, the magic lamp can pick
wrong direction and the animation will look bad.

This change improves the direction heuristic by making it analyze the
position of the center point of the screen where the window is relative
to the center point of the icon in the task manager.

The screen center is used instead of the window center in order to
properly handle edge cases such as where the window center is offscreen.

For example, if the panel is vertical (e.g. it's attached to the left
side of a monitor), the magic lamp will pick the following directions:

- if the window is to the left side of the panel, the window will be
  animated so it moves to the right hand side
- if the window is to the right side of the panel, the window will be
  animated so it moves to the left hand side

Without this change, the window will always move to the left hand side.
(cherry picked from commit 124d9154087537b927953abaec90450df2ac8f85)

M  +4    -4    src/effects/magiclamp/magiclamp.cpp

https://invent.kde.org/plasma/kwin/commit/575f56b5e6bebc3861cde28631acc3b927c310e1