Commit Graph

428 Commits (17841f9ece526aaebceb753fcfa4408eb34b9e70)

Author SHA1 Message Date
Jim Ramsay 308308b63a Add power management state to the output object
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-12-01 19:11:32 +00:00
Andri Yngvason 312ddd8960 Move control command schemas into own files
This allows them to be used by ctl-client as well.
2022-11-27 10:48:03 +00:00
Andri Yngvason 052160cbd4 ctl: Fix sign compare warnings 2022-11-27 10:33:09 +00:00
Andri Yngvason c3c3e97794 main: Use stronger error checking for client ids 2022-11-27 10:33:09 +00:00
Jim Ramsay 89bd6da3bb Add a brief timeout between a capture failure and the retry
Ensures we don't spin eating CPU if capture is continually failing due
to DPMS (for example) by only trying to restart screen capture every
100ms.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-27 10:29:24 +00:00
Jim Ramsay e958b06e44 Add wayvncctl wayvnc-exit command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-26 19:57:53 +00:00
Jim Ramsay 467cfa1889 Add wayvncctl capture-changed event
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-26 19:57:53 +00:00
Jim Ramsay 19862aace8 Cleanup magic strings in event sending code
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-26 19:57:53 +00:00
Jim Ramsay 5c8014d19b Add wayvncctl disconnect-client command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-26 19:57:53 +00:00
Jim Ramsay 3e9aa0e3ae Ensure cmd parsing never mis-sets the type
Why leave the cmd.type to chance? Force it to the right value.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-26 19:57:53 +00:00
Jim Ramsay 80fd6b074e Add wayvncctl get-outputs command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-26 19:57:53 +00:00
Andri Yngvason ac5e207321 ctl-server: Fix sign compare warning 2022-11-26 18:17:30 +00:00
Andri Yngvason 8a70c54928 buffer: Add braces to side-step bogus fallthrough warning 2022-11-26 18:16:14 +00:00
Jim Ramsay 80efc9d487 Start capture on output switch iff clients are connected
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-26 14:12:59 +00:00
Jim Ramsay 19e3d78d78 Add wayvncctl get-clients command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-23 09:41:46 +00:00
Jim Ramsay 72238686c4 Make better client IDs for wayvncctl
We were using a stringified pointer, but that wasnt great to leak, and
may end up being reused while wayvnc is running.

Using an unsigned int will make the IDs more generic and more unique.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-23 09:41:46 +00:00
Jim Ramsay 349693ed87 Fix segfault if running wayvncctl with no args
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-22 22:40:09 +00:00
Andri Yngvason ef2e68af70 Fixup previous commit 2022-11-21 10:09:24 +00:00
Andri Yngvason 1604b12f78 Create separate data-control for each client 2022-11-20 23:00:03 +00:00
Andri Yngvason b99120ddfc Create separate input for each client
This should clean up state for virtual input devices.

