os: move over osLookupColor to dix

This function is only used by DIX and not os-specific at all.
So move it over to DIX and give it a more fitting name.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1373>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-03-07 12:55:24 +01:00 committed by Alan Coopersmith
parent 6cb599f59c
commit 1999785fa9
6 changed files with 32 additions and 25 deletions

View File

@ -50,10 +50,8 @@ SOFTWARE.
#include <X11/keysym.h>
#include "os/osdep.h"
#include "dix.h"
#include "os.h"
#include "dix/dix_priv.h"
#include "include/dix.h"
typedef struct _builtinColor {
unsigned char red;
@ -849,11 +847,12 @@ static const BuiltinColor BuiltinColors[] = {
};
Bool
OsLookupColor(int screen,
char *name,
unsigned int len,
unsigned short *pred,
unsigned short *pgreen, unsigned short *pblue)
dixLookupBuiltinColor(int screen,
char *name,
unsigned int len,
unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue)
{
int low = 0;
int high = ARRAY_SIZE(BuiltinColors) - 1;

View File

@ -110,7 +110,6 @@ Equipment Corporation.
#include "dix/registry_priv.h"
#include "dix/screenint_priv.h"
#include "os/auth.h"
#include "os/osdep.h"
#include "windowstr.h"
#include "dixfontstr.h"
@ -2655,7 +2654,7 @@ ProcAllocNamedColor(ClientPtr client)
.sequenceNumber = client->sequence,
.length = 0
};
if (OsLookupColor
if (dixLookupBuiltinColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
&ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
ancr.screenRed = ancr.exactRed;
@ -2872,8 +2871,12 @@ ProcStoreNamedColor(ClientPtr client)
if (rc == Success) {
xColorItem def;
if (OsLookupColor(pcmp->pScreen->myNum, (char *) &stuff[1],
stuff->nbytes, &def.red, &def.green, &def.blue)) {
if (dixLookupBuiltinColor(pcmp->pScreen->myNum,
(char *) &stuff[1],
stuff->nbytes,
&def.red,
&def.green,
&def.blue)) {
def.flags = stuff->flags;
def.pixel = stuff->pixel;
return StoreColors(pcmp, 1, &def, client);
@ -2947,9 +2950,12 @@ ProcLookupColor(ClientPtr client)
if (rc == Success) {
CARD16 exactRed, exactGreen, exactBlue;
if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
&exactRed, &exactGreen, &exactBlue)) {
if (dixLookupBuiltinColor(pcmp->pScreen->myNum,
(char *) &stuff[1],
stuff->nbytes,
&exactRed,
&exactGreen,
&exactBlue)) {
xLookupColorReply lcr = {
.type = X_Reply,
.sequenceNumber = client->sequence,

View File

@ -5,6 +5,8 @@
#ifndef _XSERVER_DIX_PRIV_H
#define _XSERVER_DIX_PRIV_H
#include <X11/Xdefs.h>
/* This file holds global DIX settings to be used inside the Xserver,
* but NOT supposed to be accessed directly by external server modules like
* drivers or extension modules. Thus the definitions here are not part of the
@ -38,4 +40,12 @@ void ProcessWorkQueueZombies(void);
void CloseDownClient(ClientPtr client);
/* lookup builtin color by name */
Bool dixLookupBuiltinColor(int screen,
char *name,
unsigned len,
unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue);
#endif /* _XSERVER_DIX_PRIV_H */

View File

@ -1,6 +1,7 @@
srcs_dix = [
'atom.c',
'colormap.c',
'color.c',
'cursor.c',
'devices.c',
'dispatch.c',

View File

@ -10,7 +10,6 @@ srcs_os = [
'inputthread.c',
'io.c',
'mitauth.c',
'oscolor.c',
'osinit.c',
'ospoll.c',
'string.c',

View File

@ -166,14 +166,6 @@ void AutoResetServer(int sig);
/* clone fd so it gets out of our select mask */
int os_move_fd(int fd);
/* lookup builtin color by name */
Bool OsLookupColor(int screen,
char *name,
unsigned len,
unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue);
/* set signal mask - either on current thread or whole process,
depending on whether multithreading is used */
int xthread_sigmask(int how, const sigset_t *set, sigset_t *oldest);