mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
crtc: Move out MetaCrtcMode into its own file
It's somewhat annoying to have two very closely named types in the same file. It's also about to grow some, so better move it to its own file. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1287
This commit is contained in:
parent
1ce9e379d9
commit
980ece9a4b
50
src/backends/meta-crtc-mode.c
Normal file
50
src/backends/meta-crtc-mode.c
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Red Hat
|
||||
*
|
||||
* 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 "backends/meta-crtc-mode.h"
|
||||
|
||||
G_DEFINE_TYPE (MetaCrtcMode, meta_crtc_mode, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
meta_crtc_mode_finalize (GObject *object)
|
||||
{
|
||||
MetaCrtcMode *crtc_mode = META_CRTC_MODE (object);
|
||||
|
||||
if (crtc_mode->driver_notify)
|
||||
crtc_mode->driver_notify (crtc_mode);
|
||||
|
||||
g_clear_pointer (&crtc_mode->name, g_free);
|
||||
|
||||
G_OBJECT_CLASS (meta_crtc_mode_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_crtc_mode_init (MetaCrtcMode *crtc_mode)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_crtc_mode_class_init (MetaCrtcModeClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_crtc_mode_finalize;
|
||||
}
|
72
src/backends/meta-crtc-mode.h
Normal file
72
src/backends/meta-crtc-mode.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Red Hat
|
||||
*
|
||||
* 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_CRTC_MODE_H
|
||||
#define META_CRTC_MODE_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "core/util-private.h"
|
||||
|
||||
/* Same as KMS mode flags and X11 randr flags */
|
||||
typedef enum _MetaCrtcModeFlag
|
||||
{
|
||||
META_CRTC_MODE_FLAG_NONE = 0,
|
||||
META_CRTC_MODE_FLAG_PHSYNC = (1 << 0),
|
||||
META_CRTC_MODE_FLAG_NHSYNC = (1 << 1),
|
||||
META_CRTC_MODE_FLAG_PVSYNC = (1 << 2),
|
||||
META_CRTC_MODE_FLAG_NVSYNC = (1 << 3),
|
||||
META_CRTC_MODE_FLAG_INTERLACE = (1 << 4),
|
||||
META_CRTC_MODE_FLAG_DBLSCAN = (1 << 5),
|
||||
META_CRTC_MODE_FLAG_CSYNC = (1 << 6),
|
||||
META_CRTC_MODE_FLAG_PCSYNC = (1 << 7),
|
||||
META_CRTC_MODE_FLAG_NCSYNC = (1 << 8),
|
||||
META_CRTC_MODE_FLAG_HSKEW = (1 << 9),
|
||||
META_CRTC_MODE_FLAG_BCAST = (1 << 10),
|
||||
META_CRTC_MODE_FLAG_PIXMUX = (1 << 11),
|
||||
META_CRTC_MODE_FLAG_DBLCLK = (1 << 12),
|
||||
META_CRTC_MODE_FLAG_CLKDIV2 = (1 << 13),
|
||||
|
||||
META_CRTC_MODE_FLAG_MASK = 0x3fff
|
||||
} MetaCrtcModeFlag;
|
||||
|
||||
struct _MetaCrtcMode
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
uint64_t mode_id;
|
||||
char *name;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
float refresh_rate;
|
||||
MetaCrtcModeFlag flags;
|
||||
|
||||
gpointer driver_private;
|
||||
GDestroyNotify driver_notify;
|
||||
};
|
||||
|
||||
#define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ())
|
||||
META_EXPORT_TEST
|
||||
G_DECLARE_FINAL_TYPE (MetaCrtcMode, meta_crtc_mode,
|
||||
META, CRTC_MODE,
|
||||
GObject)
|
||||
|
||||
#endif /* META_CRTC_MODE_H */
|
@ -49,8 +49,6 @@ typedef struct _MetaCrtcPrivate
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaCrtc, meta_crtc, G_TYPE_OBJECT)
|
||||
|
||||
G_DEFINE_TYPE (MetaCrtcMode, meta_crtc_mode, G_TYPE_OBJECT)
|
||||
|
||||
uint64_t
|
||||
meta_crtc_get_id (MetaCrtc *crtc)
|
||||
{
|
||||
@ -216,29 +214,3 @@ meta_crtc_class_init (MetaCrtcClass *klass)
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_crtc_mode_finalize (GObject *object)
|
||||
{
|
||||
MetaCrtcMode *crtc_mode = META_CRTC_MODE (object);
|
||||
|
||||
if (crtc_mode->driver_notify)
|
||||
crtc_mode->driver_notify (crtc_mode);
|
||||
|
||||
g_clear_pointer (&crtc_mode->name, g_free);
|
||||
|
||||
G_OBJECT_CLASS (meta_crtc_mode_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_crtc_mode_init (MetaCrtcMode *crtc_mode)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_crtc_mode_class_init (MetaCrtcModeClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = meta_crtc_mode_finalize;
|
||||
}
|
||||
|
@ -23,32 +23,11 @@
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "backends/meta-backend-types.h"
|
||||
#include "backends/meta-crtc-mode.h"
|
||||
#include "backends/meta-monitor-transform.h"
|
||||
#include "core/util-private.h"
|
||||
#include "meta/boxes.h"
|
||||
|
||||
/* Same as KMS mode flags and X11 randr flags */
|
||||
typedef enum _MetaCrtcModeFlag
|
||||
{
|
||||
META_CRTC_MODE_FLAG_NONE = 0,
|
||||
META_CRTC_MODE_FLAG_PHSYNC = (1 << 0),
|
||||
META_CRTC_MODE_FLAG_NHSYNC = (1 << 1),
|
||||
META_CRTC_MODE_FLAG_PVSYNC = (1 << 2),
|
||||
META_CRTC_MODE_FLAG_NVSYNC = (1 << 3),
|
||||
META_CRTC_MODE_FLAG_INTERLACE = (1 << 4),
|
||||
META_CRTC_MODE_FLAG_DBLSCAN = (1 << 5),
|
||||
META_CRTC_MODE_FLAG_CSYNC = (1 << 6),
|
||||
META_CRTC_MODE_FLAG_PCSYNC = (1 << 7),
|
||||
META_CRTC_MODE_FLAG_NCSYNC = (1 << 8),
|
||||
META_CRTC_MODE_FLAG_HSKEW = (1 << 9),
|
||||
META_CRTC_MODE_FLAG_BCAST = (1 << 10),
|
||||
META_CRTC_MODE_FLAG_PIXMUX = (1 << 11),
|
||||
META_CRTC_MODE_FLAG_DBLCLK = (1 << 12),
|
||||
META_CRTC_MODE_FLAG_CLKDIV2 = (1 << 13),
|
||||
|
||||
META_CRTC_MODE_FLAG_MASK = 0x3fff
|
||||
} MetaCrtcModeFlag;
|
||||
|
||||
typedef struct _MetaCrtcConfig
|
||||
{
|
||||
graphene_rect_t layout;
|
||||
@ -56,23 +35,6 @@ typedef struct _MetaCrtcConfig
|
||||
MetaCrtcMode *mode;
|
||||
} MetaCrtcConfig;
|
||||
|
||||
struct _MetaCrtcMode
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
/* The low-level ID of this mode, used to apply back configuration */
|
||||
glong mode_id;
|
||||
char *name;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
float refresh_rate;
|
||||
MetaCrtcModeFlag flags;
|
||||
|
||||
gpointer driver_private;
|
||||
GDestroyNotify driver_notify;
|
||||
};
|
||||
|
||||
#define META_TYPE_CRTC (meta_crtc_get_type ())
|
||||
META_EXPORT_TEST
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaCrtc, meta_crtc, META, CRTC, GObject)
|
||||
@ -82,9 +44,6 @@ struct _MetaCrtcClass
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
#define META_TYPE_CRTC_MODE (meta_crtc_mode_get_type ())
|
||||
META_EXPORT_TEST G_DECLARE_FINAL_TYPE (MetaCrtcMode, meta_crtc_mode, META, CRTC_MODE, GObject)
|
||||
|
||||
META_EXPORT_TEST
|
||||
uint64_t meta_crtc_get_id (MetaCrtc *crtc);
|
||||
|
||||
|
@ -172,6 +172,8 @@ mutter_sources = [
|
||||
'backends/meta-backend-private.h',
|
||||
'backends/meta-barrier.c',
|
||||
'backends/meta-barrier-private.h',
|
||||
'backends/meta-crtc-mode.c',
|
||||
'backends/meta-crtc-mode.h',
|
||||
'backends/meta-crtc.c',
|
||||
'backends/meta-crtc.h',
|
||||
'backends/meta-cursor.c',
|
||||
|
Loading…
Reference in New Issue
Block a user