Commit graph

1044 commits

Author SHA1 Message Date
Consolatis
e9aac4ce8f src/view.c: prevent fullscreen with no outputs available 2023-01-03 19:46:31 +00:00
Consolatis
de8042bff5 src/output.c: prevent crash with no outputs available 2023-01-03 19:46:31 +00:00
Consolatis
8bde7bcee0 src/debug.c: reset last_view
Before this patch following would cause a use-after-free:
- calling the Debug action when there was at least one view around
- closing that view
- calling the Debug action again

Also add a label for the layer popup tree.
2023-01-02 21:52:09 +00:00
Joshua Ashton
4fa2091677 server: Filter out wp_drm_lease_device from Xwayland
For now, until we resolve the true cause here either on the Xwayland
side or our side.

I intend to look into it soon.

Fixes: #553
2023-01-02 21:26:42 +00:00
Consolatis
8c411acf1a src/view.c: move up view_apply_natural_geometry()
So its visible by all the other view_apply_xxx_geometry() functions.
2023-01-02 16:42:07 +01:00
Johan Malm
241e7de2b1 menu: minor refactoring to increase readability 2023-01-01 18:59:16 +00:00
Consolatis
a08a6c4bd4 src/view.c: reorder includes 2023-01-01 19:48:47 +01:00
Consolatis
1aef488bcc src/view.c: rename unmaximized_geometry to natural_geometry 2023-01-01 18:15:37 +00:00
Consolatis
aab775c5b5 src/view.c: use view_set_untiled() helper 2023-01-01 18:15:37 +00:00
Consolatis
62549e90d6 src/view.c: factor out special case natural geometry checks 2023-01-01 18:15:37 +00:00
Consolatis
03a1953cfa src/view.c: factor out the various view_apply_ variants 2023-01-01 18:15:37 +00:00
Consolatis
84b3df4ef2 src/layers.c: minor simplification 2023-01-01 18:15:37 +00:00
Consolatis
d094533955 src/view.c: on un-fullscreen restore SSD before applying previous geometry
Before this patch following would cause the SSD to be rendered offscreen:
- snap a window to left or right edge
- toggle fullscreen to fullscreen
- toggle fullscreen to un-fullscreen

To fix that restore the SSD before calculating the new geometry.
2023-01-01 02:24:07 +01:00
Consolatis
83a0be1b9c src/view.c: Allow snapping to the same edge
Reported-by: @Flrian via IRC
Debugged-by: @Flrian
Tested-by: @Flrian
2022-12-29 22:24:55 +00:00
Consolatis
0db67a508c ssd: scale down button icons if necessary
This allows using large XBM button icons (larger than
the button width / height) for high and mixed DPI usecases.

Instead of scaling up the low pixel icons when moving a window to a
high DPI output we scale the icons down when moving to a non-scaled
output. The user is still responsible to create / use larger XBM
icons for their theme.

Partly fixes #609
2022-12-29 22:19:13 +00:00
Johan Malm
86fa0c0a65 desktop.c: handle layer-subsurfaces in get_cursor_context()
...to allow these surfaces to receive pointer button events

Test by running `gtk-layer-demo --keyboard exclusive`, then open the
'set margin' dialog and try setting the margin with the pointer.
2022-12-29 23:18:08 +01:00
Johan Malm
15781a394c layer: s/struct wlr_box/output->usable_area/
...because Linux kernel style prefers `sizeof(*foo)` over
`sizeof(struct foo)`.
2022-12-29 23:18:08 +01:00
Johan Malm
7037ea4e8f layer: rename signal-handler functions to handle_*
...rather than *_notify to comply with naming convention agreed on in
CONTRIBUTING.md
2022-12-29 23:18:08 +01:00
Johan Malm
349a38e676 layer: get struct output from wlr_output user-data
...rather than output_from_wlr_output()
2022-12-29 23:18:08 +01:00
Johan Malm
73df50a1c8 layer: s/layers_above_shell/layers_above_views/ 2022-12-29 23:18:08 +01:00
Johan Malm
f01071e72c layer: remove wl_list layers[] from struct output
...and just use `struct wlr_scene_tree *layer_tree[]`
2022-12-29 23:18:08 +01:00
Johan Malm
9dbac2e06f layer: use scene-graph API more fully
...and thus simplify the usage of wlr_scene_node_at(). Specifically:

- desktop.c: in get_cursor_context() use node-description for
  layer-surfaces and layer-popups. This lays the foundations for a
  pointer-enter-event being sent when a new layer-surfaces appears under
  the pointer (even if the pointer doesn not move).

- layers.c:

  * Iterate over `struct wlr_scene_tree *layer_tree[]` rather than
    `struct wl_list layers[]` when arranging layers to avoid surfaces
    being out of sync with nodes

  * Set signal handlers after scene node creation to avoid configure
    race conditions

  * Handle scene-node destroy event rather than event of
    `struct wlr_layer_surface_v1`

  * Arrange layers on map and unmap

  * Handle client request for layer-change

Fixes issue #667
2022-12-29 23:18:08 +01: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
Consolatis
f7c8663f67 src/workspaces.c: use cached server pointer 2022-12-29 18:58:25 +01:00
Flrian
6d1d0aecab src/theme.c: add menu to individual buttons 2022-12-23 19:04:28 +01:00
John Lindgren
41a4176b17 rcxml: Make sure a default libinput category always exists
Previously, if rc.xml defined only non-default libinput categories,
no default category was created. This meant that configure_libinput()
might totally skip configuring some devices even with default
settings, like tap-to-click.

Fix this by making sure that a default category is always created.
2022-12-22 22:18:27 +00:00
Johan Malm
d7eecca34d seat.c: minor refactoring of seat_reconfigure() 2022-12-21 20:25:04 +00: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
Jan Beich
3dec9cf40c view: limit XCB header to Xwayland after 286b2146c3
../src/view.c:5:10: fatal error: 'xcb/xcb_icccm.h' file not found
 #include <xcb/xcb_icccm.h>
          ^~~~~~~~~~~~~~~~~
2022-12-19 13:12:41 +01:00
bi4k8
ab74d726c6 osd: bookend with calls to cursor_update_focus
this updates the cursor if it is within the OSD area when OSD appears
or disappears
2022-12-14 12:29:16 +01:00
bi4k8
4f0b72c341 osd: factor drawing out of osd_update 2022-12-13 21:41:41 +01:00
Flrian
e4aa7cef76 src/view.c: dont switch output on SnapToEdge if view is maximized 2022-12-10 23:55:49 +01:00
Consolatis
7cc80b7a99 src/action.c: Provide generic parsing of XML action arguments
.. and use it within src/config/rcxml.c and src/menu/menu.c.

This fixes being unable to use the `direction` argument in menu entries.

Reported-by: mahk via IRC
2022-12-10 19:55:53 +00:00
bi4k8
52738eedcf implement Kill action
this action sends SIGTERM to a client's process
2022-12-08 19:33:09 +00:00
bi4k8
39bea30cd5 don't NULL-check output when it can't be
`output` here is the `pos` argument of `wl_list_for_each`, which means
it is always assigned a return value of `wl_container_of`; this in
turn means that it is never NULL.

checking against NULL here just confuses static analysis and readers
2022-12-08 19:24:02 +00:00
bi4k8
272221dae2 fix cleanup issues in xdg_surface_new
`view->surface` had not been set to a non-`NULL` value here, so it
was not yet appropriate to access its `resource` member. instead,
use the resource from the argument xdg_surface.

furthermore, we need to free the newly-allocated `xdg_toplevel_view`
before error return.
2022-12-08 19:24:02 +00:00
Consolatis
d00327bc32 menu: Dynamically adjust menu width based on widest item
Adds two new theme vars:
- menu.width.min (menu will never be smaller than this)
- menu.width.max (menu will never be wider than this + padding)

A fixed menu width can be achieved by setting
menu.width.min == menu.width.max.
2022-12-06 21:08:43 +00:00
Consolatis
f0666ba5c9 menu: Convert hardcoded item padding to theme vars
Adds two new theme vars:
- menu.items.padding.x
- menu.items.padding.y
2022-12-06 21:08:43 +00:00
Consolatis
3da7cfd8c6 theme: Rename separator_width to separator_line_thickness 2022-12-06 21:08:43 +00:00
Consolatis
ccf68c5950 menu: Add generic menu_init() entry point 2022-12-06 21:08:43 +00:00
John Lindgren
b67eccc99a ssd: Move implementation details from ssd.h to ssd-internal.h
- Move private structs and functions to `ssd-internal.h`
- Add `ssd_button_get_type()` and `ssd_button_get_view()`
2022-11-27 15:09:45 +00: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
cfa51ab628 view: Fix SSD margin computation
If `view->ssd_enabled` is false when calling `ssd_create()` then
`ssd_thickness()` returns zeroes which are stored in `ssd->margins`.

The quick fix is just to ensure we set `view->ssd_enabled` before
calling `ssd_create()`. At some point, it might be nice to refactor
so that `ssd_create()` does not reference `view->ssd_enabled`.
2022-11-27 06:47:56 +00:00
Johan Malm
b203758ce1 Fix minor coding style breaches 2022-11-27 04:03:21 +01:00
John Lindgren
74fb769758 ssd: Add debug helpers 2022-11-26 21:24:46 +00:00
John Lindgren
957d9e5926 ssd: Cosmetic cleanups
- Minimize includes in `ssd.h`
- Avoid repetitive `view->ssd.margin` pattern
- Use `struct ssd *` or `const struct ssd *` rather than `struct view *`
  where convenient

Part of the motivation is to make it easier to separate `struct ssd`
from `struct view` in a future commit.
2022-11-26 21:24:46 +00:00
John Lindgren
9dd55f0490 view: Hide decorations for fullscreen views
Otherwise the decorations are visible on adjacent outputs.
2022-11-26 18:02:24 +00:00
John Lindgren
d6aea3e58f ssd: Add missing state updates
- Update `ssd.state` in `ssd_create()` to avoid doing unnecessary work in
  the next call to `ssd_update_geometry()`
- Reset `ssd.margin` in `ssd_destroy()` to avoid accidentally using stale
  values
2022-11-26 18:02:24 +00:00
John Lindgren
cb16da5a78 ssd: Eliminate unnecessary temporary variables 2022-11-26 18:02:24 +00:00
John Lindgren
4e7891eb8d ssd: Simplify ssd_create()
- Add `active` argument for consistency with `ssd_set_active()`
- `assert()` that `ssd_create()` is not called twice without an
  `ssd_destroy()` in between
2022-11-26 18:02:24 +00:00