Commit graph

213 commits

Author SHA1 Message Date
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
443d955dfd view: test whether XWayland surfaces have been mapped
This is to work around "misbehaving" (for lack of a better term)
clients. At the moment, Firefox Nightly and Google Chrome/Chromium are
known to be suchs client:

When XWayland support is enabled, Firefox first creates an XWayland
surface, closes this (before mapping it) and then opens an XDG toplevel
surface. Cage tries to manage the first XWayland surface, but when it
closes, Cage has no surfaces left and hence closes as well.

Hence, Cage terminates before it picks up on Firefox's XDG toplevel, and
Firefox (rightly) prints it cannot read the Wayland pipe.

In Chromium's case, it simply opens an XWayland surface which it
immediately closes, before opening the "real" XWayland surface.

The workaround is to track whether an XWayland surface has been mapped
and, if it hasn't, to not exit when we have no views left.

Firefox's behavior and the workaround are discussed in #18.

This commit fixes #18 and is part of the fix for #19.
2019-01-19 19:43:24 +01:00
Jente Hidskes
a324d22dfe
meson: check WLR_HAS_XWAYLAND when building with XWayland 2019-01-19 19:21:13 +01:00
Jente Hidskes
a8e15442ab
xdg_shell/xwayland: do not check parent for other view types
An xdg-shell surface can never be a parent of an xwayland surface and
vice-versa.
2019-01-18 17:37:40 +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
7f7d8ac33e
README: credit rootston as well 2019-01-18 10:19:54 +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
Jente Hidskes
14aadbca1b
Output: render software cursors
As mentioned, this is a no-op when there hardware cursors are supported.

Fixes #14.
2019-01-17 11:04:14 +01:00
Jente Hidskes
b6024e982f Fully support multiple primary clients
This is the path we settled on in #24.

That is: any new toplevel window takes over the Cage display, hiding any
previous toplevels until it is closed. Only when the last toplevel is
closed, does Cage exit as well.
2019-01-12 19:27:24 +01:00
Jente Hidskes
b0bd4e680d view: add view_has_children to query if a view has children
This allows us to check per-view whether is has dialogs open, instead of
diong it on a global basis as we are doing currently. This is necessary
for fully supporting multiple primary clients.
2019-01-12 19:27:24 +01:00
Jente Hidskes
112a662ebc Implement support for drag 'n drop icons
Fixes #8.
2019-01-11 15:28:09 +01:00
Jente Hidskes
1f85e1061b render_data: take x,y instead of cg_view
This enables us to render surfaces other than views. See the next
commit.
2019-01-11 15:28:09 +01:00
Jente Hidskes
2c51cd62b6
view_center: remove cg_server 2019-01-10 15:57:53 +01:00
Jente Hidskes
29009ddd77
view: hide maximize and center functions
This is now handled in view_position.
2019-01-10 15:57:25 +01:00
Jente Hidskes
a4a3a4954a
output: handle size changes
Fixes #23.
2019-01-10 15:50:31 +01:00
Jente Hidskes
21c01c9ee0 Add idle inhibitor support
With this, some apps (e.g. mpv) can block the idle tracker from
kicking in. This way, the screen won't blank (or whatever you
configured) when the application doesn't want it to.
2019-01-09 20:05:09 +01:00
Jente Hidskes
bf58eadf50 Add idle tracking
Note that this does not do much without an idle manager "on the other
side". See, for example, swayidle: https://github.com/swaywm/sway/blob/master/swayidle/swayidle.1.scd

