[mutter] renderer-x11-cm: Initialize screen stage view in one step
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] renderer-x11-cm: Initialize screen stage view in one step
- Date: Thu, 2 Jul 2020 20:54:30 +0000 (UTC)
commit 1f895719b31f1d6d463aee7ff40f88ac393f7bac
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Jun 2 18:52:57 2020 +0200
renderer-x11-cm: Initialize screen stage view in one step
Before we'd create the view in init(), then continue poking at it in
realize(). Move all of the screen stage view initialization to
realize(), as that's when we have all the dependent state available.
This is possible since there is nothing needing it until realizing.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
src/backends/x11/cm/meta-renderer-x11-cm.c | 24 ++++++++++--------------
src/backends/x11/cm/meta-renderer-x11-cm.h | 10 ++++------
src/backends/x11/meta-stage-x11.c | 18 ++++--------------
3 files changed, 18 insertions(+), 34 deletions(-)
---
diff --git a/src/backends/x11/cm/meta-renderer-x11-cm.c b/src/backends/x11/cm/meta-renderer-x11-cm.c
index 18ad5eb5d1..afed2e3770 100644
--- a/src/backends/x11/cm/meta-renderer-x11-cm.c
+++ b/src/backends/x11/cm/meta-renderer-x11-cm.c
@@ -37,14 +37,17 @@ G_DEFINE_TYPE (MetaRendererX11Cm, meta_renderer_x11_cm,
META_TYPE_RENDERER_X11)
void
-meta_renderer_x11_cm_ensure_screen_view (MetaRendererX11Cm *renderer_x11_cm,
- int width,
- int height)
+meta_renderer_x11_cm_init_screen_view (MetaRendererX11Cm *renderer_x11_cm,
+ CoglOnscreen *onscreen,
+ int width,
+ int height)
{
+ MetaRenderer *renderer = META_RENDERER (renderer_x11_cm);
+ MetaBackend *backend = meta_renderer_get_backend (renderer);
+ ClutterActor *stage = meta_backend_get_stage (backend);
cairo_rectangle_int_t view_layout;
- if (renderer_x11_cm->screen_view)
- return;
+ g_return_if_fail (!renderer_x11_cm->screen_view);
view_layout = (cairo_rectangle_int_t) {
.width = width,
@@ -52,7 +55,9 @@ meta_renderer_x11_cm_ensure_screen_view (MetaRendererX11Cm *renderer_x11_cm,
};
renderer_x11_cm->screen_view = g_object_new (META_TYPE_RENDERER_VIEW,
"name", "X11 screen",
+ "stage", stage,
"layout", &view_layout,
+ "framebuffer", onscreen,
NULL);
meta_renderer_add_view (META_RENDERER (renderer_x11_cm),
renderer_x11_cm->screen_view);
@@ -75,15 +80,6 @@ meta_renderer_x11_cm_resize (MetaRendererX11Cm *renderer_x11_cm,
NULL);
}
-void
-meta_renderer_x11_cm_set_onscreen (MetaRendererX11Cm *renderer_x11_cm,
- CoglOnscreen *onscreen)
-{
- g_object_set (G_OBJECT (renderer_x11_cm->screen_view),
- "framebuffer", onscreen,
- NULL);
-}
-
static void
meta_renderer_x11_cm_rebuild_views (MetaRenderer *renderer)
{
diff --git a/src/backends/x11/cm/meta-renderer-x11-cm.h b/src/backends/x11/cm/meta-renderer-x11-cm.h
index 65c5125bbc..7ddb3445dd 100644
--- a/src/backends/x11/cm/meta-renderer-x11-cm.h
+++ b/src/backends/x11/cm/meta-renderer-x11-cm.h
@@ -30,15 +30,13 @@ G_DECLARE_FINAL_TYPE (MetaRendererX11Cm, meta_renderer_x11_cm,
META, RENDERER_X11_CM,
MetaRendererX11)
-void meta_renderer_x11_cm_ensure_screen_view (MetaRendererX11Cm *renderer_x11_cm,
- int width,
- int height);
+void meta_renderer_x11_cm_init_screen_view (MetaRendererX11Cm *renderer_x11_cm,
+ CoglOnscreen *onscreen,
+ int width,
+ int height);
void meta_renderer_x11_cm_resize (MetaRendererX11Cm *renderer_x11_cm,
int width,
int height);
-void meta_renderer_x11_cm_set_onscreen (MetaRendererX11Cm *renderer_x11_cm,
- CoglOnscreen *onscreen);
-
#endif /* META_RENDERER_X11_CM_H */
diff --git a/src/backends/x11/meta-stage-x11.c b/src/backends/x11/meta-stage-x11.c
index 2367454ed5..13db11fe46 100644
--- a/src/backends/x11/meta-stage-x11.c
+++ b/src/backends/x11/meta-stage-x11.c
@@ -302,7 +302,10 @@ meta_stage_x11_realize (ClutterStageWindow *stage_window)
MetaRenderer *renderer = meta_backend_get_renderer (stage_x11->backend);
MetaRendererX11Cm *renderer_x11_cm = META_RENDERER_X11_CM (renderer);
- meta_renderer_x11_cm_set_onscreen (renderer_x11_cm, stage_x11->onscreen);
+ meta_renderer_x11_cm_init_screen_view (renderer_x11_cm,
+ stage_x11->onscreen,
+ stage_x11->xwin_width,
+ stage_x11->xwin_height);
}
/* We just created a window of the size of the actor. No need to fix
@@ -501,9 +504,6 @@ meta_stage_x11_class_init (MetaStageX11Class *klass)
static void
meta_stage_x11_init (MetaStageX11 *stage)
{
- MetaRenderer *renderer;
- MetaRendererX11Cm *renderer_x11_cm;
-
stage->xwin = None;
stage->xwin_width = 640;
stage->xwin_height = 480;
@@ -514,16 +514,6 @@ meta_stage_x11_init (MetaStageX11 *stage)
stage->backend = meta_get_backend ();
g_assert (stage->backend);
-
- if (META_IS_BACKEND_X11_CM (stage->backend))
- {
- renderer = meta_backend_get_renderer (stage->backend);
- renderer_x11_cm = META_RENDERER_X11_CM (renderer);
-
- meta_renderer_x11_cm_ensure_screen_view (renderer_x11_cm,
- stage->xwin_width,
- stage->xwin_height);
- }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]