summaryrefslogtreecommitdiff
path: root/hw/kdrive/ephyr/ephyrdriext.c
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-12-13 19:51:40 -0500
committerEamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil>2007-12-13 19:51:40 -0500
commit1c1a4bc970be061484bb8dcccf945eb08144c656 (patch)
treef3360002d522330f7a226dd377479022515a82d5 /hw/kdrive/ephyr/ephyrdriext.c
parentc8feb73f5841e7812d8dfdb91f1064e2033d028c (diff)
devPrivates rework: more cleanup from previous merge operation.
Diffstat (limited to 'hw/kdrive/ephyr/ephyrdriext.c')
-rw-r--r--hw/kdrive/ephyr/ephyrdriext.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index e3d0cfbb4..b6be47f5e 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -44,6 +44,7 @@
#include <X11/dri/xf86dri.h>
#include <X11/dri/xf86dristr.h>
#include "misc.h"
+#include "privates.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "colormapst.h"
@@ -118,14 +119,13 @@ static Bool findWindowPairFromLocal (WindowPtr a_local,
static unsigned char DRIReqCode = 0;
-static int ephyrDRIGeneration=-1 ;
-static int ephyrDRIWindowIndex=-1 ;
-static int ephyrDRIScreenIndex=-1 ;
+static DevPrivateKey ephyrDRIWindowKey = &ephyrDRIWindowKey;
+static DevPrivateKey ephyrDRIScreenKey = &ephyrDRIScreenKey;
-#define GET_EPHYR_DRI_WINDOW_PRIV(win) \
- ((EphyrDRIWindowPrivPtr)((win)->devPrivates[ephyrDRIWindowIndex].ptr))
-#define GET_EPHYR_DRI_SCREEN_PRIV(screen) \
- ((EphyrDRIScreenPrivPtr)((screen)->devPrivates[ephyrDRIScreenIndex].ptr))
+#define GET_EPHYR_DRI_WINDOW_PRIV(win) ((EphyrDRIWindowPrivPtr) \
+ dixLookupPrivate(&(win)->devPrivates, ephyrDRIWindowKey))
+#define GET_EPHYR_DRI_SCREEN_PRIV(screen) ((EphyrDRIScreenPrivPtr) \
+ dixLookupPrivate(&(screen)->devPrivates, ephyrDRIScreenKey))
Bool
@@ -164,28 +164,18 @@ ephyrDRIExtensionInit (ScreenPtr a_screen)
EPHYR_LOG_ERROR ("failed to register DRI extension\n") ;
goto out ;
}
- if (ephyrDRIGeneration != serverGeneration) {
- ephyrDRIScreenIndex = AllocateScreenPrivateIndex () ;
- if (ephyrDRIScreenIndex < 0) {
- EPHYR_LOG_ERROR ("failed to allocate screen priv index\n") ;
- goto out ;
- }
- }
screen_priv = xcalloc (1, sizeof (EphyrDRIScreenPrivRec)) ;
if (!screen_priv) {
EPHYR_LOG_ERROR ("failed to allocate screen_priv\n") ;
goto out ;
}
- a_screen->devPrivates[ephyrDRIScreenIndex].ptr = screen_priv;
+ dixSetPrivate(&a_screen->devPrivates, ephyrDRIScreenKey, screen_priv);
if (!ephyrDRIScreenInit (a_screen)) {
EPHYR_LOG_ERROR ("ephyrDRIScreenInit() failed\n") ;
goto out ;
}
EphyrMirrorHostVisuals (a_screen) ;
- if (ephyrDRIGeneration != serverGeneration) {
- ephyrDRIGeneration = serverGeneration ;
- }
is_ok=TRUE ;
out:
EPHYR_LOG ("leave\n") ;
@@ -203,17 +193,6 @@ ephyrDRIScreenInit (ScreenPtr a_screen)
screen_priv=GET_EPHYR_DRI_SCREEN_PRIV (a_screen) ;
EPHYR_RETURN_VAL_IF_FAIL (screen_priv, FALSE) ;
- if (ephyrDRIGeneration != serverGeneration) {
- ephyrDRIWindowIndex = AllocateWindowPrivateIndex () ;
- if (ephyrDRIWindowIndex < 0) {
- EPHYR_LOG_ERROR ("failed to allocate window priv index\n") ;
- goto out ;
- }
- }
- if (!AllocateWindowPrivate (a_screen, ephyrDRIWindowIndex, 0)) {
- EPHYR_LOG_ERROR ("failed to allocate window privates\n") ;
- goto out ;
- }
screen_priv->CreateWindow = a_screen->CreateWindow ;
screen_priv->DestroyWindow = a_screen->DestroyWindow ;
screen_priv->MoveWindow = a_screen->MoveWindow ;
@@ -254,7 +233,7 @@ ephyrDRICreateWindow (WindowPtr a_win)
screen->CreateWindow = ephyrDRICreateWindow ;
if (is_ok) {
- a_win->devPrivates[ephyrDRIWindowIndex].ptr = NULL ;
+ dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
}
return is_ok ;
}
@@ -285,7 +264,7 @@ ephyrDRIDestroyWindow (WindowPtr a_win)
if (win_priv) {
destroyHostPeerWindow (a_win) ;
xfree (win_priv) ;
- a_win->devPrivates[ephyrDRIWindowIndex].ptr = NULL ;
+ dixSetPrivate(&a_win->devPrivates, ephyrDRIWindowKey, NULL);
EPHYR_LOG ("destroyed the remote peer window\n") ;
}
}
@@ -1088,7 +1067,7 @@ ProcXF86DRICreateDrawable (ClientPtr client)
EPHYR_LOG_ERROR ("failed to allocate window private\n") ;
return BadAlloc ;
}
- window->devPrivates[ephyrDRIWindowIndex].ptr = win_priv ;
+ dixSetPrivate(&window->devPrivates, ephyrDRIWindowKey, win_priv);
EPHYR_LOG ("paired window '%#x' with remote '%d'\n",
(unsigned int)window, remote_win) ;
}