Commit graph

5328 commits

Author SHA1 Message Date
William Wold e787a1581c Give windows pointer focus immediately when they are switched to
Fixes #2401 (aka #2558)

Previously, when switching windows, pointer focus was not changed until the pointer was moved. This makes the pointer enter happen immediately, without the side effects of other attempted fixes.
2018-09-10 10:18:12 -07:00
emersion 024b9d85ea
Merge pull request #2613 from apreiml/fix_no_last_focus_fail
handle_layer_shell_surface: Do not crash if seat doesn't have focus
2018-09-10 13:56:02 +02:00
Armin Preiml 47b6fea3fe handle_layer_shell_surface: Do not crash if seat doesn't have focus 2018-09-10 11:23:08 +02:00
Drew DeVault f7568e26e9
Merge pull request #2609 from ianyfan/commands
commands: prevent running empty seat command
2018-09-08 17:06:33 -04:00
Ian Fan 6cd92b193c commands: prevent running empty seat command 2018-09-08 19:53:27 +01:00
Drew DeVault 1376d36104
Merge pull request #2530 from apreiml/ipc_missing_get_tree
start adding missing ipc properties
2018-09-08 09:20:36 -04:00
Drew DeVault 3600b3db57
Merge pull request #2602 from RyanDwyer/fix-title-textures
Fix gaps in title textures and vertically center them
2018-09-08 09:19:47 -04:00
Armin Preiml 7919ae5e44 code style fixes 2018-09-08 13:24:01 +02:00
Armin Preiml 2dec0d894b get_tree: percent cast to double on division 2018-09-08 13:24:01 +02:00
Armin Preiml 79eaa26b3e get_tree: default values
Added default values for all nodes, because the i3 get_tree always returns
all fields inside the json objects.

Add geometry and window for views. Window is only availabel on
x11 windows otherwise it's NULL.

Calculate percent only if parent is not empty to avoid division by 0.
2018-09-08 13:24:01 +02:00
Armin Preiml 3d8c3e560b missing ipc stuff: rebase to typesafety 2018-09-08 13:24:01 +02:00
Ryan Dwyer 9215ca0f01 Align titles to baseline
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-08 16:25:07 +10:00
Ryan Dwyer 9226aad58c Fix gaps in title textures and vertically center them
There was code that attempted to fill in the gap below the title texture
when the texture isn't tall enough, but this only worked when the output
was positioned at 0,0. The reason is that render_rect expects a box
passed in a hybrid layout-local/output-buffer-local system, and we were
passing purely output-buffer-local. I've added a comment documenting
this.

By the way, we can't use layout-local coordinates for the rectangle box
because in some cases we set the box based on a texture size. Texture
sizes are buffer-local, and we'd have to divide them to bring it back to
layout-local which means losing precision. We could use
output-buffer-local coordinates for the box, but this would require
translating the coordinates from layout-local to output-buffer-local in
many places during rendering.

This patch also vertically centers the text inside the title bar.
2018-09-08 16:25:07 +10:00
Drew DeVault 030b5bc024
Merge pull request #2603 from emersion/fix-dnd
Fix drag-and-drop
2018-09-07 11:09:02 -04:00
emersion 251a7ebc4b Fix drag-and-drop 2018-09-07 15:43:15 +02:00
Drew DeVault d86afdc6ed
Merge pull request #2600 from RyanDwyer/fix-workspace-switching
Fix workspace switching
2018-09-06 19:18:30 -04:00
Ryan Dwyer 763554e1be Fix workspace switching
The output also needs to be made dirty when focusing a new output.
2018-09-07 08:08:40 +10:00
emersion f3b96d4050
Merge pull request #2594 from RyanDwyer/fix-pinentry
Float views when min == max on either dimension
2018-09-06 21:28:51 +02:00
Drew DeVault ed9e7bb8f4
Merge pull request #2593 from RyanDwyer/dont-be-so-dirty
Don't dirty outputs unnecessarily
2018-09-06 10:08:57 -04:00
Ryan Dwyer cf32d5d776 Float views when min == max on either dimension
This fixes pinentry-gtk-2, but might make other views floating which
would otherwise be tiled. This patch is more of a trial which could end
up becoming a permanent fix.
2018-09-06 23:57:57 +10:00
Ryan Dwyer f30527e0cd Don't dirty outputs unnecessarily 2018-09-06 23:25:10 +10:00
emersion 4a3b705a12
Merge pull request #2592 from RyanDwyer/fix-fullscreen-unmap-focus
Second attempt at restoring focus when closing a fullscreen view
2018-09-06 14:59:01 +02:00
Ryan Dwyer 635ae9557c Second attempt at restoring focus when closing a fullscreen view
To reproduce the problem this is fixing, create H[view view view],
fullscreen one of the views and close it. The entire workspace will be
given focus rather than one of the siblings.

