Commit 3aaaac0b authored by Roman Gilg's avatar Roman Gilg Committed by Adam Jackson
Browse files

present: Refactor present_screen_init



To initialize easily different flip modes, refactor
'present_screen_init'.
Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent 6d813bbd
......@@ -170,32 +170,52 @@ present_clip_notify(WindowPtr window, int dx, int dy)
wrap(screen_priv, screen, ClipNotify, present_clip_notify);
}
static Bool
present_screen_register_priv_keys(void)
{
if (!dixRegisterPrivateKey(&present_screen_private_key, PRIVATE_SCREEN, 0))
return FALSE;
if (!dixRegisterPrivateKey(&present_window_private_key, PRIVATE_WINDOW, 0))
return FALSE;
return TRUE;
}
static present_screen_priv_ptr
present_screen_priv_init(ScreenPtr screen)
{
present_screen_priv_ptr screen_priv;
screen_priv = calloc(1, sizeof (present_screen_priv_rec));
if (!screen_priv)
return NULL;
wrap(screen_priv, screen, CloseScreen, present_close_screen);
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
wrap(screen_priv, screen, ConfigNotify, present_config_notify);
wrap(screen_priv, screen, ClipNotify, present_clip_notify);
dixSetPrivate(&screen->devPrivates, &present_screen_private_key, screen_priv);
return screen_priv;
}
/*
* Initialize a screen for use with present
*/
int
present_screen_init(ScreenPtr screen, present_screen_info_ptr info)
{
if (!dixRegisterPrivateKey(&present_screen_private_key, PRIVATE_SCREEN, 0))
return FALSE;
if (!dixRegisterPrivateKey(&present_window_private_key, PRIVATE_WINDOW, 0))
if (!present_screen_register_priv_keys())
return FALSE;
if (!present_screen_priv(screen)) {
present_screen_priv_ptr screen_priv = calloc(1, sizeof (present_screen_priv_rec));
present_screen_priv_ptr screen_priv = present_screen_priv_init(screen);
if (!screen_priv)
return FALSE;
wrap(screen_priv, screen, CloseScreen, present_close_screen);
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
wrap(screen_priv, screen, ConfigNotify, present_config_notify);
wrap(screen_priv, screen, ClipNotify, present_clip_notify);
screen_priv->info = info;
dixSetPrivate(&screen->devPrivates, &present_screen_private_key, screen_priv);
present_scmd_init_mode_hooks(screen_priv);
present_fake_screen_init(screen);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment