Commit graph

212 commits

Author SHA1 Message Date
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 6a12da1960
../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
9d0aa0cb83
40e87fa98a
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