Commit graph

21 commits

Author SHA1 Message Date
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
b75dbd5b38 view: Use wlr_box for current/pending geometry 2023-02-09 10:44:15 -05: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
09599861ac xwayland: Fix size issue when starting VLC fullscreen 2023-02-08 22:15:14 +00: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
14a0c83ae0 src/foreign.c: refactor 2023-02-01 17:47:34 +00:00
Consolatis
07ee56176d SnapToRegion: Allow for live config updates 2023-01-11 18:52:24 +01:00
Consolatis
4edd67de17 SnapToRegion: Evacuate tiled views from destroying outputs 2023-01-11 18:52:24 +01:00
Consolatis
9d3e309a22 SnapToRegion: Add view_snap_to_region() 2023-01-11 18:52:24 +01:00
John Lindgren
45e0a4f48c xwayland: Add xwayland.h and move more things to xwayland.c
- Move xwayland-specific struct definitions to new xwayland.h header
- Move xwayland_move_sub_views_to_front() from desktop.c to xwayland.c
- Split out xwayland_server_init/finish() from server_init/finish()
- Rename new_xwayland_surface -> xwayland_new_surface and
  xwayland_surface_new() -> handle_new_surface() for consistency
- Add "mapped" argument to xwayland_unmanaged_create() so that we can
  make unmanaged_handle_map() private to xwayland-unmanaged.c
2023-01-07 22:22:55 -05:00
Consolatis
e39fd341ec src/workspaces.c: prevent re-focus for always-on-top views
Before this patch a focused always-on-top view lost its keyboard
focus when switching workspaces. Now the view keeps its focus.
2022-12-29 18:58:25 +01:00
bi4k8
1b30edc778 don't set view->w and view->h when mapping xdg views
these should only be set on commit. doing so before then confuses
code that expects these fields to be in sync with the scene tree,
such as `handle_commit`.

these were only being set so that `view_center` could read them to
compute a centered position, so instead we can simply forward the
values directly to `view_compute_centered_position` and `view_move`.
2022-12-19 18:21:07 +01:00
John Lindgren
1e8b0414fe ssd: Allocate struct ssd and struct ssd_hover_state separately
- Store a pointer to the `struct view` in `struct ssd`
- Pass `struct ssd *` instead of `struct view *` to ssd functions
- Add `ssd_get_margin()` convenience function
2022-11-27 06:48:41 +00:00
John Lindgren
ac9228e7f8 view: Add view_reload_ssd()
Gather related logic from `reload_config_and_theme()` in `server.c` and
`ssd_reload()` in `ssd.c` into a new function, `view_reload_ssd()`.

Also drop the `view->mapped` check since we want to update any view that
has SSD nodes created, mapped or not.
2022-11-26 18:02:24 +00:00
John Lindgren
4da37c6532 view: Move xdg_surface + xwayland_surface to derived structs
Add xdg_surface_from_view() + xwayland_surface_from_view() accessors
that assert() the view is of the expected type before returning.

Fix a real bug in xdg.c parent_of() that dereferenced
`view->xdg_surface->toplevel` without first checking `view->type`.

The goal of the new accessors is to catch similar bugs in future.
2022-11-25 22:21:17 +00:00
Johan Malm
df7276345f view: create derived structs
...for XDG toplevels and XWayland views to only include applicable
wl_listeners for each type of view.
2022-11-25 14:47:53 +00:00
John Lindgren
56f8837ca6 view/ssd: Move ssd->enabled to view->ssd_enabled 2022-11-22 09:17:33 +01:00
John Lindgren
c536ee9d96 view/ssd: Move view->margin to view->ssd.margin 2022-11-22 09:17:33 +01:00
John Lindgren
e79c95489a view: Add view_set_untiled() 2022-11-22 09:17:33 +01:00
John Lindgren
c67c6691ac view: Rename/move workspaces_send_to() to view_move_to_workspace()
This function semantically belongs in view.c since it
modifies `struct view`.

Also a minor formatting fix in view_toggle_always_on_top().
2022-11-22 09:17:33 +01:00
John Lindgren
f08e931a29 include: Break out view.h from labwc.h
IMHO it encourages better design (by making dependencies more obvious)
to have source file/header file pairs like view.c/view.h, rather than a
monolithic header like labwc.h with everything in it.

I don't think we need to break up all of labwc.h at once, but maybe we
can start pulling it apart bit by bit as it's convenient.

Also:

- Move "struct border" to ssd.h so that view.h can use it without pulling
  in all of labwc.h.
- Add a missing required #include within scaled_font_buffer.h (forward
  declaration of "struct font" is not enough).
2022-11-21 21:42:37 +00:00