1
0
Fork 0

wayland: Move DND surface role into its own file

This avoids a -Wredundand-decls warning about the get_type() function.
This commit is contained in:
Jonas Ådahl 2019-01-20 17:34:50 +01:00
parent 01cea0d9ef
commit 12a42a9295
7 changed files with 99 additions and 54 deletions

View file

@ -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',

View file

@ -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,

View file

@ -35,6 +35,7 @@
#include <unistd.h>
#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"

View file

@ -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;
}

View file

@ -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 */

View file

@ -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)
{

View file

@ -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;