mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -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)
|
META_TYPE_RENDERER_X11)
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_renderer_x11_cm_ensure_screen_view (MetaRendererX11Cm *renderer_x11_cm,
|
meta_renderer_x11_cm_init_screen_view (MetaRendererX11Cm *renderer_x11_cm,
|
||||||
|
CoglOnscreen *onscreen,
|
||||||
int width,
|
int width,
|
||||||
int height)
|
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;
|
cairo_rectangle_int_t view_layout;
|
||||||
|
|
||||||
if (renderer_x11_cm->screen_view)
|
g_return_if_fail (!renderer_x11_cm->screen_view);
|
||||||
return;
|
|
||||||
|
|
||||||
view_layout = (cairo_rectangle_int_t) {
|
view_layout = (cairo_rectangle_int_t) {
|
||||||
.width = width,
|
.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,
|
renderer_x11_cm->screen_view = g_object_new (META_TYPE_RENDERER_VIEW,
|
||||||
"name", "X11 screen",
|
"name", "X11 screen",
|
||||||
|
"stage", stage,
|
||||||
"layout", &view_layout,
|
"layout", &view_layout,
|
||||||
|
"framebuffer", onscreen,
|
||||||
NULL);
|
NULL);
|
||||||
meta_renderer_add_view (META_RENDERER (renderer_x11_cm),
|
meta_renderer_add_view (META_RENDERER (renderer_x11_cm),
|
||||||
renderer_x11_cm->screen_view);
|
renderer_x11_cm->screen_view);
|
||||||
@ -75,15 +80,6 @@ meta_renderer_x11_cm_resize (MetaRendererX11Cm *renderer_x11_cm,
|
|||||||
NULL);
|
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
|
static void
|
||||||
meta_renderer_x11_cm_rebuild_views (MetaRenderer *renderer)
|
meta_renderer_x11_cm_rebuild_views (MetaRenderer *renderer)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,8 @@ G_DECLARE_FINAL_TYPE (MetaRendererX11Cm, meta_renderer_x11_cm,
|
|||||||
META, RENDERER_X11_CM,
|
META, RENDERER_X11_CM,
|
||||||
MetaRendererX11)
|
MetaRendererX11)
|
||||||
|
|
||||||
void meta_renderer_x11_cm_ensure_screen_view (MetaRendererX11Cm *renderer_x11_cm,
|
void meta_renderer_x11_cm_init_screen_view (MetaRendererX11Cm *renderer_x11_cm,
|
||||||
|
CoglOnscreen *onscreen,
|
||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
@ -38,7 +39,4 @@ void meta_renderer_x11_cm_resize (MetaRendererX11Cm *renderer_x11_cm,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
void meta_renderer_x11_cm_set_onscreen (MetaRendererX11Cm *renderer_x11_cm,
|
|
||||||
CoglOnscreen *onscreen);
|
|
||||||
|
|
||||||
#endif /* META_RENDERER_X11_CM_H */
|
#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);
|
MetaRenderer *renderer = meta_backend_get_renderer (stage_x11->backend);
|
||||||
MetaRendererX11Cm *renderer_x11_cm = META_RENDERER_X11_CM (renderer);
|
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
|
/* 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
|
static void
|
||||||
meta_stage_x11_init (MetaStageX11 *stage)
|
meta_stage_x11_init (MetaStageX11 *stage)
|
||||||
{
|
{
|
||||||
MetaRenderer *renderer;
|
|
||||||
MetaRendererX11Cm *renderer_x11_cm;
|
|
||||||
|
|
||||||
stage->xwin = None;
|
stage->xwin = None;
|
||||||
stage->xwin_width = 640;
|
stage->xwin_width = 640;
|
||||||
stage->xwin_height = 480;
|
stage->xwin_height = 480;
|
||||||
@ -514,16 +514,6 @@ meta_stage_x11_init (MetaStageX11 *stage)
|
|||||||
|
|
||||||
stage->backend = meta_get_backend ();
|
stage->backend = meta_get_backend ();
|
||||||
g_assert (stage->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
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user