summaryrefslogtreecommitdiff
path: root/present
diff options
context:
space:
mode:
Diffstat (limited to 'present')
-rw-r--r--present/present_screen.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/present/present_screen.c b/present/present_screen.c
index 98f701ab8..868eaf85b 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -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);