This happens because we emit the destroy event, so the seat code tries
to find a new focus, but the view it finds is still believed to be
hidden by the fullscreen view so it's discarded and the workspace is
used instead.

This clears the workspace's fullscreen pointer prior to emitting the
destroy event so that the seat code finds an appropriate new focus.
2018-09-06 22:34:09 +10:00
Brian Ashworth c26beebd88
Merge pull request #2591 from RyanDwyer/fix-workspace-switch
Make outputs dirty when changing focus
2018-09-06 07:24:08 -04:00
Ryan Dwyer 5896781df4 Make outputs dirty when changing focus
Fixes a workspace switch bug introduced by
5967ee1fbc.
2018-09-06 21:15:24 +10:00
emersion 8e2a2e5ca4
Merge pull request #2589 from RyanDwyer/seat-set-focus-type
Introduce seat_set_focus_container and seat_set_focus_workspace
2018-09-06 12:56:21 +02:00
Brian Ashworth 6ab38ba098
Merge pull request #2590 from RyanDwyer/fix-output-active-workspace
Fix crash when switching to new workspace during transaction
2018-09-06 06:30:21 -04:00
Ryan Dwyer 5967ee1fbc Fix crash when switching to new workspace during transaction
When rendering, the workspace for the output needs to be retrieved from
the output's `current` state. output_get_active_workspace returns the
pending workspace, which crashes if the pending workspace is new and
hasn't completed a transaction yet.
2018-09-06 20:20:29 +10:00
Ryan Dwyer 908095ef9a Introduce seat_set_focus_container and seat_set_focus_workspace
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-06 19:26:56 +10:00
emersion bea9f9c63f
Merge pull request #2578 from RyanDwyer/fix-binding-reload
Fix management of bindings during reload
2018-09-06 10:41:49 +02:00
Brian Ashworth 63567f5ac6
Merge pull request #2587 from RyanDwyer/fix-layout-toggle-crash
Fix crash when running "layout toggle"
2018-09-06 00:42:47 -04:00
Ryan Dwyer 1f941163d3 Fix crash when running "layout toggle"
The argc and argv used in this function are the same ones used by the
layout command itself.
2018-09-06 14:29:26 +10:00
Drew DeVault c6a74cb4df
Merge pull request #2586 from RyanDwyer/fix-fullscreen-focus-crash
Fix crash when focusing from fullscreen in an invalid direction
2018-09-05 22:12:54 -04:00
Drew DeVault 2eec9740bd
Merge pull request #2585 from RyanDwyer/fix-move-across-outputs
Fix crash when moving view across outputs
2018-09-05 22:04:38 -04:00
Ryan Dwyer 8859da1dc3 Fix crash when focusing from fullscreen in an invalid direction
* Fullscreen a view
* Run `focus <direction>` where there is no output in that direction

The output returned was rightfully NULL, which needs to be handled.
2018-09-06 12:03:13 +10:00
Drew DeVault 7b79ab2577
Merge pull request #2583 from RyanDwyer/fix-null-surface-crash
Fix crash when views rapidly map and unmap
2018-09-05 21:59:13 -04:00
Ryan Dwyer 01117db6d9 Fix crash when moving view across outputs
It was incorrectly determining that the container being moved and the
destination had the same parent, which resulted in tree corruption. Both
parents can be NULL but the containers may belong to different
workspaces.

