diff --git a/src/meson.build b/src/meson.build index 65f768662..26172b34e 100644 --- a/src/meson.build +++ b/src/meson.build @@ -451,6 +451,8 @@ if have_wayland 'wayland/meta-wayland-data-device-private.h', 'wayland/meta-wayland-dma-buf.c', 'wayland/meta-wayland-dma-buf.h', + 'wayland/meta-wayland-dnd-surface.c', + 'wayland/meta-wayland-dnd-surface.h', 'wayland/meta-wayland-gtk-shell.c', 'wayland/meta-wayland-gtk-shell.h', 'wayland/meta-wayland.h', diff --git a/src/meta/meta-backend.h b/src/meta/meta-backend.h index fc3c04db4..d6552c201 100644 --- a/src/meta/meta-backend.h +++ b/src/meta/meta-backend.h @@ -34,8 +34,6 @@ typedef struct _MetaBackend MetaBackend; typedef struct _MetaBackendClass MetaBackendClass; -GType meta_backend_get_type (void); - MetaBackend * meta_get_backend (void); void meta_backend_set_keymap (MetaBackend *backend, diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index f0c70b04a..122604965 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -35,6 +35,7 @@ #include #include "compositor/meta-dnd-actor-private.h" +#include "wayland/meta-wayland-dnd-surface.h" #include "wayland/meta-wayland-pointer.h" #include "wayland/meta-wayland-private.h" #include "wayland/meta-wayland-seat.h" diff --git a/src/wayland/meta-wayland-dnd-surface.c b/src/wayland/meta-wayland-dnd-surface.c new file mode 100644 index 000000000..2aad6dcd5 --- /dev/null +++ b/src/wayland/meta-wayland-dnd-surface.c @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2015-2019 Red Hat, Inc. + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include "config.h" + +#include "wayland/meta-wayland-dnd-surface.h" + +struct _MetaWaylandSurfaceRoleDND +{ + MetaWaylandActorSurface parent; +}; + +G_DEFINE_TYPE (MetaWaylandSurfaceRoleDND, + meta_wayland_surface_role_dnd, + META_TYPE_WAYLAND_ACTOR_SURFACE) + +static void +dnd_surface_assigned (MetaWaylandSurfaceRole *surface_role) +{ + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (surface_role); + + meta_wayland_surface_queue_pending_frame_callbacks (surface); +} + +static void +dnd_surface_commit (MetaWaylandSurfaceRole *surface_role, + MetaWaylandPendingState *pending) +{ + MetaWaylandSurface *surface = + meta_wayland_surface_role_get_surface (surface_role); + + meta_wayland_surface_queue_pending_state_frame_callbacks (surface, pending); +} + +static void +meta_wayland_surface_role_dnd_init (MetaWaylandSurfaceRoleDND *role) +{ +} + +static void +meta_wayland_surface_role_dnd_class_init (MetaWaylandSurfaceRoleDNDClass *klass) +{ + MetaWaylandSurfaceRoleClass *surface_role_class = + META_WAYLAND_SURFACE_ROLE_CLASS (klass); + + surface_role_class->assigned = dnd_surface_assigned; + surface_role_class->commit = dnd_surface_commit; +} diff --git a/src/wayland/meta-wayland-dnd-surface.h b/src/wayland/meta-wayland-dnd-surface.h new file mode 100644 index 000000000..45cf689ee --- /dev/null +++ b/src/wayland/meta-wayland-dnd-surface.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2015-2019 Red Hat, Inc. + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef META_WAYLAND_DND_SURFACE_H +#define META_WAYLAND_DND_SURFACE_H + +#include "wayland/meta-wayland-actor-surface.h" + +#define META_TYPE_WAYLAND_SURFACE_ROLE_DND (meta_wayland_surface_role_dnd_get_type ()) +G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleDND, + meta_wayland_surface_role_dnd, + META, WAYLAND_SURFACE_ROLE_DND, + MetaWaylandActorSurface) + +#endif /* META_WAYLAND_DND_SURFACE_H */ diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 834d7c8a8..f75fefd87 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -86,20 +86,6 @@ G_DEFINE_TYPE (MetaWaylandPendingState, meta_wayland_pending_state, G_TYPE_OBJECT); -struct _MetaWaylandSurfaceRoleDND -{ - MetaWaylandSurfaceRole parent; -}; - -G_DECLARE_FINAL_TYPE (MetaWaylandSurfaceRoleDND, - meta_wayland_surface_role_dnd, - META, WAYLAND_SURFACE_ROLE_DND, - MetaWaylandActorSurface); - -G_DEFINE_TYPE (MetaWaylandSurfaceRoleDND, - meta_wayland_surface_role_dnd, - META_TYPE_WAYLAND_ACTOR_SURFACE); - enum { SURFACE_DESTROY, SURFACE_UNMAPPED, @@ -360,16 +346,6 @@ meta_wayland_surface_queue_pending_state_frame_callbacks (MetaWaylandSurface wl_list_init (&pending->frame_callback_list); } -static void -dnd_surface_commit (MetaWaylandSurfaceRole *surface_role, - MetaWaylandPendingState *pending) -{ - MetaWaylandSurface *surface = - meta_wayland_surface_role_get_surface (surface_role); - - meta_wayland_surface_queue_pending_state_frame_callbacks (surface, pending); -} - void meta_wayland_surface_destroy_window (MetaWaylandSurface *surface) { @@ -1763,30 +1739,6 @@ meta_wayland_surface_queue_pending_frame_callbacks (MetaWaylandSurface *surface) wl_list_init (&surface->pending_frame_callback_list); } -static void -default_role_assigned (MetaWaylandSurfaceRole *surface_role) -{ - MetaWaylandSurface *surface = - meta_wayland_surface_role_get_surface (surface_role); - - meta_wayland_surface_queue_pending_frame_callbacks (surface); -} - -static void -meta_wayland_surface_role_dnd_init (MetaWaylandSurfaceRoleDND *role) -{ -} - -static void -meta_wayland_surface_role_dnd_class_init (MetaWaylandSurfaceRoleDNDClass *klass) -{ - MetaWaylandSurfaceRoleClass *surface_role_class = - META_WAYLAND_SURFACE_ROLE_CLASS (klass); - - surface_role_class->assigned = default_role_assigned; - surface_role_class->commit = dnd_surface_commit; -} - cairo_region_t * meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface) { diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h index abba1c765..62496cfb7 100644 --- a/src/wayland/meta-wayland-surface.h +++ b/src/wayland/meta-wayland-surface.h @@ -70,10 +70,6 @@ struct _MetaWaylandSerial { uint32_t value; }; -#define META_TYPE_WAYLAND_SURFACE_ROLE_DND (meta_wayland_surface_role_dnd_get_type ()) - -GType meta_wayland_surface_role_dnd_get_type (void); - struct _MetaWaylandPendingState { GObject parent;