Xext: use dixAddAtom()

Use the new helper for creating atoms on demand.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-22 15:54:43 +02:00
committed by Enrico Weigelt
parent 8454c94773
commit ef420e43be
4 changed files with 11 additions and 8 deletions

View File

@@ -4,6 +4,7 @@
#include <stdio.h>
#include "dix/dix_priv.h"
#include "dix/selection_priv.h"
#include "namespace.h"
@@ -40,7 +41,7 @@ void hookSelectionFilter(CallbackListPtr *pcbl, void *unused, void *calldata)
char selname[PATH_MAX] = { 0 };
snprintf(selname, sizeof(selname)-1, "<%s>%s", subj->ns->name, origSelectionName);
Atom realSelection = MakeAtom(selname, strlen(selname), TRUE);
Atom realSelection = dixAddAtom(selname);
switch (param->op) {
case SELECTION_FILTER_GETOWNER:
@@ -55,7 +56,7 @@ void hookSelectionFilter(CallbackListPtr *pcbl, void *unused, void *calldata)
{
// need to translate back, since we're having the ns-prefixed name here
const char *stripped = stripNS(origSelectionName);
param->selection = MakeAtom(stripped, strlen(stripped), TRUE);
param->selection = dixAddAtom(stripped);
break;
}

View File

@@ -11,6 +11,7 @@
#include <X11/Xproto.h>
#include <X11/extensions/XResproto.h>
#include "dix/dix_priv.h"
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "os/client_priv.h"
@@ -272,12 +273,12 @@ resourceTypeAtom(int i)
const char *name = LookupResourceName(i);
if (strcmp(name, XREGISTRY_UNKNOWN))
ret = MakeAtom(name, strlen(name), TRUE);
ret = dixAddAtom(name);
else {
char buf[40];
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
ret = MakeAtom(buf, strlen(buf), TRUE);
ret = dixAddAtom(buf);
}
return ret;

View File

@@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xatom.h>
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
@@ -908,10 +909,10 @@ SELinuxFlaskInit(void)
FatalError("SELinux: Failed to allocate private storage.\n");
/* Create atoms for doing window labeling */
atom_ctx = MakeAtom("_SELINUX_CONTEXT", 16, TRUE);
atom_ctx = dixAddAtom("_SELINUX_CONTEXT");
if (atom_ctx == BAD_RESOURCE)
FatalError("SELinux: Failed to create atom\n");
atom_client_ctx = MakeAtom("_SELINUX_CLIENT_CONTEXT", 23, TRUE);
atom_client_ctx = dixAddAtom("_SELINUX_CLIENT_CONTEXT");
if (atom_client_ctx == BAD_RESOURCE)
FatalError("SELinux: Failed to create atom\n");

View File

@@ -81,6 +81,7 @@ SOFTWARE.
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "miext/extinit_priv.h"
#include "Xext/panoramiX.h"
@@ -199,8 +200,7 @@ XvExtensionInit(void)
(EventSwapPtr) WriteSwappedPortNotifyEvent;
SetResourceTypeErrorValue(XvRTPort, _XvBadPort);
(void) MakeAtom(XvName, strlen(XvName), xTrue);
(void) dixAddAtom(XvName);
}
}