Commit graph

4961 commits

Author SHA1 Message Date
sghctoma 315b2bf100 Replace getdelim to make swaybar work on FreeBSD
This commit fixes a segfault in swaybar on FreeBSD that was caused by
using getdelim with EOF as delimiter on an infinite stream. The FreeBSD
implementation handles the "no more data, delimiter not found, and EOF
not reached" scenario as an error, so it can't be used to read the
output of status command. This commit replaces the getline/getdelim
calls with reading all available data from the stream in one go.
2018-09-26 20:38:16 +02:00
sghctoma 2f258eff6f Make sway/ipc-server.c POSIX 2001 compliant
This commit replaces the non-standard SOCK_NONBLOCK and SOCK_CLOEXEC
flags with two fcntl calls. This makes the file POSIX 2001 compliant,
thus it is no longer necessary to conditionally define, or use internal
(__BSD_VISIBLE) feature test macros.
2018-09-26 20:10:53 +02:00
sghctoma 3e924f2345 Add _C11_SOURCE feature test macro on FreeBSD
This will restrict the default namespace set on FreeBSD to the C11
standard (everything is visible by default), which will prevent possible
conflicts with symbols hidden behing __BSD_VISIBLE.
2018-09-26 20:05:45 +02:00
Drew DeVault a8a0014e0f Make libpam optional 2018-09-26 17:32:15 +02:00
Drew DeVault 1ef96f7fb7
Merge pull request #2713 from RyanDwyer/fix-remap-race
Fix race condition crash when view unmaps + maps quickly
2018-09-26 07:39:13 -05:00
Ryan Dwyer 4e4898e90f Fix race condition crash when view unmaps + maps quickly
When a view unmaps, we start a transaction to destroy the container,
then when the transaction completes we destroy the container and unset
the view's container pointer. But if the view has remapped in the
meantime, the view's container pointer will be pointing to a different
container which should not be cleared.

This adds a check to make sure the view is still pointing to the
container being destroyed before clearing the pointer. The freeing of
the title format is also removed as it is already freed when the view
destroys in view_destroy.
2018-09-26 21:33:54 +10:00
Brian Ashworth c43374cdf0
Merge pull request #2712 from alexbakker/fix-crash
Add a missing null check for moving tiling containers
2018-09-25 16:46:38 -04:00
Alexander Bakker d129108cdd Add a missing null check for moving tiling containers 2018-09-25 22:19:46 +02:00
emersion 08815f9cfb
Merge pull request #2708 from RyanDwyer/fix-output-disconnect-crash
Fix crash when disconnecting output
2018-09-25 09:36:25 +02:00
Ryan Dwyer b1a0e95e8e Fix crash when disconnecting output
If the output being disconnected contains views, and the views are being
relocated to another output of a different size, a transaction must
occur to reconfigure them. This means by the time
container_discover_outputs is called, the output is already disabled and
wlr_output is NULL.

I considered making it check output->wlr_output, but output->enabled
should work just as well and is more descriptive.
2018-09-25 08:21:22 +10:00
Ian Fan 6194a445d3 input: enable configuring tablets with libinput 2018-09-24 12:49:20 +01:00
Ian Fan a10fef9ae8 cursor: allow cursor_set_image to accept a NULL image to hide cursor 2018-09-24 12:34:09 +01:00
Ian Fan dafb0526d7 seat: only show cursor if pointer configured 2018-09-24 10:55:42 +01:00
emersion a032925ae7
Merge pull request #2701 from RedSoxFan/input-wildcard
Implement support for input wildcard
2018-09-24 10:43:18 +02:00
Brian Ashworth baeb28ea62 Implement support for input wildcard 2018-09-23 19:56:52 -04:00
emersion 4a4f07ac25
Merge pull request #2699 from RedSoxFan/fix-2667
swaybg: fix increasingly smaller bg on hotplug
2018-09-23 21:44:57 +02:00
Brian Ashworth 9ea99a5d36 swaybg: fix increasingly smaller bg on hotplug
render_background_image alters the scale that cairo uses. Depending on
the image mode, resolution, and image size, this may cause the surface
to be rendered increasingly smaller. By calling cairo_save and
cairo_restore, any changes to the cairo settings by the function are
not kept as a side effect.

The surface that swaybg uses is also now cleared before rendering a frame.
This is needed to avoid artifacts on resolution or scale changes with
certain combinations of image modes, resolutions, and image sizes. This
was also part of the increasingly smaller background visual since it
made it so it was not obvious the region being rendered to was smaller
and caused an increasing number of smaller images to be appear for each
hotplug.
2018-09-23 15:17:36 -04:00
Drew DeVault 0bc9dc192f
Merge pull request #2696 from RyanDwyer/fix-gtkmenubar
Fix GtkMenuBar always opening first item
2018-09-23 07:18:09 -05:00
Ryan Dwyer 271b24ddfb Fix GtkMenuBar always opening first item
It seems like advertising that we support touch when we don't, while
using SSD, makes GtkMenuBar misbehave. Please don't ask me why...
2018-09-23 22:00:18 +10:00
Drew DeVault c2c257b884
Merge pull request #2695 from RyanDwyer/remove-moveoutoftabsstacks
Remove move_out_of_tabs_stacks
2018-09-23 06:19:12 -05:00
emersion 4bc327a021
Merge pull request #2694 from RyanDwyer/fix-sticky-jumping-on-switch
Prevent sticky containers from jumping on workspace switch
2018-09-23 09:42:07 +02:00
emersion 1af4d314d1
Merge pull request #2686 from RyanDwyer/tab-scrolling
Implement tab cycling using mouse wheel
2018-09-23 09:39:53 +02:00
Ryan Dwyer 9753e52d6b Flatten container in workspace_rejigger 2018-09-23 14:32:26 +10:00
Ryan Dwyer 0b7fb6943e Fix some bugs as a result of removing move_out_of_tabs_stacks 2018-09-23 13:55:06 +10:00
Ryan Dwyer 93624599b3 Remove move_out_of_tabs_stacks
This fixes the following. Create these layouts and run move right:

(Initial layout -> expected result -> actual result)

* `H[S[unfocused focused] unfocused]` ->
`H[S[unfocused] focused unfocused]` ->
`H[H[S[unfocused] focused] unfocused]`
* `H[S[unfocused focused] V[unfocused]]` ->
`H[S[unfocused] V[unfocused focused]]` ->
`H[H[S[unfocused] focused] V[unfocused]]`

move_out_of_tabs_stacks was originally made to allow views to move out
of the tabbed/stacked container in the parallel direction, but at some
point this has started working using the regular logic.
2018-09-23 13:10:36 +10:00
Ryan Dwyer 64445f4214 Prevent sticky containers from jumping on workspace switch
If you have swaybar docked to the top, and you create a floating sticky
container and switch workspaces on the same output, the sticky container
would move down by the height of swaybar on each switch.

This happens because when creating the workspace we set the dimensions
to the same as the output, then the subsequent arrange corrects it.
During this arrange, floating containers are translated so they stay
relative to the workspace. This translation needs to not occur for the
initial arrange.

This patch makes workspaces have a zero width and height when first
created, so we can detect whether this is the initial arrange and avoid
translating the floating containers if so.
2018-09-23 11:36:16 +10:00
Drew DeVault 68395f34f6
Merge pull request #2688 from RyanDwyer/exec-commands-without-focus
Allow running commands on containers without focusing them
2018-09-22 19:51:02 -05:00
Ryan Dwyer ae2055dcf1
Merge pull request #2690 from ianyfan/commands
commands: remove obselete code for sticky windows when switching workspace
2018-09-23 09:52:38 +10:00
Ryan Dwyer 1b32eadbc1
Merge branch 'master' into commands 2018-09-23 09:44:30 +10:00
Drew DeVault 53b5c4791e Remove contrib/awesome.config
We deprecated the stuff necessary to make this work.
2018-09-22 19:39:56 -04:00
Drew DeVault c6bf0e8e98
Merge pull request #2691 from ggreer/pango-font-options
Call pango_cairo_context_set_font_options().
2018-09-22 18:28:31 -05: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 987e0054ac Call pango_cairo_context_set_font_options().
Call pango_cairo_context_set_font_options() before pango_cairo_update_layout() and pango_cairo_show_layout(). By default, Pango "merges" the Cario font options with its own, which doesn't enable full hinting.
2018-09-22 15:33:03 -07:00
Ian Fan d101f3d357 commands: remove obselete code for sticky windows when switching workspace 2018-09-22 23:27:53 +01:00
Drew DeVault 082488a81c
Merge pull request #2677 from ggreer/pretty-fonts
Render fonts slightly nicer
2018-09-22 13:56:51 -05: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
emersion eae42606e2
Merge pull request #2660 from RyanDwyer/fix-scratchpad-iteration
Fix double iteration of scratchpad containers
2018-09-22 13:40:01 +02:00
Ryan Dwyer 480bcda1ee
Merge pull request #2687 from ianyfan/swaybar
swaybar: explicitly check return value of getdelim
2018-09-22 20:10:58 +10:00
Ian Fan a4d346627c swaybar: explicitly check return value of getdelim
This prevents an signed-to-unsigned conversion error on buffer_index if
getdelim fails and returns -1, which caused swaybar to try to search the
header for the array and immediately failing
2018-09-22 11:02:47 +01:00
emersion b148da848a
Merge pull request #2679 from RyanDwyer/fix-pango-escaping
Fix pango escaping and refactor escape_markup_text
2018-09-22 11:25:07 +02:00
Ryan Dwyer 2f36502828 Use pango_layout_set_text instead of pango_layout_set_markup 2018-09-22 18:40:19 +10: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 fe7e66407c
Merge pull request #2678 from RyanDwyer/reconfigure-on-reposition
Reconfigure xwayland views when repositioned
2018-09-22 10:09:55 +02:00
Ryan Dwyer bf5933c501 Implement tab cycling using mouse wheel
Firstly, a change had to be made to the container_at functions. If you
create layout `T[view H[view view]]` and hover the second tab, the
container_at functions would return the focus_inactive child. They now
return the split container itself. To compensate for this,
dispatch_cursor_button has been adjusted to find the focus_inactive
child before focusing it.

The actual implementation of wheel scrolling is pretty straightforward.
This uses handle_cursor_axis, so I took a similar approach to
handle_cursor_button (ie. creating a dispatch_cursor_axis function).
2018-09-22 10:42:59 +10:00
Brian Ashworth d2a0a3cc0a
Merge pull request #2666 from emersion/swaybar-hotplug
swaybar: handle hotplugging
2018-09-21 15:36:08 -04:00
Brian Ashworth 04862e2121
Merge branch 'master' into swaybar-hotplug 2018-09-21 15:28:53 -04:00
Drew DeVault e554274673
Merge pull request #2672 from ianyfan/swaybar
swaybar: fix parsing errors when json is sent in parts
2018-09-21 12:52:57 -05:00
Drew DeVault ff2659ece4
Merge pull request #2683 from ammgws/patch-1
stabilityに関する注記を更新
2018-09-21 09:46:30 -05:00
Jason cf370539e5
stabilityに関する注記を更新 2018-09-21 23:26:01 +09:00
Ian Fan a2326661e1 swaybar: log invalid i3bar json 2018-09-21 15:10:47 +01:00