Commit graph

74 commits

Author SHA1 Message Date
Jente Hidskes
0d694db6fe Invert wlr_xcursor_manager_load return value 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
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
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
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
Jente Hidskes
6cbc202662 Apply clang-format 2020-02-18 21:20:23 +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
15eeb7784e cage: add -v argument to print version 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
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
8f6ffa1419
Use hard tabs 2020-01-05 13:42:17 +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
ca45f4490c (diff-b57e10fe0774258a6d21b22077001cff)
2019-12-20 17:16:53 +01:00
Jente Hidskes
7c6d6c75ae Implement wlr_export_dmabuf_unstable_v1 2019-12-20 17:02:16 +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
Derek Wallace
33bb3c818c Removed destructors per wlroots PR 1915 2019-12-18 21:30:29 +01: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
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
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
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
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
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
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
9d825d6dc7
Move set_window_title to output 2019-02-16 00:56:09 +01:00
Jente Hidskes
667667505a Put damage tracking debugging behind a flag 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
fd5175cbf8 seat: remove cg_ prefix 2019-01-31 14:47:11 +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
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
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