mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
compositor: Introduce MetaCompositorViewNative
This class is meant to hold logic specific to the native backend in the context of a MetaCompositorView. Its addition requires making MetaCompositorView inheritable, and an addition of a virtual function which allows each compositor to create its own MetaCompositorView instance. In the case of the MetaCompositorNative, a MetaCompositorViewNative is created. In all other cases, a MetaCompositorView is created. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2526>
This commit is contained in:
parent
85b8632cd6
commit
259a9998d8
@ -35,6 +35,9 @@ struct _MetaCompositorClass
|
||||
int64_t time_us);
|
||||
void (* grab_begin) (MetaCompositor *compositor);
|
||||
void (* grab_end) (MetaCompositor *compositor);
|
||||
|
||||
MetaCompositorView * (* create_view) (MetaCompositor *compositor,
|
||||
ClutterStageView *stage_view);
|
||||
};
|
||||
|
||||
gboolean meta_compositor_do_manage (MetaCompositor *compositor,
|
||||
|
@ -417,6 +417,14 @@ meta_compositor_redirect_x11_windows (MetaCompositor *compositor)
|
||||
redirect_windows (display->x11_display);
|
||||
}
|
||||
|
||||
static MetaCompositorView *
|
||||
meta_compositor_create_view (MetaCompositor *compositor,
|
||||
ClutterStageView *stage_view)
|
||||
{
|
||||
return META_COMPOSITOR_GET_CLASS (compositor)->create_view (compositor,
|
||||
stage_view);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_compositor_do_manage (MetaCompositor *compositor,
|
||||
GError **error)
|
||||
@ -1004,7 +1012,8 @@ meta_compositor_ensure_compositor_views (MetaCompositor *compositor)
|
||||
if (compositor_view)
|
||||
continue;
|
||||
|
||||
compositor_view = meta_compositor_view_new (stage_view);
|
||||
compositor_view = meta_compositor_create_view (compositor,
|
||||
stage_view);
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (stage_view),
|
||||
quark_compositor_view,
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/native/meta-crtc-kms.h"
|
||||
#include "compositor/meta-compositor-view-native.h"
|
||||
#include "compositor/meta-surface-actor-wayland.h"
|
||||
|
||||
struct _MetaCompositorNative
|
||||
@ -169,6 +170,17 @@ meta_compositor_native_before_paint (MetaCompositor *compositor,
|
||||
parent_class->before_paint (compositor, compositor_view);
|
||||
}
|
||||
|
||||
static MetaCompositorView *
|
||||
meta_compositor_native_create_view (MetaCompositor *compositor,
|
||||
ClutterStageView *stage_view)
|
||||
{
|
||||
MetaCompositorViewNative *compositor_view_native;
|
||||
|
||||
compositor_view_native = meta_compositor_view_native_new (stage_view);
|
||||
|
||||
return META_COMPOSITOR_VIEW (compositor_view_native);
|
||||
}
|
||||
|
||||
MetaCompositorNative *
|
||||
meta_compositor_native_new (MetaDisplay *display,
|
||||
MetaBackend *backend)
|
||||
@ -203,4 +215,5 @@ meta_compositor_native_class_init (MetaCompositorNativeClass *klass)
|
||||
object_class->finalize = meta_compositor_native_finalize;
|
||||
|
||||
compositor_class->before_paint = meta_compositor_native_before_paint;
|
||||
compositor_class->create_view = meta_compositor_native_create_view;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "backends/meta-dnd-private.h"
|
||||
#include "compositor/meta-compositor-server.h"
|
||||
#include "compositor/meta-compositor-view.h"
|
||||
#include "core/display-private.h"
|
||||
|
||||
G_DEFINE_TYPE (MetaCompositorServer, meta_compositor_server, META_TYPE_COMPOSITOR)
|
||||
@ -66,6 +67,13 @@ meta_compositor_server_grab_end (MetaCompositor *compositor)
|
||||
meta_display_sync_wayland_input_focus (display);
|
||||
}
|
||||
|
||||
static MetaCompositorView *
|
||||
meta_compositor_server_create_view (MetaCompositor *compositor,
|
||||
ClutterStageView *stage_view)
|
||||
{
|
||||
return meta_compositor_view_new (stage_view);
|
||||
}
|
||||
|
||||
MetaCompositorServer *
|
||||
meta_compositor_server_new (MetaDisplay *display,
|
||||
MetaBackend *backend)
|
||||
@ -91,4 +99,5 @@ meta_compositor_server_class_init (MetaCompositorServerClass *klass)
|
||||
meta_compositor_server_monotonic_to_high_res_xserver_time;
|
||||
compositor_class->grab_begin = meta_compositor_server_grab_begin;
|
||||
compositor_class->grab_end = meta_compositor_server_grab_end;
|
||||
compositor_class->create_view = meta_compositor_server_create_view;
|
||||
}
|
||||
|
55
src/compositor/meta-compositor-view-native.c
Normal file
55
src/compositor/meta-compositor-view-native.c
Normal file
@ -0,0 +1,55 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Dor Askayo
|
||||
*
|
||||
* 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:
|
||||
* Dor Askayo <dor.askayo@gmail.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "compositor/meta-compositor-view-native.h"
|
||||
|
||||
struct _MetaCompositorViewNative
|
||||
{
|
||||
MetaCompositorView parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaCompositorViewNative, meta_compositor_view_native,
|
||||
META_TYPE_COMPOSITOR_VIEW)
|
||||
|
||||
MetaCompositorViewNative *
|
||||
meta_compositor_view_native_new (ClutterStageView *stage_view)
|
||||
{
|
||||
g_assert (stage_view != NULL);
|
||||
|
||||
return g_object_new (META_TYPE_COMPOSITOR_VIEW_NATIVE,
|
||||
"stage-view", stage_view,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_compositor_view_native_class_init (MetaCompositorViewNativeClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_compositor_view_native_init (MetaCompositorViewNative *view_native)
|
||||
{
|
||||
}
|
37
src/compositor/meta-compositor-view-native.h
Normal file
37
src/compositor/meta-compositor-view-native.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2022 Dor Askayo
|
||||
*
|
||||
* 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:
|
||||
* Dor Askayo <dor.askayo@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef META_COMPOSITOR_VIEW_NATIVE_H
|
||||
#define META_COMPOSITOR_VIEW_NATIVE_H
|
||||
|
||||
#include "clutter/clutter-mutter.h"
|
||||
#include "compositor/meta-compositor-view.h"
|
||||
|
||||
#define META_TYPE_COMPOSITOR_VIEW_NATIVE (meta_compositor_view_native_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaCompositorViewNative, meta_compositor_view_native,
|
||||
META, COMPOSITOR_VIEW_NATIVE, MetaCompositorView)
|
||||
|
||||
MetaCompositorViewNative *meta_compositor_view_native_new (ClutterStageView *stage_view);
|
||||
|
||||
#endif /* META_COMPOSITOR_VIEW_NATIVE_H */
|
@ -36,8 +36,8 @@ struct _MetaCompositorViewClass
|
||||
};
|
||||
|
||||
#define META_TYPE_COMPOSITOR_VIEW (meta_compositor_view_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaCompositorView, meta_compositor_view,
|
||||
META, COMPOSITOR_VIEW, GObject)
|
||||
G_DECLARE_DERIVABLE_TYPE (MetaCompositorView, meta_compositor_view,
|
||||
META, COMPOSITOR_VIEW, GObject)
|
||||
|
||||
MetaCompositorView *meta_compositor_view_new (ClutterStageView *stage_view);
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "backends/x11/meta-backend-x11.h"
|
||||
#include "backends/x11/meta-clutter-backend-x11.h"
|
||||
#include "backends/x11/meta-event-x11.h"
|
||||
#include "compositor/meta-compositor-view.h"
|
||||
#include "compositor/meta-sync-ring.h"
|
||||
#include "compositor/meta-window-actor-x11.h"
|
||||
#include "core/display-private.h"
|
||||
@ -458,6 +459,13 @@ meta_compositor_x11_grab_end (MetaCompositor *compositor)
|
||||
meta_backend_x11_sync_pointer (backend_x11);
|
||||
}
|
||||
|
||||
static MetaCompositorView *
|
||||
meta_compositor_x11_create_view (MetaCompositor *compositor,
|
||||
ClutterStageView *stage_view)
|
||||
{
|
||||
return meta_compositor_view_new (stage_view);
|
||||
}
|
||||
|
||||
Window
|
||||
meta_compositor_x11_get_output_xwindow (MetaCompositorX11 *compositor_x11)
|
||||
{
|
||||
@ -532,4 +540,5 @@ meta_compositor_x11_class_init (MetaCompositorX11Class *klass)
|
||||
meta_compositor_x11_monotonic_to_high_res_xserver_time;
|
||||
compositor_class->grab_begin = meta_compositor_x11_grab_begin;
|
||||
compositor_class->grab_end = meta_compositor_x11_grab_end;
|
||||
compositor_class->create_view = meta_compositor_x11_create_view;
|
||||
}
|
||||
|
@ -793,6 +793,8 @@ if have_native_backend
|
||||
'backends/native/meta-xkb-utils.h',
|
||||
'compositor/meta-compositor-native.c',
|
||||
'compositor/meta-compositor-native.h',
|
||||
'compositor/meta-compositor-view-native.c',
|
||||
'compositor/meta-compositor-view-native.h',
|
||||
]
|
||||
endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user