mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-07 14:06:00 +01:00
Merge pull request #82 from 4e554c4c/detection
Add backend detection functions
This commit is contained in:
commit
f11b38f97a
5 changed files with 17 additions and 4 deletions
|
@ -52,6 +52,10 @@ static struct wlr_backend_impl backend_impl = {
|
||||||
.get_egl = wlr_drm_backend_get_egl
|
.get_egl = wlr_drm_backend_get_egl
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool wlr_backend_is_drm(struct wlr_backend *b) {
|
||||||
|
return b->impl == &backend_impl;
|
||||||
|
}
|
||||||
|
|
||||||
static void session_signal(struct wl_listener *listener, void *data) {
|
static void session_signal(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_drm_backend *backend =
|
struct wlr_drm_backend *backend =
|
||||||
wl_container_of(listener, backend, session_signal);
|
wl_container_of(listener, backend, session_signal);
|
||||||
|
|
|
@ -103,6 +103,10 @@ static struct wlr_backend_impl backend_impl = {
|
||||||
.destroy = wlr_libinput_backend_destroy
|
.destroy = wlr_libinput_backend_destroy
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool wlr_backend_is_libinput(struct wlr_backend *b) {
|
||||||
|
return b->impl == &backend_impl;
|
||||||
|
}
|
||||||
|
|
||||||
static void session_signal(struct wl_listener *listener, void *data) {
|
static void session_signal(struct wl_listener *listener, void *data) {
|
||||||
struct wlr_libinput_backend *backend = wl_container_of(listener, backend, session_signal);
|
struct wlr_libinput_backend *backend = wl_container_of(listener, backend, session_signal);
|
||||||
struct wlr_session *session = data;
|
struct wlr_session *session = data;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wlr/backend/interface.h>
|
#include <wlr/backend/interface.h>
|
||||||
|
@ -111,6 +112,8 @@ static void output_remove_reemit(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
void wlr_multi_backend_add(struct wlr_backend *_multi,
|
void wlr_multi_backend_add(struct wlr_backend *_multi,
|
||||||
struct wlr_backend *backend) {
|
struct wlr_backend *backend) {
|
||||||
|
assert(wlr_backend_is_multi(backend));
|
||||||
|
|
||||||
struct wlr_multi_backend *multi = (struct wlr_multi_backend *)_multi;
|
struct wlr_multi_backend *multi = (struct wlr_multi_backend *)_multi;
|
||||||
struct subbackend_state *sub = calloc(1, sizeof(struct subbackend_state));
|
struct subbackend_state *sub = calloc(1, sizeof(struct subbackend_state));
|
||||||
sub->backend = backend;
|
sub->backend = backend;
|
||||||
|
@ -135,10 +138,8 @@ void wlr_multi_backend_add(struct wlr_backend *_multi,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_session *wlr_multi_get_session(struct wlr_backend *_backend) {
|
struct wlr_session *wlr_multi_get_session(struct wlr_backend *_backend) {
|
||||||
// TODO: assert(wlr_backend_is_multi(_backend));
|
assert(wlr_backend_is_multi(_backend));
|
||||||
if (_backend->impl != &backend_impl) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend;
|
struct wlr_multi_backend *backend = (struct wlr_multi_backend *)_backend;
|
||||||
return backend->session;
|
return backend->session;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,6 @@
|
||||||
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
||||||
struct wlr_session *session, struct wlr_udev *udev, int gpu_fd);
|
struct wlr_session *session, struct wlr_udev *udev, int gpu_fd);
|
||||||
|
|
||||||
|
bool wlr_backend_is_drm(struct wlr_backend *backend);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,4 +12,6 @@ struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
|
||||||
struct wlr_session *session, struct wlr_udev *udev);
|
struct wlr_session *session, struct wlr_udev *udev);
|
||||||
struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *dev);
|
struct libinput_device *wlr_libinput_get_device_handle(struct wlr_input_device *dev);
|
||||||
|
|
||||||
|
bool wlr_backend_is_libinput(struct wlr_backend *backend);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue