Commit graph

1006 commits

Author SHA1 Message Date
Brian Ashworth 00745d6280 Fix bar subcommand handler structs and selection 2018-10-13 08:00:01 -04:00
Ian Fan cd6917d4a8
Merge branch 'master' into bar-bindsym 2018-10-10 12:23:04 +00:00
Rouven Czerwinski 41991542ca Add mouse_warping container
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes #2577
2018-10-10 12:45:21 +02:00
Ryan Dwyer 61699a1146 resize: Determine if anything changed using before/after check
Returning a boolean from container_resize_tiled and resize_tiled doesn't
work in all cases. This patch changes it back to void and does a
before/after check to see if the container was resized.
2018-10-09 22:25:21 +10:00
Brian Ashworth 1c969e86f5 Implement bar bindsym 2018-10-09 08:12:46 -04:00
Drew DeVault 4bebee620f
Merge pull request #2772 from RyanDwyer/improve-popup-damage
Only damage popups when popups have damage
2018-10-09 00:02:36 +02:00
Ryan Dwyer f23588de3c Introduce container_is_transient_for 2018-10-08 23:00:36 +10:00
Ryan Dwyer 832ebc8966 Implement popup_during_fullscreen
This introduces a new view_impl function: is_transient_for. Similar to
container_has_ancestor but works using the surface parents rather than
the tree.

This patch modifies view_is_visible, container_at and so on to allow
transient views to function normally when they're in front of a
fullscreen view.
2018-10-08 22:49:59 +10:00
Ryan Dwyer 82423991a8 Reload config using idle event
This patch makes it so when you run reload, the actual reloading is
deferred to the next time the event loop becomes idle. This avoids
several use-after-frees and removes the workarounds we have to avoid
them.

When you run reload, we validate the config before creating the idle
event. This is so the reload command will still return an error if there
are validation errors. To allow this, load_main_config has been adjusted
so it doesn't apply the config if validating is true rather than
applying it unconditionally.

This also fixes a memory leak in the reload command where if the config
failed to load, the bar_ids list would not be freed.
2018-10-08 19:28:53 +10:00
Drew DeVault 92e1fc00fd Shim client.background and client.placeholder
These are not supported by sway, but are valid i3 commands and should not
cause config errors.

Also includes a couple of minor touch-ups.
2018-10-07 14:44:37 -04:00
Ryan Dwyer 1059e173f4 Only damage popups when popups have damage
The previous behaviour was to damage the entire view, which would
recurse into each popup. This patch makes it damage only the popup's
surface, and respect the surface damage given by the client.

This adds listeners to the popup's map and unmap events rather than
doing the damage in the create and destroy functions. To get the popup's
position relative to the view, a new child_impl function get_root_coords
has been introduced, which traverses up the parents.
2018-10-07 11:07:29 +10:00
Ryan Dwyer b0393ae34b swaylock: Support keyboard and pointer disconnects and reconnects 2018-10-06 09:38:12 +10:00
Ian Fan e2dc6dfcd8 Remove obsolete base64.c file 2018-10-04 20:17:19 +01:00
Jonathan Buch 7727d54faf
Fix focusing topmost floating windows
Re-focus on the container on which the cursor hovers over.  A
special case is, if there are menus or other subsurfaces open
in the focused container.  It will prefer the focused container
as long as there are subsurfaces.

