Support for swaybg as a shell surface

This is a lot of work for a small payoff - the mouse cursor is now
correctly rendered over the background.

Containers can now specify a custom arrange function which will be
called during arrange_windows instead of the usual path for that
container type. For backgrounds, the function sends it to the back and
sets its geometry to the size of the screen.

This requires some changes I'm not too happy with in arrange_windows
with respect to how containers figure out the arrangemnet of their
children (special cases are undesirable).

Also, if anyone runs a debug build as their actual WM, you should know
that I've made it so swaybg is invoked as `./bin/swaybg` in debug builds
now.

This PR also includes a bunch of unrelated refactoring. This is a pretty
significant change and I can only test it under the x backend, so I'd
appreciate it if you kind folks would review+test it yourselves and
leave some 👍 if you like it.
This commit is contained in:
Drew DeVault 2016-01-17 12:58:03 -05:00
parent 2597321236
commit 802233f3d0
11 changed files with 133 additions and 68 deletions

View file

@ -5,40 +5,43 @@
#include <wlc/wlc-wayland.h>
#include "wayland-desktop-shell-server-protocol.h"
#include "list.h"
#include "container.h"
struct background_config {
wlc_handle output;
wlc_resource surface;
// we need the wl_resource of the surface in the destructor
struct wl_resource *wl_surface_res;
wlc_handle output;
wlc_handle handle;
wlc_resource surface;
// we need the wl_resource of the surface in the destructor
struct wl_resource *wl_surface_res;
};
struct panel_config {
// wayland resource used in callbacks, is used to track this panel
struct wl_resource *wl_resource;
wlc_handle output;
wlc_resource surface;
// we need the wl_resource of the surface in the destructor
struct wl_resource *wl_surface_res;
enum desktop_shell_panel_position panel_position;
// wayland resource used in callbacks, is used to track this panel
struct wl_resource *wl_resource;
wlc_handle output;
wlc_resource surface;
// we need the wl_resource of the surface in the destructor
struct wl_resource *wl_surface_res;
enum desktop_shell_panel_position panel_position;
};
struct desktop_shell_state {
list_t *backgrounds;
list_t *panels;
list_t *lock_surfaces;
bool is_locked;
struct wlc_size panel_size;
list_t *backgrounds;
list_t *panels;
list_t *lock_surfaces;
bool is_locked;
struct wlc_size panel_size;
};
struct swaylock_state {
bool active;
wlc_handle output;
wlc_resource surface;
bool active;
wlc_handle output;
wlc_resource surface;
};
extern struct desktop_shell_state desktop_shell;
void register_extensions(void);
void arrange_background_view(swayc_t *view, double width, double height);
#endif