Commit graph

4780 commits

Author SHA1 Message Date
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
Ian Fan ccdec2a329 swaybar: reset tokener if json is incomplete
If the tokener parses incomplete json, it sets its error value to
json_tokener_continue. This means that extra json should be provided,
but the code was providing the entire object again. In the interest of
simplicity, the tokener is reset so that buffer_pos always points to the
start of the current object.
2018-09-21 15:09:54 +01:00
Ian Fan dbda5d35eb swaybar: update buffer_pos when moving object to start of buffer 2018-09-21 14:33:49 +01:00
Ryan Dwyer ae2f53a477 Reconfigure xwayland views when repositioned
Fixes #2673.
2018-09-21 23:02:48 +10:00
Drew DeVault e6a52ae387 Update stability notice in README 2018-09-21 08:51:50 -04:00
emersion 65ab6b7eb4
Merge pull request #2680 from marienz/no-x11-backend
Fix compilation against wlroots without X11 backend
2018-09-21 14:50:02 +02:00
Marien Zwart 37e51a20cc Fix compilation against wlroots without X11 backend 2018-09-21 21:25:03 +10:00
Ryan Dwyer 057635f1a3
Merge pull request #2665 from emersion/render-output-segfault
Fix segfault in output_render
2018-09-21 20:15:27 +10:00
Ryan Dwyer 0798fadff2
Merge branch 'master' into render-output-segfault 2018-09-21 20:05:39 +10:00
emersion 8a5ff5a4db swaybar: don't wl_display_roundtrip on each frame
This was the source of numerous bugs, from hotplug events not being
received to segfaults because wl_display_roundtrip was making the
bar process unplug events while blocking in an iteration over all
outputs.
2018-09-20 19:31:03 +02:00
emersion 82f1393cbb swaybar: handle hotplugging
Don't kill and respawn swaybars on hotplug.
2018-09-20 18:37:51 +02:00
emersion fa4308c5ab
Merge pull request #2671 from emersion/output-execute-no-focus
Fix segfault when executing command without focus
2018-09-20 18:36:47 +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
emersion efc08ec888 Fix segfault when executing command without focus 2018-09-19 15:50:42 +02:00
Drew DeVault f0fb27aba6
Merge pull request #2669 from RyanDwyer/create-output-command
Introduce create_output command (for developer use)
2018-09-19 09:24:15 -04:00
emersion a2090d4222
Merge branch 'master' into create-output-command 2018-09-19 14:19:22 +02:00
Drew DeVault a83773e5ca
Merge pull request #2670 from ianyfan/commands
config: free strings fields when freeing input config
2018-09-19 08:16:20 -04:00
Ian Fan 8e8a5ca217 config: free strings fields when freeing input config 2018-09-19 12:55:49 +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
emersion 4289343e17 Fix segfault in output_render 2018-09-19 11:03:25 +02:00
Drew DeVault cdce604d8e
Merge pull request #2640 from ianyfan/swaybar
Overhaul swaybar protocol handling (+fixes)
2018-09-18 22:52:36 -04:00
Ian Fan 47a66da5de swaybar: only free tokener when using i3bar protocol 2018-09-18 18:06:19 +01:00
Ian Fan 5912325d5c swaybar: add debugging statements for handling i3bar json 2018-09-18 16:10:34 +01:00
Ryan Dwyer c6ff1f67f1 Fix double iteration of scratchpad containers
root_for_each_container and root_find_container were using incorrect
logic to determine if a container was hidden in the scratchpad.
Containers will have a NULL parent if they are a direct child of a
workspace. Containers will have a NULL workspace if they are hidden in
the scratchpad.

The incorrect check meant that root_for_each_container would run the
callback on scratchpad containers twice. This meant that executing a
command such as `[class="$something"] scratchpad show` would cause the
command to run twice, resulting in the container being shown and hidden
again which is effectively a no op.

Fixes #2655.
2018-09-18 21:53:02 +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 8cbce77e1d swaybar: rewrite protocol determination
This now uses the getline function to receive the header, replacing
read_line_buffer, which has been deleted since it is otherwise unused.
Furthermore, once the protocol has been determined, the current status
is handled immediately to be shown (though this has not been added for
the i3bar protocol since it has not yet been rewritten to handle this).
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 babd9618b9 swaybar: only create i3bar block hotspot if click events are enabled 2018-09-18 11:36:33 +01:00
Ian Fan 87c93d6ad9 swaybar: send trailing comma with click event json 2018-09-18 11:36:33 +01:00
Ian Fan 9932c6a1f1 swaybar: fix empty function prototypes 2018-09-18 11:36:33 +01:00
Ian Fan 952453480f swaybar: invalidate file descriptors upon closing 2018-09-18 11:36:33 +01:00