This is also a step towards multi-seat support.
2022-11-20 12:20:23 +00:00
Andri Yngvason b79ab71dca main: Add per-client state 2022-11-20 11:32:52 +00:00
Jim Ramsay fe10e46e29 Introduce wayvncctl startup amd shutdown events
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-19 11:58:07 +00:00
Jim Ramsay 325b45ef49 Clean up wayvncctl logging
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-18 09:24:31 +00:00
Jim Ramsay 1d25535e7a Add wayvncctl --reconnect option
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-18 09:24:31 +00:00
Jim Ramsay 6e13974b27 Add wayvncctl --wait option
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-18 09:24:31 +00:00
Jim Ramsay 372b530d3a Fix wayvncctl usage and manpage typos
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-18 09:24:31 +00:00
Jim Ramsay c86e2a756e Cleanup stale unix socket, iff inactive
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-13 23:06:43 +00:00
Andri Yngvason 13aa584075 ctl-server: Fix sign-compare warning 2022-11-13 15:57:27 +00:00
Andri Yngvason 125121613e Create option parser interface
This is an interface that combines option parsing with help text formatting.
2022-11-13 15:43:50 +00:00
Jim Ramsay 3ee620b8b6 Add example event-watcher script
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-12 20:11:00 +00:00
Jim Ramsay d8239109e5 Introduce an event loop mode in wayvncctl
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-12 20:11:00 +00:00
Jim Ramsay debd8a67cb Added event help text
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-12 20:11:00 +00:00
Jim Ramsay c75b64eae8 Add server event infrastructure
Includes "client-connect" and "client-disconnect" events as
proof-of-concept.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-12 20:11:00 +00:00
Jim Ramsay 8d32dfaead Add jsonipc event message constructor
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-12 20:11:00 +00:00
Jim Ramsay c859c50463 Ensure fatal errors are sent first
Once we start enqueueing asynchronous events, it's more important to
send fatal errors (which then disconnect) imediately by prepending them
to the send queue. Everything else is still processed FIFO.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-12 20:11:00 +00:00
Jim Ramsay 231a08ce19 Clarify the various wayvncctl 'help' modes
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 01bd225247 Add wayvncctl human-readable output
Also adds the '--json' option to produce machine-readable output.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 1275609aee Allow 'wayvncctl foo --help' syntax
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 15735b3256 Add wayvncctl version command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 73fd2e386f Add wayvnctl help command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 01851dc339 Add initial wayvncctl executable
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay be42c8b7bf Add ctl-client code
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 5043f8e149 Refactor some common utilities out of main
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 1a0e8aae97 Add ctl control socket and initial command infrastructure
This implements the first wayvncctl command: set-output

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay 19e1e14eab Add json-ipc message plumbing
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-10 18:02:59 +00:00
Jim Ramsay cb95ce931e Switch to previous output if current output disappears
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-06 14:55:38 +00:00
Jim Ramsay 7a159570ef Add functions to switch outputs on the fly
One to switch to an arbitrary outout, and then two helpers to switch
to the next/previous in the output list.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-06 14:55:38 +00:00
Jim Ramsay 4018c698c2 Add output_cycle to get next/prev outputs
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-06 14:55:38 +00:00
Jim Ramsay a1aa69625c Refactor output selection code
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-06 14:55:38 +00:00
Jim Ramsay 49ecbe14fa Refactor pointer initialization code
Additionally, make the pointer setup reentrant, destroying the previous
setup if needed.

Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-11-06 14:55:38 +00:00
Andri Yngvason 8bf505749c Normal exiting conditions should not yield warning 2022-10-29 15:11:28 +00:00
Andri Yngvason e9ee4e644c Adapt to aml api change 2022-10-29 11:56:54 +00:00
Andri Yngvason 6c8ad1db1e main: Suggest to enable debug logging when address binding fails 2022-10-24 21:13:45 +00:00
Andri Yngvason ec4c90b0b9 main: Refer users to man page when screencopy is missing 2022-10-24 21:13:10 +00:00
Jim Ramsay d04da7edb7 Log output selection and list of outputs
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-10-10 08:28:09 +00:00
Jim Ramsay a2d9afc90f Log signal handler
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-10-10 08:28:09 +00:00
Jim Ramsay c74c0e67d9 Log removal of seats and outputs
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-10-10 08:28:09 +00:00
Jim Ramsay 7c03f0d6e7 Log the listening address and port
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>
2022-10-10 08:28:09 +00:00
Andri Yngvason 9e85093a6d keyboard: Prefer lower keycodes
Xwayland can't handle keycodes above 255, so in order to play nice with X11,
we try to use the lowest possible keycode that's applicable for the given
shift level.

Fixes #148
2022-09-14 21:34:22 +00:00
Consolatis 34e95378e1 main: Prevent capture restart if idle
This prevents restarting the capture on dimension change when idle.
Previously the capture was running after the dimensions had changed
which caused starting the capture once a client connects to fail.

