helloSystem / Filer

A file manager that can also render the desktop
GNU General Public License v2.0
30 stars 9 forks source link

Folder/window open/close animations #160

Open probonopd opened 1 year ago

probonopd commented 1 year ago

https://user-images.githubusercontent.com/2480569/205427507-d85e67d5-e5fc-48ca-990c-16c784d98f72.mp4

We want this kind of animation whenever a folder is double-clicked in Filer, to visuallly conect the closed folder icon with the window that gets opened when the icon is double-clicked. Same for closing.

https://twitter.com/reionwong/status/1359573324704137219

ICCCM/EWMH has WM_ICON_GEOMETRY:

This optional property MAY be set by stand alone tools like a taskbar or an iconbox. It specifies the geometry of a possible icon in case the window is iconified.

Rationale: This makes it possible for a Window Manager to display a nice animation like morphing the window into its icon.

Geometry of iconified view so window manager can animate iconify: WM_ICON_GEOMETRY

Code:

https://github.com/freedesktop-unofficial-mirror/xcb__util-wm/blob/24eb17df2e1245885e72c9d4bbb0a0f69f0700f2/ewmh/ewmh.c.m4#L1067-L1099

Do we have to set WM_ICON_GEOMETRY (e.g., using NETWinInfo::setIconGeometry) whenever we create a Filer window, to the coordinates of the icon that was double-clicked to open the window? When the window is about to be closed, we would need to figure out the coordinates of the icon again, since the window which contains the icon may have been moved or closed in between.

According to https://github.com/lxqt/lxqt/issues/587#issuecomment-92379547

The icon geometry stuff is for WMs which support animations when minimizing windows. When you minimize a window, many WMs use that rectangle as the destination of their animations. For example, openbox is one of these WMs.

Would KWin use WM_ICON_GEOMETRY when opening and closing windows? Or only when minimizing/unminimizing windows? We need it for opening and closing. Could we write a KWin plugin for that?

Would Filer need to set the icon geometry whenever we receive KWindowSystem::windowChanged on one of the Filer windows? We would need to check whether there is a Filer window that contains the icon for that window, and set the window's WM_ICON_GEOMETRY to that.

NETWinInfo info(QX11Info::connection(),...;
info.setIconGeometry(...);

https://github.com/lxqt/lxqt-panel/pull/166/files

But: How would we set the WM_ICON_GEOMETRY for windows that are about to be launched and are not yet on screen, e.g., when launching?

Idea:

The following does not work quite yet, how to construct a NETWinInfo?

        KWindowInfo info(id, NET::WMPid);
        const QList<WId> winIds = KWindowSystem::windows();
        for (WId cand_id : winIds){
            KWindowInfo cand_info(cand_id, NET::WMPid);
            if(cand_info.pid() == info.pid())
                NETWinInfo nwi = NETWinInfo(QX11Info::display(), cand_id, QX11Info::appRootWindow(), NET::WMState, NET::Role::Client);
                nwi.setIconGeometry(NETRect(QRect(0,0,10,10)));
                KWindowSystem::minimizeWindow(cand_id);
        }
louies0623 commented 1 year ago

Now that there is no Dock, the animation of the window will move to the upper right corner.

louies0623 commented 1 year ago

Is it like this animation ?(picture selection is bad) experimental_low2

probonopd commented 1 year ago

Yes, that is what we need. but slower and less flickery ;-)

louies0623 commented 1 year ago

https://user-images.githubusercontent.com/44593430/210047790-607fc1dc-0c1a-4546-8087-0a2c9d09ca9c.mp4

probonopd commented 1 year ago

Yes, something like this.