backends: Split kms cursor renderer from MetaCursorRendererNative

Move the KMS updating pieces to a distinct MetaKmsCursorRenderer whose
cursor sprite will get updated from the driving MetaCursorRenderer.
Since there could be multiple MetaCursorRenderers, also add the
necessary pieces to move the KMS cursor renderer between renderers.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
Carlos Garnacho 2020-07-14 13:34:13 +02:00
parent 05f385c8ee
commit e64112de64
7 changed files with 1808 additions and 1552 deletions

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
#define META_CURSOR_RENDERER_NATIVE_H #define META_CURSOR_RENDERER_NATIVE_H
#include "backends/meta-cursor-renderer.h" #include "backends/meta-cursor-renderer.h"
#include "backends/native/meta-kms-cursor-renderer.h"
#include "meta/meta-backend.h" #include "meta/meta-backend.h"
#define META_TYPE_CURSOR_RENDERER_NATIVE (meta_cursor_renderer_native_get_type ()) #define META_TYPE_CURSOR_RENDERER_NATIVE (meta_cursor_renderer_native_get_type ())
@ -36,4 +37,7 @@ G_DECLARE_FINAL_TYPE (MetaCursorRendererNative, meta_cursor_renderer_native,
MetaCursorRendererNative * meta_cursor_renderer_native_new (MetaBackend *backend, MetaCursorRendererNative * meta_cursor_renderer_native_new (MetaBackend *backend,
ClutterInputDevice *device); ClutterInputDevice *device);
void meta_cursor_renderer_native_set_kms_cursor_renderer (MetaCursorRendererNative *native,
MetaKmsCursorRenderer *kms_cursor_renderer);
#endif /* META_CURSOR_RENDERER_NATIVE_H */ #endif /* META_CURSOR_RENDERER_NATIVE_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Copyright (C) 2014 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:
* Jasper St. Pierre <jstpierre@mecheye.net>
*/
#ifndef META_KMS_CURSOR_RENDERER_H
#define META_KMS_CURSOR_RENDERER_H
#include "backends/meta-cursor-renderer.h"
#include "meta/meta-backend.h"
#define META_TYPE_KMS_CURSOR_RENDERER (meta_kms_cursor_renderer_get_type ())
G_DECLARE_FINAL_TYPE (MetaKmsCursorRenderer, meta_kms_cursor_renderer,
META, KMS_CURSOR_RENDERER,
GObject)
MetaKmsCursorRenderer * meta_kms_cursor_renderer_new (MetaBackend *backend);
void meta_kms_cursor_renderer_invalidate_state (MetaKmsCursorRenderer *kms_renderer);
gboolean meta_kms_cursor_renderer_update_cursor (MetaKmsCursorRenderer *kms_cursor_renderer,
MetaCursorSprite *sprite);
void meta_kms_cursor_renderer_set_cursor_renderer (MetaKmsCursorRenderer *kms_renderer,
MetaCursorRenderer *renderer);
#endif /* META_KMS_CURSOR_RENDERER_H */

View File

@ -2495,6 +2495,9 @@ meta_seat_native_constructed (GObject *object)
CLUTTER_INPUT_MODE_MASTER); CLUTTER_INPUT_MODE_MASTER);
seat->core_keyboard = device; seat->core_keyboard = device;
seat->kms_cursor_renderer =
meta_kms_cursor_renderer_new (meta_get_backend ());
udev = udev_new (); udev = udev_new ();
if (G_UNLIKELY (udev == NULL)) if (G_UNLIKELY (udev == NULL))
{ {
@ -3307,6 +3310,8 @@ meta_seat_native_get_cursor_renderer (MetaSeatNative *seat,
meta_cursor_renderer_native_new (meta_get_backend (), meta_cursor_renderer_native_new (meta_get_backend (),
seat->core_pointer); seat->core_pointer);
seat->cursor_renderer = META_CURSOR_RENDERER (renderer_native); seat->cursor_renderer = META_CURSOR_RENDERER (renderer_native);
meta_cursor_renderer_native_set_kms_cursor_renderer (renderer_native,
seat->kms_cursor_renderer);
} }
return seat->cursor_renderer; return seat->cursor_renderer;

View File

@ -85,6 +85,7 @@ struct _MetaSeatNative
MetaKeymapNative *keymap; MetaKeymapNative *keymap;
MetaCursorRenderer *cursor_renderer; MetaCursorRenderer *cursor_renderer;
MetaKmsCursorRenderer *kms_cursor_renderer;
GHashTable *tablet_cursors; GHashTable *tablet_cursors;
GUdevClient *udev_client; GUdevClient *udev_client;

View File

@ -672,6 +672,8 @@ if have_native_backend
'backends/native/meta-kms-crtc-private.h', 'backends/native/meta-kms-crtc-private.h',
'backends/native/meta-kms-crtc.c', 'backends/native/meta-kms-crtc.c',
'backends/native/meta-kms-crtc.h', 'backends/native/meta-kms-crtc.h',
'backends/native/meta-kms-cursor-renderer.c',
'backends/native/meta-kms-cursor-renderer.h',
'backends/native/meta-kms-device-private.h', 'backends/native/meta-kms-device-private.h',
'backends/native/meta-kms-device.c', 'backends/native/meta-kms-device.c',
'backends/native/meta-kms-device.h', 'backends/native/meta-kms-device.h',