mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-15 20:50:33 +01:00
xnest: use own dev-privates key for per-screen cursor
Since it's storing an locally defined (ddx-internal) struct, it's better
not to abuse some globally defined key for this.
It just happened to work before, since CursorScreenKey is only used by DDX
(and there's only one DDX per executable) and they currently (!) have the
same size (pointer) - but that's a fragile programming style, so clean it up.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1342>
(cherry picked from commit 49d139344d)
This commit is contained in:
parent
a6ae6d7630
commit
fc765b8fa7
3 changed files with 12 additions and 3 deletions
|
|
@ -21,7 +21,6 @@ is" without express or implied warranty.
|
|||
#include "screenint.h"
|
||||
#include "input.h"
|
||||
#include "misc.h"
|
||||
#include "cursor.h"
|
||||
#include "cursorstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "servermd.h"
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ is" without express or implied warranty.
|
|||
Window xnestDefaultWindows[MAXSCREENS];
|
||||
Window xnestScreenSaverWindows[MAXSCREENS];
|
||||
DevPrivateKeyRec xnestScreenCursorFuncKeyRec;
|
||||
DevScreenPrivateKeyRec xnestScreenCursorPrivKeyRec;
|
||||
|
||||
ScreenPtr
|
||||
xnestScreen(Window window)
|
||||
|
|
@ -158,6 +159,10 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
|||
if (!dixRegisterPrivateKey(&xnestScreenCursorFuncKeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
||||
if (!dixRegisterScreenPrivateKey(&xnestScreenCursorPrivKeyRec, pScreen,
|
||||
PRIVATE_CURSOR, 0))
|
||||
return FALSE;
|
||||
|
||||
visuals = xallocarray(xnestNumVisuals, sizeof(VisualRec));
|
||||
numVisuals = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,16 @@ typedef struct {
|
|||
Cursor cursor;
|
||||
} xnestPrivCursor;
|
||||
|
||||
// stores xnestPrivCursor per screen's cursor
|
||||
extern DevScreenPrivateKeyRec xnestScreenCursorPrivKeyRec;
|
||||
|
||||
#define xnestGetCursorPriv(pCursor, pScreen) ((xnestPrivCursor *) \
|
||||
dixLookupScreenPrivate(&(pCursor)->devPrivates, CursorScreenKey, pScreen))
|
||||
dixLookupScreenPrivate(&(pCursor)->devPrivates, \
|
||||
&xnestScreenCursorPrivKeyRec, pScreen))
|
||||
|
||||
#define xnestSetCursorPriv(pCursor, pScreen, v) \
|
||||
dixSetScreenPrivate(&(pCursor)->devPrivates, CursorScreenKey, pScreen, v)
|
||||
dixSetScreenPrivate(&(pCursor)->devPrivates, \
|
||||
&xnestScreenCursorPrivKeyRec, pScreen, v)
|
||||
|
||||
#define xnestCursor(pCursor, pScreen) \
|
||||
(xnestGetCursorPriv(pCursor, pScreen)->cursor)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue