Compare commits

..
376 Commits
Author SHA1 Message Date
Simon Ser b7b774ac95 build: bump version to v0.3.1 2026-06-30 20:51:00 +02:00
nodscher 450dca3c64 xdg_shell: fix windows requesting fullscreen on startup
(cherry picked from commit 5f83b27d62d7d0bbfd29a803104e7a3b499413ee)
2026-06-30 20:48:48 +02:00
Rudi Heitbaum c770433ce3 build: guard git version detection against missing .git directory
When building from a release tarball, there is no .git directory
and git rev-parse would either fail or pick up a parent repository's
HEAD. Guard the git version detection with fs.is_dir('.git') so
that tarball builds produce a clean version string.

Requires importing the fs module.

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
(cherry picked from commit e5db9506b4bfff602b704329d5b7ff0a8a6bdb42)
2026-06-30 20:48:48 +02:00
Simon Ser 7fabaa5162 cage: stop using DEFAULT_XCURSOR as a cursor theme name
That's a cursor image name, not a cursor theme name.

NULL means use default.

Adapted from commit 6d6ecd44d7719632592e6991ae06b5e3a9c75171.
2026-06-30 20:47:50 +02:00
Simon Ser 3783af4fad build: bump version to 0.3.0 2026-04-11 09:28:43 +02:00
Yuxuan Shui 94904c714d Make buffer bigger to prevent wayland disconnection
Fixes #492
2026-04-05 14:37:14 +02:00
Simon Ser b7c3dba382 build: drop cage_heaers
Listing header files is unnecessary, Meson already takes care of
that.
2026-03-29 18:47:43 +02:00
Sungjoon Moon b5c3e71b02 Upgrade wlroots to v0.20
Breaking changes:
 - https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/5230
2026-03-29 18:19:40 +02:00
Simon Ser a1e5bf3789 Fix segfault during cleanup when wlr_scene isn't created
If backend creation fails, server.scene is NULL.

Discovered when investigating the following issue:
https://github.com/cage-kiosk/cage/issues/481
2026-03-19 20:31:40 +01:00
Yuxuan Shui dcd64ae48b Implement the drm-lease-v1 protocol 2026-01-08 23:35:35 +01:00
Simon Ser 73bf1c8bd6 xwayland: fix crash when request_fullscreen is called while unmapped
Closes: https://github.com/cage-kiosk/cage/issues/463
2026-01-03 12:29:34 +01:00
Simon Ser 832e88b0c9 xdg_shell: skip configure in request_fullscreen handler if unmapped
wlr_xdg_surface_schedule_configure() requires the xdg_surface to
be initialized.

Closes: https://github.com/cage-kiosk/cage/issues/456
2025-12-27 10:13:10 +01:00
Yuxuan Shui cb8582c056 Fix segfault when title or app_id is NULL 2025-12-18 14:59:57 +01:00
Simon Ser ea2069f427 xwayland: remove associate/dissociate listeners 2025-12-11 15:38:50 +01:00
GnSight af0a3cf8a6 Add support for wlr-foreign-toplevel-management 2025-12-11 14:45:53 +01:00
Simon Ser f9626f7951 build: bump version to 0.2.1 2025-10-01 17:46:45 +02:00
Simon Ser 2e593fe5a8 Fix renderer, allocator and scene memory leaks on exit 2025-07-02 09:09:20 +02:00
Simon Ser 3da3ec0c27 output: use backend commits
Pass the whole new desired state to the backend, so that the
backend can leverage KMS atomic commits.
2025-06-20 19:19:25 +02:00
Simon Ser c311ee5cdc ci: set --wrap-mode=nodownload
Make sure Meson doesn't automagically download and build
dependencies, so that we use system libraries.
2025-06-12 18:03:53 +02:00
Simon Ser e8eec54129 ci: install libdisplay-info
This dependency was missing.
2025-06-12 16:04:05 +02:00
Simon Ser 63f186632e xdg_shell: bump to v5
v5 adds the wm_capabilities event. cage only supports fullscreen.
2025-06-03 23:22:53 +02:00
Simon Ser 60d41fb93c xdg_shell: handle xdg_popup reposition signal
We are advertising xdg-shell v4, but forgot to handle this signal.
2025-06-03 23:22:35 +02:00
Simon Ser 119f98f2b8 xdg_shell: rename xdg_toplevel signal handlers
These handlers aren't invoked for all types of xdg_shell surfaces:
they are only invoked for xdg_toplevel, and are not for xdg_popup.
Rename them accordingly.
2025-06-01 15:08:50 +02:00
Simon Ser 9ad44e4f52 Upgrade wlroots to v0.19 2025-05-26 23:09:43 +02:00
Simon Ser 6efb3b5042 cage: remove global server listeners on shutdown 2025-04-15 15:26:03 +02:00
Simon Ser e21c155bcd seat: destroy keyboard groups on shutdown
These are not destroyed automatically because they are entirely
managed by the compositor.
2025-04-15 15:26:03 +02:00
Simon Ser 6b1ba34a4a output: drop unused wlr_matrix.h include
This is dropped in the next wlroots release.
2025-04-10 17:49:51 +02:00
Horror Proton 360e259ca5 Fix getopt("D") 2024-12-23 14:56:15 +01:00
Simon Ser 19157d3564 Make application arguments optional
If no application is specified, run without starting a child
process. Leave it up to the user to start applications externally
and stop cage with a signal.
2024-11-22 12:09:16 +01:00
Simon Ser 852839e59f Add CLI flag to enable debug logs
For bug reports, it's useful to ask for a debug log. However there's
no way for users to enable debug logs without recompiling. Add a
CLI flag to do so.
2024-11-22 12:03:40 +01:00
Michal Vaniš 0208f565dc readme: add link to man page 2024-11-03 16:29:19 +01:00
Simon Ser e128a9f251 build: bump to version 0.2.0 2024-10-06 15:24:22 +02:00
Simon Ser 34de3f7bac ci: drop libwayland C23 workaround 2024-10-02 09:15:44 +02:00
Simon Ser f0651c7671 xdg_shell: wait for initial commit to unconstrain popups 2024-09-07 23:42:24 +02:00
Simon Ser 412c11ea91 cage: fix abort on shutdown
Workaround for [1]: register a listener for wl_display destroy and
avoid calling wl_display_terminate() after.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/421
2024-09-07 23:42:24 +02:00
Simon Ser 1abf7e5a4b xdg_shell: wait for initial commit to set xdg-decoration mode
Sending the xdg-decoration mode when the xdg_toplevel_decoration
object is created is incorrect: we need to wait for the initial
commit.
2024-09-07 23:42:24 +02:00
Simon Ser fa90174607 xdg_shell: configure surface on initial commit
Instead of waiting for the surface to be mapped before sending a
configure event, do it on initial commit.

Note, wlroots 0.18 no longer sends automatic configure events on
initial commit.
2024-09-07 23:42:24 +02:00
Simon Ser 17af2f7be9 ci: workaround libwayland C23 bug 2024-09-07 23:42:24 +02:00
Simon Ser a81cc2a8e4 seat: rename WLR_INPUT_DEVICE_TABLET_TOOL to WLR_INPUT_DEVICE_TABLET 2024-09-07 23:42:24 +02:00
Simon Ser 874a4a1e79 xdg_shell: use new lifecycle events 2024-09-07 23:42:24 +02:00
Simon Ser 7cc49d2292 cage: drop wlr_scene_set_presentation()
Scene-graph will do the right thing without this call.
2024-09-07 23:42:24 +02:00
Simon Ser b9add8b729 cage: create backend with wl_event_loop and output layout with wl_display 2024-09-07 23:42:24 +02:00
Simon Ser 47ea6a5d68 seat: pass relative direction to wlr_seat_pointer_notify_axis() 2024-09-07 23:42:24 +02:00
Simon Ser 8714a82c24 Bump wlroots requirement to v0.18 2024-09-07 23:42:24 +02:00
Simon Ser eaeab71ffa cage: fix SIGINT/SIGTERM handler data
server.wl_display is already a pointer.

Reported-by: Jonathan GUILLOT <jonathan@joggee.fr>
2024-08-28 12:03:10 +02:00
Simon Ser 69c5eccc50 ci: turn on --fatal-meson-warnings
Catches mistakes such as non-existing build options.
2024-08-26 18:10:26 +02:00
Jonathan GUILLOT df508d65e7 readme: update meson commands 2024-08-22 08:35:58 +02:00
Jonathan GUILLOT 018d5bc4b9 readme: update wlroots dependency version 2024-08-22 08:35:58 +02:00
Simon Ser d3fb99d665 build: drop xwayland option
This is unnecessary because Xwayland logic doesn't bring in new
dependencies. We can just compile in our Xwayland-related code
when wlroots has been built with Xwayland support.

See this Sway patch: https://github.com/swaywm/sway/pull/8165
2024-07-30 00:42:32 +02:00
Simon Ser e7d8780f46 Add support for primary selection 2024-02-26 16:41:17 +01:00
Simon Ser 9d43282fa0 Add .editorconfig
Allows text editors to display files with the correct tab width.
2024-02-23 12:14:39 +01:00
Simon Ser d07afac4ae output: fix assert when re-adding output to layout
wlr_scene_output_layout_add_output() aborts when called with an
already-added output.

