aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.c
Commit message (Collapse)AuthorAge
* input: Move get_current_time_msec in from utilLibravatar Kenny Levinsen2021-06-23
| | | | | | | get_current_time_msec is only used in cursor.c, so we can move it in and make it static. This is primarily intended to avoid a symbol collision with wlroots, which we unfortunately do not have a good solution for yet.
* moved and renamed movement-unit parsing to commonLibravatar Nils Schulte2020-07-21
|
* common/util: fix `get_current_time_msec` returning microsecondsLibravatar Tudor Brindus2020-06-06
| | | | | | | | This commit makes `get_current_time_msec` correctly return milliseconds as opposed to microseconds. It also considers the value of `tv_sec`, so we don't lose occasionally go back in time by one second. Finally, the function is moved into `util.c` so that it can be reused elsewhere without having to consider these pitfalls.
* cmd_client_*: refactor duplicated codeLibravatar Brian Ashworth2019-12-28
| | | | | | | | | | | | | This is the second in a series of commits to refactor the color handling in sway. This removes the duplicated color parsing code in sway/commands/client.c. Additionally, this combines the parsing of colors to float arrays with that in sway/config.c and introduces a color_to_rgba function in commom/util.c. As an added bonus, this also makes it so non of the colors in a border color class will be changed unless all of the colors specified are valid. This ensures that an invalid command does not get partially applied.
* parse_color: return success + drop fallback colorLibravatar Brian Ashworth2019-12-28
| | | | | | | | | | | | This is the first in a series of commits to refactor the color handling in sway. This changes parse_color to return whether it was success and no longer uses 0xFFFFFFFF as the fallback color. This also verifies that the string actually contains a valid hexadecimal number along with the length checks. In the process of altering the calls to parse_color, I also took the opportunity to heavily refactor swaybar's ipc_parse_colors function. This allowed for several lines of duplicated code to be removed.
* Rename symbol set_cloexec to sway_set_cloexec, remove duplicates.Libravatar Sheena Artrip2019-11-01
| | | | | | | | set_cloexec is defined by both sway and wlroots (and who-knows-else), so rename the sway one for supporting static linkage. We also remove the duplicate version of this in client/. Fixes: https://github.com/swaywm/sway/issues/4677
* Spawn swaynag as a wayland clientLibravatar Brian Ashworth2019-04-14
| | | | | This spawns swaynag as a wayland client similar to how swaybar and swaybg are already done
* Add support for manually setting subpixel hinting on outputs.Libravatar Geoff Greer2019-03-24
| | | | | | Many laptop screens report unknown subpixel order. Allow users to manually set subpixel hinting to work around this. Addresses https://github.com/swaywm/sway/issues/3163
* util.c: remove numlen functionLibravatar Ian Fan2019-01-22
| | | | Its uses have been replaced by snprintf, which is more in line with its usage.
* Fix edge case bug in numlen, dropping use of math.h functionsLibravatar M Stoeckl2019-01-21
| | | | | (Specifically, numlen when called with INT_MIN gave an incorrect result, because abs(INT_MIN) == INT_MIN < 0.)
* Move sway-specific functions in common/util.c into sway/Libravatar M Stoeckl2019-01-21
| | | | | | 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 .
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | 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.
* Remove readline.cLibravatar Ian Fan2019-01-01
| | | | | All occurrences of read_line have been replaced by getline. peek_line has been absorbed into detect_brace.
* Merge pull request #3083 from c-edw/feature/StripWorkspaceNameLibravatar emersion2018-11-19
|\ | | | | Implement strip_workspace_name.
| * Implement strip_workspace_name.Libravatar Connor E2018-11-17
| |
* | Add scroll factor config option.Libravatar Spencer Michaels2018-11-18
|/
* Wrap to fartherest output when running focus outputLibravatar Ryan Dwyer2018-11-01
| | | | | Also moves the `opposite_direction` function into `util.c` as it's used in two places now.
* Revert "Add resolve_path() to utils"Libravatar madblobfish2018-10-31
| | | | This reverts commit c9694ee63d451da62dc50b234b3080a35a40e844.
* Remove enum movement_directionLibravatar Ryan Dwyer2018-10-30
| | | | | | | | | 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.
* Remove layout.cLibravatar Ryan Dwyer2018-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Address review comments on parse_booleanLibravatar Brian Ashworth2018-07-23
|
* Remove unneeded constLibravatar Brian Ashworth2018-07-23
|
* Switch to using a function to parse booleansLibravatar Brian Ashworth2018-07-23
|
* Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
|
* get_parent_pid: fix memory leakLibravatar Dominique Martinet2018-07-02
| | | | Found through static analysis.
* sway: change all sway_log to wlr_logLibravatar Dominique Martinet2018-01-05
|
* common/util: replace WLC_BIT_MOD_* by WLR_MODIFIER_*Libravatar Dominique Martinet2017-11-23
| | | | This removes the last wlc/wlc.h include actually in use
* FreeBSD fixesLibravatar johalun2017-06-06
| | | | | | | 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).
* Replace spaces with tabs in resolve_pathLibravatar Mykyta Holubakha2017-05-11
|
* Add resolve_path() to utilsLibravatar Jerzi Kaminsky2017-04-16
|
* UnGNUify the codebaseLibravatar Drew DeVault2017-03-10
|
* Feature for #1078: Configurable swaylock colorsLibravatar Calvin Lee2017-02-21
| | | | | | | | | | | 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.
* Reorganize includesLibravatar Drew DeVault2016-09-01
|
* common: use strtoul in parse_color to avoid clampLibravatar progandy2016-08-04
| | | | | 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.
* implement solid color rendering for swaybgLibravatar Zandr Martin2016-07-30
|
* couple small fixesLibravatar Zandr Martin2016-06-11
|
* cleanup + add timeouts for pid_workspace listLibravatar Zandr Martin2016-06-11
|
* semi-working (only non-client/server wayland apps)Libravatar Zandr Martin2016-06-10
|
* numlen(0) == 1Libravatar Mikkel Oscar Lyderik2016-01-24
|
* use log10 in numlenLibravatar Mikkel Oscar Lyderik2016-01-24
|
* Revert "s/numlen/log10/g"Libravatar Drew DeVault2016-01-23
| | | | This reverts commit 038bb8cc7c4dee77f8ee4ba3ac1ffc47409b2370.
* s/numlen/log10/gLibravatar Drew DeVault2016-01-23
|
* Add function for getting list of modifier names.Libravatar Mikkel Oscar Lyderik2016-01-08
| | | | Get an array of modifier names from modifier masks.
* Move modifier name table to common/util.cLibravatar Mikkel Oscar Lyderik2016-01-05
| | | | | Lookup of modifier names is required in several places, thus it makes sense to move it to a general place.
* Move sway/util.c to common/util.cLibravatar Mikkel Oscar Lyderik2015-12-14