mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-08 16:08:31 +02:00
Add atom tables.
This commit is contained in:
parent
ce24735445
commit
e598c34e7d
3 changed files with 86 additions and 10 deletions
|
|
@ -126,6 +126,11 @@ typedef struct _DMXScreenInfo {
|
|||
xcb_connection_t *connection;
|
||||
xcb_get_input_focus_cookie_t sync;
|
||||
|
||||
Atom *atomTable;
|
||||
int atomTableSize;
|
||||
Atom *beAtomTable;
|
||||
int beAtomTableSize;
|
||||
|
||||
Display *beDisplay; /**< Back-end X server's display */
|
||||
int beWidth; /**< Width of BE display */
|
||||
int beHeight; /**< Height of BE display */
|
||||
|
|
|
|||
|
|
@ -33,24 +33,84 @@ Atom
|
|||
dmxAtom (DMXScreenInfo *dmxScreen,
|
||||
Atom beAtom)
|
||||
{
|
||||
char *name;
|
||||
Atom atom = None;
|
||||
|
||||
name = XGetAtomName (dmxScreen->beDisplay, beAtom);
|
||||
if (!name)
|
||||
return None;
|
||||
if (beAtom < dmxScreen->beAtomTableSize)
|
||||
atom = dmxScreen->beAtomTable[beAtom];
|
||||
|
||||
return MakeAtom (name, strlen (name), TRUE);
|
||||
if (!atom)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = XGetAtomName (dmxScreen->beDisplay, beAtom);
|
||||
if (!name)
|
||||
return None;
|
||||
|
||||
atom = MakeAtom (name, strlen (name), TRUE);
|
||||
if (!atom)
|
||||
return None;
|
||||
|
||||
if (beAtom >= dmxScreen->beAtomTableSize)
|
||||
{
|
||||
Atom *table;
|
||||
int i;
|
||||
|
||||
table = xrealloc (dmxScreen->beAtomTable,
|
||||
sizeof (Atom) * (beAtom + 1));
|
||||
if (!table)
|
||||
return atom;
|
||||
|
||||
for (i = dmxScreen->beAtomTableSize; i < beAtom; i++)
|
||||
table[i] = None;
|
||||
|
||||
dmxScreen->beAtomTable = table;
|
||||
dmxScreen->beAtomTableSize = beAtom + 1;
|
||||
}
|
||||
|
||||
dmxScreen->beAtomTable[beAtom] = atom;
|
||||
}
|
||||
|
||||
return atom;
|
||||
}
|
||||
|
||||
Atom
|
||||
dmxBEAtom (DMXScreenInfo *dmxScreen,
|
||||
Atom atom)
|
||||
{
|
||||
char *name;
|
||||
Atom beAtom = None;
|
||||
|
||||
name = NameForAtom (atom);
|
||||
if (!name)
|
||||
return None;
|
||||
if (atom < dmxScreen->atomTableSize)
|
||||
beAtom = dmxScreen->atomTable[atom];
|
||||
|
||||
return XInternAtom (dmxScreen->beDisplay, name, FALSE);
|
||||
if (!beAtom)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = NameForAtom (atom);
|
||||
if (!name)
|
||||
return None;
|
||||
|
||||
beAtom = XInternAtom (dmxScreen->beDisplay, name, FALSE);
|
||||
|
||||
if (atom >= dmxScreen->beAtomTableSize)
|
||||
{
|
||||
Atom *table;
|
||||
int i;
|
||||
|
||||
table = xrealloc (dmxScreen->atomTable,
|
||||
sizeof (Atom) * (atom + 1));
|
||||
if (!table)
|
||||
return beAtom;
|
||||
|
||||
for (i = dmxScreen->atomTableSize; i < atom; i++)
|
||||
table[i] = None;
|
||||
|
||||
dmxScreen->atomTable = table;
|
||||
dmxScreen->atomTableSize = atom + 1;
|
||||
}
|
||||
|
||||
dmxScreen->beAtomTable[atom] = beAtom;
|
||||
}
|
||||
|
||||
return beAtom;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,6 +305,12 @@ Bool dmxOpenDisplay(DMXScreenInfo *dmxScreen)
|
|||
|
||||
AddEnabledDevice (dmxScreen->fd);
|
||||
|
||||
dmxScreen->atomTable = NULL;
|
||||
dmxScreen->atomTableSize = 0;
|
||||
|
||||
dmxScreen->beAtomTable = NULL;
|
||||
dmxScreen->beAtomTableSize = 0;
|
||||
|
||||
dmxPropertyDisplay(dmxScreen);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -316,6 +322,11 @@ void dmxCloseDisplay(DMXScreenInfo *dmxScreen)
|
|||
/* make sure all pending sync replies are processed */
|
||||
dmxSync (dmxScreen, TRUE);
|
||||
|
||||
if (dmxScreen->atomTable)
|
||||
xfree (dmxScreen->atomTable);
|
||||
if (dmxScreen->beAtomTable)
|
||||
xfree (dmxScreen->beAtomTable);
|
||||
|
||||
XLIB_PROLOGUE (dmxScreen);
|
||||
XCloseDisplay (dmxScreen->beDisplay);
|
||||
XLIB_EPILOGUE (dmxScreen);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue