Commit graph

64 commits

Author SHA1 Message Date
Ian Douglas Scott
9b12e76765 Rename DndWorkspaceDrag to DndToplevelDrag 2025-02-10 10:11:04 -08:00
Ian Douglas Scott
3d7d3823c4 Change workspace based on scroll events
Works, I'm not sure how many pixels to interpret as a change to the
workspace, and perhaps it should accumulate multiple deltas with a
timer. Assuming some lower level of the stack isn't doing that already.
I only see `ScrollDelta::Pixels` events, not `Lines`, though maybe
that's relevant with a different type of input device.

The behavior would also be clearer with animation, though it doesn't
seem to bad
(https://github.com/pop-os/cosmic-workspaces-epoch/issues/32).

Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/34.
2025-02-06 13:32:50 -08:00
Ian Douglas Scott
a977667ac5 Use updated screencopy abstraction
Requires https://github.com/pop-os/cosmic-protocols/pull/46.
2025-02-04 13:58:20 -08:00
Ian Douglas Scott
ba52d69421 Add workspaces_for_output helper function 2025-01-24 15:30:15 -08:00
Ian Douglas Scott
88b35e3027 Allow dropping window onto toplevel list area
Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/53.
2025-01-24 14:54:29 -08:00
Ian Douglas Scott
6838bd60be Remove unneeded field of DragSurface 2025-01-24 14:41:36 -08:00
Ian Douglas Scott
3dc82789f5 Move drag-and-drop related types to a dnd module 2025-01-24 14:28:42 -08:00
Ian Douglas Scott
efdfaed6c8 DropTarget enum instead of tuple; combine with DragId
I guess some change is needed for handling workspaces that span outputs
(can't encode both the workspace and output id in less than 64 bits, and
need bits for discriminant as well). But that's an issue with the
previous workspace index based approach.

I wonder if `drag_id` is really needed; libcosmic could check if the
drag is in bounds of the widget, if drag surfaces can't overlap...
2025-01-24 14:09:17 -08:00
Ian Douglas Scott
f532205bf9 view: Add DragId helper to manage multiple types of destinations 2025-01-24 13:24:13 -08:00
Adam Cosner
fd0bdeebbf feat: Workspace view closing by pressing current workspace or empty space 2025-01-23 20:02:16 -08:00
Vukašin Vojinović
fe1363ea42 fix(interface): align closer to designs 2025-01-15 11:49:54 -08:00
Ian Douglas Scott
764b4ae5f8 Apply screencopy transform to subsurfaces
Fixes https://github.com/pop-os/cosmic-workspaces-epoch/issues/17.
2025-01-15 10:18:50 -08:00
Ian Douglas Scott
b70828e23f Update iced/libcosmic 2025-01-13 10:26:45 -08:00
Ian Douglas Scott
686f4e764f Don't show background; rely on cosmic-comp for that
Requires https://github.com/pop-os/cosmic-comp/pull/609, or this will
show all the open windows.
2024-07-15 11:34:54 -07:00
Ian Douglas Scott
7ff45540e8 Deduplicate drag_surface code a bit 2024-07-15 11:32:07 -07:00
Ian Douglas Scott
e9e6cc275b Move drag surface view into a function
It's a bit clearer this way.
2024-07-10 18:41:34 -07:00
Ian Douglas Scott
594ecffa66 Apply both offset and alpha to drag surfaces 2024-06-12 09:40:13 -07:00
Ian Douglas Scott
30b0cfe17b Fix handling leave event to one widget after enter for another 2024-05-02 12:53:09 -07:00
Ian Douglas Scott
ccef25c40c Use subscription for cosmic-bg-config
Works, as long as a `config_state_subscription` is used.

Should also try caching image handles.
2024-05-02 08:05:51 -07:00
Ian Douglas Scott
6cca5476ab User hover style for drop target 2024-05-02 08:05:51 -07:00
Ian Douglas Scott
b635c10837 Add offset logic, commented
With large drag surfaces, and no tranparency, this seems a bit akward
when not dragging from near top left. May be better with cursor
indicator.
2024-05-02 08:05:51 -07:00
Ian Douglas Scott
249c62ee0a Update libcosmic/iced 2024-04-30 16:25:50 -07:00
Ian Douglas Scott
d759e1d7c2 Use cosmic_bg_config to get background
Scaling doesn't match `cosmic-bg`?
2024-04-30 12:49:08 -07:00
Ian Douglas Scott
96cca005b7 Rename inaccurately named widget 2024-04-25 14:17:43 -07:00
Ian Douglas Scott
8f571e9e25 Use custom style for workspace items
None of the default styles seem to work quite right here.
2024-04-25 14:10:09 -07:00
Ian Douglas Scott
7997d58ce7 Fix clippy lints 2024-04-24 13:51:20 -07:00
Ian Douglas Scott
76daf6e980 Update libcosmic/iced for drag-and-drop fixes 2024-04-24 12:46:57 -07:00
Ian Douglas Scott
a6548057b6 Don't hide toplevel until drag is started
Seems to fix behavior on Sway, but on Smithay still destroys the drag
grab once the surface that started it is gone.
2024-04-23 17:23:57 -07:00
Ian Douglas Scott
c75a48535a Add a mock backend for testing (including on other compositors)
Should help determine which issues are cosmic-comp bugs.
2024-04-23 13:44:59 -07:00
Ian Douglas Scott
09e03cd096 Hide toplevel from toplevel list when it is being dragged
Uses a custom wrapper widget, that makes `draw` do nothing when visible
is set to false.

This works well sometimes, but can cause weird bugs...
2024-04-19 15:28:16 -07:00
Ian Douglas Scott
bf2cd273f9 Add a no-subsurfaces feature for debugging 2024-04-01 15:13:51 -07:00
Ian Douglas Scott
094c28e105 cosmic-screencopy-v2 2024-03-25 10:24:47 -07:00
Ian Douglas Scott
7106001179 Address various warnings 2024-03-05 12:25:20 -08:00
Ian Douglas Scott
ea0de44e42 Remove workspace close button for now 2024-03-05 12:07:38 -08:00
Ian Douglas Scott
78b7bfe957 Use Wayland subsurfaces, dmabuf screencopy
More efficient than shm screencopy, and rendering an iced image into the
window. Done right, should espeically help with multiple GPUs, but more
testing and work is needed there.

Removes mmapping of dmabuf, which errored... I guess not allocated with
right options for that. Relevant only if we want a fallback/test that
involves reading dmabufs.

Using `OnDamage` doesn't seem to work correctly currently. Likely a
compositor issue.
2024-03-01 14:35:19 -08:00
Ian Douglas Scott
66fcf19ccc Run cargo update, and remove use of WorkspaceAmount
`WorkspaceAmount` has been removed from cosmic-comp for now.
2024-02-07 19:52:33 -08:00
Ian Douglas Scott
015f61922b Update libcosmic 2024-02-06 13:32:29 -08:00
Ian Douglas Scott
99aeca0f2f Custom Toplevels widget
Fixes centering on toplevels.

Need to use fewer hacks, and add equal scale factor.

See if Iced layout system can be improved.
2024-01-19 15:32:54 -08:00
Ian Douglas Scott
ec5dceeed2 Custom widget to avoid stretching toplevel items
Avoids close button aligned way to right. And fixes offset for drag
surface.

But left aligns workspaces (need new container?).
2024-01-19 14:42:06 -08:00
Ian Douglas Scott
bc0898fa0a Update dependencies 2024-01-03 10:57:47 -08:00
Ian Douglas Scott
b2f81b1a73 i18n 2023-12-26 13:54:29 -08:00
Ian Douglas Scott
79584a6d93 Improve handling of horizontal orientation 2023-12-18 19:59:09 -08:00
Ian Douglas Scott
899dfb0a3d Show icons for toplevels 2023-12-18 19:41:30 -08:00
Ian Douglas Scott
c8f0590a55 Spacing and alignment adjustments 2023-12-18 19:05:22 -08:00
Ian Douglas Scott
6053c527a8 Add some padding around workspaces 2023-12-18 18:47:38 -08:00
Ian Douglas Scott
06c37e39f5 WIP custom cursor for drag and drop 2023-12-15 15:46:41 -08:00
Ian Douglas Scott
5a69aff778 Adjust toplevel label style 2023-12-14 16:56:05 -08:00
Ian Douglas Scott
88fa8eecd1 Adjust styling around workspaces sidebar 2023-12-14 16:46:49 -08:00
Ian Douglas Scott
0cebd30600 Fix excessive vertical height taken by button 2023-12-14 16:29:45 -08:00
Ian Douglas Scott
1f4bed40fc Don't expand workspace preview to fill height 2023-12-14 16:24:25 -08:00