This commit starts caching the previous node as well as the
previous x/y cursor position.  Re-calculating the previous
focused node by looking at the current state of the cursor
position does not work, if the environment changes.
2018-10-03 16:23:14 +02:00
Jonathan Buch 298ccb539c
Add configuration for raising containers on focus
* New configuration option: raise_floating
  (From the discussion on https://github.com/i3/i3/issues/2990)
* By default, it still raises the window on focus, otherwise it
  will raise the window on click.
2018-10-03 16:23:12 +02:00
Drew DeVault 06c214a800
Merge pull request #2703 from RyanDwyer/csd-border
Add CSD to border modes
2018-10-03 13:03:06 +02:00
Ian Fan 65593f49bc swaybar: add leading comma to click event JSON 2018-10-02 14:05:51 +01:00
Brian Ashworth bb25194844 Handle border options for gaps
Fixes `hide_edge_borders smart` when gaps are in use.
Implements `hide_edge_borders smart_no_gaps` and `smart_borders
on|no_gaps|off`.

Since `smart_borders on` is equivalent to `hide_edge_borders smart`
and `smart_borders no_gaps` is equivalent to `hide_edge_borders
smart_no_gaps`, I opted to just save the last value set for
`hide_edge_borders` and restore that on `smart_borders off`. This
simplifies the conditions for setting the border.
2018-10-01 21:19:06 -04:00
Brian Ashworth 742d1764a6 Fix smart gaps 2018-10-01 09:41:15 -04:00
Drew DeVault f1dbdce0b2
Merge pull request #2726 from RyanDwyer/overhaul-gaps
Make gaps implementation consistent with i3-gaps
2018-09-30 13:47:35 +02:00
Drew DeVault 8f6aca2166
Merge pull request #2725 from PumbaPe/add-tap-and-drag
Add tap and drag to sway-input
2018-09-30 13:44:11 +02:00
Arkadiusz Hiler 1e70f7b19e Turn funcs() into funcs(void)
If they really do not take undefined number of arguments.
2018-09-30 14:09:05 +03:00
Arkadiusz Hiler d8200012fb Remove declarations that do no have definitions
There is a couple of leftover header files/declarations, which were
fronting implementations that are long gone.

Let's get rid of them.
2018-09-30 14:09:05 +03:00
Ian Fan 02dfeea54c swaybar: synchronize rendering to output frames 2018-09-30 10:07:33 +01:00
PP ae2b70f59e add tap-and-drag setting to sway-input 2018-09-29 11:49:41 +02:00
Ryan Dwyer 42f1fdf015 Return an error when resizing is a no op 2018-09-29 17:05:55 +10:00
Ryan Dwyer 415a48ac63 Make gaps implementation consistent with i3-gaps
This changes our gaps implementation to behave like i3-gaps.

Our previous implementation allowed you to set gaps on a per container
basis. This isn't supported by i3-gaps and doesn't seem to have a
practical use case. The gaps_outer and gaps_inner properties on
containers are now removed as they just read the gaps_inner from the
workspace.

`gaps inner|outer <px>` no longer changes the gaps for all workspaces.
It only sets defaults for new workspaces.

`gaps inner|outer current|workspace|all set|plus|minus <px>` is now
runtime only, and the workspace option is now removed. `current` now
sets gaps for the current workspace as opposed to the current container.

`workspace <ws> gaps inner|outer <px>` is now implemented. This sets
defaults for a workspace.

This also fixes a bug where changing the layout of a split container
from linear to tabbed would cause gaps to not be applied to it until you
switch to another workspace and back.
2018-09-29 11:08:19 +10:00
Ian Fan 751bb4a376 swaybar: move i3bar definitions into separate file 2018-09-28 13:54:58 +01:00
Ian Fan bcd2a8fe12 swaybar: remove unused focused_output property 2018-09-28 13:54:58 +01:00
Ian Fan 312d009f65 swaybar: fail if bar id is invalid 2018-09-28 13:48:59 +01:00
Ryan Dwyer 138d10d5d6 Rename workspace_outputs to workspace_configs and fix memory leak
When we eventually implement `workspace <ws> gaps inner|outer <px>`,
we'll need to store the gaps settings for workspaces before they're
created. Rather than create a workspace_gaps struct, the approach I'm
taking is to rename workspace_outputs to workspace_configs and then add
gaps settings to that.

I've added a lookup function workspace_find_config. Note that we have a
similar thing for outputs (output_config struct and output_find_config).

Lastly, when freeing config it would create a memory leak by freeing the
list items but not the workspace or output names inside them. This has
been rectified using a free_workspace_config function.
2018-09-28 22:35:38 +10:00
Drew DeVault c977349120 Add support for building swaylock without PAM
This involves setuid'ing swaylock, which then forks and drops perms on
the parent process. The child process remains root and listens on a pipe
for requests to validate passwords against /etc/shadow.
2018-09-28 13:53:01 +02:00
Ryan Dwyer 21ff87d72b Improve CSD logic
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-27 22:51:37 +10:00
Ryan Dwyer 6d0442c0c2 Rename view_set_csd_from_client to view_update_csd_from_client 2018-09-27 22:51:37 +10:00
Ryan Dwyer 7b138e5ef0 Add CSD to border modes
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-27 22:51:37 +10:00
Brian Ashworth baeb28ea62 Implement support for input wildcard 2018-09-23 19:56:52 -04:00
Ryan Dwyer cb66bbea42 Allow running commands on containers without focusing them
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-23 08:39:11 +10:00
Geoff Greer c495164f60 swaybar, swaylock, & tree/container: Set cairo font options to render text and lines with subpixel hinting (if available). 2018-09-22 11:34:21 -07:00
Ryan Dwyer 10ef118e09 Fix pango escaping and refactor escape_markup_text
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-22 18:33:28 +10:00
emersion 82f1393cbb swaybar: handle hotplugging
Don't kill and respawn swaybars on hotplug.
2018-09-20 18:37:51 +02:00
Drew DeVault 6ec3626228
Merge pull request #2676 from ianyfan/ipc
ipc: add pid information for views in layout tree
2018-09-19 17:37:58 -04:00
Ian Fan 81f3fda6fa ipc: add pid information for views in layout tree 2018-09-19 22:21:09 +01:00
Ryan Dwyer db28459634 Introduce create_output command (for developer use)
Should help with testing hotplugging.
2018-09-19 21:54:27 +10:00
Ian Fan 7882ac66ef swaybar: rewrite i3bar protocol handling
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-18 11:36:33 +01:00
Ian Fan 70245c2cd5 swaybar: rewrite text protocol handling
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-18 11:36:33 +01:00
Ian Fan 9932c6a1f1 swaybar: fix empty function prototypes 2018-09-18 11:36:33 +01:00
emersion 012df55be5 swaybar: use output names instead of output indexes 2018-09-17 16:04:09 +02:00
Ryan Dwyer f6e218a643 Rename seat_get_active_child to seat_get_active_tiling_child
Also renames container to con in one function to prevent ugly line
wrapping.
2018-09-16 22:01:54 +10:00
emersion 7699c5444c Update for swaywm/wlroots#1243 2018-09-14 19:21:44 +02:00
Ian Fan 2eaef80206 i3bar: count references to blocks
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-12 08:28:28 +01:00