Fixes #7.
2019-01-09 20:05:09 +01:00
Jente Hidskes
96372c145f
cage.c: fix include order 2019-01-04 20:23:50 +01:00
Jente Hidskes
905199a1a8
view.h: conditionally include xwayland.h 2019-01-04 20:23:33 +01:00
Jente Hidskes
eaa71b7af4
Use correct CG_ namespace in headers 2019-01-04 20:23:01 +01:00
Jente Hidskes
691847ca12
Add XWayland note to README 2019-01-04 18:49:48 +01:00
Jente Hidskes
8faf7a2f59
output: render an overlay when dialogs are open
Fixes #6.
2019-01-04 18:33:59 +01:00
Jente Hidskes
c848bafaed
view_destroy: focus the previous view when closing the current
Fixes #4.
2019-01-04 17:26:26 +01:00
Jente Hidskes
3ef0fc3867
view_destroy: unmap surface if it isn't yet
Otherwise, we're left with an invalid link in the view list.
2019-01-04 17:25:07 +01:00
Jente Hidskes
2b8ee61d8b
Merge pull request #16 from Hjdskes/touch
Add touch input
2019-01-04 16:22:15 +01:00
Jente Hidskes
ce755c8591
Add touch input
Fixes #1
2019-01-04 15:55:13 +01:00
Jente Hidskes
f47a76c9be
xdg_shell: only track toplevel xdg surfaces
We don't need to manage popups, but in
786e28bdac we ended up doing so. This
reverts Cage's behavior.
2019-01-04 13:41:25 +01:00
Jente Hidskes
5f60b0a00c
output: remove xwayland include
We don't need it in this file.
2019-01-03 22:31:13 +01:00
Jente Hidskes
7077f9ba1c
seat: move desktop_view_at comment 2019-01-03 22:30:55 +01:00
Jente Hidskes
183e509dd9
s/ifdef/if/g
ifdef gives us some troubles with the thing being set to 0 but still be
defined, so let's just use if.
2019-01-03 22:30:34 +01:00
Jente Hidskes
81761cae96
Cage: fix possibly uninitialized variable 2019-01-03 13:55:38 +01:00
Jente Hidskes
907bb78c92
Add missing config.h.in 2019-01-02 22:28:56 +01:00
Jente Hidskes
2847e0d54f
Seat: abstract away a view switch statement
We have our view abstraction, so why not use it?
2019-01-02 21:31:30 +01:00
Jente Hidskes
9a99ba604f
Output: abstract away a view switch statement
We have our view abstraction, so why not use it?
2019-01-02 21:23:16 +01:00
Jente Hidskes
431320443a
seat: reverse conditional for early-exit of set_focus 2019-01-02 21:13:18 +01:00
Jente Hidskes
3e10b1f7eb
README: document XWayland compile-time option 2019-01-02 21:13:00 +01:00
Jente Hidskes
9a4afdb025
Make the README for development only
For users, we have Cage's project page at
https://hjdskes.nl/projects/cage.
2019-01-02 21:06:56 +01:00
Jente Hidskes
14dde88d88
Merge pull request #15 from Hjdskes/xwayland
Add XWayland support
2019-01-02 21:02:18 +01:00
Jente Hidskes
e721808c88
Update copyright to include 2019 2019-01-02 21:01:01 +01:00
Jente Hidskes
a34c726a1c
Add XWayland support
With Cage becoming more popular since its mention on Phoronix and
therefore getting more use-cases than just my own project, add XWayland
support. The refactoring of 2cf40f7 makes this much easier. Note that
this is a no-cost addition for those of us not using XWayland as it is a
compile-time option that needs to be explicitly enabled by adding
`-Dxwayland=true` to your meson command.
2019-01-02 20:58:48 +01:00
Jente Hidskes
48f8f69556
view_get_geometry: only out width and height
This is the only thing we need, as we don't use a view's x and y
coordinates for placing windows.
2019-01-02 20:47:46 +01:00
Jente Hidskes
786e28bdac
Properly track mapping and unmapping
We shouldn't render a window before it is mapped (obviously), but we
render all windows in the view list. Hence, only insert the window once
it is mapped.

We could run into the case where a window is destroyed without being in
the window list, so we now track unmapping again and remove windows from
the list when they get unmapped.
2018-12-31 20:00:23 +01:00
Jente Hidskes
a9818c0df1
Do not display a cursor on output creation
Now we don't display a cursor unless a pointer device is connected.

Fixes #2
2018-12-31 00:55:19 +01:00
Jente Hidskes
fd4ff669dd
Move xcursor theme loading and cursor warping to output
Since this is inherently output independent, we can move this to here
and avoid the inexistance of an output we ran into in the previous
commit.

Warping the cursor is no problem here either: since we restrict
ourselves to a single output, there won't be any confusing UX by having
the cursor jump from one output to the newly attached one.
2018-12-31 00:25:37 +01:00
Jente Hidskes
2cf40f7a9b
Refactor cage into separate source files
This makes Cage much easier to maintain. Not only is it easier where to
look and to maintain a mental model of the code, there is also more
encapsulation, better abstractions and better extendability.
2018-12-31 00:12:33 +01:00
Jente Hidskes
e1525a20c8
Do not create a dmabuf global
In new enough wlroots versions, the renderer creates the dmabuf global
itself.

Fixes #11.
2018-12-28 15:32:07 +01:00
Jente Hidskes
f680ee02db
Fix possibly uninitialized variable warning 2018-12-25 20:29:24 +01:00
Jente Hidskes
4ea5cc6b32
Use Wayland's event loop for signals
Now we don't require a global variable.
2018-12-25 20:29:24 +01:00
Jente Hidskes
b22f4b465c
Improve child spawning 2018-12-25 20:29:24 +01:00