Commit graph

1629 commits

Author SHA1 Message Date
NorwayFun
e8d06c5b2e po: Add Georgian translation 2023-02-22 11:33:26 +01:00
John Lindgren
976136299d output: Add output_nearest_to()
Reimplement output_from_cursor_coords() as output_nearest_to_cursor().
2023-02-21 08:46:22 +01:00
John Lindgren
84294c9cfb xdg: Use wlr_xdg_surface_get_geometry() to get size
This fixes an issue with havoc not having a valid size on map().

Investigation showed that xdg_surface->current.geometry is set only by
the xdg_surface::set_geometry protocol message, which is optional. If
set_geometry is not called, then we are supposed to compute the size
from the surface buffer(s). wlr_xdg_surface_get_geometry() already
accounts for this, so we just need to use wlr_xdg_surface_get_geometry()
instead of reading xdg_surface->current.geometry directly.
2023-02-21 08:30:10 +01:00
John Lindgren
2e1c360c71 xdg: Remove unused #include 2023-02-21 08:30:10 +01:00
Consolatis
397a8f4785 README.md: suggest using nested gamescope for gaming
Fixes #690
2023-02-20 18:50:13 +00:00
John Lindgren
f018ca708d view: Rediscover output in view_adjust_for_layout_change() 2023-02-20 13:45:40 -05:00
John Lindgren
d83e99ff66 view: Handle fullscreen also in view_apply_special_geometry() 2023-02-20 13:45:40 -05:00
John Lindgren
1f80cda061 view: Factor out set_fullscreen() helper from view_set_fullscreen() 2023-02-20 13:45:40 -05:00
John Lindgren
c639cdba06 xdg: Save natural_geometry.x/y with initially maximized view
Fixes an issue where, if Thunar was started maximized, it would
un-maximize to the top-left corner rather than the center.
2023-02-20 11:50:12 -05:00
John Lindgren
74bc16910a xdg: Use view_center() for parent-relative centering
- Add optional struct wlr_box* ref argument to view_center()
- Perform margin adjustment within view_center()
- Expose view_output() to fetch parent's output
2023-02-20 11:50:12 -05:00
John Lindgren
612c296d52 view: Align large views to usable area 2023-02-20 11:50:12 -05:00
John Lindgren
5062c5bea3 view: Add optional output parameter to view_center()
Allows centering the view on a specific output without the workaround of
overwriting view->current.x/y.
2023-02-20 11:50:12 -05:00
Flrian
df7c47b8d7 labwc-actions(5): update action format 2023-02-19 12:51:50 +01:00
John Lindgren
913f89b6c4 Revert "xwayland: Fix size issue when starting VLC fullscreen"
The fix caused a couple of issues:

1. Ignoring client configure requests caused some clients to hang
   and not repaint correctly. We are supposed to synthesize a
   ConfigureNotify event when ignore/override a client configure
   request, but this isn't possible with current wlroots.

2. Setting view->natural_geometry from client configure requests
   resulted in overwriting good values with bad in some cases (e.g.
   with tiled xfce4-terminal in xwayland mode).

For now, revert the fix. This does allow clients to mess with view
positioning for maximized/fullscreen/tiled views, but right now the
alternatives seem worse.

The original specific issue (VLC undoing its fullscreen geometry)
is arguably a bug in VLC anyway.

This reverts commit 09599861ac.
2023-02-18 05:31:22 +01:00
John Lindgren
49c9466039 view: Tidy up view->output/view->fullscreen redundancy
A fullscreen view currently has its output specified twice by:
  - struct output *output
  - struct wlr_output *fullscreen

view->fullscreen may also become a dangling pointer if the output is
disconnected, because view_on_output_destroy() clears view->output but
not view->fullscreen.

To eliminate the redundancy and the dangling pointer, let's change
view->fullscreen to a Boolean and rely on view->output to specify the
output.

Along the way, change a few related usages of struct wlr_output to
struct output as well.

No functional change intended.

v2: Don't allow entering fullscreen on disabled output (makes
    conditions for entering/leaving fullscreen symmetric)
v3: Use output_is_usable() helper
2023-02-17 06:59:39 -05:00
John Lindgren
6efc6a9db4 output: Add output_is_usable() helper 2023-02-17 06:59:39 -05:00
John Lindgren
fe7edf82d9 region: Add output pointer to struct region 2023-02-17 04:47:15 +01:00
John Lindgren
e0388ba8bf region: Add #include to make header dependency explicit 2023-02-17 04:47:15 +01:00
John Lindgren
d2fae39fe3 view: Add view_evacuate_region() helper
v2: Modify asserts as suggested by Consolatis
2023-02-17 04:47:15 +01:00
John Lindgren
0ca6c4c763 view: Unify view_move()/view_move_resize()
view->impl->move() is a specific case of view->impl->configure().
To reduce code duplication, we can use view->impl->configure() for
pure moves (without resize) as well.