To reproduce, create layout H[V[view] view] in one workspace then move a
view left or right from another output into that workspace.
2018-09-06 11:53:55 +10:00
Drew DeVault 97474f12e3
Merge pull request #2582 from ascent12/func
Remove __PRETTY_FUNCTION__
2018-09-05 21:44:52 -04:00
Ryan Dwyer 9642b87b9e Fix crash when views rapidly map and unmap
Suppose the following:

* Transactions are already in progress - say transaction A.
* View A maps, which creates transaction B and appends it to the
transaction queue.
* View B maps, which creates transaction C and appends it to the queue.
* View A unmaps, which creates transaction D and appends it to the
queue.
* Transaction A completes, so transaction B attempts to save View A's
buffer, but this doesn't exist so it saves nothing.
* Rendering code attempts to render View A, but there is no saved buffer
nor live buffer that it can use.

Rather than implement an elaborate solution for a rare circumstance,
I've take the safe option of just not rendering anything for that view.
It means that if you reproduce the scenario above, you might get the
title and borders rendered but no surface.
2018-09-06 11:39:52 +10:00
Scott Anderson bcde223129 Remove __PRETTY_FUNCTION__
This is a non-standard extension as well as completely useless in C.
__func__ is the standard way of doing this.
2018-09-06 13:31:57 +12:00
Drew DeVault f255881134
Merge pull request #2579 from RyanDwyer/adjust-container-box
Adjust container box
2018-09-05 21:14:19 -04:00
Drew DeVault 85e95d5825
Merge pull request #2580 from RyanDwyer/fix-focus-after-fullscreen
Restore focus correctly when closing a fullscreen view
2018-09-05 20:39:13 -04:00
Ryan Dwyer 5cc70d1dfd Restore focus correctly when closing a fullscreen view
We weren't calling seat_send_focus. I think this was previously called
by seat_set_focus_warp.
2018-09-06 09:33:37 +10:00
Ryan Dwyer c6368febc8 Adjust container box
Prior to f5b9815128, children of tabbed
and stacked containers would have their container size and position set
to the same as the tabbed/stacked container. Normally this would be a
problem for a layout such as T[V[view]], but there was some code in the
arrange functions which would check if the grandparent of the view was a
tabbed or stacked container and would offset the view's Y accordingly.

Commit f5b9815128 changed the box to
exclude the titlebar for all tabbed/stacked children so that the
grandparent check could be removed. But this meant the title was not
covered in the container and wasn't damaged when the child changed its
title.

This patch changes it so that a child of a tabbed/stacked container will
have its box include the title bar if the child is a view, but not if
it's a layout container. This fixes the title damage issue while
avoiding the grandparent check in the arrange functions, and matches
what we see visually.
2018-09-06 09:13:36 +10:00
Ryan Dwyer 32c7386b0f Fix management of bindings during reload
seat_execute_command needs to check the flags on `binding_copy`, as
`binding` will be a dangling pointer after a reload command.

handle_keyboard_key needs to set the next_repeat_binding for
non-reloads prior to executing the command in case the binding is
freed by the reload command.
2018-09-06 08:33:00 +10:00
Drew DeVault 49c937fc87
Merge pull request #2572 from RedSoxFan/wlr-output-disabling
Call wlr_output_enable on enable/disable if needed
2018-09-05 14:55:13 -04:00
Brian Ashworth c246cf84c8 Call wlr_output_enable on enable/disable if needed 2018-09-05 14:00:00 -04:00
Drew DeVault 610eb94617
Merge pull request #2540 from RyanDwyer/typesafety
Implement type safe arguments and demote sway_container
2018-09-05 09:33:27 -04:00
emersion aa2bf98e04
Merge pull request #2574 from ammgws/block-bg-fix
Fix swaybar block background fill logic
2018-09-05 12:11:27 +02:00
Jason 13fbe5176b
Fix swaybar block background fill logic
Same as #2571 but for 1.0.
2018-09-05 18:48:31 +09:00