Commit graph

112 commits

Author SHA1 Message Date
tokyo4j
bb1d0b4352 Implement <resize><drawContents>
<resize><drawContents>[yes|no] configures whether to let the clients
redraw its window content content while resizing.

When <resize><drawContents> is set to no, a multi-rect is shown to
indicate the geometry of the resized window.
2024-06-15 21:17:01 +01:00
Yuri Nesterov
65f7499f1c wayland: add support for security-context-v1 2024-05-29 22:28:06 +01:00
Consolatis
6f3f2aae27 ForEach: initialize view query window_type correctly
Before this patch, the window type would be checked even if
not actually requested to do so.

Fixes: #1852
2024-05-27 19:59:06 +01:00
Tobias Bengfort
41a3b68846 decorations: add SetDecorations action 2024-05-19 19:03:42 +01:00
Tobias Bengfort
e2590f10fd decorations: make has_ssd public 2024-05-19 19:03:42 +01:00
Tobias Bengfort
a0debda142 decorations: refactor view_set_decorations 2024-05-19 19:03:42 +01:00
Andrew J. Hesford
89589f17c4 action: allow configurable policy in AutoPlace action
Closes: #1784.
2024-05-19 17:32:52 +01:00
Tobias Bengfort
7bc3cae91a query: add window type filter for if-actions 2024-05-18 20:04:08 +01:00
Consolatis
c4d12bf5d9 xwayland: prevent shaded views from getting mouse events
Fixes: #1753
2024-05-05 21:04:55 +01:00
tokyo4j
c224e1e05a view: set LAB_MIN_VIEW_WIDTH equal to total width of buttons
This fixes pixman error due to a negative width passed to
`wlr_scene_rect_set_size()` in `ssd_titlebar_update()`.
2024-04-28 10:20:24 +02:00
Consolatis
3f10857496 Fix pid lookup for the Kill action
Before this patch, labwc would happily kill itself when the user
called the `Kill` action when any xwayland view had focus.

The reason this happened was that wlroots creates the xwayland
wayland client via socketpair() and thus a lookup of the pid
of the socket connection would return the pid of labwc itself.

This patch fixes that by implementing different pid lookup
mechanisms based on the view implementation backend.

Fixes: #1739
2024-04-22 19:11:57 +01:00
Tobias Bengfort
858e1c65cf window-rules: implement type filter
Co-Authored-By: Grigory Kirillov <txgk@bk.ru>
2024-04-20 15:29:41 +02:00
Hiroaki Yamamoto
be37f9a564
Fix various typos across the codebase 2024-03-08 13:59:20 +01:00
Johan Malm
79bca44cb1 window-rules: add root-toplevel critiera 2024-03-05 22:16:55 +01:00
Johan Malm
777e6bb868 desktop: refactor desktop_cycle_view()
...in preparation for using common window-rule criteria with osd.c

No functional change intended.

Related-to #1454
2024-03-05 22:16:55 +01:00
John Lindgren
6a35e8e78c view: remove view_is_related(), no longer used 2024-03-05 20:51:32 +00:00
John Lindgren
11cdad0c11 Revert "desktop: allow re-focus between "globally active" views of the same PID"
This is undesired when a focusable popup (e.g. applications menu) of an
unfocusable view (e.g. XWayland panel) is closed.

This reverts commit f6e3527767.
2024-03-05 20:51:32 +00:00
Johan Malm
3c3bcc2765 view: add MoveToOutput wrap attribute
Support `wrap` in view_get_adjacent_output(). This means that when seeking
an adjacent output in a particular direction from an output that is
already furthest in that direction within the layout, rather than
returning NULL, wrap around from the leftmost to the rightmost, or topmost
to the bottommost and vice versa.

Example usage:

    <action name="MoveToOutput" direction="right" wrap="yes" />

Wrap is disabled by default to keep the user interface consistent.
2024-03-02 21:23:01 +00:00
Consolatis
29a26d5ff7 edges: do not apply resistance to invisible edges 2024-02-14 21:20:45 +00:00
Consolatis
382068e452 src/view.c: store outputs the view is visible on 2024-02-06 17:23:45 +01:00
Andrew J. Hesford
cf34e60240 edges: limit edge attraction and resistance...
...to edges actually encountered by motion during interactive moves and
resizes.