Fixes #152
2022-08-23 16:49:45 +00:00
Consolatis f3247ad933 Prevent capture and performance counter when idle
Fixes #80
2022-08-21 16:29:08 +00:00
Andri Yngvason 069d2de873 pointer: Add horizontal scrolling 2022-07-28 20:14:50 +00:00
Andri Yngvason fbf2dee187 main: Fix typo in help text 2022-07-28 20:14:27 +00:00
Andri Yngvason 28963df226 Make enabling of screencopy-dmabuf a runtime option 2022-07-09 17:34:40 +00:00
shironeko 4209a4deb2 main: check data_control exist before using it
fixes #141
2022-07-02 15:19:15 +00:00
Andri Yngvason 5e3c53b8db screencopy: Add pts to dtrace probes 2022-06-26 13:54:59 +00:00
Andri Yngvason 7c75c8919c Use neatvnc logging facilities 2022-06-25 16:14:18 +00:00
Andri Yngvason 43164f799d main: Add options to change log level 2022-06-25 16:03:11 +00:00
Andri Yngvason 099bdb8e17 main: Disallow setting seat name and disabling input 2022-05-30 18:35:04 +00:00
Andri Yngvason d1057f481f main: Extract input related object binding into function
Nesting those in an if-clause exceeded the 80 character limit and looked
bad on my screen.
2022-05-30 18:28:31 +00:00
shironeko c07f4483b2 Disable seat completely when using disable-input 2022-05-30 18:20:18 +00:00
Andri Yngvason 57f31be52e main: Add a placeholder buffer
In theory, this should allow clients to connect when the output is turned off.
2022-04-23 12:06:33 +00:00
Andri Yngvason dfc34bbe9d screencopy: Attach pts to nvnc fbs 2022-04-14 17:08:21 +00:00
Joel Jensen 5ed57b90b4 When remote input is disabled, also disable clipboard management 2022-04-03 21:04:54 +00:00
Andri Yngvason ce183e82e5 Clean up input managers and input backends separately
When inputs are disabled, managers may exist while backends don't.
2022-01-30 13:11:07 +00:00
Consolatis e9e7c1a33f Function without virtual keyboard, mouse protocol
Some compositors have a working screencopy protocol implementation but
are missing virtual keyboard and/or virtual mouse protocols. On those
compositors, don't just outright fail but instead provide a new option
to disable all remote input: --disable-input.

This is useful for using a different system (like a tablet) as
additional screen without the system providing any kind of input.
2022-01-30 13:07:04 +00:00
Andri Yngvason 3b26a43b97 pixels: Remove unused function 2022-01-27 23:16:44 +00:00
Andri Yngvason fba97621e2 main: Exit on failed keyboard initialisation
Fixes #122
2022-01-01 13:58:55 +00:00
Andri Yngvason f614e4aea7 main: Set upper bounds on pointer manager version 2021-12-15 23:29:47 +00:00
Andri Yngvason 87584ef934 screencopy: Set upper bounds on protocol version 2021-12-15 23:24:26 +00:00
Andri Yngvason 85563d59f8 main: Pin wl_output version to 3
Otherwise, things will crash when the compositor adds support for a
newer version.
2021-12-15 23:13:58 +00:00
Andri Yngvason 7581cf0bc4 Correct transform for y-inverted buffers 2021-09-25 00:24:38 +00:00
Andri Yngvason 1a41154b8c Remove left-over #include 2021-09-21 23:14:42 +00:00
Andri Yngvason 0d05b08fb0 Remove damage-refinery
It has been moved into neatvnc
2021-09-20 21:34:40 +00:00
Andri Yngvason 61ebb57696 Let neatvnc handle buffer transforms 2021-09-20 01:03:15 +00:00
Andri Yngvason 87c040c919 Align with nvnc_fb_pool API change 2021-09-05 00:47:34 +00:00
Andri Yngvason 6c3d9bbb9f Use new NeatVNC buffer submission API 2021-09-04 21:04:00 +00:00
Ryan Farley 81192ac74d Support UNIX domain sockets
Makes use of the functionality added in
https://github.com/any1/neatvnc/pull/49 to support UNIX domain sockets
with a command line flag.
2021-04-06 14:19:28 +00:00
Andri Yngvason 2dc16d2e07 Also exit on ECONNRESET 2020-12-31 13:28:15 +00:00
Andri Yngvason e3af211523 keyboard: Show warning when multiple layouts are specified 2020-12-27 19:34:06 +00:00
Andri Yngvason 0178c13627 keyboard: Always use layout index 0
Layout switching isn't supported anyhow. Better not to confuse things.
2020-12-27 19:26:54 +00:00
Andri Yngvason b9142a94ae Add xkb config options 2020-12-26 21:32:06 +00:00
Andri Yngvason d0aa51aa6e keyboard: Pass struct xkb_rule_names to keyboard_init 2020-12-26 21:07:49 +00:00
Andri Yngvason 482ebaf168 keyboard: Match shift levels to keycodes when needed 2020-12-26 17:19:34 +00:00
Andri Yngvason 2957f6f3a2 keyboard: Split keyboard_feed_code() into more functions 2020-12-26 17:19:34 +00:00
Arnavion a9b2d93568 Don't free the front buffer if screencopy fails
It is possible for `screencopy_failed` to be called without
the front buffer ever being set, such as when the output is dpms-off.

Fixes #65
2020-12-19 12:53:33 +00:00
Andri Yngvason d757e6db88 Add handler for raw key events 2020-11-29 20:50:39 +00:00
Andri Yngvason d978d94041 keyboard: Extract function 'keyboard_feed_code()' 2020-11-29 18:58:21 +00:00
NickSica 6a73f293fc Add PAM authentication 2020-11-03 22:18:46 +00:00
Andri Yngvason fa4dc0f169 Limit usage text to 80 characters per line 2020-10-17 18:16:12 +00:00
Flakebi 98d703bfa8 Fix de-neo layout
- Add possibility to specify layout variant with -k <layout>-<variant>
- Add ISO_Level5_Shift and ISO_Level5_Lock to modifier keys
2020-10-17 18:06:12 +00:00
Antonin Décimo 41f30bf7ca Fix use-after-free in error path 2020-10-01 09:57:14 +00:00
Andri Yngvason 4a098e27f9 Don't init data_control if it's not supported by compositor 2020-09-22 20:08:10 +00:00
Andri Yngvason 30295bb715 data-control: Destroy data device on exit 2020-09-22 20:01:11 +00:00
Andri Yngvason 5c30d7752c data-control: Clean up whole receive context in aml_free_fn
This takes care of the case where wayvnc exits before the whole offer
has been processed.
2020-09-22 19:53:05 +00:00
Andri Yngvason 9a2f761a02 data-control: Don't free data-control-manager twice 2020-09-22 19:37:35 +00:00
Andri Yngvason 630e2e67bc data-control: Make offer handling asynchronous 2020-09-22 03:12:46 -06:00
Scott Moreau 3ee9aac35e Add basic clipboard support
Uses wlr-data-control-unstable-v1 protocol to interface with the clipboard
making copy/paste of text to/from host clipboard possible.
2020-09-22 03:11:03 -06:00
Andri Yngvason 8038e65597 Clean up aml on nvnc init failure 2020-08-23 13:25:45 +00:00
Andri Yngvason dcf3b5869c Clean up config on exit 2020-08-23 13:18:47 +00:00
Andri Yngvason 7ef8d0b0ae Exit if enabling auth fails 2020-08-23 13:10:59 +00:00
Andri Yngvason 69d36dd7ef buffer: Fix buffer attribute comparison 2020-07-28 17:32:14 +00:00
Jan Beich 72dd8a159c shm: guard fallback on FreeBSD < 13 as well
../src/shm.c:35:13: warning: unused function 'randname' [-Wunused-function]
static void randname(char *buf)
            ^
2020-07-27 20:04:42 +00:00
Jan Beich 6916780389 buffer: guard gbm.h after 3742dc7144
../src/buffer.c:25:10: fatal error: 'gbm.h' file not found
 #include <gbm.h>
          ^~~~~~~