xwayland's move() function also possibly contained a race condition
when there was a pending resize, as it used the current surface
width/height rather than the pending width/height. This is fixed.
2023-02-16 05:21:47 +01:00
John Lindgren
859eba1c6b desktop: Avoid centering views without initial geometry 2023-02-15 18:59:26 +00:00
John Lindgren
e465a41c0a ssd: Fix segfault when disabling output with fullscreen view
wlr_output_layout_get() returns NULL for disabled outputs.

Backtrace (abbreviated):

     #0  lab_wlr_output_layout_layout_coords at ../src/ssd/ssd_extents.c:33
     #1  ssd_extents_update at ../src/ssd/ssd_extents.c:133
     #2  ssd_extents_create at ../src/ssd/ssd_extents.c:95
     #3  ssd_create at ../src/ssd/ssd.c:161
     #4  decorate.part.0.lto_priv.0 at ../src/view.c:637
     #5  decorate at ../src/view.c:636
     #6  view_set_fullscreen at ../src/view.c:716
     #7  view_adjust_for_layout_change ../src/view.c:745
     #8  desktop_arrange_all_views ../src/desktop.c:52
     #9  output_update_all_usable_areas at ../src/output.c:495
     #10 output_update_for_layout_change at ../src/output.c:263
     #11 do_output_layout_change at ../src/output.c:423
     #12 do_output_layout_change at ../src/cursor.c:267
     #13 output_config_apply at ../src/output.c:334
     #14 handle_output_manager_apply at ../src/output.c:354
2023-02-15 03:09:21 -05:00
Consolatis
ecd03b70ef src/xdg.c: sync move with pending resize
Before this patch, configuring a surface with a new size,
immediately followed up by one or more view_move() calls
would move the surface to the new coordinates immediately
without waiting for the resize. This caused visual glitches
when for example dragging a maximized window: the position
would change but the size was still that of a maximized
window.

This patch fixes that by just ignoring view_move() requests
(but still updating view->pending) if there is a configure
request pending. Once the client commit comes in the new
size will be applied as usual.
2023-02-13 11:30:15 -05:00
Consolatis
06e0771341 view: make view_move_resize always work
It was not working before because in the case of wayland
we are only dealing with sizes as wayland has no notion
of a global position. A wayland client would thus not
necessarily respond to a configure request which sets
the same size again. This causes us to also not apply
a new position set in view->pending because there may
be no commit from the client in those cases.

We previously worked around this issue in some parts
of the code to check our new sizes against the pending
ones and if they were the same we would call view_move
instead. That had two issues:

- Not all parts of the code did that which could end up
  delaying the positioning either to the next completely
  unrelated xdg commit event or to the next view_move call

- The code started to repeat itself, e.g. the same condition
  with calls to either view_move or view_move_resize based
  on the result

This patch fixes it by doing the check in the xdg configure
handler instead. Xwayland is unaffected by this issue as we
are always configuring a xwayland client with both, position
and size.
2023-02-13 08:58:31 -05:00
Consolatis
231d88706a src/cursor.c: explain X11 cursor name fallback 2023-02-12 09:34:37 +00:00
Consolatis
f9882d8dd3 src/cursor.c: cursor names: use absence of "grab" to trigger fallback
This is necessary because wlroots backported a patch containing
cursor name aliases to the 0.16 branch. That internal mapping
does not alias "grab" to "grabbing" because it is not technically
part of the cursor-names spec.

To keep the "grab" cursor working on systems with no cursor theme
available (or in an unusual location) change the trigger for our
internal cursor name aliasing to "grab".

See wlroots commit 1e345c74c3ca5d2575aa975d4d9af87cd0c7ba13
Alias existing cursor defaults to cursor-spec cursor names

for further details.
2023-02-11 13:27:03 +00:00
Consolatis
aeb6aa0cd8 src/view.c: view_is_floating() add missing tiled_region_evacuate
Also
- remove static inline (e.g. trust the compiler to optimize)
- move from include/view.h to src/view.c
2023-02-11 13:15:49 +00:00
Dino Duratović
a90adab948 docs: add hint for using wev
Potentially fixes #456.
2023-02-10 21:31:14 +00:00
Consolatis
f56d07aa47 Add xdg-activation protocol
This PR allows applications to activate themselves *if they provide
a valid xdg_activation token* (e.g. raise to the top and get keyboard
focus).

These tokens are given out by the xdg_activation protocol implemented
by wlroots and can be configured by the client requesting the token
in three ways:
- an "empty" token
  (apparently used to tell the compositor about "urgency")
- seat / input serial attached
- surface attached

Wlroots makes sure that
- If the client attached the seat / input serial: those two are valid.
- If the client attached a surface: that it has keyboard focus at the
  point where the request is finalized. There is a patch [1] pending
  for backport to wlroots 0.16 that also allows valid tokens when the
  supplied surface had cursor focus.
- a token is only valid for 30 seconds after being given out

The token can then be used by the client or given to other clients by
unspecified means (e.g. via environment variable or dbus) which then
may use the token on their own surface and request activation.

We only handle the actual request activation part:
- If the seat is set on the token we know wlroots validated seat and
  input serial
