aboutsummaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2018-09-27Improve CSD logicRyan Dwyer
This does the following: * Removes the xdg-decoration surface_commit listener. I was under the impression the client could ignore the server's preference and set whatever decoration they like using this protocol, but I don't think that's right. * Adds a listener for the xdg-decoration request_mode signal. The protocol states that the server should respond to this with its preference. We'll always respond with SSD here. * Makes it so tiled views which use CSD will still have sway decorations rendered. To do this, using_csd had to be added back to the view struct, and the border is changed when floating or unfloating a view.
2018-09-27Rename view_set_csd_from_client to view_update_csd_from_clientRyan Dwyer
2018-09-27Add CSD to border modesRyan Dwyer
This replaces view.using_csd with a new border mode: B_CSD. This also removes sway_xdg_shell{_v6}_view.deco_mode and view->has_client_side_decorations as we can now get these from the border. You can use `border toggle` to cycle through the modes including CSD, or use `border csd` to set it directly. The client must support the xdg-decoration protocol, and the only client I know of that does is the example in wlroots. If the client switches from SSD to CSD without us expecting it (via the server-decoration protocol), we stash the previous border type into view.saved_border so we can restore it if the client returns to SSD. I haven't found a way to test this though.
2018-09-23Implement support for input wildcardBrian Ashworth
2018-09-23Allow running commands on containers without focusing themRyan Dwyer
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.
2018-09-22swaybar, swaylock, & tree/container: Set cairo font options to render text ↵Geoff Greer
and lines with subpixel hinting (if available).
2018-09-22Fix pango escaping and refactor escape_markup_textRyan Dwyer
Fixes #2674. The cause of the issue was in get_pango_layout. When we call pango_parse_markup, `text` is the escaped string, and the unescaped string is then computed and written to `buf`. We were then passing the unescaped string to pango_layout_set_markup, but this function needs the escaped string. `buf` is not needed and has been removed. The other part of this PR refactors escape_markup_text to remove the dest_length argument and removes the -1 return value on error. It now assumes that you've allocated dest to the correct length.
2018-09-20swaybar: handle hotpluggingemersion
Don't kill and respawn swaybars on hotplug.
2018-09-19Merge pull request #2676 from ianyfan/ipcDrew DeVault
ipc: add pid information for views in layout tree
2018-09-19ipc: add pid information for views in layout treeIan Fan
2018-09-19Introduce create_output command (for developer use)Ryan Dwyer
Should help with testing hotplugging.
2018-09-18swaybar: rewrite i3bar protocol handlingIan Fan
This now correctly handles an incoming json infinite array by shifting most of the heavy listing to the json-c parser, as well as sending multiple statuses at once. It also removes the struct i3bar_protocol_state and moves its members into the status_line struct, allowing the same buffer to be used for both protocols.
2018-09-18swaybar: rewrite text protocol handlingIan Fan
This now uses getline to correctly handle multiple or long statuses. It also removes the struct text_protocol_state and moves its members into the status_line struct.
2018-09-18swaybar: fix empty function prototypesIan Fan
2018-09-17swaybar: use output names instead of output indexesemersion
2018-09-16Rename seat_get_active_child to seat_get_active_tiling_childRyan Dwyer
Also renames container to con in one function to prevent ugly line wrapping.
2018-09-14Update for swaywm/wlroots#1243emersion
2018-09-12i3bar: count references to blocksIan Fan
This prevents blocks from being destroyed before their hotspots are destroyed, in case it is used for a pending click event that fires between the bar receiving a new status, which destroys the block, and the bar rendering the new status, which destroys the hotspot; this problem can be easily produced by scrolling on a block that immediately causes a new status to be sent, with multiple outputs
2018-09-12Minor fixes to tiling drag implementationRyan Dwyer
* Make container_add_sibling's `after` argument a boolean. * Use a constant for drop layout border * Make thickness an int * Add button state check * Move comments in seat_end_move_tiling
2018-09-11Implement tiling dragRyan Dwyer
Hold floating_modifier and drag a tiling view to a new location.
2018-09-11Introduce tiling_drag directiveRyan Dwyer
2018-09-11Rename OP_MOVE to OP_MOVE_FLOATINGRyan Dwyer
In preparation for introducing OP_MOVE_TILING.
2018-09-08Align titles to baselineRyan Dwyer
This does the following: * Adds a baseline argument to get_text_size (the baseline is the distance from the top of the texture to the baseline). * Stores the baseline in the container when calculating the title height. * Takes the baseline into account when calculating the config's max font height. * When rendering, pads the textures according to the baseline so they line up.
2018-09-06Introduce seat_set_focus_container and seat_set_focus_workspaceRyan Dwyer
These are the same as seat_set_focus, but accept a specific type rather than using nodes. Doing this adds more typesafety and lets us avoid using &con->node which looks a little ugly. This fixes a crash that pretty much nobody would ever come across. If you have a bindsym for "focus" with no arguments and run it from an empty workspace, sway would crash because it assumes `container` is not NULL.
2018-09-06Remove __PRETTY_FUNCTION__Scott Anderson
This is a non-standard extension as well as completely useless in C. __func__ is the standard way of doing this.
2018-09-05Remove offset argument to container_add_siblingRyan Dwyer
I added this thinking that it might come in useful. Turns out it didn't.
2018-09-05Don't use wlr_output propertiesRyan Dwyer
These properties are before rotation.
2018-09-05Implement type safe arguments and demote sway_containerRyan Dwyer
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.
2018-09-04Deny repeating reload by holding keyRyan Dwyer
Fixes #2568 The binding that gets stored in the keyboard's `repeat_binding` would get freed on reload, leaving a dangling pointer. Rather than attempt to unset the keyboard's `repeat_binding` along with the other bindings, I opted to just not set it for the reload command because there's no point in reloading repeatedly by holding the binding. This disables repeat bindings for the reload command. As we now need to detect whether it's a reload command in two places, I've added a binding flag to track whether it's a reload or not.
2018-09-04Implement window_role criteria tokenRyan Dwyer
Depends on https://github.com/swaywm/wlroots/pull/1226
2018-09-03move criteria "instance", "class" and "window_role" inside HAVE_XWAYLAND ifdefs"Pascal Pascher
2018-09-03Fixed window_type with disabled xwayland support.Pascal Pascher
2018-09-02Rename fowa enum and use switch in view_request_activateRyan Dwyer
2018-09-02Implement focus_on_window_activationRyan Dwyer
Depends on https://github.com/swaywm/wlroots/pull/1223
2018-09-01Merge pull request #2547 from RyanDwyer/fix-reload-crashDrew DeVault
Fix crash on reload
2018-09-01Implement window_type criteria tokenRyan Dwyer
2018-09-01Allow reload command to exist anywhere in the command stringRyan Dwyer
This fixes a crash if you have commands where reload appears in the middle or at the end, such as `bindsym r mode default, reload`.
2018-08-28Prepare arrange code for type safe argumentsRyan Dwyer
This commit changes the arrange code in a way that will support type safe arguments. The arrange_output et al functions are now public, however I opted not to use them directly yet. I've kept the generic arrange_windows there for convenience until type safety is fully implemented. This means this patch has much less risk of breaking things as it would otherwise. To be type safe, arrange_children_of cannot exist in its previous form because the thing passed to it could be either a workspace or a container. So it's now renamed to arrange_children and accepts a list_t, as well as the parent layout and parent's box. There was some code which checked the grandparent's layout to see if it was tabbed or stacked and adjusted the Y offset of the grandchild accordingly. Accessing the grandparent layout isn't easy when using type safe arguments, and it seemed odd to even need to do this. I determined that this was needed because a child of a tabbed container would have a swayc Y matching the top of the tab bar. I've changed this so a child of a tabbed container will have a swayc Y matching the bottom of the tab bar, which means we don't need to access the grandparent layout. Some tweaks to the rendering and autoconfigure code have been made to implement this, and the container_at code appears to work without needing any changes. arrange_children_of (now arrange_children) would check if the parent had gaps and would copy them to the child, effectively making the workspace's gaps recurse into all children. We can't do this any more without passing has_gaps, gaps_inner and gaps_outer as arguments to arrange_children, so I've changed the add_gaps function to retrieve it from the workspace directly. apply_tabbed_or_stacked_layout has been split into two functions, as it had different logic depending on the layout. Lastly, arrange.h had an unnecessary include of transaction.h. I've removed it, which means I've had to add it to several other files.
2018-08-26Merge pull request #2513 from RyanDwyer/rename-root-outputsDrew DeVault
Rename sway_root.outputs to sway_root.all_outputs
2018-08-26Remove layout.cRyan Dwyer
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-26Make separate gaps functions per container typeRyan Dwyer
In preparation for using type safety.
2018-08-25Add comment for sway_root.all_outputsRyan Dwyer
2018-08-25Rename sway_root.outputs to sway_root.all_outputsRyan Dwyer
This list includes disabled outputs. When sway_container is demoted, we'll need to store the root's children (ie. enabled outputs) in the sway_root. It makes sense to put these in a list called `outputs`, so I'm renaming the existing list in advance.
2018-08-25Relocate container_move, container_move_to and container_get_in_directionRyan Dwyer
* container_move is only called from the move command * container_move_to was called from both the move command and the sticky command, but the sticky command can easily not call it * container_get_in_direction is only called from the focus command Moving these functions to their respective commands gives better separation of code and removes bloat from layout.c. These functions will need to be refactored to take advantage of type safety, so separating them will make this easier to refactor. The following static functions have also been moved: * is_parellel * invert_movement * move_offs * container_limit * workspace_rejigger * move_out_of_tabs_stacks * get_swayc_in_output_direction They were all used by the move functions, except for the last one which is used by focus. Other changes: * index_child has been renamed to container_sibling_index, moved to container.c and made public * sway_output_from_wlr has been renamed to output_from_wlr_output, moved to output.c and made public * container_handle_fullscreen_reparent has been made public * sway_dir_to_wlr has been made public No changes have been made to any of the moved functions, other than updating calls to functions that have been renamed.
2018-08-24Refactor destroy functions and save workspaces when there's no outputsRyan Dwyer
This changes the destroy functions to the following: * output_begin_destroy * output_destroy * workspace_begin_destroy * workspace_destroy * container_begin_destroy * container_destroy * view_begin_destroy * view_destroy The terminology was `destroy` and `free`, and it has been changed to `begin_destroy` and `destroy` respectively. When the last output is disconnected, its workspaces will now be stashed in the root. Upon connection of a new output they will be restored. There is a new function `workspace_consider_destroy` which decides whether the given workspace should be destroyed or not (ie. empty and not visible). Calling container_begin_destroy will no longer automatically reap the parents. In some places we want to reap the parents and in some we don't, so this is left to the caller. container_reap_empty_recursive and container_reap_empty have been combined into one function and it will recurse up the tree.
2018-08-21Replace enum resize_edge with wlr_edgesRyan Dwyer
2018-08-20Fix bad-free in swaynagBrian Ashworth
2018-08-20Fix crash when adding outputRyan Dwyer
2018-08-20Send output enter/leave events correctlyRyan Dwyer
Previously we used a reparent event to detect when a view changes parent, then sent an output enter/leave to the surfaces if needed. This worked for tiling views but not floating views, as floating views can intersect another output without changing parent. The solution implemented for floating views also applies cleanly to tiling views, so the previous method has been completely replaced and the reparent event has been removed. This introduces a new function container_discover_outputs. This function compares the container's `current` position to the outputs, sends enter and leave events as needed, and keeps track of which outputs it's intersecting in a new `container->outputs` list. If it has entered a new output with a different scale then the title and marks textures will also be recreated at the new scale. The function is called when a transaction applies. This is convenient as it means we don't have to call it from various places. There is imperfect rendering when a floating view overlaps two outputs with different scales. It renders correctly for the most recently entered output, but there is only one title texture so it renders incorrectly on the old output. Fixes #2482
2018-08-19Merge pull request #2478 from RyanDwyer/standardise-debugDrew DeVault
Standardise debug variables