aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
Commit message (Collapse)AuthorAge
* 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
|
* Separate root-related codeLibravatar Ryan Dwyer2018-08-04
| | | | | | | | | This creates a root.c and moves bits and pieces from elsewhere into it. * layout_init has been renamed to root_create and moved into root.c * root_destroy has been created and is called on shutdown * scratchpad code has been moved into root.c, because hidden scratchpad containers are stored in the root struct
* Write to swaynag pipe fd directly on config errorsLibravatar Brian Ashworth2018-08-03
|
* Show swaynag on config errorsLibravatar Brian Ashworth2018-08-03
|
* ipc: add shutdown eventLibravatar Ian Fan2018-08-01
|
* Fix deferred command handlingLibravatar Brian Ashworth2018-07-19
|
* Make focus part of transactionsLibravatar Ryan Dwyer2018-07-15
| | | | | | | | | | | | Rather than maintain copies of the entire focus stack, this PR transactionises the focus by introducing two new properties to the container state and using those when rendering. * `bool focused` means this container has actual focus. Only one container should have this equalling true in its current state. * `struct sway_container *focus_inactive_child` points to the immediate child that was most recently focused (eg. for tabbed and stacked containers).
* Add extended debugging flagsLibravatar Drew DeVault2018-07-14
| | | | | | We currently have several ways of setting debug flags, including command line arguments, environment variables, and compile-time macros. This replaces the lot with command line flags.
* Update for swaywm/wlroots#1126Libravatar emersion2018-07-09
|
* pango/cairo: set default font map to NULL to free itLibravatar Dominique Martinet2018-07-05
|
* ipc-server: add display destroy listener and remove ipc_terminateLibravatar Dominique Martinet2018-07-04
| | | | | | | | | | | | | | | | | | | | | | | | | wl_event_source_remove() is illegal after display has been destroyed, so just destroy everything when we still can. ==20392==ERROR: AddressSanitizer: heap-use-after-free on address 0x607000001240 at pc 0x00000048e86e bp 0x7ffe4b557e00 sp 0x7ffe4b557df0 READ of size 8 at 0x607000001240 thread T0 #0 0x48e86d in wl_list_insert ../common/list.c:149 #1 0x7fdf673d4d7d in wl_event_source_remove src/event-loop.c:487 #2 0x41b742 in ipc_terminate ../sway/ipc-server.c:94 #3 0x40b1ad in main ../sway/main.c:440 #4 0x7fdf6664c18a in __libc_start_main ../csu/libc-start.c:308 #5 0x409359 in _start (/opt/wayland/bin/sway+0x409359) 0x607000001240 is located 48 bytes inside of 72-byte region [0x607000001210,0x607000001258) freed by thread T0 here: #0 0x7fdf692c4880 in __interceptor_free (/lib64/libasan.so.5+0xee880) #1 0x7fdf673d371a in wl_display_destroy src/wayland-server.c:1097 previously allocated by thread T0 here: #0 0x7fdf692c4c48 in malloc (/lib64/libasan.so.5+0xeec48) #1 0x7fdf673d4d9e in wl_event_loop_create src/event-loop.c:522 #2 0x40acb2 in main ../sway/main.c:363 #3 0x7fdf6664c18a in __libc_start_main ../csu/libc-start.c:308
* startup: move setenv WAYLAND_DISPLAY before config execsLibravatar Dominique Martinet2018-07-04
| | | | | | | | | We would previously run all config commands without the environment, which would appear to work as our socket name is the default one, but wayland clients would start up in the wrong sway session. (This explains why 'sometimes' my swayidle processes wouldn't die with sway, as they weren't listening to the correct socket)
* log_kernel: s/fclose/pclose/ (for popen'd FILE)Libravatar Dominique Martinet2018-07-02
| | | | | | | With recent glibc the functions are strictly identical, but this might not be true for all libc implementations Found through static analysis.
* Perform (partial) server initialization before dropping privileges.Libravatar Tobias Blass2018-06-19
| | | | | | | | Some operations during backend creation (e.g. becoming DRM master) require CAP_SYS_ADMIN privileges. At this point, sway has dropped them already, though. This patch splits the privileged part of server_init into its own function and calls it before dropping its privileges. This fixes the bug with minimal security implications.
* Remove suspicious unconditional returnLibravatar Tobias Blass2018-06-05
| | | | This return effectively disables the log_kernel function
* sway: run commands without waiting for XwaylandLibravatar Dominique Martinet2018-05-16
| | | | Xwayland is lazy now, there is no need to wait at all
* Add debug tree viewLibravatar Drew DeVault2018-04-06
|
* temporarily add LD_LIBRARY_PATH stuffLibravatar Tony Crisci2018-03-31
|
* Revert "Merge pull request #1653 from swaywm/revert-1647-refactor-tree"Libravatar Tony Crisci2018-03-29
| | | | | This reverts commit 472e81f35d689d67cda241acafda91c688d61046, reversing changes made to 6b7841b11ff4cd35f54d69dc92029855893e5ce0.
* Revert "Refactor tree"Libravatar Drew DeVault2018-03-29
|
* rename layout initLibravatar Tony Crisci2018-03-29
|
* move tree includes to their own directoryLibravatar Tony Crisci2018-03-29
|
* fix typos in comments/messages; add shutting down messageLibravatar Dominique Martinet2018-01-05
|
* Consolidate WLR and Sway loggingLibravatar Calvin Lee2017-12-31
| | | | See #1390
* Merge branch 'wlroots' into feature/inputLibravatar Tony Crisci2017-12-16
|\
| * Add output configLibravatar emersion2017-12-06
| |
* | xkb configLibravatar Tony Crisci2017-12-15
| |
* | working xcursorLibravatar Tony Crisci2017-12-09
|/
* Add minimal config subsystemLibravatar emersion2017-12-05
|
* log env after ipc initLibravatar Tony Crisci2017-12-02
|
* remove nvidia support claimLibravatar Tony Crisci2017-11-28
|
* Wire up IPC serverLibravatar Drew DeVault2017-11-22
|
* Add outputs to the treeLibravatar Drew DeVault2017-11-19
|
* Move everything to sway/old/Libravatar Drew DeVault2017-11-18
|
* Initialize outputs from backend and add to treeLibravatar Drew DeVault2017-11-11
|
* Fire up the wlroots backend and run the event loopLibravatar Drew DeVault2017-11-11
|
* nvidia: Validate the nvidia_drm module optionsLibravatar Dan Robertson2017-10-24
| | | | | When the proprietary nvidia driver is used, ensure the modeset option is set instead of checking /proc/cmdline for nvidia-drm.modeset=1.
* Check for Raspberry PiLibravatar azarus2017-08-14
|
* 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).
* Terminate when both suid bit and filecaps are setLibravatar Mykyta Holubakha2017-05-11
|
* Initialise logging earlierLibravatar Mykyta Holubakha2017-05-11
|
* Add -DVERSION flag for release version numbersLibravatar Sebastian Noack2017-04-26
|
* Implement more thourough nvidia config checkLibravatar Drew DeVault2017-04-12
|
* Downgrade nvidia proprietary driver warningLibravatar Drew DeVault2017-04-12
|
* Add libcap check to CMakeLibravatar JerziKaminsky2017-04-07
| | | | | | | | | | | - Moved ``<sys/capability.h>`` include inside `__linux__` guard, because all uses are similarly guarded. - <sys/capability.h> is part of an optional devel package, at least in fedora. CMake now explicitly checks that libcap devel files are available. - Added libcap to the list of install packages in .travis.yml, to make the dependency explicit. travis-ci installs the package by default, which is why this hasn't surfaced previously.