In addition, ignore edge resistance and attraction for minimized views.
2024-02-05 22:05:22 +00:00
Andrew J. Hesford
3162bbb3c2 xdg: add snapping.notifyClient option to control tiling events 2024-01-30 07:30:07 -05:00
Andrew J. Hesford
c1a2dd3e27 view, xdg: notify clients when tiling windows 2024-01-30 07:30:07 -05:00
Andrew J. Hesford
9ecd8c2b43 view: ensure midpoint is visible on layout change
Fixes: #1476.
2024-01-25 20:22:10 +01:00
Jens Peters
b1d626fbfd view: add move_to_output() function 2024-01-22 22:27:08 +00:00
Jens Peters
982df84407 view: expose view_get_adjacent_output 2024-01-22 22:27:08 +00:00
Jens Peters
099929cf46 view: allow overriding of cursor placement policy 2024-01-22 22:27:08 +00:00
Consolatis
e05bedb140 feat: add Shade/Unshade/ToggleShade actions
This builds on the work of @Consolatis in #1018.

Co-authored-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
2024-01-15 21:37:36 +00:00
Johan Malm
c646c7bd1b view: constrain window size to that of usable area
...on first map (when application is started).

Fixes #1399
2024-01-08 22:08:27 +00:00
Ph42oN
bce0c6ce56
Add tearing support (#1390)
Co-authored-by: Andrew J. Hesford <ajh@sideband.org>
2024-01-08 20:58:58 +00:00
Andrew J. Hesford
c229f6edc0 view: try to honor original geometry with layout changes
Whenever the output layout changes, each view's original geometry will
be captured as last_layout_geometry (if it has not already been captured
by a previous layout change), which will remain valid unless the user
modifies the view's geometry (i.e., by tiling, maximizing, moving,
resizing or full-screening). On subsequent output layout changes, views
with valid last_layout_geometry will be back to their original position
if possible, or else to the closest possible output.
2024-01-06 19:04:11 +00:00
Andrew J. Hesford
ef62d47ad1 feat: under-cursor window placement
With under-cursor placement, new top-level windows will be centered
under the cursor rather than centered on the active view.
2023-12-26 19:20:06 +00:00
John Lindgren
83e67b32b6 xwayland: treat X11 panel views as if fixedPosition rule is set 2023-11-29 06:48:31 +00:00
Brandon Nason
bad8f334ea Add omnipresent flag for views 2023-11-28 21:41:30 +00:00
Christopher Snowhill
d7dc6e01b4 Chase wlroots: Unified mapping
Need to handle new unified mapping, where mapping is attached to the
wlr_surface objects instead of their parents. Also, most of them require
a new associate event for xsurface objects, their surface member will be
NULL before this event is received.

Refactored by jlindgren:
- add struct mappable
- unify map/unmap logic
2023-11-27 21:01:53 +00:00
Consolatis
4d679801ad src/view.c: add always_on_top criteria 2023-11-21 22:31:05 +01:00
Consolatis
13d0b14244 Update top layer visiblity on workspace switch
Fixes: #1158
2023-11-12 17:39:00 +00:00
tokyo4j
9a8a2905ad interactive: Make window snapping with mouse more intuitive
1. Prevent window snapping triggered by mouse from moving the window
 into the adjacent output.
2. Make the coordinates used to check whether window snapping is
 triggered relative to the output the cursor is at, not the output the
 view is belonging to. This allows users to grab a tiled window and move
 it into another output or tile it again in another output in a single
 drag.
2023-11-10 19:41:36 +00:00
John Lindgren
57075ce864 view: ensure that floating views don't overlap top panels
The top_left_edge_boundary_check() function in xwayland.c ensures that
views trying to position themselves at 0,0 don't end up with a titlebar
offscreen. However, it doesn't take into account the usable area and
thus these views can still end up overlapping a top panel.

Also, there is no good reason for top_left_edge_boundary_check() to be
xwayland-specific. This logic should really be part of
view_adjust_for_layout_change().

To fix all this, add a new view_adjust_floating_geometry() function,
which replaces the existing similar (and duplicated) logic in
view_apply_natural_geometry() and view_adjust_for_layout_change().

view_adjust_for_layout_change() is already being called from xwayland's
set_initial_position(), so top_left_edge_boundary_check() is now
redundant and can just be deleted.

Lightly tested with waybar and feh --geometry 640x480+0+0. The feh
window is now correctly positioned below waybar, even if started before
waybar (in that case, the feh window is moved when waybar starts).
2023-11-05 15:03:13 +00:00
Consolatis
984aeb0b0b keyboard: allow applying keyboard layout per window
Fixes #1076

It can be enabled with a config like

