Commit graph

345 commits

Author SHA1 Message Date
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 915c6df244.
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