dix: add getter for display name

Xrdp needs to know the current display name (for setting up it's
own server sockets accordingly). Instead of exporting an internal
field, adding a little getter for this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1783>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-11 19:08:30 +01:00
parent 80a3df55ae
commit 2e0c19b6d9
4 changed files with 31 additions and 2 deletions

19
dix/display.c Normal file
View File

@ -0,0 +1,19 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#include <dix-config.h>
#include "dix/dix_priv.h"
#include "include/dix.h"
#include "include/screenint.h"
const char *display = "0";
int displayfd = -1;
const char *dixGetDisplayName(ScreenPtr *pScreen)
{
// pScreen currently is ignored as the value is global,
// but this might perhaps change in the future.
return display;
}

View File

@ -116,7 +116,5 @@ TimeStamp currentTime;
int defaultColorVisualClass = -1;
int monitorResolution = 0;
const char *display;
int displayfd = -1;
Bool explicit_display = FALSE;
char *ConnectionInfo;

View File

@ -5,6 +5,7 @@ srcs_dix = [
'cursor.c',
'devices.c',
'dispatch.c',
'display.c',
'dixfonts.c',
'main.c',
'dixutils.c',

View File

@ -407,4 +407,15 @@ IsFloating(DeviceIntPtr dev);
extern _X_EXPORT void *lastGLContext;
/**
* @brief get display string for given screen
*
* Entry point for drivers/modules that really need to know what
* display ID we're running on (eg. xrdp).
*
* @param pScreen pointer to ScreenRec to query.
* @return pointer to string, valid as long as the pScreen is, owned by DIX.
*/
_X_EXPORT const char *dixGetDisplayName(ScreenPtr *pScreen);
#endif /* DIX_H */