To reproduce, run wlr-randr to reconfigure one of the enabled
outputs.
2024-02-23 12:14:00 +01:00
Simon Ser 767ccf9bbd output: use wlr_output_head_v1_state_apply()
No need to hand-roll this code, there is a wlroots helper for it.
Additionally, this fixes missing adaptive sync handling.
2024-02-20 11:01:41 +01:00
Supreeeme b6f8f92585 xwayland: fix double wl_list_remove
When destroying an xwayland surface, the dissociate and destroy handlers
are called, but both of these were removing the map and unmap signal
handlers, causing a segfault when the destroy handler went to remove
them.
Fixes #309
2024-02-12 11:57:38 +01:00
Kenny Levinsen 8a009212bc output: Transition to wlr_output_state
We previously used the wlr_output's built-in pending state and
wlr_output_rollback. The modern state API is much nicer.
2024-01-26 23:45:57 +01:00
Kenny Levinsen f0bc13bef7 output: Add scene output layout helper manually 2024-01-26 23:45:57 +01:00
Kenny Levinsen 63c0887664 output: Implement request_state event listener
wlroots backends no longer change state on their own, and instead send a
request_state event. Monitor this event and apply any state we receive.
2024-01-26 23:45:57 +01:00
Kenny Levinsen c9d2f3afac meson: Bump minimum wlroots to 0.17 2024-01-26 23:45:57 +01:00
Kenny Levinsen b40be06da2 ci: Upgrade wlroots to 0.17 2024-01-26 23:45:57 +01:00
Kenny Levinsen 67def26d83 ci: Fix Alpine xwayland dependency 2024-01-26 23:45:57 +01:00
Kenny Levinsen c801544d61 meson: Convert xwayland option to feature type
wlroots as a subproject now yields the xwayland meson option to its
parent. We need to match the type for this to work. This also adds
support for auto mode, where xwayland is used if present but no warning
is given otherwise.
2024-01-26 23:45:57 +01:00
Kenny Levinsen 1ff7945ba1 Switch from wlr_idle to wlr_idle_notify_v1
The latter implemented the KDE protocol which has been dropped.
2024-01-26 23:45:57 +01:00
Kenny Levinsen a30f2bcec1 Use new wlr_compositor_create signature 2024-01-26 23:45:57 +01:00
Kenny Levinsen b55e40ad9d seat: New cursor/xcursor interface 2024-01-26 23:45:57 +01:00
Kenny Levinsen 2d4b7a4e23 shell: Use new map/unmap events
For xwayland we must listen on associate/dissociate to set up and tear
down the map/unmap event handlers instead of during surface
create/destroy.
2024-01-26 23:45:57 +01:00
Kenny Levinsen 4ea6a8b1a7 shell: Use new try_from surface getters 2024-01-26 23:45:57 +01:00
Kenny Levinsen 8df120dafd output: Use state field in wlr_output_event_commit 2024-01-26 23:45:57 +01:00
Kenny Levinsen 2f7ab094d4 output: Remove output mode handler
This is replaced by monitoring for WLR_OUTPUT_STATE_MODE on commit.
2024-01-26 23:45:57 +01:00
Kenny Levinsen b51a6e950f output: wlr_scene_output_commit NULL options 2024-01-26 23:45:57 +01:00
Kenny Levinsen b772a00df8 output: Call wlr_scene_output_create 2024-01-26 23:45:57 +01:00
Kenny Levinsen 64e2a44124 output: Remove wlr_output_damage include 2024-01-26 23:45:57 +01:00
Kenny Levinsen 624355485a Use new wlr_backend_autocreate signature
The session is now stored explicitly, with wlr_backend_get_session being
dropped.
2024-01-26 23:45:57 +01:00
Simon Ser 34eb3ec2c8 Make Xwayland optional at runtime
Closes: https://github.com/cage-kiosk/cage/issues/293
2023-12-11 17:25:08 +01:00
Moon Sungjoon 1f3e3043dd CI: Set `fail-fast' to false
This allows other jobs to continue running even if one job fails
2023-11-22 15:21:03 +01:00
Jonathan GUILLOT d40dd3bd99 cage: remove not really used variables in server initialization 2023-11-10 14:38:28 +01:00
Jonathan GUILLOT 2ab480910e cage: add relative-pointer-unstable-v1 support 2023-11-10 14:38:28 +01:00
Jonathan GUILLOT efbf7c035b seat: move initial cursor center to dedicated function 2023-11-10 14:38:28 +01:00
Jonathan GUILLOT 4dc3cf80b2 output: fix crash when re-enabling DRM output
The output is disabled then re-enabled using the wlr-output-management
protocol with tool such as wlr-randr.

$ wlr-randr --output HDMI-A-1 --off
$ wlr-randr --output HDMI-A-1 --on

When re-enabled the new output configuration is committed before the
output to be added to the global output layout. However,
handle_output_commit() expects the output to be already part of this
global layout and assert failed. Now, do not treat this in
handle_output_commit() and simply ensure the resulting scene output is
not NULL in handle_output_frame().
2023-09-20 00:01:35 +09:00
Jonathan GUILLOT a769943447 output: ensure output is marked as enabled before trying to set mode
Otherwise, testing to set preferred / "best" mode will always return an
error. Consequently, output will simply be configured with last and
probably "worst" mode.
2023-09-01 18:37:53 +09:00
Jonathan GUILLOT 96ffaa340e output: do not always terminate when last output is destroyed
Only terminate if the last output was nested under the Wayland or X11
backend. If not, using DRM backend for example, terminating Cage when
unplugging the last monitor or simply turning it off does not seem to be
the right behavior.
2023-09-01 18:37:53 +09:00
Jonathan GUILLOT 7ec7e3df2b seat: add missing touch_frame handler
wl_touch::frame() is expected to be sent to client to indicate end of
touch frame event and not sending it may cause issues.
For example, Qt applications using Qt Wayland platform plugin do not
consider touch events until this end of frame to be received.
2023-08-24 10:05:12 +02:00
Jonathan GUILLOTandPatrick Steinhardt 121e3ac8b2 cage: return exit code of primary client
Some applications indicate different shutdown conditions by returning
specific exit codes. One of these is e.g. Kodi, which returns 64 in case
the user chose "Power off" and 66 in case the user chose "Reboot".
In order to act on these exit codes, it thus makes sense in some
situations to pass them on from the primary client to the caller of
Cage.

This exit code is only returned if the primary client is the cause of
Cage terminating.

Co-authored-by: Patrick Steinhardt <ps@pks.im>
2023-08-21 14:40:05 +02:00
Jan Beich 9a4310f8b6 Chase HTTP redirect 2023-08-14 09:18:22 +02:00
Jente Hidskes Ankarberg d519b5b529 Establish chain of trust for signed releases 2023-07-29 10:27:05 +02:00
Simon Ser ea95a8af72 readme: update PGP key ID 2023-07-29 01:08:56 +02:00
Simon Ser 83ffc574be build: bump version to 0.1.5 2023-07-28 16:46:37 +02:00
Simon Ser 794803adc9 build: fix default xwayland option type 2023-07-28 16:42:58 +02:00
Simon Ser 8dcc901522 Log execvp() failures
Closes: https://github.com/cage-kiosk/cage/issues/255
2023-07-28 16:41:03 +02:00
Jonathan GUILLOT b1129ca72e output: fix segfault when using -m last option
Check output list length before accessing previous or next item to avoid
segfault.
2023-07-28 15:36:34 +02:00
Jonathan GUILLOTandDima Krasner 6f78d9d5b2 cage: add basic wlr-output-management support
Co-authored-by: Dima Krasner <dima@dimakrasner.com>
2023-07-28 15:36:34 +02:00
Jente Hidskes 27b6971b36 cage: remove support for rotating outputs
This is now handled through wlr_output_management
2023-07-28 15:36:34 +02:00
ChemicalXandco bd5b20e1fa add wlr_virtual_keyboard_manager_v1 and wlr_virtual_pointer_manager_v1 2023-02-01 00:26:37 +01:00
Simon Ser 46f0ec1b72 readme: drop CI badge
cage currently uses GitHub CI, not SourceHut.
2023-01-03 22:30:54 +01:00
Alexander Orzechowski 5f4c43db04 CI: bump to wlroots 0.16 2022-12-17 21:56:03 +01:00
Alexander Orzechowski a8e4e3d131 Enable single-pixel-buffer
Why not.
2022-12-17 21:56:03 +01:00
Alexander Orzechowski 491d508d75 meson: Bump wlroots version 2022-12-17 21:56:03 +01:00
Alexander Orzechowski 36c9c52d3f Port 0.16 surface header includes 2022-12-17 21:56:03 +01:00
Alexander Orzechowski 3015e0368b Give xdg_shell a version 2022-12-17 21:56:03 +01:00
Alexander Orzechowski 32c44ddb5f Port 0.16 scene changes 2022-12-17 21:56:03 +01:00
Alexander Orzechowski 979ff58a24 Port 0.16 wlr_output_layout_get_box changes
Fixes memory leaks.
2022-12-17 21:56:03 +01:00
Alexander Orzechowski 5818a32a99 xdg_shell: Port 0.16 configure changes 2022-12-17 21:56:03 +01:00
Alexander Orzechowski ea14819153 xdg_shell: Port to 0.16 double buffered geometry 2022-12-17 21:56:03 +01:00
Alexander Orzechowski b43c7adcd9 xdg_shell: Port 0.16 xdg_toplevel changes 2022-12-17 21:56:03 +01:00
Alexander Orzechowski 47f5daba20 seat: Port 0.16 device changes 2022-12-17 21:56:03 +01:00
Phil Jones a57e0067c1 Explicitly create wlr_subcompositor.
Following wlroots b6f43ab2, the subcompositor must now be created
explicitly, rather than being handled by wlr_compositor_create.
2022-12-17 21:56:03 +01:00
Jan Beich d3d4a129e7 cage: allow running as root when not using setuid bit 2022-12-14 11:46:48 +01:00
Ethan D. Twardy a81ab701d7 Update meson.build not to fail if git rev-parse fails 2022-08-19 11:59:41 +02:00
Ethan D. Twardy 1b9d750dc2 Fix warnings in `meson build' output for deprecated functions.
Previously, the output of `meson build` would warn about the use of
some functions that have been deprecated since meson v0.56.0, and
the use of the `check` kwarg in the `run_command()` function.
Update meson.build to fix these build warnings.
2022-08-19 11:59:41 +02:00
Leonardo Hernández Hernández 46778e6d6c output: get scene_output by wlroots function 2022-03-22 16:58:24 +01:00
Jente Hidskes f71844ab54 xdg_shell: add note why we're setting the size for fullscreen clients 2022-01-14 14:59:13 +01:00
Jente Hidskes 38f8566155 xdg_shell: check role in is_primary 2022-01-14 14:59:13 +01:00
Jente Hidskes ee5410d3fb util: remove unneeded module 2022-01-14 14:59:13 +01:00
Jente Hidskes d708a73aca view: require non-NULL surface in view_from_wlr_surface 2022-01-14 14:59:13 +01:00
Jente Hidskes ba9c245393 view: implement view_from_wlr_surface in terms of wlr_surface->data pointer 2022-01-14 14:59:13 +01:00
Jente Hidskes 1ccbacf198 output: set pointer to cg_output in wlr_output->data
This will be used later in the layer shell implementation.
2022-01-14 14:59:13 +01:00
Dima Krasner 3321daef98 fall back to a lower output mode if needed (swaywm/sway@4cdc4ac) 2021-12-22 07:36:43 +01:00
Dima Krasner f44ba0cea2 use find_library() for libm 2021-12-22 07:19:26 +01:00
Dima Krasner 0e87c2c8d8 restore direct libm dependency (fixes #222) 2021-12-22 07:09:09 +01:00
lunacb de03250ca0 fixed typo 2021-12-21 21:56:56 +01:00
Jente Hidskes dfba2d8f9d Remove no longer needed dependencies 2021-12-21 21:53:28 +01:00
Simon Ser 7fe306a79a Enable presentation-time
We get this for free with wlr_scene.
2021-12-21 21:53:28 +01:00
Simon Ser 36309d0c07 Enable viewporter
We get this for free with wlr_scene.
2021-12-21 21:53:28 +01:00
Simon Ser 77a3f6bb0c Use wlr_scene_output_send_frame_done 2021-12-21 21:53:28 +01:00
Simon Ser 7a7325c0ee Drop cg_view_child
This is now unused.
2021-12-21 21:53:28 +01:00
Simon Ser 79950cd691 Use wlr_scene_xdg_surface_create for popups
See https://github.com/swaywm/wlroots/pull/3298
2021-12-21 21:53:28 +01:00
Simon Ser af610192f4 Use wlr_scene_output_for_each_surface 2021-12-21 21:53:28 +01:00
Simon Ser 5a1933f660 Delegate direct scan-out to wlr_scene
Depends on [1].

[1]: https://github.com/swaywm/wlroots/pull/3279
2021-12-21 21:53:28 +01:00
Simon Ser e6f89ed6f1 Remove output_for_each_surface
It's used only by send_frame_done. Instead of keeping a generic
iterator, let's inline it in the only user.
2021-12-21 21:53:28 +01:00
Simon Ser 48b31afb5a Drop unused output_surface_for_each_surface 2021-12-21 21:53:28 +01:00
Simon Ser 0736d72e88 Use wlr_scene_attach_output_layout
This provides wlr_output_layout integration.

References: https://github.com/swaywm/wlroots/pull/3160
2021-12-21 21:53:28 +01:00
Simon Ser d46e8a82dd Use scene-graph for damage tracking
References: https://github.com/swaywm/wlroots/pull/3117
2021-12-21 21:53:28 +01:00
Simon Ser 128fa90ea1 Use scene-graph helpers for sub-surfaces
Delegate sub-surface handling to wlr_scene_surface_tree_create.

References: https://github.com/swaywm/wlroots/pull/3128
2021-12-21 21:53:28 +01:00
Simon Ser fb3dc58237 Replace view_wlr_surface_at with scene-graph 2021-12-21 21:53:28 +01:00
Simon Ser 6d60c6c464 Drop view_for_each_surface and view_for_each_popup_surface
With the scene-graph, these are no longer used.
2021-12-21 21:53:28 +01:00
Simon Ser f544483340 Use the wlroots scene-graph API
References: https://github.com/swaywm/wlroots/pull/1966
2021-12-21 21:53:28 +01:00
Simon Ser 395189fb05 Upgrade to wlroots 0.15
- Update wlr_box includes to util/box.h: the wlroots header has
  been moved upstream.
- Subsurface fields have been moved
- Create renderer and allocator, stop using wlr_backend_get_renderer
- Initalize output rendering
2021-12-21 21:53:28 +01:00
Jente Hidskes 388d60d6b8 Tune compiler options 2021-12-19 11:12:19 +01:00
Jente Hidskes 8385b62a9b Move to GitHub actions 2021-12-19 11:12:19 +01:00
Palanix d1367b1c46 removed focus_changed logic 2021-09-06 16:09:14 +02:00
Palanix 0ba1c40aa6 fix drag 2021-09-06 16:09:14 +02:00
Lorenz Brun 60492959a7 Set xdg_toplevel geometry for fullscreen clients 2021-09-06 15:46:09 +02:00
Simon Ser b21f9c6322 Fix count_surface_iterator
This increments the pointer value, not the actual count.

References: https://github.com/Hjdskes/cage/issues/176
2021-08-11 12:54:49 +02:00
Simon Ser 1a3ab3eb3a build: allow using subproject for wlroots
This is handy when testing cage with a newer wlroots copy, or
when developing cage and wlroots patches in parallel.
2021-08-09 20:54:11 +02:00
Simon Ser 5424a35aba Damage drag icon when destroyed
This fixes the drag icon not disappearing when releasing the
pointer button.

Reproduction steps:

- Open gedit
- Drag some text around
- Release the pointer button
2021-08-09 20:53:24 +02:00
Simon Ser cdb1cdf3b4 Don't manually parse XKB_* env vars
libxkbcommon will do it for us if we provide a NULL struct
xkb_rule_names.
2021-08-09 20:52:51 +02:00
Jente Hidskes 646b3e80b4 Update version to 0.1.4 2021-06-26 09:39:40 +02:00
Jan Beich 08e58c2b45 CI: bump wlroots version to 0.14.0 2021-06-26 09:25:36 +02:00
Jan Beich 636185bf9c meson: require wlroots 0.14.0 after 9a4523d47efe
view.c:238:52: error: no member named 'subsurfaces_below' in 'struct wlr_surface'
        wl_list_for_each (subsurface, &view->wlr_surface->subsurfaces_below, parent_link) {
                                       ~~~~~~~~~~~~~~~~~  ^
/usr/include/wayland-util.h:443:30: note: expanded from macro 'wl_list_for_each'
        for (pos = wl_container_of((head)->next, pos, member);  \
                                    ^~~~
/usr/include/wayland-util.h:409:32: note: expanded from macro 'wl_container_of'
        (__typeof__(sample))((char *)(ptr) -                            \
                                      ^~~
2021-06-26 09:25:36 +02:00
Jan Beich 851268bedc view: chase swaywm/wlroots@9e58301df7
view.c:238:52: error: no member named 'subsurfaces' in 'struct wlr_surface'
        wl_list_for_each (subsurface, &view->wlr_surface->subsurfaces, parent_link) {
                                       ~~~~~~~~~~~~~~~~~  ^
/usr/include/wayland-util.h:443:30: note: expanded from macro 'wl_list_for_each'
        for (pos = wl_container_of((head)->next, pos, member);  \
                                    ^~~~
/usr/include/wayland-util.h:409:32: note: expanded from macro 'wl_container_of'
        (__typeof__(sample))((char *)(ptr) -                            \
                                      ^~~

Based on https://github.com/swaywm/sway/commit/3162766eef14
2021-06-26 09:25:36 +02:00
Jente Hidskes efaf76e9ab Include release scripts 2021-04-16 14:34:57 +02:00
Jente Hidskes aa91af32a5 Update version to 0.1.3 2021-04-16 14:01:38 +02:00
Jan Beich 0891f4b814 CI: bump wlroots version to 0.13.0 2021-04-09 19:33:14 +02:00
Jan Beich b07647fb78 CI: explicitly depend on Mesa on Arch Linux
meson.build:102:0: ERROR: Dependency "egl" not found, tried pkgconfig
2021-04-09 19:33:14 +02:00
Jan Beich 40fc92f7e7 CI: chase swaywm/wlroots@de5347d0f2
Run-time dependency xcb-icccm found: NO (tried pkgconfig and cmake)
Message: Required for Xwayland support.
2021-04-09 19:33:14 +02:00
Jan Beich cb93785649 CI: chase swaywm/wlroots@3504bb587d + swaywm/wlroots@e8ad05913f
meson.build:70:4: ERROR: Problem encountered: Cannot build Cage with XWayland support: wlroots has been built without it
2021-04-09 19:33:14 +02:00
Jan Beich eb18383e8e meson: require wlroots 0.13.0 after 0db62672a4c1
cage.c:307:59: error: too few arguments to function call, expected 2, have 1
        server.backend = wlr_backend_autocreate(server.wl_display);
                         ~~~~~~~~~~~~~~~~~~~~~~                  ^
subprojects/wlroots/include/wlr/backend.h:43:21: note: 'wlr_backend_autocreate' declared here
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
                    ^
2021-04-09 19:33:14 +02:00
Jan Beich a5aa497ff1 output: chase swaywm/wlroots@cc56b4f073
output.c:456:36: error: no member named 'transform' in 'struct wlr_output::(anonymous at /usr/local/include/wlr/types/wlr_output.h:154:2)'
        wl_signal_add(&wlr_output->events.transform, &output->transform);
                       ~~~~~~~~~~~~~~~~~~ ^

Based on https://github.com/swaywm/sway/commit/2c76923282b1
2021-04-09 19:33:14 +02:00
Jan Beich 82bad3f0fc xdg_shell: chase swaywm/wlroots@07111828c5
xdg_shell.c:230:2: warning: implicit declaration of function 'wlr_xdg_surface_for_each_popup' is invalid in C99 [-Wimplicit-function-declaration]
        wlr_xdg_surface_for_each_popup(xdg_shell_view->xdg_surface, iterator, data);
        ^
ld: error: undefined symbol: wlr_xdg_surface_for_each_popup
>>> referenced by xdg_shell.c:230 (../xdg_shell.c:230)
>>>               cage.p/xdg_shell.c.o:(for_each_popup)

Based on https://github.com/swaywm/sway/commit/5438cc158a1b
2021-04-09 19:33:14 +02:00
Jan Beich 90da4ee4dc cage: chase swaywm/wlroots@4b03bdc3ab
cage.c:307:61: error: too many arguments to function call, expected single argument 'display', have 2 arguments
        server.backend = wlr_backend_autocreate(server.wl_display, NULL);
                         ~~~~~~~~~~~~~~~~~~~~~~                    ^~~~
/usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL'
 #define NULL    ((void *)0)
                 ^~~~~~~~~~~
/usr/local/include/wlr/backend.h:36:21: note: 'wlr_backend_autocreate' declared here
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display);
                    ^

Based on https://github.com/swaywm/sway/commit/53f5197c26f1
2021-04-09 19:33:14 +02:00
Jan Beich e6762725ed seat: chase swaywm/wlroots@e06c9e43af
seat.c:453:58: error: incomplete definition of type 'struct wlr_event_touch_down'
        wlr_cursor_absolute_to_layout_coords(seat->cursor, event->device, event->x, event->y, &lx, &ly);
                                                           ~~~~~^
seat.c:450:9: note: forward declaration of 'struct wlr_event_touch_down'
        struct wlr_event_touch_down *event = data;
               ^

Based on https://github.com/swaywm/sway/commit/a56098a24e43
2021-04-09 19:33:14 +02:00
Jan Beich 4a01da76f1 seat: chase swaywm/wlroots@7693f61d81
seat.c:263:56: error: use of undeclared identifier 'WLR_KEY_PRESSED'
        if ((modifiers & WLR_MODIFIER_ALT) && event->state == WLR_KEY_PRESSED) {
                                                              ^

Based on https://github.com/swaywm/sway/commit/bb342ac5e6de
2021-04-09 19:33:14 +02:00
Michael Weiss 0d85c1652e meson.build: Unify the indentation (replace all tabs) 2020-08-02 17:43:05 +02:00
Michael Weiss 7d37322906 seat.c: Make clangformat happy and simplify the control flow
This restores the original behaviour from 2cf40f7, is easier to read,
and satisfies clangformat.
This also doesn't call wlr_idle_notify_activity anymore, which was
probably unintended.
2020-08-02 17:43:05 +02:00
Jente Hidskes d097393732 man: indent with tabs 2020-07-16 16:25:19 +02:00
Jente Hidskes 7b861bf175 Release Cage 0.1.2 2020-07-16 15:41:38 +02:00
Jente Hidskes 1037adbab7 man: document -s and fix some typos 2020-07-16 15:41:38 +02:00
Jan Beich efb1121769 CI: bump wlroots version to 0.11.0 2020-07-16 15:25:11 +02:00
Jan Beich 99aba6b89b meson: require wlroots 0.11.0 after 6a12da196068
../output.c:235:57: error: no member named 'base' in 'struct wlr_buffer'
        wlr_output_attach_buffer(wlr_output, &surface->buffer->base);
                                              ~~~~~~~~~~~~~~~  ^
2020-07-16 15:25:11 +02:00
Jente Hidskes 0d694db6fe Invert wlr_xcursor_manager_load return value 2020-07-16 15:25:11 +02:00
Jan Beich a6b1cf1d69 output: unbreak with wlroots 0.11.0
Port changes changes from
https://github.com/swaywm/sway/commit/9d0aa0cb8396
https://github.com/swaywm/sway/commit/40e87fa98afd
2020-07-16 15:25:11 +02:00
Jan Tatje 79992f39f3 Add option to allow changing VT
Code that does the VT switch taken from sway.
2020-07-16 14:46:28 +02:00
Jente Hidskes bd961db6f5 cage: allow setting output mode 2020-06-26 20:56:11 +02:00
Jente Hidskes 72f6c0bae3 output: implement CAGE_MULTI_OUTPUT_MODE_LAST
In this mode, only the last connected output will be used. If that one
is unplugged, the previously last connected output will be enabled. This
for example allows one to switch between two outputs, e.g. on a handheld
device such as a mobile phone.
2020-06-26 20:56:11 +02:00
Jente Hidskes 64299054db output: add output_mode enum
This enum provides two means of behaviour for multi-output setups:
extend the display across all outputs, or only use the last one. The
former is the current (and default) behaviour; the latter will be added
in the next commit.
2020-06-26 20:56:11 +02:00
Jente Hidskes f4b63cd6b8 output: add enable and disable functions
These will allow different patterns of multimonitor behaviour. In a
followup commit, we will introduce a behaviour where only the last
connected output is in use.
2020-06-26 20:56:11 +02:00
travankor 4e96d913fb Add man page. (#141)
* Add man page.

* CI: add scdoc
2020-05-31 15:14:18 +02:00
travankor 6eb693c05b Cage: drop gid before uid (#142)
If setuid is called first then the target user may not have the ability to
setgid. See https://wiki.sei.cmu.edu/confluence/display/c/POS36-C.+Observe+correct+revocation+order+while+relinquishing+privileges
2020-04-17 21:58:26 +02:00
Matthew Bauer 5d7ff9e64d Don’t terminate display when no view is found (#132)
* Don’t terminate display when no view is found

Some apps like RetroArch will quit and fork itself to switch
modes (like from the menu to a loaded core). This means that for a
very short period of time we have no view available for Wayland. Right
now, Cage doesn’t actually exit when it does this terminate, so you
get this kind of zombie child process that is running but not showing
anything on the screen because there is no compositor.

The solution I have here is to just keep Cage’s Wayland server running
to avoid this issue. I’m open to other idea, but this seems sane to
me. Perhaps an alternative is to check if the process is still alive
when this happens, if not then we can do the quitting behavior. In
addition, we could make this an option if some users don’t want this
behavior.

* Remove "ever_been_mapped" from cg_wayland_view
2020-03-16 20:32:24 +01:00
Jente Hidskes fc5564645e seat: remove signals earlier in seat destroy handler (#130)
This fixes a bunch of invalid writes found with valgrind.
2020-02-27 20:39:15 +01:00
Jente Hidskes 9886efa112 seat: log around input device mapping (#128)
This should make it easier to troubleshoot why, for example, a touch
input device isn't mapped to a touch output device. See #126.
2020-02-23 16:00:57 +01:00
Jente Hidskes 27391f174a Cage: check for sigchld_source being NULL before removing it
If something goes wrong during startup (i.e., the wlroots backend cannot
be created), we jump to the end. This then unconditionally removes the
sigchld_source, but that hasn't been set at this point yet.
2020-02-22 00:23:03 +01:00
project-repo e96fccfa54 Implement support for wlr_keyboard_group (#123)
* Implement support for wlr_keyboard_group

* Cast pointers to void type when passing to wlr_log

* Fix bracket style

* Improve style

* Remove unnecessary function

* Prefer defined variable for brevity

* Remove unnecessary pointer printing

* Ameliorate style

* Remove duplicate functionality

* Set group repeat info

* Ameliorate style

* Fix bug introduced through renaming

* Ameliorate style in seat.h

* Remove cg_keyboard in favour of cg_keyboard_group

* Remove unused signalling

* Apply clang-format

* Fix ordering of commands

* Remove unnecessary field in cg_keyboard_group
2020-02-21 21:19:12 +01:00
Jente Hidskes b2bcf06eee CI: add tasks that build without XWayland 2020-02-18 21:20:23 +01:00
Jente Hidskes 1e3417cd65 CI: add clang-format task 2020-02-18 21:20:23 +01:00
Jente Hidskes 6d0714bfa3 Begrudgingly format wl_list_* macros with a space before parameter list
I can't seem to configure clang-format to remove this space...
2020-02-18 21:20:23 +01:00
Jente Hidskes 6cbc202662 Apply clang-format 2020-02-18 21:20:23 +01:00
Jente Hidskes bd48cad492 Add clang-format file
This adds a first iteration of a clang-format style definition. It
formats the current code such that it aligns (mostly..) with the style
I prefer, but it is most likely incomplete and there will be corner
cases.

Fixes #124.
2020-02-18 21:20:23 +01:00
Jente Hidskes 6fa2734651 meson: fix snapshot builds
Previously, is git was found but the build was run from a snapshot,
`version` wouldn't be set. This commit fixes this by first setting
version to the project version and only then, conditionally, setting it
to the git version.

Fixes #125.
2020-02-17 19:34:54 +01:00
Jente Hidskes 42782bda1d server: remove backend pointer 2020-02-08 16:49:12 +01:00
Jente Hidskes dc002acd20 cage: cleanup_primary_client when jumping to 'end'
With the new CLOEXEC setting, spawning the primary client
can fail *after* forking. In this case, the client process
has been forked and will need to be cleaned up.

In case something fails before pid has been set, it's set to 0.
From waitpid(2):

  The value of pid can be:

     0    meaning wait for any child process whose process group ID
          is equal to that of the calling process at the time of the
          call to waitpid().

That will be none in this case, and hence this won't block and is thus
safe.
2020-02-07 19:04:16 +01:00
Jente Hidskes 24cc576377 cage: set CLOEXEC on the file descriptors
As mentioned by @emersion:

By default, pipe creates FDs without the CLOEXEC flag set, which means
they will be leaked to any other child process spawned. Would be nice to
set the CLOEXEC flag to prevent the leak.
2020-02-07 19:04:16 +01:00
Jente Hidskes 009cca3fa9 cage: switch SIGCHLD handling for pipe
As explained in [1] and [2], SIGCHLD is a tricky signal to handle. A
pipe can be used to signal completion instead.

[1]: https://github.com/swaywm/wlroots/issues/2012#issuecomment-578908333
[2]: https://stackoverflow.com/questions/8976004/using-waitpid-or-sigaction/8976461#8976461
2020-02-07 19:04:16 +01:00
Jente Hidskes 6be4306b4d cage: destroy output_layout after wl_display
wl_display will destroy the outputs, whose destroy handler will remove
them from the output layout. But by that point, the output layout has
already been destroyed.
2020-02-07 19:04:16 +01:00
Jente Hidskes b570cdb22c cage: report on exit status of primary client 2020-02-07 19:04:16 +01:00
Jente Hidskes bb5d4cf52e cage: handle SIGCHLD of primary client
Fixes #13, #53.
2020-02-07 19:04:16 +01:00
Jente Hidskes f33fe5d6f2 cage: change copyright to include 2020 2020-02-07 19:04:16 +01:00
Jente Hidskes acf5925a86 cage: return 0 always in the signal handler
According to the Wayland docs:

If the event source is registered for re-check with
wl_event_source_check(): 0 for all done, 1 for needing a re-check. If
not registered, the return value is ignored and should be zero.

See e.g. http://manpages.ubuntu.com/manpages/cosmic/man3/wl_event_source.3.html

Since we don't register any of these for re-checking, we should
return 0.
2020-02-07 19:04:16 +01:00
Jente Hidskes 8069893b0d render: use output backend to get renderer
This prevents a segfault when shutting down during startup, when a
client is passed that doesn't spawn a window.

It also brings us one step closer to not having to have a pointer to the
backend in cg_server.
2020-02-07 19:04:16 +01:00
Jente Hidskes 8a6d16391f output: include seat.h 2020-02-03 21:23:39 +01:00
Damon e3be8159b3 output: wrap xwayland.h include in CAGE_HAS_XWAYLAND (#120)
* move xwayland.h include to ifdef block for X11

* use correct ifdef CAGE_HAS_XWAYLAND
2020-02-03 21:14:29 +01:00
Jente Hidskes b04e02cd60 output: add support for direct scan-out
Fixes #88.
2020-02-01 23:24:49 +01:00
Jente Hidskes e664fdce79 README: update build instructions 2020-02-01 16:17:58 +01:00
Jente Hidskes 66313efb01 CI: build with --werror 2020-01-31 22:58:15 +01:00
Jente Hidskes 33cd4c2af9 meson: don't build with -Werror by default
Fixes #70. For development, initialise meson with the `--werror` option:

```
meson build --werror
```

Alternatively, for an existing build, run

```
cd build
meson configure -Dwerror=true
```
2020-01-31 22:55:16 +01:00
Jente Hidskes 15eeb7784e cage: add -v argument to print version 2020-01-26 18:18:49 +01:00
Jente Hidskes 5e27683961 Move docs to the wiki 2020-01-26 18:18:49 +01:00
Jente Hidskes a63c75c849 Cage: check if XDG_RUNTIME_DIR is set
Wayland requires this environment variable to be set, see
https://manpages.debian.org/experimental/libwayland-doc/wl_display_connect.3.en.html
2020-01-25 23:30:28 +01:00
Jente Hidskes 30d805d6ff CI: build against wlroots 0.10.0
There are no breaking changes otherwise, so in meson.build we can leave
the version to anything greater than 0.9.1.
2020-01-25 23:27:30 +01:00
Jente Hidskes cc1f975c44 cage: center cursor only on initial startup
With Cage now supporting hotplugging of outputs, we shouldn't warp the
cursor to the center of every new output. Rather, we should warp it only
on the initial startup.
2020-01-18 11:57:16 +01:00
Jente Hidskes e3f9959519 view: maximize dialog if it extends output layout
If the dialog extends the output layout in at least one dimension, then
the part of it that is larger than the output will be rendered
of-screen. This commit maximizes such dialogs instead.

Fixes #110.
2020-01-11 17:11:16 +01:00
Jente Hidskes cfb15d20ba xwayland: use view's (x,y) coordinate when maximizing
It might happen that the (x,y) coordinate of the left-most monitor is
not 0. If it isn't, this doesn't cost us anything, so better safe than
sorry.
2020-01-11 17:11:16 +01:00
Jente Hidskes fbff19939a README: update Copyright to include 2020 2020-01-11 17:11:16 +01:00
Jente Hidskes 12aa43abba output: initialise wlr_output before positioning views 2020-01-11 17:07:33 +01:00
Jente Hidskes 2f9442906d output: refactor get_surface_box
The function also did an intersection check, so it did more than just
getting the surface box. This refactoring makes it more clear.

This commit also fixes a bug in coordinate spaces that makes dialogs
render properly over multiple outputs.
2020-01-11 17:07:33 +01:00
Jente Hidskes 23f8d609ce output: check whether outputs are enabled 2020-01-11 17:07:33 +01:00
Jente Hidskes a53dca91ce Render popups separately from their toplevel view when possible 2020-01-11 17:07:33 +01:00
Jente Hidskes 2db815aa23 Refactor surface damaging and rendering code
This is based on code from Sway, which is also MIT licensed hence
compatible. This makes the surface damaging and rendering code easier to
follow and makes it easier to import future changes to Sway as well.
2020-01-11 17:07:33 +01:00
Tristan Daniel bfd7d605b8 meson: require wlroots 0.9.1
And update CI builds accordingly.
2020-01-10 19:33:30 +01:00
Tristan Daniel 84216ca2a4 output: call wlr_output_rollback if not rendering
Required by wlroots 0.9.0.
2020-01-10 19:33:30 +01:00
Tristan Daniel 51e6c760da Update new output handler for wlroots 0.9.0
Following breaking changes in wlroots 0.9.0, wlr_output_commit must be
called after wlr_output_set_mode, wlr_output_set_transform and wlr_output_enable.
Additionally, wlr_output_enable is no longer implicitly called by
wlr_output_set_mode.

Fixes #102
2020-01-06 11:49:57 +01:00
Jente Hidskes 8f6ffa1419 Use hard tabs 2020-01-05 13:42:17 +01:00
Jente Hidskes 651d579c30 seat: be explicit about output- and layout coordinates
This commit follows up on 95b7782c72
2020-01-05 13:16:01 +01:00
Jente Hidskes 530b32d496 xwayland: fix regression after 95b7782
Fixes #101
2020-01-05 12:59:26 +01:00
Jente Hidskes 1c59946e20 Rename view_damage_surface to view_damage_part
To better align it with its counterpart view_damage_whole
2019-12-29 22:54:25 +01:00
Jente Hidskes 95b7782c72 Be explicit about output- and layout coordinates 2019-12-29 16:07:14 +01:00
Jente Hidskes 21229984ff view: use output layout to set x,y coordinates 2019-12-29 13:17:47 +01:00
Jente Hidskes 22adaae715 output: log error when failing to allocate output 2019-12-26 17:25:22 +01:00
Kenny Levinsen 4e832c6aaf Revert "Set title on outputs that the focused surface is intersecting with"
This reverts commit 915c6df2444fdb6984db82a5e60fa8855346679b.
2019-12-26 17:14:57 +01:00
Kenny Levinsen edfe4e07ce Avoid excessive log messages with multiple outputs 2019-12-26 17:14:57 +01:00
Kenny Levinsen bcd0086f13 Set title on outputs that the focused surface is intersecting with 2019-12-26 17:14:57 +01:00
Kenny Levinsen 24f48966d8 Annotate wl_list link field 2019-12-26 17:14:57 +01:00
Kenny Levinsen 739ba1fe65 Check calloc return value 2019-12-26 17:14:57 +01:00
Kenny Levinsen 06ada15661 Support multiple outputs
Outputs are arranged in a horizontal layout in the order they are
created in by wlroots. Maximized xdg_shell views will span all outputs,
like the global fullscreen mode in sway.

Fixes #87
2019-12-26 17:14:57 +01:00
Jente Hidskes 0aeba8085c Replace all wayland-server.h includes with wayland-server-core.h
The documentation for `wayland-server.h` says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

See also
https://github.com/swaywm/wlroots/commit/ca45f4490ccce64bf7aa0985951319646b55d258#diff-b57e10fe0774258a6d21b22077001cff
2019-12-20 17:16:53 +01:00
Jente Hidskes abfe6a66ca README: refer to docs/ 2019-12-20 17:05:00 +01:00
Jente Hidskes 7c6d6c75ae Implement wlr_export_dmabuf_unstable_v1 2019-12-20 17:02:16 +01:00
Jente Hidskes 90e70c6882 Document environment variables
Fixes #93.
2019-12-20 16:51:11 +01:00
Jente Hidskes dd87c1fab5 Rename data_device_mgr to _manager 2019-12-20 12:35:41 +01:00
Jente Hidskes 65177466e7 Implement wlr-gamma-control-unstable-v1
Closes #20
2019-12-20 12:35:41 +01:00
Jente Hidskes 531cdc84b7 Fix the FreeBSD build 2019-12-18 21:51:05 +01:00
Jente Hidskes 436ad33db8 Update wlroots in CI builds to 0.8.1 2019-12-18 21:51:05 +01:00
Derek Wallace 33bb3c818c Removed destructors per wlroots PR 1915 2019-12-18 21:30:29 +01:00
Ruben Vandamme 0fb513fb85 Set startup color to black. 2019-08-27 18:14:57 +02:00
Andri Yngvason c13ada98de Add xdg output manager 2019-08-25 18:14:01 +02:00
Andri Yngvason da6b6c208e Add screencopy 2019-08-25 18:14:01 +02:00
Jente Hidskes 69340921a4 CI: use a version of wlroots that compiles with libinput 1.14
See https://github.com/swaywm/wlroots/issues/1796
2019-08-25 17:48:07 +02:00
Jente Hidskes 016ef340d2 README: update email address 2019-07-09 14:25:33 +02:00
Jente Hidskes 35166e4e1b README: use www subdomain
Fixes #76
2019-07-07 16:43:20 +02:00
Jente Hidskes 1ecba7e67c Release Cage 0.1.1
A new tag for packagers to build Cage with wlroots 0.6.0.

Changelog:

* Update to wlroots 0.6.0
* Don't submit too much damage in damage tracking implementation
* Use XKB_* environment variables to configure keyboard devices
2019-06-03 19:55:52 +02:00
Jente Hidskes 6bb73b3658 meson: require wlroots 0.6.0
Missed in 9354781f32
2019-05-03 23:33:50 +02:00
Jente Hidskes 1de6054d7e seat: use XKB_* env vars for configuring keyboard devices
Fixes #66
2019-05-03 21:32:58 +02:00
Jente Hidskes b16fc7d780 output: use the output's preferred mode
On outputs that have modes, we need to set one before we can use it.  We
pick the preferred mode, or if this is not advertised, the last listed
mode. This mode is generally the mode with the highest resolution.

Fixes #10
2019-05-03 21:14:51 +02:00
Jente Hidskes 5af455a905 output: fix damage tracking debug mode
We want to damage the whole output in this mode. However if we overwrite
the damaged region after it's useless.

See
https://github.com/swaywm/wlroots/commit/8b1220f5a32376578fb2ddc39ba174f455859689#diff-95fe5e5b411cc64a5dc31e2b72669a0d
2019-05-03 21:07:40 +02:00
Jente Hidskes f23257d170 output: don't submit too much damage
See https://github.com/swaywm/wlroots/issues/1666#issue-436967396 and
the linked changes
https://github.com/swaywm/wlroots/pull/1668/files#diff-95fe5e5b411cc64a5dc31e2b72669a0d
2019-05-03 21:03:09 +02:00
Drew DeVault 9354781f32 Update to wlroots 0.6.0 2019-05-03 21:03:09 +02:00
Jente Hidskes 887c855a3b CI: use wlroots 0.6.0 2019-05-03 21:03:09 +02:00
Jan Beich 61894994f3 Cage: drop root on startup like Sway
wlroots may need setuid to run on DRM if built without (e)logind
support.
2019-05-01 13:38:19 +02:00
Jan Beich 3fb89563ae Switch to system epoll-shim.pc in FreeBSD build 2019-04-27 20:27:23 +02:00
Michael Vetter c69d394bed Set version to 0.1
Since we now have a tag with 0.1 and also a release with that version
number was published on GitHub we should adjust the version in the meson
file too.
2019-04-24 21:18:12 +02:00
Jente Hidskes 2eb28ce216 README: set logo size in px 2019-04-24 21:01:50 +02:00
Jente Hidskes fa5142e773 README: add logo and signed release note 2019-04-23 22:53:23 +02:00
Jente Hidskes cf06e42687 CI: add a FreeBSD build on Sourcehut 2019-04-22 18:43:19 +02:00
Jente Hidskes 5bfedaf84f CI: add an Alpine Edge build on Sourcehut 2019-04-22 18:43:19 +02:00
Jente Hidskes 46441ff85a CI: add an Arch Linux build on Sourcehut 2019-04-22 18:43:19 +02:00
Jente Hidskes 90498e85d5 Cage: print the correct variable 2019-04-22 18:43:19 +02:00
Tristan Daniel 9e6a5ad44f Cage: implement output transform
This commit adds the command line switch -r, which rotates the output 90
degrees clockwise and can be specified up to three times.
2019-04-14 08:31:33 +02:00
Jente Hidskes 69872baead Cage: encapsulate debug specific behavior 2019-03-23 20:18:37 +01:00
Jente Hidskes 78fc6fbe0d Cage: fix previous commit 2019-03-23 20:18:13 +01:00
Jente Hidskes d855ea6718 Cage: update for wlroots 0.5.0 2019-03-23 16:42:31 +01:00
Jente Hidskes eee63b8001 meson: require wlroots >= 0.41.0 2019-02-28 19:26:07 +01:00
Drew DeVault da62449c27 Update for wlroots 0.4 2019-02-28 19:24:43 +01:00
Jente Hidskes 848929c88c Cage: exit when there is no application passed
This regression was introduced in 667667505a
due to wrongfully handling optind.
2019-02-26 18:56:23 +01:00
Jente Hidskes c2226da89b README: document to build against wlroots tags
Fixes #52.
2019-02-26 18:33:50 +01:00
Jente Hidskes b189f90465 meson: -Werror is already set in project() 2019-02-24 13:41:34 +01:00
Jente Hidskes b758e421cb Cage: bail when there is no xdg decoration manager 2019-02-24 00:29:22 +01:00
Jente Hidskes cd0c51814f Cage: implement server-decoration protocol
GTK still uses the (now deprecated) server-decoration protocol, which is
the predecessor to xdg-decoration. Hence, with this commit Cage now also
hides decorations on applications such as Firefox.

Fixes #47, see also
https://github.com/Hjdskes/cage/pull/45#issuecomment-466402865.
2019-02-24 00:29:22 +01:00
Jente Hidskes 1ef3843839 Wrap x11 backend features in wlroots' feature flag
Fixes #46
2019-02-23 23:05:54 +01:00
Jente Hidskes 1c5cbe6de0 Cage: don't destroy wlr_backend manually
The backend gets destroyed automatically when the wl_display is
destroyed, so we're getting a use-after-free when we do this ourselves
again.

Fixes #44
2019-02-23 19:49:01 +01:00
Jente Hidskes 65f7107078 cage: fix signal handler event source memory leaks 2019-02-21 11:38:30 +01:00
Jente Hidskes 707cb2cdfc seat: fix memory leak when explicitly destroying the seat 2019-02-21 11:35:43 +01:00
Jente Hidskes 2166fbdcfb Implement xdg-decoration
This commit adds a commandline switch (-d) to disable client side
decorations, if possible. In this case, Cage will not draw any
decorations of its own, in order to maximize screen real estate.

The default behavior remains the same, i.e., if -d is not passed,
clients will draw their client side decorations, if any.

Fixes #32
2019-02-21 09:14:59 +01:00
Jente Hidskes 996f641cf0 Cage: reset signal mask after forking
Cage uses wl_event_loop_add_signal to handle SIGINT and SIGTERM, which
masks these signals. This means that the subprocess spawned by Cage
start with these signals masked, which can lead to delays in Cage
shutting down on e.g. ^C. Hence, we now unmask all signals between fork
and exec.

Fixes #40
2019-02-17 21:14:31 +01:00
Jente Hidskes 76e8be14d9 seat: listen on wlr_seat.events.request_set_selection and wlr_seat.events.request_set_primary_selection
This is now required with wlroots 0.3, see https://github.com/swaywm/wlroots/releases/tag/0.3
and https://github.com/swaywm/wlroots/pull/1402

Fixes #42.
2019-02-16 19:09:00 +01:00
Jente Hidskes 202f74f21a seat: listen on the wlr_cursor.frame event
This is now required with wlroots 0.3, see https://github.com/swaywm/wlroots/releases/tag/0.3
and https://github.com/swaywm/wlroots/pull/1503.
2019-02-16 19:09:00 +01:00
Jente Hidskes 9d825d6dc7 Move set_window_title to output 2019-02-16 00:56:09 +01:00
Jente Hidskes 2669c80803 Listen to fullscreen requests
Fixes #34.
2019-02-16 00:36:07 +01:00
Jente Hidskes 5a1da1baee output: optimize when drawing whole surface 2019-02-16 00:35:17 +01:00
Jente Hidskes a114ddbbf3 Damage whole views on map and unmap 2019-02-16 00:35:17 +01:00
Jente Hidskes 1308c0ffc3 view: add function to damage whole view 2019-02-16 00:35:17 +01:00
Jente Hidskes aa4b27ec20 xdg_shell: implement xdg_popup 2019-02-16 00:35:17 +01:00
Jente Hidskes 36670f02f3 view: implement subsurfaces 2019-02-16 00:35:17 +01:00
Jente Hidskes 667667505a Put damage tracking debugging behind a flag 2019-02-16 00:35:17 +01:00
Jente Hidskes e981cb8a1c Implement damage tracking
Fixes #5.
2019-02-16 00:35:17 +01:00
Jente Hidskes f0eb115bda seat: remove cg_ prefix from cg_seat_destroy 2019-02-02 17:13:10 +01:00
Jente Hidskes 75b0f832ed xwayland: move override-redirect assignmend to map handler
Some surfaces set their coordinates only when they're mapped, such as
current Firefox's menu popup. Hence, we accomodate such clients.
2019-01-31 18:31:14 +01:00
Jente Hidskes c47eb031c6 xwayland: abstract override-redirect behind function 2019-01-31 18:29:29 +01:00
Jente Hidskes 16ab37b706 view: don't position override-redirect windows
Override-redirect windows are meant to be ignored by the X server, at
least as far as position goes. Hence, we detect whether we're dealing
with such a window and consequently don't position it.

This makes, amongst others, Chromium's popup menus and dmenu appear on
the correct position and size.
2019-01-31 16:57:51 +01:00
Jente Hidskes 2543934055 view_get_title: add NULL check
Otherwise, we'll segfault:

0x00007ffff7c36715 in __strlen_avx2 () at /usr/lib/libc.so.6
0x000055555555ae00 in view_get_title (view=0x5555558403c0) at ../view.c:34
2019-01-31 16:21:25 +01:00
Jente Hidskes a9a8f551e5 README: tinywl is now within wlroots 2019-01-31 14:49:01 +01:00
Jente Hidskes fd5175cbf8 seat: remove cg_ prefix 2019-01-31 14:47:11 +01:00
Jente Hidskes 5c403edc0b view: replace view_has_children with view_is_transient_for
This is a much cleaner implementation but allows us to do the same
things.
2019-01-31 14:47:11 +01:00
Jente Hidskes 7de253386c output: do not render an overlay for now
There are better ways to do this (i.e., custom shaders). We will get
back to this later.
2019-01-31 14:47:11 +01:00
Jente Hidskes 41d4ccfe44 xwayland: reintroduce XWayland workaround
This was temporarily removed when introducing proper view abstractions.
Now that we have the cg_xwayland_view struct, we reintroduce this
workaround in its proper place.

This also fixes the previous workaround, which checked whether a view
was *currently* mapped and not if it *has ever* been mapped.

See #18, #19 and 443d955dfd.
2019-01-31 14:47:11 +01:00
Jente Hidskes 7175100d0d view: reorder functions
It had gotten a bit messy. Now functions are grouped together (i.e.,
getters, queries, etc).
2019-01-31 14:47:11 +01:00
Jente Hidskes 64b971a665 view: add proper abstraction with interface 2019-01-31 14:47:11 +01:00
Jente Hidskes 24517922cc view: remove cg_ prefix 2019-01-31 14:47:11 +01:00
Jente Hidskes f25460f365 xdg_shell/xwayland: include respective header 2019-01-25 20:34:11 +01:00
Jente Hidskes e9139f08e3 xdg_shell/xwayland: unlink listeners on destroy 2019-01-25 16:27:51 +01:00
Jente Hidskes 2387bce647 output: remove mode link on destroy 2019-01-25 16:25:40 +01:00
Jente Hidskes 8db6b82c59 Suppport output transforms 2019-01-25 16:25:39 +01:00
Jente Hidskes 7379226bbe seat: remove unused surface_commit listener 2019-01-25 16:25:39 +01:00
Jente Hidskes 8cb1e5c4ef output: don't draw multiple overlays 2019-01-25 16:18:05 +01:00
Jente Hidskes 6ebc684ee6 cage: free window title 2019-01-25 09:02:38 +01:00
Jente Hidskes c00ac5c462 Set Cage's window title to toplevel's title
When using the Wayland or X11 backend, Cage is drawn inside a window.
This commit sets this window's title to that of the currently focused
toplevel window inside Cage.

Fixes #29.
2019-01-24 16:15:03 +01:00
Jente Hidskes 443d955dfd view: test whether XWayland surfaces have been mapped
This is to work around "misbehaving" (for lack of a better term)
clients. At the moment, Firefox Nightly and Google Chrome/Chromium are
known to be suchs client:

When XWayland support is enabled, Firefox first creates an XWayland
surface, closes this (before mapping it) and then opens an XDG toplevel
surface. Cage tries to manage the first XWayland surface, but when it
closes, Cage has no surfaces left and hence closes as well.

Hence, Cage terminates before it picks up on Firefox's XDG toplevel, and
Firefox (rightly) prints it cannot read the Wayland pipe.

In Chromium's case, it simply opens an XWayland surface which it
immediately closes, before opening the "real" XWayland surface.

The workaround is to track whether an XWayland surface has been mapped
and, if it hasn't, to not exit when we have no views left.

Firefox's behavior and the workaround are discussed in #18.

This commit fixes #18 and is part of the fix for #19.
2019-01-19 19:43:24 +01:00
Jente Hidskes a324d22dfe meson: check WLR_HAS_XWAYLAND when building with XWayland 2019-01-19 19:21:13 +01:00
Jente Hidskes a8e15442ab xdg_shell/xwayland: do not check parent for other view types
An xdg-shell surface can never be a parent of an xwayland surface and
vice-versa.
2019-01-18 17:37:40 +01:00
Jente Hidskes 5deb7776fc Cage: destroy XWayland before clients
This is the order in which it should be done.
2019-01-18 13:29:30 +01:00
Jente Hidskes 7f7d8ac33e README: credit rootston as well 2019-01-18 10:19:54 +01:00
Jente Hidskes 9b797fb98e Cage: move xwayland check 2019-01-17 22:25:20 +01:00
Jente Hidskes 2c5b3c5ad0 Cage: add debug print for Wayland socket 2019-01-17 21:46:43 +01:00
Jente Hidskes 14aadbca1b Output: render software cursors
As mentioned, this is a no-op when there hardware cursors are supported.

Fixes #14.
2019-01-17 11:04:14 +01:00
Jente Hidskes b6024e982f Fully support multiple primary clients
This is the path we settled on in #24.

That is: any new toplevel window takes over the Cage display, hiding any
previous toplevels until it is closed. Only when the last toplevel is
closed, does Cage exit as well.
2019-01-12 19:27:24 +01:00
Jente Hidskes b0bd4e680d view: add view_has_children to query if a view has children
This allows us to check per-view whether is has dialogs open, instead of
diong it on a global basis as we are doing currently. This is necessary
for fully supporting multiple primary clients.
2019-01-12 19:27:24 +01:00
Jente Hidskes 112a662ebc Implement support for drag 'n drop icons
Fixes #8.
2019-01-11 15:28:09 +01:00
Jente Hidskes 1f85e1061b render_data: take x,y instead of cg_view
This enables us to render surfaces other than views. See the next
commit.
2019-01-11 15:28:09 +01:00
Jente Hidskes 2c51cd62b6 view_center: remove cg_server 2019-01-10 15:57:53 +01:00
Jente Hidskes 29009ddd77 view: hide maximize and center functions
This is now handled in view_position.
2019-01-10 15:57:25 +01:00
Jente Hidskes a4a3a4954a output: handle size changes
Fixes #23.
2019-01-10 15:50:31 +01:00
Jente Hidskes 21c01c9ee0 Add idle inhibitor support
With this, some apps (e.g. mpv) can block the idle tracker from
kicking in. This way, the screen won't blank (or whatever you
configured) when the application doesn't want it to.
2019-01-09 20:05:09 +01:00
Jente Hidskes bf58eadf50 Add idle tracking
Note that this does not do much without an idle manager "on the other
side". See, for example, swayidle: https://github.com/swaywm/sway/blob/master/swayidle/swayidle.1.scd

Fixes #7.
2019-01-09 20:05:09 +01:00
Jente Hidskes 96372c145f cage.c: fix include order 2019-01-04 20:23:50 +01:00
Jente Hidskes 905199a1a8 view.h: conditionally include xwayland.h 2019-01-04 20:23:33 +01:00
Jente Hidskes eaa71b7af4 Use correct CG_ namespace in headers 2019-01-04 20:23:01 +01:00
Jente Hidskes 691847ca12 Add XWayland note to README 2019-01-04 18:49:48 +01:00
Jente Hidskes 8faf7a2f59 output: render an overlay when dialogs are open
Fixes #6.
2019-01-04 18:33:59 +01:00
Jente Hidskes c848bafaed view_destroy: focus the previous view when closing the current
Fixes #4.
2019-01-04 17:26:26 +01:00
Jente Hidskes 3ef0fc3867 view_destroy: unmap surface if it isn't yet
Otherwise, we're left with an invalid link in the view list.
2019-01-04 17:25:07 +01:00
Jente Hidskes 2b8ee61d8b Merge pull request #16 from Hjdskes/touch
Add touch input
2019-01-04 16:22:15 +01:00
Jente Hidskes ce755c8591 Add touch input
Fixes #1
2019-01-04 15:55:13 +01:00
Jente Hidskes f47a76c9be xdg_shell: only track toplevel xdg surfaces
We don't need to manage popups, but in
786e28bdac we ended up doing so. This
reverts Cage's behavior.
2019-01-04 13:41:25 +01:00
Jente Hidskes 5f60b0a00c output: remove xwayland include
We don't need it in this file.
2019-01-03 22:31:13 +01:00
Jente Hidskes 7077f9ba1c seat: move desktop_view_at comment 2019-01-03 22:30:55 +01:00
Jente Hidskes 183e509dd9 s/ifdef/if/g
ifdef gives us some troubles with the thing being set to 0 but still be
defined, so let's just use if.
2019-01-03 22:30:34 +01:00
Jente Hidskes 81761cae96 Cage: fix possibly uninitialized variable 2019-01-03 13:55:38 +01:00
Jente Hidskes 907bb78c92 Add missing config.h.in 2019-01-02 22:28:56 +01:00
Jente Hidskes 2847e0d54f Seat: abstract away a view switch statement
We have our view abstraction, so why not use it?
2019-01-02 21:31:30 +01:00
Jente Hidskes 9a99ba604f Output: abstract away a view switch statement
We have our view abstraction, so why not use it?
2019-01-02 21:23:16 +01:00
Jente Hidskes 431320443a seat: reverse conditional for early-exit of set_focus 2019-01-02 21:13:18 +01:00
Jente Hidskes 3e10b1f7eb README: document XWayland compile-time option 2019-01-02 21:13:00 +01:00
Jente Hidskes 9a4afdb025 Make the README for development only
For users, we have Cage's project page at
https://hjdskes.nl/projects/cage.
2019-01-02 21:06:56 +01:00
Jente Hidskes 14dde88d88 Merge pull request #15 from Hjdskes/xwayland
Add XWayland support
2019-01-02 21:02:18 +01:00
Jente Hidskes e721808c88 Update copyright to include 2019 2019-01-02 21:01:01 +01:00
Jente Hidskes a34c726a1c Add XWayland support
With Cage becoming more popular since its mention on Phoronix and
therefore getting more use-cases than just my own project, add XWayland
support. The refactoring of 2cf40f7 makes this much easier. Note that
this is a no-cost addition for those of us not using XWayland as it is a
compile-time option that needs to be explicitly enabled by adding
`-Dxwayland=true` to your meson command.
2019-01-02 20:58:48 +01:00
Jente Hidskes 48f8f69556 view_get_geometry: only out width and height
This is the only thing we need, as we don't use a view's x and y
coordinates for placing windows.
2019-01-02 20:47:46 +01:00
Jente Hidskes 786e28bdac Properly track mapping and unmapping
We shouldn't render a window before it is mapped (obviously), but we
render all windows in the view list. Hence, only insert the window once
it is mapped.

We could run into the case where a window is destroyed without being in
the window list, so we now track unmapping again and remove windows from
the list when they get unmapped.
2018-12-31 20:00:23 +01:00
Jente Hidskes a9818c0df1 Do not display a cursor on output creation
Now we don't display a cursor unless a pointer device is connected.

Fixes #2
2018-12-31 00:55:19 +01:00
Jente Hidskes fd4ff669dd Move xcursor theme loading and cursor warping to output
Since this is inherently output independent, we can move this to here
and avoid the inexistance of an output we ran into in the previous
commit.

Warping the cursor is no problem here either: since we restrict
ourselves to a single output, there won't be any confusing UX by having
the cursor jump from one output to the newly attached one.
2018-12-31 00:25:37 +01:00
Jente Hidskes 2cf40f7a9b Refactor cage into separate source files
This makes Cage much easier to maintain. Not only is it easier where to
look and to maintain a mental model of the code, there is also more
encapsulation, better abstractions and better extendability.
2018-12-31 00:12:33 +01:00
Jente Hidskes e1525a20c8 Do not create a dmabuf global
In new enough wlroots versions, the renderer creates the dmabuf global
itself.

Fixes #11.
2018-12-28 15:32:07 +01:00
Jente Hidskes f680ee02db Fix possibly uninitialized variable warning 2018-12-25 20:29:24 +01:00
Jente Hidskes 4ea5cc6b32 Use Wayland's event loop for signals
Now we don't require a global variable.
2018-12-25 20:29:24 +01:00
Jente Hidskes b22f4b465c Improve child spawning 2018-12-25 20:29:24 +01:00
Jente Hidskes 96fd0e13bb Add error handling 2018-12-25 20:29:24 +01:00
Jente Hidskes 3be28b5b6d Remove unmap support
Since we do not ever minimize or otherwise unmap clients (except when
destroying them), we don't need to track mapped/unmapped state. The
destroy case is captured in checking whether the surface has a buffer
attached to it, before requesting its texture.
2018-12-25 20:29:24 +01:00
Jente Hidskes 11e71dbfb5 Make dialogs modal
That is, do not allow another view to get focus upon clicking a pointer
button.
2018-12-25 20:29:24 +01:00
Jente Hidskes e68d76f403 Abstract fullscreen view away into a function 2018-12-25 20:29:23 +01:00
Jente Hidskes 0f3ce4a7d8 Remove renderer pointer from server struct 2018-12-25 20:29:23 +01:00
Jente Hidskes 1dcb6355ad Make pointer visible on startup 2018-12-25 20:29:23 +01:00
Jente Hidskes 95372f3f37 Switch to Meson
This makes it easier to extend in the future. Also, it will make it
easier to add (un)install targets and eventually, distribute files such
as systemd services.
2018-12-25 20:29:23 +01:00
Jente Hidskes 429392ac63 Refactor desktop_view_at 2018-12-25 20:29:23 +01:00
Jente Hidskes 58a9f09617 Handle keyboard removal 2018-12-25 20:29:23 +01:00
Jente Hidskes 92ba822b10 Actually maximize the window.
It appears that wlr_xdg_toplevel_set_maximized does not actually change
the size of the surface. Rather, it only makes the surface think it is
maximized. Hence, we need to set the size to that of the output
manually.
2018-12-25 20:29:23 +01:00
Jente Hidskes d819eedc62 Allow arguments to be passed to applications 2018-12-25 20:29:23 +01:00
Jente Hidskes fda8e22d13 Remove support for multiple outputs
A kiosk is only ever attached to a single output.
2018-12-25 20:29:22 +01:00
Jente Hidskes 26d9917160 Initial commit 2018-12-25 20:29:22 +01:00

Diff Content Not Available