Commit graph

5076 commits

Author SHA1 Message Date
Rouven Czerwinski
f52825336c swaybar: disallow left and right position and print error on default
The positions "left" and "right" are not allowed by the man page, remove them
from the allowed positions. Also print an error to stderr if we default to the
bottom position.

Fixes #2878
2018-10-20 08:21:44 +02:00
Ryan Dwyer
c006717910 Minor refactor of input manager
The input manager is a singleton object. Passing the sway_input_manager
argument to each of its functions is unnecessary, while removing the
argument makes it obvious to the caller that it's a singleton. This
patch removes the argument and makes the input manager use server.input
instead.

On a similar note:

* sway_input_manager.server is removed in favour of using the server
global.
* seat.input is removed because it can get it from server.input.

Due to a circular dependency, creating seat0 is now done directly in
server_init rather than in input_manager_create. This is because
creating seats must be done after server.input is set.

Lastly, it now stores the default seat name using a constant and removes
a second reference to seat0 (in input_manager_get_default_seat).
2018-10-20 13:11:43 +10:00
Ryan Dwyer
ed771a6a6e Fix crash when view unmaps while no outputs connected
When a view unmaps, we call workspace_consider_destroy. This function
assumed the workspace would always have an output, but this is not the
case when hotplugged down to zero. The function now handles this and
allows itself to be destroyed when there is no output.

This means that workspace_begin_destroy must remove the workspace from
the root->saved_workspaces list to avoid an eventual dangling pointer,
so it does that now.

Lastly, when an output is plugged in again and it has to create a new
initial workspace for it, we must emit the workspace::init IPC event
otherwise swaybar shows no workspaces at all. I guess when you start
sway, swaybar is started after the workspace has been created which is
why this hasn't been needed earlier.
2018-10-20 13:07:33 +10:00
Drew DeVault
5b8257b88f
Merge pull request #2872 from RyanDwyer/cursor-rebase
Introduce cursor_rebase
2018-10-20 05:06:03 +02:00
Drew DeVault
3b8dd49583
Merge pull request #2885 from RyanDwyer/fix-tiling-drag-crash
Fix crash when ending tiling drag
2018-10-20 01:18:23 +02:00
Drew DeVault
bb6c9f52c7
Merge pull request #2884 from c-edw/feature/2867_FixScalingParameter
Prevent overriding background mode after it's been set.
2018-10-20 01:16:24 +02:00
Ryan Dwyer
9b828939e5 Fix crash when ending tiling drag
If the container being dragged has a parent that needs to be reaped, it
must be reaped after we've reinserted the dragging container into the
tree. During reaping, handle_seat_node_destroy tries to refocus the
dragging container which isn't possible while it's detached.
2018-10-20 08:57:09 +10:00
Connor E
d855837da2 Change initial background mode before arg parse. 2018-10-19 16:38:01 +01:00
emersion
0a4735c50c
Merge pull request #2883 from ponkyh/missing-stdlib
missing headers for swaybar/input.c
2018-10-19 15:18:05 +02:00
ossi.ahosalmi
79011e68df missing headers for swaybar/input.c 2018-10-19 15:55:30 +03:00
Ryan Dwyer
9ea71f292b Introduce cursor_rebase
This function "rebases" the cursor on top of whatever is underneath it,
without triggering any focus changes.
2018-10-19 22:47:54 +10:00
Drew DeVault
28f3b8cb03
Merge pull request #2882 from RyanDwyer/fix-mouse-warp-logic
Fix logic used for mouse_warping output
2018-10-19 14:40:56 +02:00
Ryan Dwyer
4d743b64d0 Fix logic used for mouse_warping output
Turns out we don't need to store the previous focus, and it should be
based on which output the cursor was in.
2018-10-19 22:28:02 +10:00
Drew DeVault
96e3686ae8
Merge pull request #2875 from RedSoxFan/input-device-bindings
cmd_bind{sym,code}: Implement per-device bindings
2018-10-19 14:00:03 +02:00
Drew DeVault
19adc3ff2d
Merge pull request #2877 from RyanDwyer/warp-on-workspace-switch
Consider cursor warp when switching workspaces
2018-10-19 02:49:13 +02:00
Ryan Dwyer
a2fdac2c4b Consider cursor warp when switching workspaces
Fixes a regression introduced in
24a90e5d86.

consider_warp_to_focus has been renamed to seat_consider_warp_to_focus,
moved to seat.c and made public. It is now called when switching
workspaces via `workspace <ws>`.
2018-10-19 08:00:13 +10:00
Brian Ashworth
2e637b7368 cmd_bind{sym,code}: Implement per-device bindings
bindsym --input-device=<identifier> ...
bindcode --input-device=<identifier> ...
2018-10-18 13:42:01 -04:00
Brian Ashworth
30dbb8eba0
Merge pull request #2874 from ianyfan/swaybar
swaybar: separate input code to new file
2018-10-18 13:37:35 -04:00
Ian Fan
499150a91b swaybar: separate input code to new file 2018-10-18 14:19:00 +01:00
Drew DeVault
d88b7a63f4
Merge pull request #2871 from RyanDwyer/untangle-cursor-warp
Remove cursor warping from seat_set_focus
2018-10-18 15:18:41 +02:00
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