diff --git a/dix/display.c b/dix/display.c new file mode 100644 index 000000000..5e8cf7bc5 --- /dev/null +++ b/dix/display.c @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + */ +#include + +#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; +} diff --git a/dix/globals.c b/dix/globals.c index 5baee0af6..f0ce065df 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -116,7 +116,5 @@ TimeStamp currentTime; int defaultColorVisualClass = -1; int monitorResolution = 0; -const char *display; -int displayfd = -1; Bool explicit_display = FALSE; char *ConnectionInfo; diff --git a/dix/meson.build b/dix/meson.build index aa0c908dc..78f3b1f9e 100644 --- a/dix/meson.build +++ b/dix/meson.build @@ -5,6 +5,7 @@ srcs_dix = [ 'cursor.c', 'devices.c', 'dispatch.c', + 'display.c', 'dixfonts.c', 'main.c', 'dixutils.c', diff --git a/include/dix.h b/include/dix.h index 750b9f8df..33db66b05 100644 --- a/include/dix.h +++ b/include/dix.h @@ -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 */