Commit graph

5656 commits

Author SHA1 Message Date
Ryan Dwyer 24a90e5d86 Remove cursor warping from seat_set_focus
Because cursor warping was the default behaviour in seat_set_focus,
there may be cases where we may have been warping the cursor
unintentionally. This patch removes cursor warping from seat_set_focus
and only does it in the focus command. This is managed by a static
function in focus.c.

To know whether to warp or not, we need to know which node had focus
previously. To keep track of this easily, seat->prev_focus has been
introduced and is set to the previous in seat_set_focus.
2018-10-18 23:08:45 +10:00
Drew DeVault 103b7bc47d
Merge pull request #2868 from emersion/xcursor-env
Export XCURSOR_SIZE and XCURSOR_THEME
2018-10-17 22:19:01 +02:00
emersion fd9198a3a4 Export XCURSOR_SIZE and XCURSOR_THEME
These can be used by toolkits (currently Qt, libxcursor, glfw) to
choose a default cursor theme and size.

This backports this rootston commit:
3a181ab430
2018-10-17 21:10:30 +02:00
Drew DeVault 10d07478ad
Merge pull request #2858 from RyanDwyer/fix-move-to-floating-ws
Fix moving tiled containers to workspaces which only have floating views
2018-10-17 16:16:12 +02:00
Drew DeVault 46dafbf74a
Merge pull request #2864 from sghctoma/freebsd-fixes
FreeBSD fixes
2018-10-17 16:14:35 +02:00
Drew DeVault e46c3ffbc9
Merge pull request #2861 from RyanDwyer/fix-empty-workspace-crashes
Fix crashes when running certain commands on an empty workspace
2018-10-17 16:13:05 +02:00
Drew DeVault 765c80e5f7
Merge pull request #2820 from Emantor/fix-mouse-warping-container
Fix mouse warping container
2018-10-17 15:57:13 +02:00
Drew DeVault 8d56269d9c
Merge pull request #2862 from SpeedJack/fix-stringop-overflow
Fix overflow in strcpy
2018-10-17 15:55:49 +02:00
sghctoma af2cfa5221 Set sysconfdir to /etc only if prefix is /usr
PR #2855 basically hardcodes the config file path to /etc, which is a
problem on e.g. FreeBSD, where the expected path for config files of
non-base software is '/usr/local/etc'.
Meson sets sysconfdir to '/etc' explicitly only when prefix is '/usr',
so it is still possible to use '/usr/local' as prefix, and install the
config files under '/usr/local/etc'. This commit allows to do that by
setting sysconfdir based on the value of prefix.
2018-10-17 15:28:18 +02:00
Niccolò Scatena 8c86fff6dc
Fix stringop-overflow warnings 2018-10-17 13:00:12 +02:00
Ryan Dwyer 17014c34e2 Fix crashes when running certain commands on an empty workspace
This fixes crashes when running the border, mark, unmark and
title_format commands on an empty workspace.
2018-10-17 19:55:00 +10:00
sghctoma 2694fd72b6 Increase _POSIX_C_SOURCE to 200112L
CLOCK_MONOTONIC appeared in IEEE Std. 1003.1-200x, it was not part of
POSIX.1b (the 1993 version), and FreeBSD treats it accordingly.
2018-10-17 11:09:58 +02:00
Ryan Dwyer 799f285cd1 Fix moving tiled containers to workspaces which only have floating views
* Make a workspace which only contains floating views
* Switch to another workspace and create a tiled view
* Move the tiled view to the workspace with
`move container to workspace N`

The container would be added as a sibling to the floating view, which
makes the container floating while having the geometry of a tiled
container.

This changes it so it only looks for tiled containers in the workspace
with a fallback to the workspace itself.
2018-10-17 16:57:32 +10:00
Brian Ashworth 434cbaabf0
Merge pull request #2843 from c-edw/feature/2842_TruncateMessage
swaynag: Truncate message to 2048 chars.
2018-10-16 21:39:37 -04:00
Brian Ashworth 3a5a8aa5ad
Merge branch 'master' into feature/2842_TruncateMessage 2018-10-16 21:31:29 -04:00
Drew DeVault fa2d2c8559
Merge pull request #2855 from SpeedJack/sysconfdir-fhs-compliant
Make SYSCONFDIR FHS compliant when "prefix" is set
2018-10-16 23:50:42 +02:00
Connor E cfc533aa9c Truncate message, append buffer overflow message if too long.
Increase buffer size, remove macros.

Make variables lowercase.

Some more feedback.
2018-10-16 20:20:45 +01:00
Niccolò Scatena 027928bdeb
Set SYSCONFDIR to /etc even when "prefix" is set
SYSCONFDIR should be "/etc" even when prefix="/usr" to be FHS compliant.
This is the default in meson from v0.44.
2018-10-16 19:44:45 +02:00
Niccolò Scatena 615d4bf958
Revert "Fix SYSCONFDIR to include "prefix""
This reverts commit 6942f5b684.
SYSCONFDIR should be "/etc" even when prefix="/usr" to be FHS compliant.
This is the default in meson from v0.44.
2018-10-16 19:35:06 +02:00
Drew DeVault 18a2646c1d
Merge pull request #2852 from RyanDwyer/back-and-forth-crash
Fix crash when using workspace back_and_forth with no previous
2018-10-16 18:18:01 +02:00
Rouven Czerwinski 1f0aeae335 view: rewarp cursor during view_unmap
If the cursor is warped during the destruction of the workspace, we end up in
the wrong position. Warp the cursor after arrange_workspace() so we end up in
the correct position.
2018-10-16 15:47:02 +02:00
Rouven Czerwinski d69cf4c23c seat: use new warping functions for cursor warping during focus warp 2018-10-16 15:47:02 +02:00
Rouven Czerwinski 0969bf758b cursor: functions to warp cursor to container and workspace
The new functions allow a cursor to be warped without changing the focus.
This is a preparation commit to handle cursor warping not only in
seat_set_focus_warp.
2018-10-16 15:47:02 +02:00
Rouven Czerwinski 892446a0b6 view: move arrange_workspace into view_map
For mouse_warping cursor to correctly work on newly spawned containers,
the workspace needs to be arranged before the cursor is warped.

The shell functions each implement their own fullscreen and arrange checks,
move them into the view_map function and pass their states via boolean arguments.

Fixes #2819
2018-10-16 15:47:02 +02:00
Ryan Dwyer d0974d5c50 Fix crash when using workspace back_and_forth with no previous 2018-10-16 23:42:53 +10:00
Ian Fan 113751ea48
Merge pull request #2836 from RyanDwyer/set-set-raw-focus
Introduce seat_set_raw_focus and remove notify argument from seat_set_focus_warp
2018-10-16 10:59:09 +01:00
Ian Fan ac20690945
Merge branch 'master' into set-set-raw-focus 2018-10-16 10:50:56 +01:00
Ryan Dwyer 05284b65db Prevent duplicate workspace::focus events
Previously we would compare the last focus's workspace with the new
focus's workspace to determine if we need to emit an IPC
workspace::focus event. This doesn't work when moving the focused
container to a new workspace.

This adds a workspace property to the seat which stores the last emitted
workspace::focus workspace. Using this method, after moving the
container, refocusing it will trigger exactly one workspace::focus
event: from the old workspace to the new workspace.
2018-10-16 08:17:24 +10:00
Drew DeVault cd02d60a99
Merge pull request #2845 from colemickens/posix_clock
common/loop.c: add _POSIX_C_SOURCE for clock_gettime and CLOCK_MONOTONIC
2018-10-15 23:01:53 +02:00
Cole Mickens a9a9df75ec common/loop.c: add _POSIX_C_SOURCE for clock_gettime and CLOCK_MONOTONIC 2018-10-15 13:42:24 -07:00
Drew DeVault 4e4b922d79
Merge pull request #2839 from RyanDwyer/swaylock-version
Fix swaylock version string
2018-10-15 21:30:53 +02:00
Ryan Dwyer e644632198 Fix swaylock version string
The referenced constants were not defined so it always printed "version
unknown".

