mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
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
This commit is contained in:
parent
37326e4a32
commit
1f895719b3
@ -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)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user