2020-07-27 19:51:59 +00:00
Andri Yngvason 3742dc7144 Add build option for enabling screencopy-dmabuf 2020-07-26 15:12:14 +00:00
Andri Yngvason ca069ea738 buffer: Add function to get available buffer types 2020-07-26 14:26:58 +00:00
Andri Yngvason f8344fda16 main: Suppress unused variable warnings in release build 2020-07-26 13:47:40 +00:00
Andri Yngvason ef6756d0f4 keyboard: suppress unused variable warnings in release build 2020-07-26 13:47:20 +00:00
Andri Yngvason 8ff47ee559 Add a way to learn the version of wayvnc and its dependencies 2020-07-26 11:49:02 +00:00
Andri Yngvason c53ab3bbf5 Report average damaged area per frame in performance ticker 2020-07-25 22:51:37 +00:00
Andri Yngvason 0be56b2100 Add documentation for performance counters 2020-07-25 22:21:48 +00:00
Andri Yngvason c8ba15c455 Add performance counters 2020-07-25 22:17:13 +00:00
Andri Yngvason 85fca04e27 Resize buffers on modeset 2020-07-19 14:38:35 +00:00
Andri Yngvason 4a5838c180 screencopy: Release front buffer on screencopy_stop() 2020-07-19 14:37:48 +00:00
Andri Yngvason c79eb98e68 output: Add callbacks for change notification 2020-07-19 13:56:10 +00:00
Andri Yngvason f9b3d98f83 pixels: Fix endian macros, take 3 2020-07-18 09:23:42 +00:00
Andri Yngvason bed4b7261e screencopy: Disable linux-dmabuf code path
I need to iron out some kinks before it's made the default
2020-07-17 16:27:46 +00:00
Andri Yngvason 0c86f9cf53 screencopy: Don't delay if time_left == 0 2020-07-17 16:22:17 +00:00
Andri Yngvason ce86f51699 screencopy: Fix pixel format of shm buffers 2020-07-16 18:10:12 +00:00
Andri Yngvason 14768ca6e3 pixels: Add function to convert from wl_shm format to fourcc 2020-07-16 18:09:18 +00:00
Andri Yngvason fbd8020778 pixels: Fix more endienness macros 2020-07-16 17:46:44 +00:00
Jan Beich 1bc095bd75 pixels: detect endianness via compiler defines
../src/pixels.c:24:10: fatal error: 'endian.h' file not found
 #include <endian.h>
          ^~~~~~~~~~
../src/pixels.c:58:6: error: expected value in expression
 #elif
      ^
2020-07-16 14:34:56 +00:00
Andri Yngvason 2cb9f663a0 Align with aml API changes 2020-07-11 21:33:02 +00:00
Andri Yngvason 184ed0a7ef Allow the user to adjust the FPS limit 2020-07-11 20:53:31 +00:00
Andri Yngvason 73ade6b84e Add dtrace probes for rendering and damage checking 2020-07-11 20:53:31 +00:00
Andri Yngvason e5272618ba Destroy wl_registry on exit 2020-07-11 20:53:31 +00:00
Andri Yngvason 0268b52c53 Use native pixel format 2020-07-11 20:53:31 +00:00
Andri Yngvason c0f1036f97 pixels: Add more formats and take into account endianness 2020-07-11 20:53:31 +00:00
Andri Yngvason ef74911298 Exit on mode change intead of crashing 2020-07-11 20:53:31 +00:00
Andri Yngvason 9d2e22b9bd pixels: Add copyright notice 2020-07-11 20:53:31 +00:00
Andri Yngvason 9a9c7c8be6 buffer: Cleanup dmabuf params after use 2020-07-11 20:53:31 +00:00
Andri Yngvason 1406ce1cf8 Clean up damage refinery on exit 2020-07-11 20:53:31 +00:00
Andri Yngvason cd7594320b Clean up gbm device on exit 2020-07-11 20:53:31 +00:00
Andri Yngvason 4c14c11de4 transform-util: Add copyright notice 2020-07-11 20:53:31 +00:00
Andri Yngvason b8df02838e pixman-renderer: Add copyright notice 2020-07-11 20:53:31 +00:00
Andri Yngvason ee3b6d74cf buffer: Add copyright notice 2020-07-11 20:53:31 +00:00
Andri Yngvason 7b6372ef49 damage-refinery: Add copyright notice 2020-07-11 20:53:31 +00:00
Andri Yngvason 843368c993 screencopy: Actually use y-inversion flag 2020-07-11 20:53:31 +00:00
Andri Yngvason 46fdbfb109 screencopy: Set the rate limit to 30 Hz 2020-07-11 20:53:31 +00:00
Andri Yngvason 2b522ee596 Remove frame-capture abstraction 2020-07-11 20:53:31 +00:00