Compare commits

...

36 commits

Author SHA1 Message Date
Sergey Bugaev
7f562d9ef9 WIP: Implement wl-copy --regular and multiseat 2019-09-16 00:19:16 +03:00
Sergey Bugaev
87dcd09eba Implement wl-paste --watch
Closes https://github.com/bugaevc/wl-clipboard/issues/39
2019-09-15 20:42:57 +03:00
Sergey Bugaev
771a6c63ce Move forking to background to happen after setting selection
This way, we'll actually return our error code to the parent
process if anything goes wrong during the initial stages, instead
of successfully exiting in the parent.
2019-09-15 20:42:57 +03:00
Sergey Bugaev
8b83791ad6 Move copy action logic into types/copy-action 2019-09-15 20:42:57 +03:00
Sergey Bugaev
6afabd3b59 Support acessing primary selection using wlr-data-control
See https://github.com/swaywm/wlr-protocols/pull/34
2019-09-15 20:42:57 +03:00
Sergey Bugaev
c4919ee748 Update the bundled version of wlr-data-control-unstable-v1 2019-09-15 20:42:57 +03:00
Sergey Bugaev
27e65aa705 Reimplement clearing selection
We now properly set a nil/NULL source instead of
setting a dummy source and exiting. It's actually
more straigtforawrd this way, and the Mutter bug
that caused it to crash on nil sources [1] has been
fixed.

Fixes https://github.com/bugaevc/wl-clipboard/issues/47

[1]: https://gitlab.gnome.org/GNOME/mutter/issues/335
2019-09-15 20:42:57 +03:00
Sergey Bugaev
e15813320b Move Wayland initialization into wl-copy and wl-paste
This was the last thing left in boilerplate.c,
so now boilerplate.c and boilerplate.h are finally
completely gone.
2019-09-15 20:42:57 +03:00
Sergey Bugaev
ca45611d25 Make wl-copy and wl-paste use popup surface directly
This lets us finally completely get rid of the infrastructure
that boilerplate.h and boilerplate.c used to have for managing
the popup surface and its callbacks.
2019-09-15 20:42:57 +03:00
Sergey Bugaev
7ea4b31216 Add a typedef for argv_t 2019-09-15 20:42:57 +03:00
Sergey Bugaev
1c3970b1f9 Make popup surface manage the keyboard and forward its callback 2019-09-15 20:42:57 +03:00
Sergey Bugaev
6d20b63147 Move seat handling to types/seat
This type is now responsible for keeping track of
the seat's name and capabilities. An array of available
seats is stored by the registry, which allows you to
find a desired seat by its name.
2019-09-15 20:42:57 +03:00
Sergey Bugaev
18bd9a195c Move registry and globals handling to types/registry 2019-09-15 20:42:57 +03:00
Sergey Bugaev
a1afdc65e5 Move popup surface handling to types/popup-surface 2019-09-15 20:42:57 +03:00
Sergey Bugaev
235b8c993c Move shell handling to types/shell 2019-09-15 20:42:57 +03:00
Sergey Bugaev
20fa2f039a Move shell surface handling to types/shell-surface 2019-09-15 20:42:57 +03:00
Sergey Bugaev
ebec7f6f58 Move keyboard handling to types/keyboard 2019-09-15 20:42:56 +03:00
Sergey Bugaev
dc9f8d2b49 Move device manager handling to types/device-manager 2019-09-15 20:42:52 +03:00
Sergey Bugaev
8d62b8c956 Move device handling to types/device 2019-09-15 19:53:13 +03:00
Sergey Bugaev
0a7c8fb747 Move offer mime type handling to struct offer
Now, instead of processing offerred mime types as they
appear, we will collect them into a single buffer inside
struct offer, and then analyze the whole thing when it's
ready.

This way, in the future it'd be possible to handle the case
where we see multiple offers and don't know in adnvance which
ones are the ones we need, and which we should ignore.
2019-09-15 19:47:15 +03:00
Sergey Bugaev
6a9800d7eb Move offer handling to types/offer 2019-09-15 19:45:06 +03:00
Sergey Bugaev
7aa546e7ff Move source handling to types/source
This is the first in a series of commits moving parts of logic
that was previously implemented in wl-copy/wl-paste into separate
files, with separate types (structures) that encapsulate, to a
certain degree, the implementation details of a type, somewhat
OOP style.
2019-09-15 19:43:42 +03:00
Sergey Bugaev
d981e9d606 Rename libwl-clipboard-boilerplate to just libwl-clipboard
It's getting increasingly more structured and less boilerplaity,
and this trend is only going to continue. It still remains an internal
static library, at least for now.
2019-09-15 17:49:05 +03:00
Sergey Bugaev
2f5954e2fa Move Wayland protocol includes to their own files 2019-09-15 17:49:05 +03:00
Sergey Bugaev
eadb839420 Do not allow any positional arguments to wl-paste
They were previously silently ignored.
2019-09-15 17:49:05 +03:00
Sergey Bugaev
b8e8b9ab54 Make sure to always handle fork() failure 2019-09-15 17:49:05 +03:00
Sergey Bugaev
f103563cd7 Add a missing shell surface listener
This fell through the cracks. The compilers were not
issuing an unused symbol warning because of the symbol
being public, so now they do.
2019-09-15 13:03:07 +03:00
Sergey Bugaev
f5e479dda6 Make most symbols static
We used not to care about this and just make everything
externally visible. Now we switch to a different convention
where everything is static by default unless it needs to be
externally visible.
2019-09-15 13:03:07 +03:00
Sergey Bugaev
fea8702bdf Separate option parsing into parse_options()
Similar to how printing usage is a separate function, print_usage().
2019-09-15 13:03:07 +03:00
Sergey Bugaev
7f0c644a38 Consolidate all options into struct { ... } options
This is in preparation for moving option parsing out
to explicit separate functions.
2019-09-15 13:03:07 +03:00
Sergey Bugaev
5c36753c15 Workaround id_rsa.pub not being identified as text
And extensively docomment why mime_type_is_text() does
what it does, including this workaround.
2019-09-15 13:03:07 +03:00
Sergey Bugaev
9bf0f299c6 Unimplement wlr-layer-shell support
This largely reverts commits 3eac589774
and cd8cb31e61.

Now that wlroots-based compositors implement the wlr-data-control
protocol, there's no need to use the popup surface hack when running
under them, which means wlr-layer-shell does not actually get used.

While it is possible that a compositor supports wlr-layer-shell but
not wlr-data-control, it is unlikely enough by this point. Furthermore,
wl-clipboard is now used widely enough for niche compositors to consider
implmenting a protocol to make wl-clipboard work better rather than the
other way around. In other words, if your compositor implements
wlr-layer-shell but not wlr-data-control and you would like wl-clipboard
to work well under your compositor, please implement wlr-data-control
in your compositor so that we can avoid relying on hacks.

Closes https://github.com/bugaevc/wl-clipboard/issues/24
2019-09-15 13:03:07 +03:00
Sergey Bugaev
a1481254ca Tweak comments throughout the codebase 2019-09-15 13:03:07 +03:00
Sergey Bugaev
4591982b15 Fix a potential buffer overflow 2019-09-15 13:03:07 +03:00
Sergey Bugaev
bc806e7382 Treat YAML and PGP keys as text
Fixes https://github.com/bugaevc/wl-clipboard/issues/44 and https://github.com/bugaevc/wl-clipboard/issues/46
2019-09-15 13:03:07 +03:00
Sergey Bugaev
b74c07c917 Refactor some bits in util/files.c 2019-09-15 13:03:07 +03:00
40 changed files with 2905 additions and 1716 deletions