xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 15 23:26:48 UTC 2024


 dix/color.c     |   16 +++++++++-------
 dix/dispatch.c  |   19 +++++++++++++------
 dix/dix_priv.h  |   10 ++++++++++
 dix/meson.build |    1 +
 include/os.h    |    8 --------
 os/meson.build  |    1 -
 6 files changed, 33 insertions(+), 22 deletions(-)

New commits:
commit 1999785fa95b3099b274ae60d8b5b0b2e58f3577
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Thu Mar 7 12:55:24 2024 +0100

    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 at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1373>

diff --git a/os/oscolor.c b/dix/color.c
similarity index 99%
rename from os/oscolor.c
rename to dix/color.c
index 996d684d8..8252e2e88 100644
--- a/os/oscolor.c
+++ b/dix/color.c
@@ -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;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index fc0470501..fb301ea0b 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -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,
diff --git a/dix/dix_priv.h b/dix/dix_priv.h
index 43eb0c706..f189cf50a 100644
--- a/dix/dix_priv.h
+++ b/dix/dix_priv.h
@@ -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 */
diff --git a/dix/meson.build b/dix/meson.build
index fbbcf8646..0b5cfbf8f 100644
--- a/dix/meson.build
+++ b/dix/meson.build
@@ -1,6 +1,7 @@
 srcs_dix = [
     'atom.c',
     'colormap.c',
+    'color.c',
     'cursor.c',
     'devices.c',
     'dispatch.c',
diff --git a/os/meson.build b/os/meson.build
index 2f40a7525..84acc0924 100644
--- a/os/meson.build
+++ b/os/meson.build
@@ -10,7 +10,6 @@ srcs_os = [
     'inputthread.c',
     'io.c',
     'mitauth.c',
-    'oscolor.c',
     'osinit.c',
     'ospoll.c',
     'string.c',
diff --git a/os/osdep.h b/os/osdep.h
index fbe320c71..b6120eef2 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -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);
commit 6cb599f59c18a1204e13dc0c75dd9e50c4c2697a
Author: Enrico Weigelt, metux IT consult <info at metux.net>
Date:   Thu Mar 7 12:44:04 2024 +0100

    os: unexport OsLookupColor()
    
    It's an internal function, only used by DIX, not by drivers and shouldn't
    have been exported in the first place.
    
    Fixes: 49f77fff1495c0a2050fb18f9b1fc627839bbfc2
    Signed-off-by: Enrico Weigelt, metux IT consult <info at metux.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1373>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 6411a5389..fc0470501 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -110,6 +110,7 @@ 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"
diff --git a/include/os.h b/include/os.h
index 848330760..08a546878 100644
--- a/include/os.h
+++ b/include/os.h
@@ -283,14 +283,6 @@ LockServer(void);
 extern _X_EXPORT void
 UnlockServer(void);
 
-extern _X_EXPORT Bool
-OsLookupColor(int /*screen */ ,
-              char * /*name */ ,
-              unsigned /*len */ ,
-              unsigned short * /*pred */ ,
-              unsigned short * /*pgreen */ ,
-              unsigned short * /*pblue */ );
-
 extern _X_EXPORT void
 OsInit(void);
 
diff --git a/os/oscolor.c b/os/oscolor.c
index 5f55b25fb..996d684d8 100644
--- a/os/oscolor.c
+++ b/os/oscolor.c
@@ -49,6 +49,9 @@ SOFTWARE.
 #endif
 
 #include <X11/keysym.h>
+
+#include "os/osdep.h"
+
 #include "dix.h"
 #include "os.h"
 
diff --git a/os/osdep.h b/os/osdep.h
index b6120eef2..fbe320c71 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -166,6 +166,14 @@ 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);


More information about the xorg-commit mailing list