~/.config/labwc/rc.xml:
<keyboard layoutScope="window">

~/.config/labwc/environment:
XKB_DEFAULT_LAYOUT=de,us
XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,grp_led:scroll

With a configuration like this each window should now remember
the active keyboard layout when switching between windows.

By default, the keyboard layout keeps being a global state.
2023-11-04 07:58:43 +00:00
Tomi Ollila
7aa1dc1ca5 view.h: changed the type of tiled in struct view to enum view_edge
The type enum view_edge used to be defined in a .c file, so a
structure member 'tiled' in struct view had to be defined to
use another type.

Later (2023-08-02, commit 1ee8715) the definition of enum view_edge
was moved to view.h, so now 'tiled' can be defined to use that type.
2023-10-31 21:58:20 +00:00
John Lindgren
0430f6f818 view: implement separate horizontal/vertical maximize
This is a useful (if lesser-known) feature of at least a few popular X11
window managers, for example Openbox and XFWM4. Typically right-click on
the maximize button toggles horizontal maximize, while middle-click
toggles vertical maximize.

Support in labwc uses the same configuration syntax as Openbox, where the
Maximize/ToggleMaximize actions have an optional "direction" argument:
horizontal, vertical, or both (default). The default mouse bindings match
the XFWM4 defaults (not sure what Openbox has by default).

Most of the external protocols still assume "maximized" is a Boolean,
which is no longer true internally. For the sake of the outside world,
a view is only "maximized" if maximized in both directions.

Internally, I've taken the following approach:

- SSD code decorates the view as "maximized" (i.e. hiding borders) only
  if maximized in both directions.

- Layout code (interactive move/resize, tiling, etc.) generally treats
  the view as "maximized" (with the restrictions that entails) if
  maximized in either direction. For example, moving a vertically-
  maximized view first restores the natural geometry (this differs from
  Openbox, which instead allows the view to move only horizontally.)

v2: use enum view_axis for view->maximized
v3:
  - update docs
  - allow resizing if partly maximized
  - add TODOs & corrections noted by Consolatis
2023-10-28 22:46:49 +02:00
Axel Burri
299fb83fcc GrowToEdge, ShrinkToEdge: Implement actions 2023-10-19 19:09:42 +01:00
Axel Burri
08cff6edcf MoveToEdge: Snap to window edge
Add configurable option (enabled by default) to snap to next window
edge instead of screen edge.
2023-10-19 19:09:42 +01:00
Axel Burri
5176ac4f64 Move min/max view width/height to header
Preparatory for snap to window edge framework.
2023-10-19 19:09:42 +01:00
John Lindgren
a1324c8cdc xwayland: center stored natural geometry for initially maximized views
For views that are initially maximized or fullscreen and have no
explicitly specified position, we need to center the stored natural
geometry, or the view may end up partially offscreen once unmaximized/
unfullscreened.
2023-10-18 19:49:53 +01:00
John Lindgren
f6e3527767 desktop: allow re-focus between "globally active" views of the same PID
Commit 7e72bf975f changed behavior to not automatically focus xwayland
views using the "Globally Active" input model (WM_HINTS.inputs = false
but WM_TAKE_FOCUS listed in WM_PROTOCOLS).

One undesired side effect of this change is that when a dialog is
closed, the parent window is not re-focused if "Globally Active". This
issue is seen for example with JDownloader. It can be solved taking a
similar approach to what is done for unmanaged xwayland views: allow
automatic re-focus between views sharing the same PID.

Note that it's difficult to completely solve all of the focus issues
with Globally Active views without proper WM_TAKE_FOCUS support.
Implementing proper support is difficult since it requires wlroots
changes and would also mean waiting for a message round-trip in
desktop_focus_topmost_view().

Fixes (partially): 7e72bf975f
("view/xwayland: avoid focusing views that don't want focus")
2023-10-16 20:28:18 +01:00
John Lindgren
dd7f563a50 view: add view_wants_focus enum (NEVER/ALWAYS/OFFER) and function
This allows identifying XWayland views using the ICCCM "Globally Active"
input model. Later commits will improve handling of these views.

No functional change in this commit.
2023-10-16 20:28:18 +01:00
Arnaudv6
8920e546db Add MoveToCursor action 2023-10-15 20:36:37 +01:00
John Lindgren
5c4038493f view: add view_is_related()
Allows removing xwayland-specific stuff from seat.c.

Based on a suggestion from @Consolatis.

v2: add comments
2023-10-15 18:38:47 +02:00