Add MetaX11Display skeleton

Also reorder meta_display_open () and meta_display_close ()
to sort X11 and non-X11 specific members.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
Armin Krezović
2017-08-26 18:24:46 +02:00
committed by Jonas Ådahl
parent 15fa7816bd
commit 3d2b9a3a69
9 changed files with 242 additions and 48 deletions

View File

@@ -0,0 +1,44 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Mutter X display handler */
/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2002 Red Hat, Inc.
* Copyright (C) 2003 Rob Adams
* Copyright (C) 2004-2006 Elijah Newren
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef META_X11_DISPLAY_PRIVATE_H
#define META_X11_DISPLAY_PRIVATE_H
#include <glib.h>
#include "core/display-private.h"
#include "meta/common.h"
#include "meta/types.h"
#include "meta/meta-x11-display.h"
struct _MetaX11Display
{
GObject parent;
MetaDisplay *display;
};
MetaX11Display *meta_x11_display_new (MetaDisplay *display, GError **error);
#endif /* META_X11_DISPLAY_PRIVATE_H */

View File

@@ -0,0 +1,75 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2001 Havoc Pennington
* Copyright (C) 2002, 2003, 2004 Red Hat, Inc.
* Copyright (C) 2003, 2004 Rob Adams
* Copyright (C) 2004-2006 Elijah Newren
*
* 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, see <http://www.gnu.org/licenses/>.
*/
/**
* SECTION:display
* @title: MetaX11Display
* @short_description: Mutter X display handler
*
* The X11 display is represented as a #MetaX11Display struct.
*/
#include "config.h"
#include "x11/meta-x11-display-private.h"
G_DEFINE_TYPE (MetaX11Display, meta_x11_display, G_TYPE_OBJECT)
static void
meta_x11_display_dispose (GObject *object)
{
G_OBJECT_CLASS (meta_x11_display_parent_class)->dispose (object);
}
static void
meta_x11_display_class_init (MetaX11DisplayClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = meta_x11_display_dispose;
}
static void
meta_x11_display_init (MetaX11Display *x11_display)
{
}
/**
* meta_x11_display_new:
*
* Opens a new X11 display, sets it up, initialises all the X extensions
* we will need.
*
* Returns: #MetaX11Display if the display was opened successfully,
* and %NULL otherwise-- that is, if the display doesn't exist or
* it already has a window manager, and sets the error appropriately.
*/
MetaX11Display *
meta_x11_display_new (MetaDisplay *display, GError **error)
{
MetaX11Display *x11_display;
x11_display = g_object_new (META_TYPE_X11_DISPLAY, NULL);
x11_display->display = display;
return x11_display;
}