Commit Graph

71 Commits

Author SHA1 Message Date
Ivan Molodetskikh a09a073d2d Rename variables to be less confusing 2023-10-21 20:58:30 +04:00
Ivan Molodetskikh ccce8d3141 Crop workspaces during transition tightly 2023-10-21 20:58:30 +04:00
Ivan Molodetskikh f7669a55ad Add binds to move workspaces up and down 2023-10-14 20:42:44 +04:00
Ivan Molodetskikh 736191e826 Add check for no empty workspaces invariant 2023-10-14 20:42:44 +04:00
Ivan Molodetskikh d1f431fd7e Fix moving empty workspaces to original output 2023-10-14 20:42:44 +04:00
Ivan Molodetskikh c29fdcaccb Fix by-idx workspace actions not cleaning up 2023-10-14 20:42:44 +04:00
Ivan Molodetskikh 8a08e01a2d Fix removing output not keeping empty focus on primary 2023-10-14 20:42:44 +04:00
Ivan Molodetskikh 1831d68915 Fix assertion message 2023-10-14 20:42:44 +04:00
Ivan Molodetskikh 3602876b5e Add a few more Tracy spans 2023-10-11 14:53:53 +04:00
Ivan Molodetskikh 1d66f1b81e Draw focus ring as border on SSD windows
With SSD we're reasonably sure that the window is a rectangle with no
rounded corners, so a rectangular border should work.
2023-10-11 14:32:29 +04:00
Ivan Molodetskikh b283f546aa layout: Store location in FocusRing 2023-10-11 11:56:38 +04:00
Ivan Molodetskikh c8105ae1a6 Add screenshot-window action 2023-10-10 12:42:24 +04:00
Ivan Molodetskikh e70e660df6 Add barebones three-finger-swipe workspace switch
Notable omission is velocity tracking.
2023-10-08 09:57:59 +04:00
Ivan Molodetskikh 497e52da59 Update bounds of toplevel windows 2023-10-07 17:50:45 +04:00
Ivan Molodetskikh 994bc64679 Add gaps setting
The past few refactors have led up to this point, and now it's finally
possible.
2023-10-07 17:45:55 +04:00
Ivan Molodetskikh 624b3296e9 layout: Refactor view offset, padding, work area handling
Fixes broken padding on fullscreen windows, especially with struts on
the sides present.

It is now view offset's job to include padding and struts.
2023-10-07 10:47:51 +04:00
Ivan Molodetskikh 23b59b40aa layout: Add every_op test from starting state 2023-10-05 09:59:28 +04:00
Ivan Molodetskikh 8491ba593e layout: Handle padding in ColumnWidth::resolve() 2023-10-05 09:29:39 +04:00
Ivan Molodetskikh 6fcdb41922 Refactor layout for configurability, add preset-column-widths option
layout.rs finally gets a struct actually named Layout.
2023-10-05 09:25:07 +04:00
Ivan Molodetskikh 3ac1607406 layout: Store view size in Columns 2023-10-04 15:45:30 +04:00
Ivan Molodetskikh 7558ac14e6 Add set-column-width action 2023-10-03 11:38:42 +04:00
Ivan Molodetskikh 5b6b3fcfbe Avoid sending frame callbacks to invisible surfaces 2023-10-01 19:41:42 +04:00
Ivan Molodetskikh 751345759a Make find_window_and_output() accept non-mut self 2023-10-01 06:29:33 +03:00
Ivan Molodetskikh 6f8ad18d9a Compute view offset relative to anim target
This enables quickly tapping focus right-left to keep typing in the
current window while showing the next window.

Resolves https://github.com/YaLTeR/niri/issues/26
2023-09-30 17:29:57 +04:00
Ivan Molodetskikh a3aa5fca12 Refactor frame scheduling
Combine the redraw state variables into one enum, and refactor to get
rid of the requirement that a VBlank must queue a subsequent redraw.
Also fix the bug where ongoing animations that produced no damage could
stall the redrawing.
2023-09-30 17:13:56 +04:00
Ivan Molodetskikh 404661ed8d Throttle frame callbacks to once per monitor refresh
Under some circumstances, the compositor can get into a commit-frame
callback busy loop with a client. For example, if a client redraws on
frame callbacks, but the resulting frame has empty damage (e.g. the
damaged part of the client is outside the monitor). Or if the client
simply commits with empty damage (looking at you, Firefox).

This behavior is compliant with the Wayland specification and with the
intended idea of frame callbacks, but causes a lot of unnecessary CPU
usage in the client and the compositor.

To solve this problem, this commit introduces frame callback throttling.

Every surface may only receive a single frame callback in one
monitor refresh cycle. If a surface commits resulting in no KMS frame
submission, a timer is created, that will fire at the predicted would-
be-VBlank time, and send the accumulated frame callbacks.

This way, a surface that redraws on frame callbacks will not notice
any change in frame callback delivery, if its commits suddenly stop
producing KMS updates.
2023-09-29 13:12:50 +04:00
Ivan Molodetskikh 73fd286f34 layout: Add communicate op to tests 2023-09-28 08:59:45 +04:00
Ivan Molodetskikh 1572ef75bd layout: Refresh windows too
This will send output enter/leave to new popups.
2023-09-28 08:26:17 +04:00
Ivan Molodetskikh cf123ddcd0 layout: Use actual working area on workspace creation
Fixes https://github.com/YaLTeR/niri/issues/19
2023-09-27 17:39:42 +04:00
Ivan Molodetskikh 06d15e4adc layout: Add more ops for proptest to play with 2023-09-27 13:45:49 +04:00
Ivan Molodetskikh 31ea816d2b layout: Add randomized test 2023-09-27 13:35:02 +04:00
Ivan Molodetskikh f2e28f54d6 Fix test name 2023-09-27 13:09:39 +04:00
Ivan Molodetskikh d3735227ce Fix panic when the last window on previous workspace is closed 2023-09-26 20:42:16 +04:00
Ivan Molodetskikh 5ad5f29a92 Extract check_ops 2023-09-26 20:41:55 +04:00
Ivan Molodetskikh 756997ca83 Fix panic when adding previously-removed output sometimes 2023-09-26 20:36:48 +04:00
Ivan Molodetskikh b7be8fcb75 Fix verify_invariants() asserts 2023-09-26 20:35:08 +04:00
Ivan Molodetskikh 953d1064c2 Add layer shell exclusive zone support 2023-09-26 20:12:04 +04:00
Ivan Molodetskikh a62e1cbef6 Make focus ring configurable 2023-09-26 13:45:03 +04:00
Ivan Molodetskikh f58e56d65a Add focus rings 2023-09-24 18:11:20 +04:00
Ivan Molodetskikh 51df1aba01 layout: Focus prev column when removing just created column
This works similar to tabs in Firefox: when you create a tab and then
close it without focusing any other tabs, the focus returns to the
previously-focused tab, rather than the usual next tab. The logic is
that in this case, the new tab was likely transient, and the user wants
to get right back to what they were doing.

In niri's case, this also serves as a workaround for wl-clipboard
spawning and destroying a window, messing up the focus.
2023-09-24 10:08:43 +04:00
Ivan Molodetskikh b3b1e082ac layout: Preserve active column when column to the left is removed 2023-09-24 09:42:49 +04:00
Ivan Molodetskikh 109668fa30 Add output configuration & integer scaling support 2023-09-21 13:48:50 +04:00
Ivan Molodetskikh cfa73c153c layout: Fix workspace output updating 2023-09-21 13:48:50 +04:00
Ivan Molodetskikh 37ec524264 Add by-index workspace commands and binds 2023-09-16 12:14:02 +04:00
Ivan Molodetskikh 46403bd84a layout: Correct view offset when swapping columns 2023-09-13 19:37:14 +04:00
Ivan Molodetskikh 219ca08836 Implement minimizing view movement on changes
Before this commit, windows were always left-aligned.

Now, when changing focus, if the window is fully visible, the view
doesn't move. If the window is not fully visible, the view is moved the
minimum amount.
2023-09-13 16:57:12 +04:00
Ivan Molodetskikh 84885fe5fb layout: Add tests for various operations 2023-09-12 19:46:12 +04:00
Ivan Molodetskikh 99b4ea6541 layout: Fix assertion in verify_invariants() 2023-09-12 19:46:12 +04:00
Ivan Molodetskikh 513763eaec layout: Replace add_window_to_output with add_window 2023-09-12 19:46:12 +04:00
Ivan Molodetskikh 18e29d0028 layout: Fix input to non-active window in column 2023-09-05 18:14:42 +04:00