Also it would exit with code 1. It now exits with code 0.
2018-10-16 00:09:16 +10:00
Drew DeVault f6ad4908bc
Merge pull request #2838 from RyanDwyer/compositor-unavailable-crash
Sway clients: Exit gracefully when compositor is unavailable
2018-10-15 15:37:17 +02:00
Drew DeVault 97b9452171
Merge pull request #2835 from RyanDwyer/swap-crash
Fix crash in swap command
2018-10-15 15:35:50 +02:00
Ryan Dwyer 32ba8154b8 Sway clients: Exit gracefully when compositor is unavailable 2018-10-15 21:57:59 +10:00
Ryan Dwyer 26278b694c Introduce seat_set_raw_focus and remove notify argument from seat_set_focus_warp
This introduces seat_set_raw_focus: a function that manipulates the
focus stack without doing any other behaviour whatsoever. There are a
few places where this is useful, such as where we set focus_inactive
followed by another call to set the real focus again. With this change,
the notify argument to seat_set_focus_warp is also removed as these
cases now use the raw function instead.

A bonus of this is we are no longer emitting window::focus IPC events
when setting focus_inactive, nor are we sending focus/unfocus events to
the surface.

This also fixes the following:

* When running `move workspace to output <name>` and moving the last
workspace from the source output, the workspace::focus IPC event is no
longer emitted for the newly created workspace.
* When splitting the currently focused container, unfocus/focus events
will not be sent to the surface when giving focus_inactive to the newly
created parent, and window::focus events will not be emitted.
2018-10-15 21:06:24 +10:00
Ryan Dwyer fe803b89a7 Fix crash in swap command
When swapping containers that are in the root of the workspace, parent
will be NULL.
2018-10-15 19:40:40 +10:00
Drew DeVault 56c388b510
Merge pull request #2831 from swaywm/move-output-docs
Establish sway-output(5)
2018-10-14 17:04:55 +02:00
Drew DeVault b69060fc58 Establish sway-output(5) 2018-10-14 10:52:57 -04:00
Drew DeVault 53d90dd6a8
Merge pull request #2826 from RyanDwyer/common-eventloop
Implement common event loop for swaybar and swaylock
2018-10-14 16:34:22 +02:00
Drew DeVault 135f0fc7e7 Update README.MD (and README.*.md) 2018-10-14 10:33:38 -04:00
Ryan Dwyer c6f153d8f9 Event loop: Fix memmove and remove extraneous declaration 2018-10-15 00:26:27 +10:00
Ryan Dwyer 893f61d03a Event loop: Free fds and fix race condition 2018-10-15 00:26:27 +10:00
Ryan Dwyer 6921fdc6d6 Remove timerfd from loop implementation
timerfd doesn't work on the BSDs, so this replaces it with a timespec
for the expiry and uses a poll timeout to check the timers when needed.
2018-10-15 00:26:27 +10:00
Ryan Dwyer f98f351a52 swaylock: Don't wait too long for surface damage before verifying 2018-10-15 00:26:27 +10:00
Ryan Dwyer fa11b7f701 swaylock: clear password after 10 seconds 2018-10-15 00:26:27 +10:00
Ryan Dwyer c242712262 swaylock: Remove indicator after 3 seconds 2018-10-15 00:26:27 +10:00
Ryan Dwyer 9c833c661a swaylock: Use common event loop 2018-10-15 00:26:27 +10:00
Ryan Dwyer 4056c09e13 Move swaybar's event loop to common directory and refactor
* The loop functions are now prefixed with `loop_`.
* It is now easy to add timers to the loop.
* Timers are implemented using pollfd and timerfd, rather than manually
checking them when any other event happens to arrive.
2018-10-15 00:26:27 +10:00
Drew DeVault 7f2e6d812a Document border csd 2018-10-14 10:23:40 -04:00