aboutsummaryrefslogtreecommitdiff
path: root/sway
AgeCommit message (Collapse)Author
2019-03-20Support focus <direction> for floating containersRyan Dwyer
This kind of worked before in that focus would change, but it wasn't intentionally supported and had side effects such as not raising the container, and being unable to cycle through all floaters depending on the direction used. This commit makes it properly supported. The new focus is chosen based on the distance to the center point of each floating container in the workspace, and the container is raised. In a multi output setup, if both visible workspaces have floating containers, focus will NOT cross into the other output. It is assumed the user will use a workspace binding in this case. If two floating containers occupy the exact same center point and you try to focus in a direction, the behaviour is undefined.
2019-03-19Support WLR_INPUT_DEVICE_SWITCH in swayRyan Walklin
This commit adds support for laptop lid and tablet mode switches as provided by evdev/libinput and handled by wlroots. Adds a new bindswitch command with syntax: bindswitch <switch>:<state> <command> Where <switch> is one of: tablet for WLR_SWITCH_TYPE_TABLET_MODE lid for WLR_SWITCH_TYPE_LID <state> is one of: on for WLR_SWITCH_STATE_ON off for WLR_SWITCH_STATE_OFF toggle for WLR_SWITCH_STATE_TOGGLE (Note that WLR_SWITCH_STATE_TOGGLE doesn't map to libinput and will trigger at both on and off events)
2019-03-19Clean up focus follows mouse logicRyan Dwyer
Firstly, this fixes a recent regression where having `focus_follows_mouse yes` and hovering an inactive tab caused it to gain focus. The code was missing a view_is_visible check. The code is handling the logic for both focus_follows_mouse yes and focus_follows_mouse always, where the latter will apply when nudging the mouse after a workspace switch. However, the view_is_visible check didn't apply when using focus_follows_mouse always, so hovering a tab with that configuration would cause is to focus. This was a bug. When adding the view_is_visible check, it now applies to both yes and always. Note that the comment about the split container was wrong. At this point the hovered node cannot be a split container because it passed the node_is_view check. The comment has been removed. Lastly, the else condition is completely removed. This didn't appear to have any practical use. Setting focus to the result of seat_get_focus_inactive is very likely going to be a no op. There is a slim chance that this will break something, and if so I'd like to find out what so it can be properly documented in the code.
2019-03-18Remove debug treeRyan Dwyer
This feature has served its purpose. It's better to use IPC now.
2019-03-18Document the title_format commandRyan Dwyer
2019-03-17config/output: handle wildcard in get_output_configBrian Ashworth
In #3916, I overlooked that `get_output_config` does not handle wildcards unless the config is reloading, which is a remnant of older iterations of the output config handling that went unnoticed due to `output_find_config` handling it. With the current version of the output config handling, having `get_output_config` handle wildcard configs is actually preferable. This fixes having only a wildcard output config in the config file or when connecting/enabling a new output with only a wildcard config existing.
2019-03-17Introduce default seatopRyan Dwyer
This introduces a `default` seat operation which is used when no mouse buttons are being held. This means there is now always a seat operation in progress. It allows us to separate `default` code from the standard cursor management code. The sway_seatop_impl struct has gained callbacks `axis`, `rebase` and `end`, and lost callbacks `finish` and `abort`. `axis` and `rebase` are only used by the default seatop. `end` is called when a seatop is being replaced by another one and allows the seatop to free any resources, though no seatop currently needs to do this. `finish` is no longer required, as each seatop can gracefully finish in their `button` callback. And `abort` is not needed, as calling `end` would achieve the same thing. The struct has also gained a bool named allow_set_cursor which allows the client to set a new cursor during `default` and `down` seatops. Seatops would previously store which button they were started with and stop when that button was released. This behaviour is changed so that it only ends once all buttons are released. So you can start a drag with $mod+left, then click and hold right, release left and it'll continue dragging while the right button is held. The motion callback now accepts dx and dy. Most seatops don't use this as they store the cursor position when the seatop is started and compare it with the current cursor position. This approach doesn't make sense for the default seatop though, hence why dx and dy are needed. The pressed_buttons array has been moved from the sway_cursor struct to the default seatop's data. This is only used for the default seatop to check bindings. The total pressed button count remains in the sway_cursor struct though, because all the other seatops check it to know if they should end. The `down` seatop no longer has a `moved` property. This was used to track if the cursor moved and to recheck focus_follows_mouse, but seems to work without it. The logic for focus_follows_mouse has been refactored. As part of this I've removed the call to wlr_seat_keyboard_has_grab as we don't appear to use keyboard grabs. The functions for handling relative motion, absolute motion and tool axis have been changed. Previously the handler functions were handle_cursor_motion, handle_cursor_motion_absolute and handle_tool_axis. The latter two both called cursor_motion_absolute. Both handle_cursor_motion and cursor_motion_absolute did very similar things. These are now simplified into three handlers and a single common function called cursor_motion. All three handlers call cursor_motion. As cursor_motion works with relative distances, the absolute and tool axis handlers convert them to relative first.
2019-03-17Replace seatup allows_events with button callbackRyan Dwyer
2019-03-16config/output: revamp identifier/name layeringBrian Ashworth
This revamps the way that output configs are handled when referencing an output by both identifier and name. If an output is always referred to by name or by identifier, this should have no noticeable change. As soon as there is a name output config and an identifier output config that matches an output, an output config is generated that is named `<identifier> on <name>` that is generated with the identifier output config merged on top of the name output config and stored. When a change to either is stored, the delta is merged on top of that "id on name" output config, as well. If the "id on name" output config exists, it has the highest precedence and will be used when applying a config to the output. This fixes the following case: - `swaymsg output <name> bg /path/to/wallpaper1 fill` - `swaymsg output <identifier> bg /path/to/wallpaper2 fill` - `swaymsg output <name> dpms on` Without this, the wallpaper is changed to `/path/to/wallpaper1`. With this, the wallpaper remains `/path/to/wallpaper2`.
2019-03-16Fix output config retrieval for new outputsBrian Ashworth
This removes `output_find_config`, which would take the first matching output config it found. This is fine if only a name output config, identifier output config, or even just wildcard exist, but if there is a name output config and identifier output config, they are not merged. Instead, this introduces find_output_config, which is just a wrapper for `get_output_config`. This ensures that both the name and identifier output configs are respected. This fixes the following case: - For simplicity in this example, remove all output configs from config - Run `swaymsg output <name> bg #ff0000 solid_color` - Run `swaymsg output <identifier> scale 2` - Disconnect and reconnect output Without this, the output will have the background, but not the scale. With this, the output will have both the background and scale
2019-03-15Fix quoting of commands passed to for_windowminus
E.g. `for_window [class="mpv"] move container to output "Dell Inc. ..."` does not work because the executed move command only uses `Dell` as output name.
2019-03-15output_cmd_background: validate colorsBrian Ashworth
This validates the color and fallback color in `output_cmd_background` to ensure that only colors of the form `#RRGGBB` are accepted.
2019-03-14Set prev_workspace_name based off of focusBrian Ashworth
This moves setting `seat->prev_workspace_name` from `workspace_switch` to `set_workspace`. `workspace_switch` is only called when using a `workspace` command to change the workspace so any workspace change based on criteria was not altering `seat->prev_workspace_name`. By moving it to `set_workspace`, which is called by `seat_set_focus`, it will change any time focus changes to a node on a different workspace
2019-03-13xwayland: handle floating configure request sizeBrian Ashworth
This makes it so the container gets resized by a configure request for xwayland floating views. The minimum and maximum sizes are also respected. Previously, the configure request was resizing the surface to the size requested, but never changing the container size. This caused the surface to be rendered outside of the container or to be smaller than the container. The former is never ideal and the latter makes no sense for floating views since the container itself can just be shrunk.
2019-03-12criteria: change workspace to support regexBrian Ashworth
This changes the workspace criteria to support regex instead of basic strings. This matches i3's behavior.
2019-03-12Handle seat_get_focused_workspace returning NULLBrian Ashworth
This modifiers the callers of seat_get_focused_workspace to handle getting NULL as the return value, if they did not already.
2019-03-11get_deco_rect: fix floaters on tabbed/stacked wsBrian Ashworth
This fixes the decoration rects for floating containers on a workspace that is either tabbed or stacked. Without this, the floater would incorrectly try to calculate where it's tab or stack decorations were on the workspace. This would cause a SIGFPE (due to a divide-by-zero) when the floater was on a tabbed workspace without any tiling children. Furthermore, the floater does not care what the workspace's layout is and should just use the location relative to the workspace. This should have no effect on children of a floating container.
2019-03-11commands: allow tiled sticky containers to be movedIan Fan
Namely, to a workspace on the same output. However, tiled sticky children of floating containers are still restricted.
2019-03-11Stop using wlr_output->{lx,ly}emersion
Also fixes sway_output->{lx,ly,width,height} not being updated. Also fixes output_get_in_direction adding buffer coords to layout coords.
2019-03-11Fix click behaviourRyan Dwyer
By the time seatop_allows_events was called, seatop_impl was already NULL, causing the function to always return false. This means a press event was sent to clients without a corresponding release event. This patch moves the call to seatop_finish to after the seatop_allows_events check.
2019-03-11Don't send button events to surfaces when dragging or resizingRyan Dwyer
It turns out sending button events during all seat operations is not desirable. This patch introduces a new property `seatop_impl.allows_events` which allows each operation to define whether button events should be passed to the surface or not. The `down` seat operation is the only one that supports this. As all the other seatops don't support it, the calls to seat_pointer_notify_button prior to starting them have been removed.
2019-03-11sway_view_child: add listener for view unmapBrian Ashworth
Since not all child views's have an unmap event, it is possible for it to still be mapped (default state) in the destruction handler. When the destruction handler is called, the corresponding view may have already been freed and the memory location reallocated. This adds a listener for the view unmapping and removes the mapped status. This ensures that the child view is damaged due to destruction while the view still exists and not after.
2019-03-10detect_proprietary: use strncmpBrian Ashworth
Only the main nvidia module needs to be blocked. Others such as nvidiafb are benign and do not need to be blocked
2019-03-10fullscreen: init floating on disable without sizeBrian Ashworth
If a container gets mapped as fullscreen and set to floating by criteria, the size and location are never set for the floating container. This adds a check in container_fullscreen_disable for a width or height of 0 and calls container_init_floating
2019-03-10Make raw keysyms take precedence over translatedBen Challenor
Allows both BackSpace and Shift+BackSpace to be bound under the US keyboard layout, per #3705.
2019-03-10Fix crash in cmd_workspace when layer surface has focusemersion
2019-03-10Update language in sway.desktop & sway(1)Drew DeVault
2019-03-10arrange: use int not size_t for title offsetsBrian Ashworth
This changes `apply_tabbed_layout` and `apply_stacked_layout` to use `int` instead of `size_t`. This is necessary for tabbed and stacked containers to be positioned correctly when the y-location is negative. The reasoning for this is signed plus unsigned is always an unsigned value. This was causing the y-location of the container to be positioned near `INT_MIN` due to an unsigned integer underflow
2019-03-10damage: remove output_damage_viewBrian Ashworth
This removes `output_damage_view` since it is unnecessary. The logic has been moved into its only caller `output_damage_from_view`. When damaging the whole view, `output_damage_whole_container` should be used instead
2019-03-10output_damage_whole_container: damage subsurfacesBrian Ashworth
This adds an iterative call in `output_damage_whole_container` to damage the subsurfaces for all visible views that are inside of the container. This is needed to damage subsurfaces that extend outside the box of the container. Without this, those subsurfaces will create artifacts when moving or resizing.
2019-03-09fix "directive argument is null" errorsJeff Peeler
2019-03-09Fix crash when moving window to scratchpadminus
2019-03-07ipc: describe libinput device configurationBrian Ashworth
This adds the device configurations to the ipc response for libinput devices. Only supported configuration options for the device will be added. This also moves `libinput_send_events` inside a new `libinput` object that contains the rest of the configuration options. sway-ipc(7) has been updated to reflect the changes and document the new additions.
2019-03-06ipc: fix fullscreen deco_rectBrian Ashworth
This fixes the deco_rect reported by the ipc for fullscreen containers to be all zeroes. Children of the fullscreen container should still have their decorations reported correctly
2019-03-06ipc: fix rect for stacked childrenBrian Ashworth
This now takes all titlebars for stacked children into account for the ipc property `rect`
2019-03-06Fix container_parent_layout for scratchpad windowsemersion
2019-03-06ipc: change {,deco_}rect to match i3Brian Ashworth
This fixes the `deco_rect` and `rect` properties in the IPC responses to match i3's behavior. `deco_rect` should be relative to the parent node, not the current node. This also takes tabbed and stacked decorations into account and will calculate `deco_rect` for all containers since tabbed and stacked child containers will have decorations. `rect` should exclude the window decorations.
2019-03-04Set DISPLAY after initializing Xwaylandemersion
This is necessary after https://github.com/swaywm/wlroots/pull/1596
2019-03-04Allow concurrent clicksRyan Dwyer
If two cursor buttons are pressed at the same time, the client will now be notified of the second button press. The main reason for not sending the concurrent presses was due to an early return in dispatch_cursor_button if a seatop is in progress. This patch makes it call seat_pointer_notify_button prior to returning. But it also has to make sure there's not a mismatch in events such as a release without a press. Prior to this patch, the down seatop would send press and release events in its begin and finish functions. No other seatops did this. A press event would be sent prior to starting tiling drag, but never an associated release. After this patch, no seatops send their own press or release events. We send them prior to calling the seatop begin functions, then the first part of dispatch_cursor_button handles all presses during seatops and when releasing the seatop.
2019-03-03sway.1.scd: document environment vars set by swayBrian Ashworth
This just documents the few environment variables set by sway in sway.1.scd
2019-03-03render_floating: skip fullscreen floatersBrian Ashworth
If a floater is fullscreen either on a workspace or globally, it should not be rendered on any output is is not fullscreened on. When rendering it on an output it should not be rendered on, there will be an extraneous border along the adjacent side of the output. This adds a check in render_floating to skip all fullscreened floaters
2019-03-03Fixes crash in spawn_swaybg (closes #3733)Noam Preil
2019-03-02floating_maximum_size: change default behaviorBrian Ashworth
This changes the way zero (which is the default) is interpreted for both the width and height of `floating_maximum_size`. It now refers to the width and height of the entire output layout, which matches i3's behavior. This also removes duplicated code to calculate the floating constraints in three files. Before this, `container_init_floating` used two-thirds of the workspace width/height as the max and the entire workspace width/height was used everywhere else. Now, all callers use a single function `floating_calculate_constraints`.
2019-03-02Minor fix of code duplication.hugbubby
Removes 3~ lines of code that didn't need to be restated.
2019-02-28seat: don't send button release when not pressedemersion
All seat operations except "down" eat the button pressed event and don't send it to clients. Thus, when ending such seat operations we shouldn't send the button released event. This commit moves the logic used to send pressed/released into the "down" operation.
2019-02-27sway-ipc.7: clarify window_rect omits decorationsBrian Ashworth
According to the i3 ipc documentation, `window_rect` excludes the window decorations from the calculation. This just clarifies that in `sway-ipc.7.scd`
2019-02-27Add output dpms to manpageemersion
2019-02-27Merge pull request #3766 from RedSoxFan/sway-ipc-scdocDrew DeVault
Add sway-ipc.7.scd to document IPC protocol
2019-02-27Add sway-ipc.7.scd to document IPC protocolBrian Ashworth
This add `sway-ipc.7.scd` that documents the IPC protocol. This also increased the minimum scdoc version from 1.8.1 to 1.9.0 to allow for table cells to be continued on the following line
2019-02-27config: remove double assignement to result in get_output_configRouven Czerwinski