Commit graph

347 commits

Author SHA1 Message Date
John Lindgren
065c37d3f5 xwayland: Process move-only client configure requests more quickly
For a move-only client configure request, treat it similarly to
view_move() by updating the scene-graph immediately, rather than waiting
for handle_commit().  Move-and-resize requests are handled the same as
before.

This (mostly?) fixes the glitchiness that was noticeable when dragging
an undecorated XWayland window (e.g. Audacious in Winamp mode).

Also:

- Reduce some code duplication in handle_request_configure() by
  simply calling configure(), as suggested by @johanmalm in #428.
- Factor out common logic after a move and/or resize into view_moved().
2022-07-18 22:06:12 +01:00
Consolatis
f1ba0a89fc src/view.c: Prevent crash by killing a moving application
When a view is destroyed labwc calls interactive_end(view) which
may reposition the view which is partly destroyed and doesn't own
any surface anymore. To prevent this scenario from happening don't
call interactive_end() at all and just reset server->grabbed_view
and server->input_mode directly.

Before this patch, the bug could be reproduced by:
- xcalc &
- sleep 5; killall xcalc
- move the xcalc window completely to one of the edges

The change in src/xwayland.c is not required for this bug
to be fixed but may prevent something similar in the future.
2022-07-11 15:58:33 +01:00
Consolatis
baaee26937 src/view.c: Fall back to default geometry when changing state
This makes sure that applications starting in maximized of fullscreen
mode always have their natural_geometry set to sensible values.

Partly fixes #403
2022-07-03 13:46:47 +01:00
Consolatis
3c345201cd Restore original geometry when moving a tiled window
Fixes #391
2022-07-02 16:21:32 +01:00
Consolatis
5585977f72 Rename unmaximized_geometry to natural_geometry 2022-07-02 16:21:32 +01:00
Consolatis
02595eefaa src/view.c: Unmaximize on SnapToEdge 2022-07-02 12:43:23 +01:00
Consolatis
7bdcef51b7 src/view.c: Prevent SnapToEdge while in fullscreen 2022-07-02 12:43:23 +01:00
Consolatis
2f7b1fd5fb src/view.c: Re-arrange tiled windows on un-fullscreen and un-maximize 2022-07-02 12:43:23 +01:00
Consolatis
2d02fec4b2 src/view.c: Re-arrange tiled windows on decoration change 2022-07-02 12:43:23 +01:00
Consolatis
8ed62b4860 src/view.c: Re-arrange tiled windows on layout change 2022-07-02 12:43:23 +01:00
Consolatis
3a4b55886d src/view.c: Convert SnapToEdge to use view_apply_xxx_geometry framework 2022-07-02 12:43:23 +01:00
Consolatis
8c5157a098 workspaces: Wire up workspaces 2022-06-15 22:26:21 +02:00
Consolatis
5a4c5de332 src/menu: Attach view to menu and use it when executing actions
This fixes #380
2022-06-09 22:09:40 +01:00
Consolatis
32dac72734 src/view.c: Cache server pointer 2022-06-09 17:15:13 +02:00
Johan Malm
bbea6d8330 view: if view->fullscreen on destroy, re-enable top-layer
The layer-shell top-layer is disabled when running an application in
fullscreen mode, so if this is the case on view_destroy() we have to
re-enabled the top-layer again.

Reported-by: @heroin-moose
Helped-by: @Consolatis

Fixes #377
2022-06-07 23:41:37 +02:00
Consolatis
2ed7a10779 Chase wlroots: every scene_node parent is now a tree
Chases wlroots ccd0f85c2a36308e35b153c7f9653abac7659af3
wlr_scene: Only allow parenting on a wlr_scene_tree
2022-06-07 07:13:37 +01:00
Johan Malm
fb1af5f68e view: when centering, top/left align if view is bigger than usable area 2022-06-06 20:46:29 +02:00
Johan Malm
0f22613952 view: take into account top-margin for xwayland views
...in order to center accurately.
2022-06-06 20:46:29 +02:00
Johan Malm
d1e16c5030 view: center correctly with scale != 1
Fixes issue #376
2022-06-06 20:46:29 +02:00
Consolatis
986ab70780 Prevent missing direction arguments to segfault labwc
Reported-by: @Flrian
2022-06-03 19:07:13 +01:00
Consolatis
6dd290afc9 src/cursor.c: Fix branch condition for out-of-view selecting/dragging
Instead of using the stored view for comparison use the actual surface.

