Commit graph

36 commits

Author SHA1 Message Date
M Stoeckl c040defd5f Fix edge case bug in numlen, dropping use of math.h functions
(Specifically, numlen when called with INT_MIN gave an incorrect
result, because abs(INT_MIN) == INT_MIN < 0.)
2019-01-21 12:46:45 -05:00
M Stoeckl d7ff776552 Move sway-specific functions in common/util.c into sway/
Modifier handling functions were moved into sway/input/keyboard.c;
opposite_direction for enum wlr_direction into sway/tree/output.c;
and get_parent_pid into sway/tree/root.c .
2019-01-21 12:39:16 -05:00
M Stoeckl 1211a81aad Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although
with a sway_* prefix. (This is very similar to PR #2009.)
However, the logging function no longer needs to be replaceable,
so sway_log_init's second argument is used to set the exit
callback for sway_abort.

wlr_log_init is still invoked in sway/main.c

This commit makes it easier to remove the wlroots dependency for
the helper programs swaymsg, swaybg, swaybar, and swaynag.
2019-01-21 12:59:42 +01:00
Ian Fan a82b8a3c14 Remove readline.c
All occurrences of read_line have been replaced by getline.
peek_line has been absorbed into detect_brace.
2019-01-01 09:01:25 +00:00
emersion bf7af9c690
Merge pull request #3083 from c-edw/feature/StripWorkspaceName
Implement strip_workspace_name.
2018-11-19 17:56:18 +01:00
Spencer Michaels 70bc4c3ab6 Add scroll factor config option. 2018-11-18 13:49:30 -05:00
Connor E 4bd46fb079 Implement strip_workspace_name. 2018-11-17 16:11:28 +00:00
Ryan Dwyer bf19f63a79 Wrap to fartherest output when running focus output
Also moves the `opposite_direction` function into `util.c` as it's used
in two places now.
2018-11-01 08:29:45 +10:00
madblobfish 1f23ec2d05 Revert "Add resolve_path() to utils"
This reverts commit c9694ee63d.
2018-10-31 13:04:08 +01:00
Ryan Dwyer 7be309710d Remove enum movement_direction
There's no point having both movement_direction and wlr_direction. This
replaces the former with the latter.

As movement_direction also contained MOVE_PARENT and MOVE_CHILD items,
these are now checked specifically in the focus command and handled in
separate functions, just like the other focus variants.
2018-10-30 23:27:49 +10:00
Ryan Dwyer 5dbbab7bdc Remove layout.c
When we have type safety we'll need to have functions for
workspace_add_tiling and so on. This means the existing container
functions will be just for containers, so they are being moved to
container.c. At this point layout.c doesn't contain much else, so I've
relocated everything and removed the file.

* container_swap and its static functions have been moved to the swap
command and made static.
* container_recursive_resize has been moved to the resize command and
made static.
* The following have been moved to container.c:
    * container_handle_fullscreen_reparent
    * container_insert_child
    * container_add_sibling
    * container_add_child
    * container_remove_child
    * container_replace_child
    * container_split
* enum movement_direction and sway_dir_to_wlr have been moved to util.c.

Side note: Several commands included layout.h which then included
root.h. With layout.h gone, root.h has to be included by those commands.
2018-08-26 12:05:16 +10:00
Brian Ashworth 9ec1d6cf79 Address review comments on parse_boolean 2018-07-23 21:37:53 -04:00
Brian Ashworth d56d62c1c0 Remove unneeded const 2018-07-23 21:33:17 -04:00
Brian Ashworth 863914ec95 Switch to using a function to parse booleans 2018-07-23 21:33:17 -04:00
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Dominique Martinet f0d1d26320 get_parent_pid: fix memory leak
Found through static analysis.
2018-07-02 08:03:41 +09:00
Dominique Martinet 67985e9031 sway: change all sway_log to wlr_log 2018-01-05 23:39:46 +01:00
Dominique Martinet 977c1f6a30 common/util: replace WLC_BIT_MOD_* by WLR_MODIFIER_*
This removes the last wlc/wlc.h include actually in use
2017-11-23 00:23:37 +01:00
johalun 7fef283044 FreeBSD fixes
Increase _POSIX_SOURCE value where needed.
Increase _XOPEN_SOURCE value where needed.
Conditionally link to libcap (only on Linux).
Possibly some trailing whitespace fixes (automatic).
2017-06-06 09:45:50 +02:00
Mykyta Holubakha f470fa58a3 Replace spaces with tabs in resolve_path 2017-05-11 19:38:32 +03:00
Jerzi Kaminsky c9694ee63d Add resolve_path() to utils 2017-04-16 17:09:53 +03:00
Drew DeVault 9aed9d9359 UnGNUify the codebase 2017-03-10 23:41:24 -05:00
Calvin Lee 34e2c70abc Feature for #1078: Configurable swaylock colors
Colors are configured through the command line so that swaylock conforms
to the i3lock fork 'github.com/chrjguill/i3lock-color'. Differences from
it are that one letter options '-r' and '-s' are not implimentend because
'-s' is already used by '--scaling' in swaylock.
This commit also fixed whitespace in 'include/swaylock/swaylock.h' and
changed `parse_color` in 'common/util.h' so that it can accept colors
that do not start with a hash. This was done to keep compatability with
the i3lock fork.
2017-02-21 14:12:31 -07:00
Drew DeVault 416417a54c Reorganize includes 2016-09-01 08:18:37 -04:00
progandy bf4056a2c6 common: use strtoul in parse_color to avoid clamp
Some implementations of strtol may clamp the values to LONG_MAX instead of
wrapping around to negative values, so use strtoul instead to parse colors.
2016-08-04 14:37:54 +02:00
Zandr Martin 98aa59fdda
implement solid color rendering for swaybg 2016-07-30 18:50:13 -05:00
Zandr Martin 9ecb43ea3b
couple small fixes 2016-06-11 15:29:04 -05:00
Zandr Martin 2298143d09
cleanup + add timeouts for pid_workspace list 2016-06-11 12:43:34 -05:00
Zandr Martin 03d79b41c7
semi-working (only non-client/server wayland apps) 2016-06-10 06:08:59 -05:00
Mikkel Oscar Lyderik c8cf3f70f9 numlen(0) == 1 2016-01-24 03:02:51 +01:00
Mikkel Oscar Lyderik 2707be7199 use log10 in numlen 2016-01-24 02:59:58 +01:00
Drew DeVault a416715372 Revert "s/numlen/log10/g"
This reverts commit 038bb8cc7c.
2016-01-23 16:35:32 -05:00
Drew DeVault 038bb8cc7c s/numlen/log10/g 2016-01-23 15:51:38 -05:00
Mikkel Oscar Lyderik dffacea831 Add function for getting list of modifier names.
Get an array of modifier names from modifier masks.
2016-01-08 03:03:40 +01:00
Mikkel Oscar Lyderik 95e0f44c73 Move modifier name table to common/util.c
Lookup of modifier names is required in several places, thus it makes
sense to move it to a general place.
2016-01-05 18:36:24 +01:00
Mikkel Oscar Lyderik cf56c41c10 Move sway/util.c to common/util.c 2015-12-14 17:17:06 +01:00
Renamed from sway/util.c (Browse further)