mirror of
https://github.com/swaywm/sway.git
synced 2025-11-14 06:59:47 -05:00
Basic support for extensions in server and clients
This commit is contained in:
parent
fb0bfa13ce
commit
82db2a57a9
9 changed files with 208 additions and 7 deletions
32
sway/extensions.c
Normal file
32
sway/extensions.c
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include <wlc/wlc.h>
|
||||
#include <wlc/wlc-wayland.h>
|
||||
#include "wayland-desktop-shell-server-protocol.h"
|
||||
#include "log.h"
|
||||
|
||||
static void set_background(struct wl_client *client, struct wl_resource *resource,
|
||||
struct wl_resource *output, struct wl_resource *surface) {
|
||||
sway_log(L_DEBUG, "Surface requesting background for output");
|
||||
}
|
||||
|
||||
static struct desktop_shell_interface desktop_shell_implementation = {
|
||||
.set_background = set_background,
|
||||
};
|
||||
|
||||
static void desktop_shell_bind(struct wl_client *client, void *data,
|
||||
unsigned int version, unsigned int id) {
|
||||
if (version > 1) {
|
||||
// Unsupported version
|
||||
return;
|
||||
}
|
||||
|
||||
struct wl_resource *resource = wl_resource_create(client, &desktop_shell_interface, version, id);
|
||||
if (!resource) {
|
||||
wl_client_post_no_memory(client);
|
||||
}
|
||||
|
||||
wl_resource_set_implementation(resource, &desktop_shell_implementation, NULL, NULL);
|
||||
}
|
||||
|
||||
void register_extensions(void) {
|
||||
wl_global_create(wlc_get_wl_display(), &desktop_shell_interface, 1, NULL, desktop_shell_bind);
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
#include <sys/un.h>
|
||||
#include <signal.h>
|
||||
#include <getopt.h>
|
||||
#include "extensions.h"
|
||||
#include "layout.h"
|
||||
#include "stringop.h"
|
||||
#include "config.h"
|
||||
|
|
@ -73,6 +74,8 @@ int main(int argc, char **argv) {
|
|||
if (!wlc_init(&interface, argc, argv)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
register_extensions();
|
||||
|
||||
char *config_path = NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue