Commit graph

54 commits

Author SHA1 Message Date
Ngô Huy
60af24a70d
dbus: Fix issue #114 (#115)
The line #249 calls system bus by default, dbus will deny this request,
then we need to call session bus instead.
2023-10-12 23:17:00 +01:00
vaxerski
ec2e207740 core: fix missing sentinel in execl 2023-10-10 14:47:03 +01:00
vaxerski
667007fa4e core: kill process if threads are in a deadlock 2023-10-10 14:45:54 +01:00
vaxerski
f147831c53 core: remove debug terminate
I am a fucking idiot. fixes #107
2023-10-08 01:05:34 +01:00
vaxerski
158b5892bd internal: gracefully exit on termination after creating the event loop
possibly might help #103
2023-10-05 01:24:55 +01:00
Rudolchr
f9461b0b7d
build: Fix build when using clang (#100)
* Add -Wno-address-of-temporary to allow taking an address of temporary like -fpermissive does for gcc

* Make some implicit casts explicit

* Implement the wl_array_for_each macro inline as clang does not like to handle it's implicit typecast

* Removed unecessary include that was automatically added by the ide

* Replaced reinterpret_cast's with c-style casts
2023-09-26 22:23:02 +01:00
vaxerski
2f48e65503 core: rework event loop for polling and C++-style awaits
Stops the event loop from checking all the time in favor of locks and polling.
2023-09-16 18:22:53 +01:00
Vaxry
022469529c
Woo! Full rewrite, v1.0 release. (#78) 2023-09-06 20:36:48 +02:00
Pascal J
7d3da7e968
fix implicit function declaration (#53)
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
2023-04-23 19:37:42 +01:00
vaxerski
2366b4d415 internal: remove metadata cursor mode 2023-04-13 21:14:13 +01:00
vaxerski
0527deefe8 internal: bring back metadata cursor support 2023-04-10 12:27:18 +01:00
vaxerski
ab8d54f6f6 feat: add session restore 2023-04-09 23:30:19 +01:00
Vaxry
510257c0e9
[WIP] Global Shortcuts impl (#35)
Implements the `GlobalShortcuts` portal via `hyprland-global-shortcuts-v1`

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2023-04-09 13:47:05 +01:00
vaxerski
803c00db11 screencast: crudely allow metadata and ignore it 2023-04-05 22:23:59 +01:00
Leftas
607ce73671
Change from wlr to hyprland so dbus would recognize different implementation 2022-12-04 19:57:30 +02:00
columbarius
c83b3cc514 screenshot: Announce version property 2022-09-12 23:33:54 +02:00
columbarius
b5491df0c0 screencast: destroy session if output is removed
We teardown all existing screencast_instances using the removed output
by destroying the frame, removing all timers and then marking the
instance as ready for teardown so we can destroy it after the last connected
session is closed.

Any wlr_screencopy_frame_v1 has to be destroyed before the connected
output can be removed. Otherwise wlr_screencopy_frame_v1_destroy
segfaults the whole program. To ensure this we will make all frame
callbacks safe to be triggered for a previous destroyed frame.
2022-05-31 01:23:34 +02:00
Alias Gram
657b9edad5 chore(logging): change config file error to info 2022-04-18 18:44:47 +02:00
columbarius
0683f7ca7e screencast: add option to force implicit modifier to be linear
Linear buffer layouts are supported by most gpu vendors and as such
should be compatible in mixed mutli gpu setup where the implicit
modifier of one gpu is not supported by the other.

This option should make xdpw work in these environemnts.

The option is marked as experimental since it might be removed if
explicit modifiers provide a better solution.
2022-04-10 13:38:01 +02:00
columbarius
21d26fe23e session: destroy screencast_instance directly when paused
A PipeWire client might pause the stream which enables us to stop
requesting buffers from the compositor. In this case the the quit bool
won't be enacted on and thus we should destroy it directly from here.
2022-04-04 15:37:53 +02:00
Simon Ser
e23e109e41 Handle POLLHUP
This makes xdpw exit when either the D-Bus daemon, the Wayland
compositor or Pipewire is shut down. This avoids having dangling
non-functional xdpw instances, e.g. when restarting the compositor.

To test, start Sway nested in Sway, run xdpw with
WAYLAND_DISPLAY=wayland-2, and exit the nested Sway.
2021-07-01 11:58:26 +02:00
columbarius
6438edb7b9 config: handle missing HOME env variable gracefully
Fixes: https://github.com/emersion/xdg-desktop-portal-wlr/issues/149
2021-06-17 09:37:16 +02:00
columbarius
b20b9d76d7 config: fix format specifier for max_fps 2021-05-22 12:26:50 +02:00
columbarius
bbd4f9d2b1 doc: add note about the list character of env XDG_CURRENT_DESKTOP 2021-05-21 19:35:58 +02:00
columbarius
feede20314 config: parse XDG_CURRENT_DESKTOP as a list 2021-05-20 22:45:10 +02:00
columbarius
c60b2b6ca8 config: fix memory leak config_home_fallback 2021-05-06 11:52:16 +02:00
columbarius
620946b320 config: add missing keys to print_config 2021-05-03 15:19:20 +02:00
columbarius
22af25749e config: use inih instead if iniparser 2021-05-03 15:19:20 +02:00
Simon Ser
5d3cf9a8fa Remove -o and -f options
These can be specified in the configuration file now.
2021-04-21 12:12:40 -04:00
Aleksei Bavshin
9ba958c7d2 Fix gcc warnings on invalid free call
```
../src/core/config.c: In function ‘finish_config’:
../src/core/config.c:26:9: error: ‘free’ called on pointer ‘config_7(D)’ with nonzero offset 16 [-Werror=free-nonheap-object]
   26 |         free(&config->screencast_conf.exec_before);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/core/config.c:27:9: error: ‘free’ called on pointer ‘config_7(D)’ with nonzero offset 24 [-Werror=free-nonheap-object]
   27 |         free(&config->screencast_conf.exec_after);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/core/config.c:28:9: error: ‘free’ called on pointer ‘config_7(D)’ with nonzero offset 32 [-Werror=free-nonheap-object]
   28 |         free(&config->screencast_conf.chooser_cmd);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
2021-04-10 10:50:24 +02:00
columbarius
9d78b21695 screencast: add outputchooser with config option
Supports "dmenu" chooser type, which is called with a dmenu type list
piped to stdin, "simple" type, which recieves nothing on stdin and
default, which tries the hardcoded choosers.
Choosers are required to return the name of the choosen output as given
by the xdg-output protocol.

Thanks to piater for closing overlooked pipes.
Thanks to ericonr for suggestions regarding fork and pipes.
2021-04-02 15:07:38 +02:00
David96
4c2d8fc808 Add exec_before and exec_after
Adds an option to execute some program before and after screencast (e.g.
for disabling notifications during a cast)
2021-03-16 23:44:08 +01:00
Simon Ser
a18c298ad4 Don't use ~/.config when XDG_CONFIG_HOME is set
According to the spec, ~/.config is a fallback used when
XDG_CONFIG_HOME is unset. When the user has explicitly set
XDG_CONFIG_HOME, we shouldn't try to use the fallback.
2021-03-15 18:08:57 +01:00
Simon Ser
491cbb1cc6 Constify config_path arguments
These are not modified.
2021-03-15 18:08:57 +01:00
Simon Ser
b92ad3eb6b Drop /etc/xdg-desktop-portal-wlr/ from config file dirs
We were checking both /etc/xdg-desktop-portal-wlr/ and
/etc/xdg/xdg-desktop-portal-wlr/. These two directories serve the same
purpose, let's just settle on a single one.
2021-03-15 18:08:57 +01:00
Zsolt Donca
ab8ff54f4c Control how many frames are captured per second
The goal is to control the rate of capture while in screencast, as it
can represent a performance issue and can cause input lag and the
feeling of having a laggy mouse.

This commit addresses the issue reported in #66.

The code measures the time elapsed to make a single screen capture, and
calculates how much to wait for the next capture to achieve the targeted
frame rate. To delay the capturing of the next frame, the code
introduces timers into the event loop based on the event loop in
https://github.com/emersion/mako

Added a command-line argument and an entry in the config file as well
for the max FPS. The default value is 0, meaning no rate control.

Added code to measure the average FPS every 5 seconds and print it with
DEBUG level.
2021-03-08 16:59:17 +01:00
Simon Ser
d3ac33a0aa Fix segfault in config_parse_file
configfile is a `char *`. %s needs a `char *`, so we shouldn't
dereference the pointer here.

Closes: https://github.com/emersion/xdg-desktop-portal-wlr/issues/91
2021-03-04 14:16:30 -05:00
columbarius
07154bb1e3
Add support for config file
Closes: https://github.com/emersion/xdg-desktop-portal-wlr/issues/60
2021-03-03 10:29:56 +01:00
Simon Ser
5401e7f9f2 Add --replace flag
This allows replacing a running xdpw instance. xdg-desktop-portal
itself has this feature.

This is useful when developing, to stop the currently running
system instance.
2021-02-11 13:24:53 -05:00
Marian Buschsieweke
1e92d603a8 core/main: Clean up option handling
- Add a missing space in the usage string
- Drop short option "p", which is unused
2020-05-26 17:02:56 +02:00
Marian Buschsieweke
4cd31295cf core/main: Use EXIT_FAILURE / EXIT_SUCCESS 2020-05-26 12:58:13 +02:00
Marian Buschsieweke
05f44e7a7d core/main: Add static qualifier to internal func 2020-05-26 12:58:13 +02:00
Marian Buschsieweke
a105e0e363
core: fix error handling in main
The error handling at the `error:` label tears down the whole state. Thus, the
state needs to be fully initialized in order for the tear down to succeed.
Currently, if e.g. `sd_bus_open_user()` fails, a `segfault` is triggered by
the tear down. This commit adds individual tear down code that only touches
stuff that until that point was successfully initialized.
2020-05-21 16:44:47 +02:00
Simon Ser
a7ea407e2f Remove --pixelformat flag
This hack is not needed anymore.
2020-05-05 10:00:10 -04:00
Dan Shick
f6d14d9206 Check cast instance refcount before attaching 2020-04-21 14:45:55 +02:00
danshick
55f873dac4
Screencast session support (#22)
* Initial session support WIP
Remove libdrm dependency

Remove display from context, add dbus properties

Use random names for shm and pw_stream, init the stream only for new cast instances

Separate cast initialized flag from refcount, cleanup names and comments

* Refactor and stability improvements

Properly report xdp screencast implementation version
2020-04-16 10:21:55 +02:00
Dan Shick
ccc8a31568 Remove pipewire workarounds after upstream fix 2020-04-01 13:38:38 -04:00
Dan Shick
bba347be4c Add pipewire 0.3 support. Workaround pipewire bugs. 2020-03-16 22:43:45 +01:00
Dan Shick
45699637d1 Fix CI with libpipewire02, libdrm. Remove png.h unused import. Cleanup style. 2020-03-13 21:01:32 +01:00
Dan Shick
c0da39f022 Add proper event loop. Remove last threads. Update CI with pipewire. 2020-03-13 21:01:32 +01:00