diff --git a/lib/meson.build b/lib/meson.build index 55c6040..56136cb 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -31,6 +31,7 @@ libmks_enums = gnome.mkenums_simple('mks-enums', ) libmks_private_sources = [ + 'mks-paintable-listener.c', 'mks-read-only-list-model.c', gnome.gdbus_codegen('mks-qemu', diff --git a/lib/mks-paintable-listener-private.h b/lib/mks-paintable-listener-private.h new file mode 100644 index 0000000..072f1f6 --- /dev/null +++ b/lib/mks-paintable-listener-private.h @@ -0,0 +1,35 @@ +/* + * mks-paintable-listener-private.h + * + * Copyright 2023 Christian Hergert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include "mks-qemu.h" + +G_BEGIN_DECLS + +#define MKS_TYPE_PAINTABLE_LISTENER (mks_paintable_listener_get_type()) +#define MKS_PAINTABLE_LISTENER_OBJECT_PATH "/org/qemu/Display1/Listener" + +G_DECLARE_FINAL_TYPE (MksPaintableListener, mks_paintable_listener, MKS, PAINTABLE_LISTENER, MksQemuListenerSkeleton) + +MksPaintableListener *mks_paintable_listener_new (void); + +G_END_DECLS diff --git a/lib/mks-paintable-listener.c b/lib/mks-paintable-listener.c new file mode 100644 index 0000000..dc72106 --- /dev/null +++ b/lib/mks-paintable-listener.c @@ -0,0 +1,150 @@ +/* + * mks-paintable-listener.c + * + * Copyright 2023 Christian Hergert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include "config.h" + +#include "mks-paintable-listener-private.h" + +struct _MksPaintableListener +{ + MksQemuListenerSkeleton parent_instance; +}; + +static gboolean +mks_paintable_listener_update_dmabuf (MksQemuListener *listener, + GDBusMethodInvocation *invocation, + int x, + int y, + int width, + int height) +{ + return FALSE; +} + +static gboolean +mks_paintable_listener_scanout_dmabuf (MksQemuListener *listener, + GDBusMethodInvocation *invocation, + GUnixFDList *unix_fd_list, + GVariant *dmabuf, + guint width, + guint height, + guint stride, + guint fourcc, + guint64 modifier, + gboolean y0_top) +{ + return FALSE; +} + +static gboolean +mks_paintable_listener_update (MksQemuListener *listener, + GDBusMethodInvocation *invocation, + int x, + int y, + int width, + int height, + guint stride, + guint pixman_format, + GVariant *bytes) +{ + return TRUE; +} + +static gboolean +mks_paintable_listener_scanout (MksQemuListener *listener, + GDBusMethodInvocation *invocation, + guint width, + guint height, + guint stride, + guint pixman_format, + GVariant *bytes) +{ + return TRUE; +} + +static gboolean +mks_paintable_listener_cursor_define (MksQemuListener *listener, + GDBusMethodInvocation *invocation, + int width, + int height, + int hot_x, + int hot_y, + GVariant *bytes) +{ + return FALSE; +} + +static gboolean +mks_paintable_listener_mouse_set (MksQemuListener *listener, + GDBusMethodInvocation *invocation, + int x, + int y, + int on) +{ + return FALSE; +} + +static gboolean +mks_paintable_listener_disable (MksQemuListener *listener, + GDBusMethodInvocation *invocation) +{ + return TRUE; +} + +static void +listener_iface_init (MksQemuListenerIface *iface) +{ + iface->handle_update = mks_paintable_listener_update; + iface->handle_scanout = mks_paintable_listener_scanout; + iface->handle_update_dmabuf = mks_paintable_listener_update_dmabuf; + iface->handle_scanout_dmabuf = mks_paintable_listener_scanout_dmabuf; + iface->handle_cursor_define = mks_paintable_listener_cursor_define; + iface->handle_mouse_set = mks_paintable_listener_mouse_set; + iface->handle_disable = mks_paintable_listener_disable; +} + +G_DEFINE_FINAL_TYPE_WITH_CODE (MksPaintableListener, mks_paintable_listener, MKS_QEMU_TYPE_LISTENER_SKELETON, + G_IMPLEMENT_INTERFACE (MKS_QEMU_TYPE_LISTENER, listener_iface_init)) + +MksPaintableListener * +mks_paintable_listener_new (void) +{ + return g_object_new (MKS_TYPE_PAINTABLE_LISTENER, NULL); +} + +static void +mks_paintable_listener_finalize (GObject *object) +{ + G_OBJECT_CLASS (mks_paintable_listener_parent_class)->finalize (object); +} + +static void +mks_paintable_listener_class_init (MksPaintableListenerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = mks_paintable_listener_finalize; +} + +static void +mks_paintable_listener_init (MksPaintableListener *self) +{ +}