- Thus, if no seat is set we deny the activation request so we don't
  have windows suddenly popping up and taking over the keyboard focus
  (focus stealing prevention)
- We should also check for the surface being set but we can't do that
  with wlroots 0.16 as it will reset the surface to `NULL` when it is
  destroyed (which is something that usually happens for
  notifications). Once we move to wlroots 0.17.x we can add the
  missing surface check because it provides a `new_token` signal.
  We can use it to attach further details to the token which are then
  verified later when we decide if we allow the activate request or
  not.

With this PR in place the following setup should activate windows:
- launching an URL in foot should activate the target application if
  it is already running, foot requests a proper token and then sets it
  as `XDG_ACTIVATION_TOKEN` environment var before spawning `xdg-open`
- clicking on a `mako` notification with a `default` action defined
  should request a proper token which is then given to the application
  starting the notification and can thus be used to activate itself

This protocol is still very much in the process of being
implemented / finalized all over the place (e.g. GTK / QT / Firefox /
notification daemons, ..) but we should do our part and remove labwc
from the puzzle of potential issues causing this not to work.

[1] f6008ffff4)
2023-02-10 20:51:29 +00:00
John Lindgren
db1d6fa308 xdg: Fix positioning of initially-maximized views
- Don't overwrite pending size in map() if it was already set
- Don't reposition view in map() if maximized/fullscreen

Also, as future-proofing in case we one day allow initially-tiled views,
replace explicit maximized/fullscreen checks with view_is_floating().
2023-02-10 10:45:16 +01:00
John Lindgren
a1b5e1939d xdg: Just call view_center() now that it uses pending width/height 2023-02-09 18:26:44 +01:00
John Lindgren
cf6eb29ef5 view: Use pending rather than current dimensions in positioning
This should fix race conditions (such as #671) when multiple
position changes occur in rapid succession.
2023-02-09 18:26:44 +01:00
John Lindgren
0181e5f4ae xdg: Set initial pending dimensions for the view at map
We would like to use the pending dimensions in view positioning
logic, so make sure they are set early on.
2023-02-09 18:26:44 +01:00
John Lindgren
b75dbd5b38 view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05:00
John Lindgren
3941991505 menu: Compute usable area for the correct output
If a menu was opened via keybind while the cursor was on another,
differently-sized output, the wrong usable area was used to
position the menu.
2023-02-09 00:33:56 -05:00
John Lindgren
103a2a8f6c xdg: Handle corner case of move with pending resize correctly
If xdg_toplevel_view_move() is called when a resize is pending
(e.g. after xdg_toplevel_view_resize() but before handle_commit()),
the newer x/y coordinates passed to move() should take precendence
over the older pending_move_resize.x/y coordinates.

This is consistent with the logic used in xwayland.c's move().
2023-02-08 22:22:10 +00:00
John Lindgren
cfc3c93102 xdg: Eliminate redundant update_x/update_y flags
struct view's pending_move_resize.update_x/update_y flags appear to
be redundant, since we can easily determine whether x/y have been
update via a simple comparison in handle_commit().

The only corner case I can think of where this change might affect
behavior, is if xdg_toplevel_view_move() is called while a resize
is still pending (e.g. after xdg_toplevel_view_configure() but
before handle_commit()). This corner case will be addressed in the
following commit.
2023-02-08 22:22:10 +00:00
John Lindgren
a417c1c761 xwayland: Save natural geometry from initially maximized views 2023-02-08 22:19:25 +00:00
John Lindgren
09599861ac xwayland: Fix size issue when starting VLC fullscreen 2023-02-08 22:15:14 +00:00
Consolatis
44a15b16ce CI: adapt to new debian.sources format 2023-02-06 04:39:52 +01:00
Johan Malm
f829a78918
Merge pull request #735 from Consolatis/feature/clear_action
Allow clearing key/mouse bindings
2023-02-04 18:59:38 +00:00
Johan Malm
6a51764884
Merge pull request #747 from Consolatis/feature/foreign_output_tracking
src/foreign.c: track outputs
2023-02-03 21:59:12 +00:00
Consolatis
4a8b50603e src/config/rcxml.c: allow clearing key/mouse bindings
Fixes #567
2023-02-03 03:30:10 +01:00
Consolatis
27218cd2c9 src/view.c: make view_wlr_output() static
.. as there are no external consumers left.
2023-02-02 13:40:21 +01:00
Consolatis
3a21c39509 src/foreign.c: track outputs
Fixes #744
2023-02-02 13:26:53 +01:00
Consolatis
14a0c83ae0 src/foreign.c: refactor 2023-02-01 17:47:34 +00:00
Consolatis
82e9e866ec Enable more compiler warnings 2023-02-01 10:42:22 +01:00
Consolatis
1995a33df9 CodeStyle: prevent space in code indents 2023-01-31 21:22:40 +00:00
Johan Malm
a3fff9f87b build: bump version to 0.6.1 2023-01-29 16:22:09 +00:00
Johan Malm
649b324446 NEWS.md: add notes on 0.6.1 2023-01-29 16:20:58 +00:00