aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
Commit message (Collapse)AuthorAge
* main: removed vc4 detection code.Libravatar Bartłomiej Burdukiewicz2021-04-29
| | | Signed-off-by: Bartłomiej Burdukiewicz <bartlomiej.burdukiewicz@gmail.com>
* Log wlroots version on startupLibravatar Simon Ser2021-04-12
| | | | | | Can be useful to make sure a bugfix is included. In the future maybe the wlroots version string could include a commit hash when built from source, too.
* Make command line option lists constLibravatar Manuel Stoeckl2021-02-04
|
* Changed fprintf(stdout,...) to printf(...) for more readable codeLibravatar SpizzyCoder2021-01-16
|
* Route wlroots logs into Sway logging infrastructureLibravatar Simon Ser2020-12-09
| | | | | | | | | | Instead of letting wlroots print messages to stdout, route debugging messages into Sway's logging functions. This allows a more consistent output (e.g. if Sway or wlroots changes its output style, they don't get out-of-sync). I also added a [wlr] prefix to wlroots messages, not yet sure it's a good thing.
* Handle SIGINTLibravatar Simon Ser2020-08-11
| | | | Gracefully exit on SIGINT, like we do for SIGTERM.
* Log empty value if envvar is not definedLibravatar Antonin Décimo2020-07-30
| | | | | | | If the environment variable is not defined, getenv returns NULL. Passing a NULL pointer to the "%s" format specifier is undefined behavior. Even if some implementations output "(null)", an empty string is nicer.
* Log Sway version on startupLibravatar Simon Ser2020-06-11
|
* config: fix validation exit code and log levelLibravatar Brian Ashworth2020-02-11
| | | | | | | | | This makes it so invalid configs will return the exit code 1 when the validation flag is given. This also reduces the log level to SWAY_ERROR, which makes it so only the errors are shown. If someone wants more verbose output, the can use the -V/--verbose or -d/--debug flags. Additionally, this also makes it so swaybg will not be spawned when validating the config.
* Fix ordering of setgid and setuidLibravatar Teddy Reed2020-02-11
| | | | | | | It looks like the code to drop privileges may have been broken via commit 37f0e1f. That commit reverted the correct order from #911, which first drops the gid then the uid. If setuid is called first then the target user may not have the ability to setgid.
* Fix compiling with -fno-commonLibravatar thermitegod2020-01-24
|
* Fix various memory leaksLibravatar lbonn2019-11-01
| | | | Found with clang-tidy
* Error out on unknown debug flagLibravatar Simon Ser2019-09-22
| | | | | Otehrwise it's pretty easy to misremember a flag and think damage=rerender is enabled when it's not.
* bindings: defer while initiailizingLibravatar Brian Ashworth2019-06-12
| | | | | | | | This adds the logic to defer binding execution while sway is still initializing. Without this, the binding command would be executed, but the command handler would return CMD_DEFER, which was being treated as a failure to run. To avoid partial executions, this will defer all bindings while config->active is false.
* Remove extra inclusion of stdio.hLibravatar Lane Surface2019-04-27
|
* 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
* Remove debug treeLibravatar Ryan Dwyer2019-03-18
| | | | This feature has served its purpose. It's better to use IPC now.
* detect_proprietary: use strncmpLibravatar Brian Ashworth2019-03-10
| | | | | Only the main nvidia module needs to be blocked. Others such as nvidiafb are benign and do not need to be blocked
* Minor fix of code duplication.Libravatar hugbubby2019-03-02
| | | | Removes 3~ lines of code that didn't need to be restated.
* run_as_ipc_client: free response after running the IPC commandLibravatar Rouven Czerwinski2019-02-21
| | | | | | | | | | | | Fixes memory leaks in the form of: Direct leak of 24 byte(s) in 1 object(s) allocated from: #0 0x7f5f7c2f4f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30) #1 0x563c799569f2 in ipc_recv_response ../common/ipc-client.c:94 #2 0x563c79957062 in ipc_single_command ../common/ipc-client.c:138 #3 0x563c798a56cc in run_as_ipc_client ../sway/main.c:127 #4 0x563c798a6a3a in main ../sway/main.c:349 #5 0x7f5f7b4d609a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
* ipc-client: free payload after sending it over the socketLibravatar Rouven Czerwinski2019-02-21
| | | | | | | | | | Fixes memory leaks in the form of: Direct leak of 20 byte(s) in 1 object(s) allocated from: #0 0x7f5f7c2f4f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30) #1 0x563c7995b36a in join_args ../common/stringop.c:268 #2 0x563c798a6a1a in main ../sway/main.c:348 #3 0x7f5f7b4d609a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
* Abort early when XDG_RUNTIME_DIR is not setLibravatar Brian Ashworth2019-02-11
| | | | | | This aborts sway and displays an error message about XDG_RUNTIME_DIR not being set without initializing the wl_display or logging any other information.
* Clarify error for options and positional argsLibravatar Brian Ashworth2019-02-06
| | | | | | | | | | | | When both options and positional arguments are given, sway would print the error `Don't use options with the IPC client`. Over the past several months, it seems like users are including this error message in issues instead of a debug log due to not understanding that the error message means there is an issue with their command. This makes the error message more verbose and will hopefully make it so more users understand that the message is not a bug in sway, but with the command used.
* Initialize server so input manager is available.Libravatar Connor E2019-02-05
|
* If validating the config, do it as early as possible.Libravatar Connor E2019-02-05
|
* Cleanup config reading failure error logsLibravatar Brian Ashworth2019-01-29
| | | | | | | | | | | | | | This cleans up the log when sway fails to read a config file. The following changes have been made: - A missing error message has been added to the log when the config file is a directory instead of a regular file - In main, `goto` statements have been added after the `sway_terminate` calls instead of wrapping every block in `if (!terminate_request)` - Unnecessary NULL-checks around calls to free in `main` have been removed - Deferred command execution has been extracted to a separate function and the `Running deferred commands` log message will not be shown when there are no deferred commands.
* Cleanup log_envLibravatar emersion2019-01-28
| | | | | SWAY_CURSOR_* are not used anymore. LD_PRELOAD_PATH doesn't exist and has been replaced with LD_PRELOAD.
* 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.
* Do not send ipc_event_shutdown from ipc clientLibravatar Brian Ashworth2019-01-15
| | | | | | In `sway_terminate`, `ipc_event_shutdown` was being sent regardless which mode sway was running in. When running as an ipc client, `sway_terminate` should just exit
* Merge pull request #3144 from emersion/cmd-xwaylandLibravatar Drew DeVault2019-01-13
|\ | | | | Add xwayland command
| * Add xwayland commandLibravatar emersion2018-11-19
| |
* | 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.
* | Cleanup list codeLibravatar Ian Fan2018-12-09
| |
* | Change execute_command to return a list of resultsLibravatar Brian Ashworth2018-11-27
| | | | | | | | | | | | This matches i3's behavior of returning a list of results that contain the result of each command that was executed. Additionally, the `parse_error` attribute has been added to the IPC JSON reply.
* | Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
|/ | | | And make sure we don't define both in the same source file.
* Teardown compositor when failing to drop permissionsLibravatar emersion2018-11-01
|
* Make it clear that being able to restore root is a failureLibravatar emersion2018-11-01
|
* Abort if proprietary drivers are in useLibravatar Ryan Dwyer2018-10-21
| | | | | | The idea here is we don't want users to be blissfully unaware that they are running unsupported drivers. So we abort on startup, and force the user to add a specific argument to bypass the check.
* Remove unnecessary commentLibravatar Drew DeVault2018-10-13
|
* Add support for installing binaries with DT_RPATHLibravatar Arkadiusz Hiler2018-09-30
| | | | | | | | | | | | | | It's better to use DT_RPATH dynamic section of the elf binary to store the paths of libraries to load instead of overwriting LD_LIBRARY_PATH for the whole environment, causing surprises. This solution is much more transparent and perfectly suitable for running contained installations of wayland/wlroots/sway. The code unsetting the LD_LIBRARY_PATH/LD_PRELOAD was also deleted as it's a placebo security at best - we should trust the execution path that leads us to running sway, and it's way too late to care about those variables since we already started executing our compositor, thus we would be compromised anyway.
* Turn funcs() into funcs(void)Libravatar Arkadiusz Hiler2018-09-30
| | | | If they really do not take undefined number of arguments.
* Remove libcap/prctl artifactsLibravatar Arkadiusz Hiler2018-09-30
| | | | | | | They seem like relics of the pasts, from when we were retaining the ptrace cap. Some translations still may need updates.
* Allow running commands on containers without focusing themLibravatar Ryan Dwyer2018-09-23
| | | | | | | | | | | | | | This adds a `con` argument to `execute_command` which allows you to specify the container to execute the command on. In most cases it leaves it as `NULL` which makes it use the focused node. We only set it when executing `for_window` criteria such as when a view maps. This means we don't send unnecessary IPC focus events, and fixes a crash when the criteria command is `move scratchpad` (because we can't give focus to a hidden scratchpad container). Each of the shell map handlers now check to see if the view has a workspace. It won't have a workspace if criteria has moved it to the scratchpad.
* swaybar: handle hotpluggingLibravatar emersion2018-09-20
| | | | Don't kill and respawn swaybars on hotplug.
* Implement type safe arguments and demote sway_containerLibravatar Ryan Dwyer2018-09-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the meaning of sway_container so that it only refers to layout containers and view containers. Workspaces, outputs and the root are no longer known as containers. Instead, root, outputs, workspaces and containers are all a type of node, and containers come in two types: layout containers and view containers. In addition to the above, this implements type safe variables. This means we use specific types such as sway_output and sway_workspace instead of generic containers or nodes. However, it's worth noting that in a few places places (eg. seat focus and transactions) referring to them in a generic way is unavoidable which is why we still use nodes in some places. If you want a TL;DR, look at node.h, as well as the struct definitions for root, output, workspace and container. Note that sway_output now contains a workspaces list, and workspaces now contain a tiling and floating list, and containers now contain a pointer back to the workspace. There are now functions for seat_get_focused_workspace and seat_get_focused_container. The latter will return NULL if a workspace itself is focused. Most other seat functions like seat_get_focus and seat_set_focus now accept and return nodes. In the config->handler_context struct, current_container has been replaced with three pointers: node, container and workspace. node is the same as what current_container was, while workspace is the workspace that the node resides on and container is the actual container, which may be NULL if a workspace itself is focused. The global root_container variable has been replaced with one simply called root, which is a pointer to the sway_root instance. The way outputs are created, enabled, disabled and destroyed has changed. Previously we'd wrap the sway_output in a container when it is enabled, but as we don't have containers any more it needs a different approach. The output_create and output_destroy functions previously created/destroyed the container, but now they create/destroy the sway_output. There is a new function output_disable to disable an output without destroying it. Containers have a new view property. If this is populated then the container is a view container, otherwise it's a layout container. Like before, this property is immutable for the life of the container. Containers have both a `sway_container *parent` and `sway_workspace *workspace`. As we use specific types now, parent cannot point to a workspace so it'll be NULL for containers which are direct children of the workspace. The workspace property is set for all containers, except those which are hidden in the scratchpad as they have no workspace. In some cases we need to refer to workspaces in a container-like way. For example, workspaces have layout and children, but when using specific types this makes it difficult. Likewise, it's difficult for a container to get its parent's layout when the parent could be another container or a workspace. To make it easier, some helper functions have been created: container_parent_layout and container_get_siblings. container_remove_child has been renamed to container_detach and container_replace_child has been renamed to container_replace. `container_handle_fullscreen_reparent(con, old_parent)` has had the old_parent removed. We now unfullscreen the workspace when detaching the container, so this function is simplified and only needs one argument now. container_notify_subtree_changed has been renamed to container_update_representation. This is more descriptive of its purpose. I also wanted to be able to call it with whatever container was changed rather than the container's parent, which makes bubbling up to the workspace easier. There are now state structs per node thing. ie. sway_output_state, sway_workspace_state and sway_container_state. The focus, move and layout commands have been completely refactored to work with the specific types. I considered making these a separate PR, but I'd be backporting my changes only to replace them again, and it's easier just to test everything at once.
* Enable privilege dropping of FreeBSDLibravatar sghctoma2018-08-30
| | | | | Privilege dropping works on FreeBSD too, so only the caps parts need to be Linux-only.
* 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.
* Use enum for damage debug optionsLibravatar Ryan Dwyer2018-08-19
|
* Standardise debug variablesLibravatar Ryan Dwyer2018-08-19
| | | | | | | | | | | | | | | | | | This makes all debug options stored in a single struct rather than in various places, changes/fixes the behaviour of existing options, and introduces some new options. * Fixes damage issues with `-Drender-tree` texture (by removing scissor) * Offsets the render tree overlay's `y` position for those who have swaybar at the top * Replaces `-Ddamage=rerender` with `-Dnodamage` * Replaces `-Ddamage=highlight` with `-Dhighlight-damage` * Replaces `-Dtxn-debug` with `-Dtxn-wait` * Introduces `-Dnoatomic` * Removes the `create_time` and `ms_arranging` figures from transactions and the log message. Transactions are created after arranging and the create time is of no significance. * Fixes `-Dtxn-debug` (now `-Dtxn-wait`) not working.
* Remove obsolete security sanity checkLibravatar Drew DeVault2018-08-09
|