-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
496 additions
and
510 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
zen/src/backend/immersive/common.h → common/include/zen-common/cpp-util.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
|
||
// NOLINTBEGIN(bugprone-macro-parentheses) | ||
#define DISABLE_MOVE_AND_COPY(Class) \ | ||
Class(const Class &) = delete; \ | ||
Class(Class &&) = delete; \ | ||
Class &operator=(const Class &) = delete; \ | ||
Class &operator=(Class &&) = delete | ||
// NOLINTEND(bugprone-macro-parentheses) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include <wayland-server-core.h> | ||
|
||
struct zn_xr_system; | ||
struct zn_desktop_server_xr_system; | ||
|
||
struct zn_desktop_xr_system { | ||
struct zn_xr_system *zn_xr_system; // @nonnull, @outlive | ||
|
||
struct wl_global *global; // @nonnull, @owning | ||
struct wl_list resource_list; // wl_resource::link of zen_xr_system | ||
|
||
struct wl_listener zn_xr_system_destroy_listener; | ||
}; | ||
|
||
struct zn_desktop_xr_system *zn_desktop_xr_system_create( | ||
struct zn_xr_system *zn_xr_system, struct wl_display *display); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#include "zen-desktop/xr-system.h" | ||
|
||
#include <zen-desktop-protocol.h> | ||
|
||
#include "zen-common/log.h" | ||
#include "zen-common/util.h" | ||
#include "zen/xr-system.h" | ||
|
||
static void zn_desktop_xr_system_destroy(struct zn_desktop_xr_system *self); | ||
|
||
static void | ||
zn_desktop_xr_system_handle_destroy(struct wl_resource *resource) | ||
{ | ||
wl_list_remove(wl_resource_get_link(resource)); | ||
} | ||
|
||
static void | ||
zn_desktop_xr_system_protocol_connect( | ||
struct wl_client *client UNUSED, struct wl_resource *resource UNUSED) | ||
{} | ||
|
||
static const struct zen_xr_system_interface implementation = { | ||
.connect = zn_desktop_xr_system_protocol_connect, | ||
}; | ||
|
||
static void | ||
zn_desktop_xr_system_bind( | ||
struct wl_client *client, void *data, uint32_t version, uint32_t id) | ||
{ | ||
struct zn_desktop_xr_system *self = data; | ||
|
||
struct wl_resource *resource = | ||
wl_resource_create(client, &zen_xr_system_interface, (int)version, id); | ||
if (resource == NULL) { | ||
zn_error("Failed to create a wl_resource"); | ||
wl_client_post_no_memory(client); | ||
return; | ||
} | ||
|
||
wl_resource_set_implementation( | ||
resource, &implementation, self, zn_desktop_xr_system_handle_destroy); | ||
|
||
wl_list_insert(&self->resource_list, wl_resource_get_link(resource)); | ||
} | ||
|
||
static void | ||
zn_desktop_xr_system_handle_xr_system_destroy( | ||
struct wl_listener *listener, void *data UNUSED) | ||
{ | ||
struct zn_desktop_xr_system *self = | ||
zn_container_of(listener, self, zn_xr_system_destroy_listener); | ||
|
||
zn_desktop_xr_system_destroy(self); | ||
} | ||
|
||
struct zn_desktop_xr_system * | ||
zn_desktop_xr_system_create( | ||
struct zn_xr_system *zn_xr_system, struct wl_display *display) | ||
{ | ||
struct zn_desktop_xr_system *self = zalloc(sizeof *self); | ||
if (self == NULL) { | ||
zn_error("Failed to allocate memory"); | ||
goto err; | ||
} | ||
|
||
self->zn_xr_system = zn_xr_system; | ||
wl_list_init(&self->resource_list); | ||
|
||
self->global = wl_global_create( | ||
display, &zen_xr_system_interface, 1, self, zn_desktop_xr_system_bind); | ||
if (self->global == NULL) { | ||
zn_error("Failed to create a wl_global"); | ||
goto err_free; | ||
} | ||
|
||
self->zn_xr_system_destroy_listener.notify = | ||
zn_desktop_xr_system_handle_xr_system_destroy; | ||
wl_signal_add( | ||
&zn_xr_system->events.destroy, &self->zn_xr_system_destroy_listener); | ||
|
||
return self; | ||
|
||
err_free: | ||
free(self); | ||
|
||
err: | ||
return NULL; | ||
} | ||
|
||
static void | ||
zn_desktop_xr_system_destroy(struct zn_desktop_xr_system *self) | ||
{ | ||
wl_list_remove(&self->zn_xr_system_destroy_listener.link); | ||
wl_global_destroy(self->global); | ||
wl_list_remove(&self->resource_list); | ||
free(self); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
wl_protocol_dir = wayland_protocols_dep.get_variable('pkgdatadir') | ||
zen_protocol_dir = zen_protocols_dep.get_variable('pkgdatadir') | ||
|
||
wayland_scanner = find_program( | ||
wayland_scanner_dep.get_variable('wayland_scanner'), | ||
|
@@ -8,11 +9,11 @@ wayland_scanner = find_program( | |
protocols = { | ||
'xdg-shell': wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml', | ||
|
||
'zen-desktop': zen_protocol_dir / 'unstable/zen-desktop.xml', | ||
|
||
'wlr-layer-shell-unstable-v1': 'wlr-layer-shell-unstable-v1.xml', | ||
} | ||
|
||
wlroots_srcs = [] | ||
|
||
protocols_code = {} | ||
protocols_server_header = {} | ||
protocols_client_header = {} | ||
|
@@ -24,17 +25,13 @@ foreach name, path : protocols | |
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'], | ||
) | ||
|
||
wlroots_srcs += code | ||
|
||
server_header = custom_target( | ||
name.underscorify() + '_server_h', | ||
input: path, | ||
output: '@[email protected]', | ||
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'], | ||
) | ||
|
||
wlroots_srcs += server_header | ||
|
||
client_header = custom_target( | ||
name.underscorify() + '_client_h', | ||
input: path, | ||
|
@@ -47,3 +44,10 @@ foreach name, path : protocols | |
protocols_server_header += { name: server_header } | ||
protocols_client_header += { name: client_header } | ||
endforeach | ||
|
||
wlroots_srcs = [ | ||
protocols_code['wlr-layer-shell-unstable-v1'], | ||
protocols_code['xdg-shell'], | ||
protocols_server_header['wlr-layer-shell-unstable-v1'], | ||
protocols_server_header['xdg-shell'], | ||
] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.