Before this patch, there were situations where the branch intended for
out-of-window text selection / scrollbar dragging was used even though
the cursor never left the surface.

Partly fixes #340
2022-05-24 17:35:32 +01:00
Johan Malm
bacabdc4a1 xdg-shell: set fallback geometry if width/height == 0 on unmaximize 2022-04-28 22:29:10 +01:00
Johan Malm
76a85ae87d view: do not crash on missing output
We should survive all outputs being disabled
2022-04-26 21:55:04 +01:00
Consolatis
73930f7e0f view: Refactor view destruction some more 2022-04-23 08:59:06 +01:00
Joshua Ashton
d0b9680d00 view: Refactor view destruction
Consolidates all of the view destruction code for xwl + xdg into one function.

Fixes several notable bugs along the way:
  - Fixes a crash when alt tabbing when a selected view gets destroyed.
  - Fixes the OSD not updating to reflect a view has been destroyed.
2022-04-22 01:58:52 +02:00
Johan Malm
b27955050f xdg-shell: remove view->padding
With the wlroots scene-graph API, the padding variable is no longer
needed for windows with Client Side Decoration (CSD).
2022-04-21 20:21:36 +01:00
Johan Malm
286b2146c3 Chase wlroots X11 hints update 2022-04-20 18:48:49 +01:00
Johan Malm
a234e71b29 view: increase accuracy of center-alignment
When center-aligning, take into account usable area and server-side
decoration (if used).
2022-04-19 23:01:23 +01:00
Consolatis
6b4d9b9383 Add ToggleAlwaysOnTop action 2022-04-09 17:18:39 +01:00
Johan Malm
5b34c81768 Fix trivial coding style breaches 2022-04-04 20:53:36 +01:00
John Lindgren
8e1f115486 cursor: Fix "jumping opposite edges" issue when resizing
Commit 08c537e ("xwayland: Honor size increments from
WM_SIZE_HINTS") adjusted only the window width/height according
to the size hints.  If resizing from the top or left edge of the
window, we also need to adjust the window position to keep the
bottom or right edge from jumping around.
2022-04-04 17:28:52 +01:00
Consolatis
3171aba0e2 ssd: dynamically adjust resize extents based on usable_area
Fixes #265
2022-03-12 15:32:44 +00:00
Johan Malm
6b8c10dcd4 view: show fullscreen views above top-layer
See https://github.com/LBCrion/sfwbar/issues/24
2022-03-07 21:20:44 +00:00
Johan Malm
d34efad7bb view: remove warning in view_move_resize() 2022-03-07 20:59:54 +00:00
Johan Malm
bd9ac3478a Remove src/damage.c 2022-03-01 20:54:52 +00:00
Johan Malm
f4c9d1ba9f Set node position in xdg/xwayland commit handlers
...in order to sync resize/move events to avoid left/bottom edge wobbling
when resizing with top/left resize edges
2022-02-23 22:39:57 +00:00
Consolatis
5862b65f89 Convert SSD to scene nodes 2022-02-23 21:47:01 +00:00
Consolatis
7ea733761b Use view->scene_tree as toplevel for view + some legwork:
desktop.c move_to_front() calls wlr_scene_node_raise_to_top
desktop.c, ssd/include.h add LAB_SSD_{OSD, MENU, LAYER_SURFACE} enums
desktop.c desktop_surface_and_view_at() -> desktop_node_and_view_at()
cursor.c reenable cursor_rebase()
cursor.c reenable button click on layer surface
2022-02-23 21:47:01 +00:00
Johan Malm
532656ad5b Use wlroots scene-graph API
Move xdg-shell and xwayland-shell surfaces to new API

Also render alt-tab on-screen-display by converting cairo-surface to
wlr_buffer
2022-02-23 21:46:48 +00:00
John Lindgren
e0264e471c view: Handle maximized view on disabled output more simply
Partially reverts commit ab07b68d7e.
2022-01-08 17:23:57 +00:00
Johan Malm
ab07b68d7e view: adjust views safety following layout change
Refactor view_adjust_for_layout_change() in order to:

- Use view_maximize() - otherwise the unmaximized geometry remains off
  the screen.
- Avoid relying on view_apply_maximized_geometry() to handle missing
  output

Issue #194
2022-01-07 22:01:44 +00:00
Johan Malm
be89478f7a view: fix bug in view_snap_to_edge()
Use view_move() and view_move_resize() correctly.

view_move_resize() should only be used when the view actually changes
width and/or height, otherwise the serials might cause a delay in moving
xdg-shell clients.

Issue #201
2022-01-07 20:53:48 +00:00
ARDiDo
70845643af fullscreen: ignore decorations and maximize requests while fullscreen 2022-01-02 10:19:48 -05:00
ARDiDo
0f9374c701 decorations: use view_apply_maximized_geometry instead of view_maximize 2022-01-01 11:50:35 -05:00
John Lindgren
a837fefc80 Adjust views to account for output layout changes
labwc currently doesn't handle output layout changes very well:

 - Windows can end up "lost" completely offscreen
 - Maximized/fullscreen windows can end up spanning multiple outputs

Currently, new_output_notify() and output_destroy_notify() contain logic
to update the cursor and force a repaint when outputs are added or
removed.  This logic in fact needs to run on any output layout change,
so consolidate it into a new function, output_update_for_layout_change().

Then add a second new function, view_adjust_for_layout_change(), which
adjusts window placement to account for the new layout.

The behavior is roughly as follows:

 - Normal windows that end up offscreen are centered on the closest
   output (making use of the existing view_center() logic)
 - Maximized windows are re-maximized on the closest output.  Logic is
   also added to the unmaximize step to check that the original
   unmaximized position is still on-screen.
 - Fullscreen windows are re-fullscreened on the same output if
   possible; otherwise they are un-fullscreened.

Minimized windows don't require any special handling.  Their placement
is adjusted just the same, but invisible to the user until they are
later unminimized.

There is some positioning glitch still with un-fullscreening a window
whose output has been disconnected/disabled; it can end up in an
unexpected position (but at least has the correct size and decoration).
I don't think this is due to a bug in my change per se, but perhaps the
change has exposed a bug elsewhere.

Fixes: #177
2022-01-01 16:20:13 +00:00
ARDiDo
cd50344fdb view.c: re-maximize views when toggling decorations 2021-12-31 17:18:51 +00:00
Consolatis
4b2a7a28c6 view:c Do not overwrite unmaximized dimensions on fullscreen
Before: window -> maximize -> fullscreen -> unfullscreen would reset pre maximized state
Now: window -> maximize -> fullscreen -> unfullscreen -> unmaximize works as expected
2021-12-28 10:14:40 -05:00
Consolatis
09949e6faf view.c: Remove 'activated' flag when minimizing a view
Before this change a window that had been minimized showed up with states Minimized and Activated.
For foreign-toplevel clients like taskbars that could mean to handle multiple windows at once
having a 'activated' state even though they were clearly minimized.
2021-12-28 09:50:21 -05:00
John Lindgren
2ce961a0bd Check the return value of wlr_output_layout_get() for NULL
wlr_output_layout_get() seems to return NULL for disabled outputs.

Fixes: #174
2021-12-24 21:08:32 +00:00
ARDiDo
fd09e26ac8 view.c: end interactive mode when maximizing a view 2021-12-23 12:22:46 -05:00