summaryrefslogtreecommitdiff
path: root/src/backends/x11/nested
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends/x11/nested')
-rw-r--r--src/backends/x11/nested/meta-backend-x11-nested.c320
-rw-r--r--src/backends/x11/nested/meta-backend-x11-nested.h40
-rw-r--r--src/backends/x11/nested/meta-cursor-renderer-x11-nested.c91
-rw-r--r--src/backends/x11/nested/meta-cursor-renderer-x11-nested.h38
-rw-r--r--src/backends/x11/nested/meta-renderer-x11-nested.c248
-rw-r--r--src/backends/x11/nested/meta-renderer-x11-nested.h37
-rw-r--r--src/backends/x11/nested/meta-stage-x11-nested.c236
-rw-r--r--src/backends/x11/nested/meta-stage-x11-nested.h35
8 files changed, 0 insertions, 1045 deletions
diff --git a/src/backends/x11/nested/meta-backend-x11-nested.c b/src/backends/x11/nested/meta-backend-x11-nested.c
deleted file mode 100644
index 041b42860..000000000
--- a/src/backends/x11/nested/meta-backend-x11-nested.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (C) 2017 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/x11/nested/meta-backend-x11-nested.h"
-
-#include "backends/meta-input-settings-dummy.h"
-#include "backends/meta-monitor-manager-dummy.h"
-#include "backends/x11/nested/meta-backend-x11-nested.h"
-#include "backends/x11/nested/meta-cursor-renderer-x11-nested.h"
-#include "backends/x11/nested/meta-renderer-x11-nested.h"
-
-#include "wayland/meta-wayland.h"
-
-typedef struct _MetaBackendX11NestedPrivate
-{
- MetaGpu *gpu;
- MetaCursorRenderer *cursor_renderer;
- MetaInputSettings *input_settings;
-} MetaBackendX11NestedPrivate;
-
-static GInitableIface *initable_parent_iface;
-
-static void
-initable_iface_init (GInitableIface *initable_iface);
-
-G_DEFINE_TYPE_WITH_CODE (MetaBackendX11Nested, meta_backend_x11_nested,
- META_TYPE_BACKEND_X11,
- G_ADD_PRIVATE (MetaBackendX11Nested)
- G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
- initable_iface_init));
-
-static MetaRenderer *
-meta_backend_x11_nested_create_renderer (MetaBackend *backend,
- GError **error)
-{
- return g_object_new (META_TYPE_RENDERER_X11_NESTED,
- "backend", backend,
- NULL);
-}
-
-static MetaMonitorManager *
-meta_backend_x11_nested_create_monitor_manager (MetaBackend *backend,
- GError **error)
-{
- return g_object_new (META_TYPE_MONITOR_MANAGER_DUMMY,
- "backend", backend,
- NULL);
-}
-
-static MetaCursorRenderer *
-meta_backend_x11_nested_get_cursor_renderer (MetaBackend *backend,
- ClutterInputDevice *device)
-{
- MetaBackendX11Nested *backend_x11_nested = META_BACKEND_X11_NESTED (backend);
- MetaBackendX11NestedPrivate *priv =
- meta_backend_x11_nested_get_instance_private (backend_x11_nested);
-
- if (!priv->cursor_renderer)
- {
- priv->cursor_renderer =
- g_object_new (META_TYPE_CURSOR_RENDERER_X11_NESTED,
- "backend", backend,
- "device", device,
- NULL);
- }
-
- return priv->cursor_renderer;
-}
-
-static MetaInputSettings *
-meta_backend_x11_nested_get_input_settings (MetaBackend *backend)
-{
- MetaBackendX11Nested *backend_x11_nested = META_BACKEND_X11_NESTED (backend);
- MetaBackendX11NestedPrivate *priv =
- meta_backend_x11_nested_get_instance_private (backend_x11_nested);
-
- if (!priv->input_settings)
- {
- priv->input_settings =
- g_object_new (META_TYPE_INPUT_SETTINGS_DUMMY, NULL);
- }
-
- return priv->input_settings;
-}
-
-static void
-meta_backend_x11_nested_update_screen_size (MetaBackend *backend,
- int width,
- int height)
-{
- ClutterActor *stage = meta_backend_get_stage (backend);
- MetaRenderer *renderer = meta_backend_get_renderer (backend);
-
- if (meta_is_stage_views_enabled ())
- {
- meta_renderer_rebuild_views (renderer);
- clutter_stage_clear_stage_views (CLUTTER_STAGE (stage));
- }
- clutter_actor_set_size (stage, width, height);
-}
-
-static void
-meta_backend_x11_nested_select_stage_events (MetaBackend *backend)
-{
- MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
- Display *xdisplay = meta_backend_x11_get_xdisplay (x11);
- Window xwin = meta_backend_x11_get_xwindow (x11);
- unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
- XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
-
- XISetMask (mask.mask, XI_KeyPress);
- XISetMask (mask.mask, XI_KeyRelease);
- XISetMask (mask.mask, XI_ButtonPress);
- XISetMask (mask.mask, XI_ButtonRelease);
- XISetMask (mask.mask, XI_Enter);
- XISetMask (mask.mask, XI_Leave);
- XISetMask (mask.mask, XI_FocusIn);
- XISetMask (mask.mask, XI_FocusOut);
- XISetMask (mask.mask, XI_Motion);
-
- /*
- * When we're an X11 compositor, we can't take these events or else replaying
- * events from our passive root window grab will cause them to come back to
- * us.
- *
- * When we're a nested application, we want to behave like any other
- * application, so select these events like normal apps do.
- */
- XISetMask (mask.mask, XI_TouchBegin); XISetMask (mask.mask, XI_TouchEnd);
- XISetMask (mask.mask, XI_TouchUpdate);
-
- XISelectEvents (xdisplay, xwin, &mask, 1);
-
- /*
- * We have no way of tracking key changes when the stage doesn't have focus,
- * so we select for KeymapStateMask so that we get a complete dump of the
- * keyboard state in a KeymapNotify event that immediately follows each
- * FocusIn (and EnterNotify, but we ignore that.)
- */
- XWindowAttributes xwa;
-
- XGetWindowAttributes(xdisplay, xwin, &xwa);
- XSelectInput(xdisplay, xwin,
- xwa.your_event_mask | FocusChangeMask | KeymapStateMask);
-}
-
-static void
-meta_backend_x11_nested_lock_layout_group (MetaBackend *backend,
- guint idx)
-{
-}
-
-static void
-meta_backend_x11_nested_set_keymap (MetaBackend *backend,
- const char *layouts,
- const char *variants,
- const char *options)
-{
-}
-
-static gboolean
-meta_backend_x11_nested_is_lid_closed (MetaBackend *backend)
-{
- return FALSE;
-}
-
-static gboolean
-meta_backend_x11_nested_handle_host_xevent (MetaBackendX11 *x11,
- XEvent *event)
-{
-#ifdef HAVE_WAYLAND
- if (event->type == FocusIn)
- {
- Window xwin = meta_backend_x11_get_xwindow (x11);
- XEvent xev;
-
- if (event->xfocus.window == xwin)
- {
- MetaWaylandCompositor *compositor =
- meta_wayland_compositor_get_default ();
- Display *xdisplay = meta_backend_x11_get_xdisplay (x11);
-
- /*
- * Since we've selected for KeymapStateMask, every FocusIn is
- * followed immediately by a KeymapNotify event.
- */
- XMaskEvent (xdisplay, KeymapStateMask, &xev);
- meta_wayland_compositor_update_key_state (compositor,
- xev.xkeymap.key_vector,
- 32, 8);
- }
- }
-#endif
-
- return FALSE;
-}
-
-static void
-meta_backend_x11_nested_translate_device_event (MetaBackendX11 *x11,
- XIDeviceEvent *device_event)
-{
- /* This codepath should only ever trigger as an X11 compositor,
- * and never under nested, as under nested all backend events
- * should be reported with respect to the stage window.
- */
- g_assert (device_event->event == meta_backend_x11_get_xwindow (x11));
-}
-
-static void
-meta_backend_x11_nested_real_init_gpus (MetaBackendX11Nested *backend_x11_nested)
-{
- MetaBackendX11NestedPrivate *priv =
- meta_backend_x11_nested_get_instance_private (backend_x11_nested);
-
- priv->gpu = g_object_new (META_TYPE_GPU_DUMMY,
- "backend", backend_x11_nested,
- NULL);
- meta_backend_add_gpu (META_BACKEND (backend_x11_nested), priv->gpu);
-}
-
-static void
-meta_backend_x11_nested_post_init (MetaBackend *backend)
-{
- MetaBackendClass *backend_class =
- META_BACKEND_CLASS (meta_backend_x11_nested_parent_class);
-
- backend_class->post_init (backend);
-}
-
-static gboolean
-meta_backend_x11_nested_initable_init (GInitable *initable,
- GCancellable *cancellable,
- GError **error)
-{
- return initable_parent_iface->init (initable, cancellable, error);
-}
-
-static void
-initable_iface_init (GInitableIface *initable_iface)
-{
- initable_parent_iface = g_type_interface_peek_parent (initable_iface);
-
- initable_iface->init = meta_backend_x11_nested_initable_init;
-}
-
-static void
-meta_backend_x11_nested_constructed (GObject *object)
-{
- MetaBackendX11Nested *backend_x11_nested = META_BACKEND_X11_NESTED (object);
- MetaBackendX11NestedClass *backend_x11_nested_class =
- META_BACKEND_X11_NESTED_GET_CLASS (backend_x11_nested);
- GObjectClass *parent_class =
- G_OBJECT_CLASS (meta_backend_x11_nested_parent_class);
-
- parent_class->constructed (object);
-
- backend_x11_nested_class->init_gpus (backend_x11_nested);
-}
-
-static void
-meta_backend_x11_nested_dispose (GObject *object)
-{
- MetaBackendX11Nested *backend_x11_nested = META_BACKEND_X11_NESTED (object);
- MetaBackendX11NestedPrivate *priv =
- meta_backend_x11_nested_get_instance_private (backend_x11_nested);
-
- g_clear_object (&priv->input_settings);
-
- G_OBJECT_CLASS (meta_backend_x11_nested_parent_class)->dispose (object);
-}
-
-static void
-meta_backend_x11_nested_init (MetaBackendX11Nested *backend_x11_nested)
-{
-}
-
-static void
-meta_backend_x11_nested_class_init (MetaBackendX11NestedClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- MetaBackendClass *backend_class = META_BACKEND_CLASS (klass);
- MetaBackendX11Class *backend_x11_class = META_BACKEND_X11_CLASS (klass);
-
- object_class->constructed = meta_backend_x11_nested_constructed;
- object_class->dispose = meta_backend_x11_nested_dispose;
-
- backend_class->post_init = meta_backend_x11_nested_post_init;
- backend_class->create_renderer = meta_backend_x11_nested_create_renderer;
- backend_class->create_monitor_manager = meta_backend_x11_nested_create_monitor_manager;
- backend_class->get_cursor_renderer = meta_backend_x11_nested_get_cursor_renderer;
- backend_class->get_input_settings = meta_backend_x11_nested_get_input_settings;
- backend_class->update_screen_size = meta_backend_x11_nested_update_screen_size;
- backend_class->select_stage_events = meta_backend_x11_nested_select_stage_events;
- backend_class->lock_layout_group = meta_backend_x11_nested_lock_layout_group;
- backend_class->set_keymap = meta_backend_x11_nested_set_keymap;
- backend_class->is_lid_closed = meta_backend_x11_nested_is_lid_closed;
-
- backend_x11_class->handle_host_xevent = meta_backend_x11_nested_handle_host_xevent;
- backend_x11_class->translate_device_event = meta_backend_x11_nested_translate_device_event;
-
- klass->init_gpus = meta_backend_x11_nested_real_init_gpus;
-}
diff --git a/src/backends/x11/nested/meta-backend-x11-nested.h b/src/backends/x11/nested/meta-backend-x11-nested.h
deleted file mode 100644
index 4f19ff54a..000000000
--- a/src/backends/x11/nested/meta-backend-x11-nested.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2017 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_BACKEND_X11_NESTED_H
-#define META_BACKEND_X11_NESTED_H
-
-#include <glib-object.h>
-
-#include "backends/x11/meta-backend-x11.h"
-#include "core/util-private.h"
-
-#define META_TYPE_BACKEND_X11_NESTED (meta_backend_x11_nested_get_type ())
-META_EXPORT_TEST
-G_DECLARE_DERIVABLE_TYPE (MetaBackendX11Nested, meta_backend_x11_nested,
- META, BACKEND_X11_NESTED, MetaBackendX11)
-
-struct _MetaBackendX11NestedClass
-{
- MetaBackendX11Class parent_class;
-
- void (* init_gpus) (MetaBackendX11Nested *backend_x11_nested);
-};
-
-#endif /* META_BACKEND_X11_NESTED_H */
diff --git a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c b/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c
deleted file mode 100644
index 0daae683c..000000000
--- a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/*
- * Copyright (C) 2015 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.
- *
- * Written by:
- * Jonas Ådahl <jadahl@gmail.com>
- */
-
-#include "config.h"
-
-#include "backends/x11/nested/meta-cursor-renderer-x11-nested.h"
-
-#include <X11/Xcursor/Xcursor.h>
-
-#include "backends/x11/meta-backend-x11.h"
-
-struct _MetaCursorRendererX11Nested
-{
- MetaCursorRenderer parent;
-};
-
-G_DEFINE_TYPE (MetaCursorRendererX11Nested, meta_cursor_renderer_x11_nested,
- META_TYPE_CURSOR_RENDERER);
-
-static gboolean
-meta_cursor_renderer_x11_nested_update_cursor (MetaCursorRenderer *renderer,
- MetaCursorSprite *cursor_sprite)
-{
- if (cursor_sprite)
- meta_cursor_sprite_realize_texture (cursor_sprite);
- return FALSE;
-}
-
-static Cursor
-create_empty_cursor (Display *xdisplay)
-{
- XcursorImage *image;
- XcursorPixel *pixels;
- Cursor xcursor;
-
- image = XcursorImageCreate (1, 1);
- if (image == NULL)
- return None;
-
- image->xhot = 0;
- image->yhot = 0;
-
- pixels = image->pixels;
- pixels[0] = 0;
-
- xcursor = XcursorImageLoadCursor (xdisplay, image);
- XcursorImageDestroy (image);
-
- return xcursor;
-}
-
-static void
-meta_cursor_renderer_x11_nested_init (MetaCursorRendererX11Nested *x11_nested)
-{
- MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
- Window xwindow = meta_backend_x11_get_xwindow (backend);
- Display *xdisplay = meta_backend_x11_get_xdisplay (backend);
-
- Cursor empty_xcursor = create_empty_cursor (xdisplay);
- XDefineCursor (xdisplay, xwindow, empty_xcursor);
- XFreeCursor (xdisplay, empty_xcursor);
-}
-
-static void
-meta_cursor_renderer_x11_nested_class_init (MetaCursorRendererX11NestedClass *klass)
-{
- MetaCursorRendererClass *renderer_class = META_CURSOR_RENDERER_CLASS (klass);
-
- renderer_class->update_cursor = meta_cursor_renderer_x11_nested_update_cursor;
-}
diff --git a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.h b/src/backends/x11/nested/meta-cursor-renderer-x11-nested.h
deleted file mode 100644
index 32f816629..000000000
--- a/src/backends/x11/nested/meta-cursor-renderer-x11-nested.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/*
- * Copyright (C) 2015 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.
- *
- * Written by:
- * Jonas Ådahl <jadahl@gmail.com>
- */
-
-#ifndef META_CURSOR_RENDERER_X11_NESTED_NESTED_H
-#define META_CURSOR_RENDERER_X11_NESTED_NESTED_H
-
-#include <glib-object.h>
-
-#include "backends/meta-cursor-renderer.h"
-
-#define META_TYPE_CURSOR_RENDERER_X11_NESTED (meta_cursor_renderer_x11_nested_get_type ())
-G_DECLARE_FINAL_TYPE (MetaCursorRendererX11Nested,
- meta_cursor_renderer_x11_nested,
- META, CURSOR_RENDERER_X11_NESTED,
- MetaCursorRenderer);
-
-#endif /* META_CURSOR_RENDERER_X11_NESTED_NESTED_H */
diff --git a/src/backends/x11/nested/meta-renderer-x11-nested.c b/src/backends/x11/nested/meta-renderer-x11-nested.c
deleted file mode 100644
index 7c1a4facf..000000000
--- a/src/backends/x11/nested/meta-renderer-x11-nested.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/*
- * Copyright (C) 2016 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/x11/nested/meta-renderer-x11-nested.h"
-
-#include <glib-object.h>
-
-#include "backends/meta-backend-private.h"
-#include "backends/meta-logical-monitor.h"
-#include "backends/meta-output.h"
-#include "backends/meta-renderer.h"
-#include "backends/meta-renderer-view.h"
-#include "backends/x11/meta-clutter-backend-x11.h"
-#include "core/boxes-private.h"
-#include "meta/meta-backend.h"
-#include "meta/util.h"
-
-struct _MetaRendererX11Nested
-{
- MetaRendererX11 parent;
-};
-
-G_DEFINE_TYPE (MetaRendererX11Nested, meta_renderer_x11_nested,
- META_TYPE_RENDERER_X11)
-
-static MetaMonitorTransform
-calculate_view_transform (MetaMonitorManager *monitor_manager,
- MetaLogicalMonitor *logical_monitor)
-{
- MetaMonitor *main_monitor;
- MetaOutput *main_output;
- MetaCrtc *crtc;
- MetaMonitorTransform crtc_transform;
-
- main_monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
- main_output = meta_monitor_get_main_output (main_monitor);
- crtc = meta_output_get_assigned_crtc (main_output);
- crtc_transform =
- meta_monitor_logical_to_crtc_transform (main_monitor,
- logical_monitor->transform);
- /*
- * Pick any monitor and output and check; all CRTCs of a logical monitor will
- * always have the same transform assigned to them.
- */
-
- if (meta_monitor_manager_is_transform_handled (monitor_manager,
- crtc,
- crtc_transform))
- return META_MONITOR_TRANSFORM_NORMAL;
- else
- return crtc_transform;
-}
-
-static MetaRendererView *
-get_legacy_view (MetaRenderer *renderer)
-{
- GList *views;
-
- views = meta_renderer_get_views (renderer);
- if (views)
- return META_RENDERER_VIEW (views->data);
- else
- return NULL;
-}
-
-static CoglOffscreen *
-create_offscreen (CoglContext *cogl_context,
- int width,
- int height)
-{
- CoglTexture2D *texture_2d;
- CoglOffscreen *offscreen;
- GError *error = NULL;
-
- texture_2d = cogl_texture_2d_new_with_size (cogl_context, width, height);
- offscreen = cogl_offscreen_new_with_texture (COGL_TEXTURE (texture_2d));
-
- if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (offscreen), &error))
- meta_fatal ("Couldn't allocate framebuffer: %s", error->message);
-
- return offscreen;
-}
-
-static void
-meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11_nested,
- int width,
- int height)
-{
- MetaRenderer *renderer = META_RENDERER (renderer_x11_nested);
- MetaBackend *backend = meta_get_backend ();
- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
- CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
- MetaRendererView *legacy_view;
- cairo_rectangle_int_t view_layout;
- CoglOffscreen *fake_onscreen;
-
- legacy_view = get_legacy_view (renderer);
-
- clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (legacy_view),
- &view_layout);
- if (view_layout.width == width &&
- view_layout.height == height)
- return;
-
- view_layout = (cairo_rectangle_int_t) {
- .width = width,
- .height = height
- };
-
- fake_onscreen = create_offscreen (cogl_context, width, height);
-
- g_object_set (G_OBJECT (legacy_view),
- "layout", &view_layout,
- "framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
- NULL);
-}
-
-void
-meta_renderer_x11_nested_ensure_legacy_view (MetaRendererX11Nested *renderer_x11_nested,
- int width,
- int height)
-{
- MetaRenderer *renderer = META_RENDERER (renderer_x11_nested);
- MetaBackend *backend = meta_get_backend ();
- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
- CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
- cairo_rectangle_int_t view_layout;
- CoglOffscreen *fake_onscreen;
- MetaRendererView *legacy_view;
-
- if (get_legacy_view (renderer))
- {
- meta_renderer_x11_nested_resize_legacy_view (renderer_x11_nested,
- width, height);
- return;
- }
-
- fake_onscreen = create_offscreen (cogl_context, width, height);
-
- view_layout = (cairo_rectangle_int_t) {
- .width = width,
- .height = height
- };
- legacy_view = g_object_new (META_TYPE_RENDERER_VIEW,
- "name", "legacy nested",
- "stage", meta_backend_get_stage (backend),
- "layout", &view_layout,
- "framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
- NULL);
-
- g_assert (!meta_renderer_get_views (renderer));
- meta_renderer_add_view (renderer, legacy_view);
-}
-
-static MetaRendererView *
-meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
- MetaLogicalMonitor *logical_monitor,
- MetaOutput *output,
- MetaCrtc *crtc)
-{
- MetaBackend *backend = meta_get_backend ();
- MetaMonitorManager *monitor_manager =
- meta_backend_get_monitor_manager (backend);
- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
- CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
- MetaMonitorTransform view_transform;
- float view_scale;
- const MetaCrtcConfig *crtc_config;
- int width, height;
- CoglOffscreen *fake_onscreen;
- CoglOffscreen *offscreen;
- MetaRectangle view_layout;
- const MetaCrtcModeInfo *mode_info;
- MetaRendererView *view;
-
- view_transform = calculate_view_transform (monitor_manager, logical_monitor);
-
- if (meta_is_stage_views_scaled ())
- view_scale = logical_monitor->scale;
- else
- view_scale = 1.0;
-
- crtc_config = meta_crtc_get_config (crtc);
- width = roundf (crtc_config->layout.size.width * view_scale);
- height = roundf (crtc_config->layout.size.height * view_scale);
-
- fake_onscreen = create_offscreen (cogl_context, width, height);
-
- if (view_transform != META_MONITOR_TRANSFORM_NORMAL)
- offscreen = create_offscreen (cogl_context, width, height);
- else
- offscreen = NULL;
-
- meta_rectangle_from_graphene_rect (&crtc_config->layout,
- META_ROUNDING_STRATEGY_ROUND,
- &view_layout);
-
- mode_info = meta_crtc_mode_get_info (crtc_config->mode);
-
- view = g_object_new (META_TYPE_RENDERER_VIEW,
- "name", meta_output_get_name (output),
- "stage", meta_backend_get_stage (backend),
- "layout", &view_layout,
- "crtc", crtc,
- "refresh-rate", mode_info->refresh_rate,
- "framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
- "offscreen", COGL_FRAMEBUFFER (offscreen),
- "transform", view_transform,
- "scale", view_scale,
- NULL);
- g_object_set_data (G_OBJECT (view), "crtc", crtc);
-
- return view;
-}
-
-static void
-meta_renderer_x11_nested_init (MetaRendererX11Nested *renderer_x11_nested)
-{
-}
-
-static void
-meta_renderer_x11_nested_class_init (MetaRendererX11NestedClass *klass)
-{
- MetaRendererClass *renderer_class = META_RENDERER_CLASS (klass);
-
- renderer_class->create_view = meta_renderer_x11_nested_create_view;
-}
diff --git a/src/backends/x11/nested/meta-renderer-x11-nested.h b/src/backends/x11/nested/meta-renderer-x11-nested.h
deleted file mode 100644
index 9fc88e85b..000000000
--- a/src/backends/x11/nested/meta-renderer-x11-nested.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/*
- * Copyright (C) 2016 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_RENDERER_X11_NESTED_H
-#define META_RENDERER_X11_NESTED_H
-
-#include "backends/x11/meta-renderer-x11.h"
-
-#define META_TYPE_RENDERER_X11_NESTED (meta_renderer_x11_nested_get_type ())
-G_DECLARE_FINAL_TYPE (MetaRendererX11Nested, meta_renderer_x11_nested,
- META, RENDERER_X11_NESTED,
- MetaRendererX11)
-
-void meta_renderer_x11_nested_ensure_legacy_view (MetaRendererX11Nested *renderer_x11_nested,
- int width,
- int height);
-
-#endif /* META_RENDERER_X11_NESTED_H */
diff --git a/src/backends/x11/nested/meta-stage-x11-nested.c b/src/backends/x11/nested/meta-stage-x11-nested.c
deleted file mode 100644
index dbf3b7bbf..000000000
--- a/src/backends/x11/nested/meta-stage-x11-nested.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/*
- * Copyright (C) 2016 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.
- *
- * Written by:
- * Jonas Ådahl <jadahl@gmail.com>
- */
-
-#include "config.h"
-
-#include "backends/x11/nested/meta-stage-x11-nested.h"
-
-#include "backends/meta-backend-private.h"
-#include "backends/meta-crtc.h"
-#include "backends/meta-logical-monitor.h"
-#include "backends/meta-monitor.h"
-#include "backends/meta-output.h"
-#include "backends/meta-renderer.h"
-#include "backends/x11/nested/meta-renderer-x11-nested.h"
-#include "clutter/clutter-mutter.h"
-
-static ClutterStageWindowInterface *clutter_stage_window_parent_iface = NULL;
-
-struct _MetaStageX11Nested
-{
- MetaStageX11 parent;
-
- CoglPipeline *pipeline;
-};
-
-static void
-clutter_stage_window_iface_init (ClutterStageWindowInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (MetaStageX11Nested, meta_stage_x11_nested,
- META_TYPE_STAGE_X11,
- G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_STAGE_WINDOW,
- clutter_stage_window_iface_init))
-
-typedef struct _MetaStageX11View
-{
- CoglTexture *texture;
- MetaStageView *view;
-} MetaStageX11NestedView;
-
-static void
-meta_stage_x11_nested_resize (ClutterStageWindow *stage_window,
- gint width,
- gint height)
-{
- if (!meta_is_stage_views_enabled ())
- {
- MetaBackend *backend = meta_get_backend ();
- MetaRenderer *renderer = meta_backend_get_renderer (backend);
- MetaRendererX11Nested *renderer_x11_nested =
- META_RENDERER_X11_NESTED (renderer);
-
- meta_renderer_x11_nested_ensure_legacy_view (renderer_x11_nested,
- width, height);
- }
-
- clutter_stage_window_parent_iface->resize (stage_window, width, height);
-}
-
-static gboolean
-meta_stage_x11_nested_can_clip_redraws (ClutterStageWindow *stage_window)
-{
- return FALSE;
-}
-
-static GList *
-meta_stage_x11_nested_get_views (ClutterStageWindow *stage_window)
-{
- MetaBackend *backend = meta_get_backend ();
- MetaRenderer *renderer = meta_backend_get_renderer (backend);
-
- return meta_renderer_get_views (renderer);
-}
-
-typedef struct
-{
- MetaStageX11Nested *stage_nested;
- CoglTexture *texture;
- ClutterStageView *view;
- MetaLogicalMonitor *logical_monitor;
-} DrawCrtcData;
-
-static gboolean
-draw_view (MetaStageX11Nested *stage_nested,
- MetaRendererView *renderer_view,
- CoglTexture *texture)
-{
- MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_nested);
- CoglFramebuffer *onscreen = COGL_FRAMEBUFFER (stage_x11->onscreen);
- ClutterStageView *stage_view = CLUTTER_STAGE_VIEW (renderer_view);
- MetaCrtc *crtc;
- const MetaCrtcConfig *crtc_config;
- graphene_matrix_t projection_matrix;
- graphene_matrix_t transform;
- float texture_width, texture_height;
- float sample_x, sample_y, sample_width, sample_height;
- float s_1, t_1, s_2, t_2;
-
- texture_width = cogl_texture_get_width (texture);
- texture_height = cogl_texture_get_height (texture);
-
- crtc = g_object_get_data (G_OBJECT (renderer_view), "crtc");
- crtc_config = meta_crtc_get_config (crtc);
-
- sample_x = 0;
- sample_y = 0;
- sample_width = texture_width;
- sample_height = texture_height;
-
- clutter_stage_view_get_offscreen_transformation_matrix (stage_view,
- &transform);
-
- cogl_framebuffer_push_matrix (onscreen);
- graphene_matrix_init_scale (&projection_matrix, 2, -2, 0);
- graphene_matrix_translate (&projection_matrix,
- &GRAPHENE_POINT3D_INIT (-1, 1, 0));
- graphene_matrix_multiply (&transform, &projection_matrix, &projection_matrix);
- cogl_framebuffer_set_projection_matrix (onscreen, &projection_matrix);
-
- s_1 = sample_x / texture_width;
- t_1 = sample_y / texture_height;
- s_2 = (sample_x + sample_width) / texture_width;
- t_2 = (sample_y + sample_height) / texture_height;
-
- cogl_framebuffer_set_viewport (onscreen,
- crtc_config->layout.origin.x,
- crtc_config->layout.origin.y,
- crtc_config->layout.size.width,
- crtc_config->layout.size.height);
-
- cogl_framebuffer_draw_textured_rectangle (onscreen,
- stage_nested->pipeline,
- 0, 0, 1, 1,
- s_1, t_1, s_2, t_2);
-
- cogl_framebuffer_pop_matrix (onscreen);
- return TRUE;
-}
-
-static void
-meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window,
- ClutterStageView *stage_view,
- ClutterFrame *frame)
-{
- MetaStageX11Nested *stage_nested = META_STAGE_X11_NESTED (stage_window);
- MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window);
- MetaBackend *backend = meta_get_backend ();
- MetaRenderer *renderer = meta_backend_get_renderer (backend);
- ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
- CoglFramebuffer *onscreen = COGL_FRAMEBUFFER (stage_x11->onscreen);
- CoglContext *context = cogl_framebuffer_get_context (onscreen);
- GList *l;
- CoglFrameInfo *frame_info;
-
- if (!stage_nested->pipeline)
- stage_nested->pipeline = cogl_pipeline_new (clutter_backend->cogl_context);
-
- cogl_framebuffer_clear4f (onscreen,
- COGL_BUFFER_BIT_COLOR,
- 0.0f, 0.0f, 0.0f, 1.0f);
-
- for (l = meta_renderer_get_views (renderer); l; l = l->next)
- {
- ClutterStageView *view = l->data;
- MetaRendererView *renderer_view = META_RENDERER_VIEW (view);
- CoglFramebuffer *framebuffer;
- CoglTexture *texture;
-
- framebuffer = clutter_stage_view_get_onscreen (view);
- texture = cogl_offscreen_get_texture (COGL_OFFSCREEN (framebuffer));
-
- cogl_pipeline_set_layer_texture (stage_nested->pipeline, 0, texture);
- cogl_pipeline_set_layer_wrap_mode (stage_nested->pipeline, 0,
- COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE);
-
- draw_view (stage_nested, renderer_view, texture);
- }
-
- frame_info = cogl_frame_info_new (context, 0);
- cogl_onscreen_swap_buffers (stage_x11->onscreen, frame_info, frame);
-
- if (!clutter_frame_has_result (frame))
- clutter_frame_set_result (frame, CLUTTER_FRAME_RESULT_IDLE);
-}
-
-static void
-meta_stage_x11_nested_unrealize (ClutterStageWindow *stage_window)
-{
- MetaStageX11Nested *stage_nested = META_STAGE_X11_NESTED (stage_window);
-
- g_clear_pointer (&stage_nested->pipeline, cogl_object_unref);
-
- clutter_stage_window_parent_iface->unrealize (stage_window);
-}
-
-static void
-meta_stage_x11_nested_init (MetaStageX11Nested *stage_x11_nested)
-{
-}
-
-static void
-meta_stage_x11_nested_class_init (MetaStageX11NestedClass *klass)
-{
-}
-
-static void
-clutter_stage_window_iface_init (ClutterStageWindowInterface *iface)
-{
- clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
-
- iface->resize = meta_stage_x11_nested_resize;
- iface->can_clip_redraws = meta_stage_x11_nested_can_clip_redraws;
- iface->unrealize = meta_stage_x11_nested_unrealize;
- iface->get_views = meta_stage_x11_nested_get_views;
- iface->finish_frame = meta_stage_x11_nested_finish_frame;
-}
diff --git a/src/backends/x11/nested/meta-stage-x11-nested.h b/src/backends/x11/nested/meta-stage-x11-nested.h
deleted file mode 100644
index 76678465b..000000000
--- a/src/backends/x11/nested/meta-stage-x11-nested.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
-
-/*
- * Copyright (C) 2016 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.
- *
- * Written by:
- * Jonas Ådahl <jadahl@gmail.com>
- */
-
-#ifndef META_STAGE_X11_NESTED_H
-#define META_STAGE_X11_NESTED_H
-
-#include "clutter/clutter-mutter.h"
-#include "backends/x11/meta-stage-x11.h"
-
-#define META_TYPE_STAGE_X11_NESTED (meta_stage_x11_nested_get_type ())
-G_DECLARE_FINAL_TYPE (MetaStageX11Nested, meta_stage_x11_nested,
- META, STAGE_X11_NESTED, MetaStageX11)
-
-#endif /* META_STAGE_X11_NESTED_H */