[PATCH xf86-video-nested 03/10] Add preliminary support for screen options "Fullscreen" and "Output" in xorg.conf
Laércio de Sousa
laerciosousa at sme-mogidascruzes.sp.gov.br
Thu Nov 5 01:14:59 PST 2015
This patch introduces support for new screen options in xorg.conf, namely:
"Fullscreen" and "Output". They are expected to work exactly as command-line
options -fullscreen and -output for Xephyr, allowing to open nested Xorg
window in fullscreen mode (restricted to given host X server output
if option "Output" is set).
In order to achieve this, NestedClientCheckDisplay() needs to be extended
to allow collecting fullscreen geometry from host X server while
checking if it's ready for connections, which has to be implemented
on each backend client.
NestedClientCreateScreen() also was extended to include a boolean
argument that tells backend client if it needs to set appropriate fullscreen
hint for nested Xorg window.
Signed-off-by: Laércio de Sousa <laerciosousa at sme-mogidascruzes.sp.gov.br>
---
src/client.h | 8 ++++-
src/driver.c | 101 ++++++++++++++++++++++++++++++++++++++++---------------
src/xlibclient.c | 8 ++++-
3 files changed, 87 insertions(+), 30 deletions(-)
diff --git a/src/client.h b/src/client.h
index 7f46844..30319c2 100644
--- a/src/client.h
+++ b/src/client.h
@@ -39,11 +39,17 @@
struct NestedClientPrivate;
typedef struct NestedClientPrivate *NestedClientPrivatePtr;
-Bool NestedClientCheckDisplay();
+Bool NestedClientCheckDisplay(int scrnIndex,
+ const char *output,
+ int *width,
+ int *height,
+ int *x,
+ int *y);
Bool NestedClientValidDepth(int depth);
NestedClientPrivatePtr NestedClientCreateScreen(int scrnIndex,
+ Bool wantFullscreenHint,
int width,
int height,
int originX,
diff --git a/src/driver.c b/src/driver.c
index 0c2f26a..74c7d93 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -97,7 +97,9 @@ void NestedPrintMode(ScrnInfoPtr p, DisplayModePtr m);
typedef enum {
OPTION_DISPLAY,
OPTION_XAUTHORITY,
- OPTION_ORIGIN
+ OPTION_ORIGIN,
+ OPTION_FULLSCREEN,
+ OPTION_OUTPUT
} NestedOpts;
typedef enum {
@@ -113,10 +115,14 @@ static SymTabRec NestedChipsets[] = {
* port NestedClient to something that's not Xlib/Xcb we might need to add some
* custom options */
static OptionInfoRec NestedOptions[] = {
- { OPTION_DISPLAY, "Display", OPTV_STRING, {0}, FALSE },
- { OPTION_XAUTHORITY, "Xauthority", OPTV_STRING, {0}, FALSE },
- { OPTION_ORIGIN, "Origin", OPTV_STRING, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE }
+ { OPTION_DISPLAY, "Display", OPTV_STRING, {0}, FALSE },
+ { OPTION_XAUTHORITY, "Xauthority", OPTV_STRING, {0}, FALSE },
+ { OPTION_DISPLAY, "Display", OPTV_STRING, {0}, FALSE },
+ { OPTION_XAUTHORITY, "Xauthority", OPTV_STRING, {0}, FALSE },
+ { OPTION_ORIGIN, "Origin", OPTV_STRING, {0}, FALSE },
+ { OPTION_FULLSCREEN, "Fullscreen", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_OUTPUT, "Output", OPTV_STRING, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
};
_X_EXPORT DriverRec NESTED = {
@@ -167,6 +173,10 @@ _X_EXPORT XF86ModuleData nestedModuleData = {
typedef struct NestedPrivate {
int originX;
int originY;
+ int fullWidth;
+ int fullHeight;
+ Bool fullscreen;
+ const char *output;
NestedClientPrivatePtr clientData;
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
@@ -321,6 +331,10 @@ static Bool NestedPreInit(ScrnInfoPtr pScrn, int flags) {
pNested = PNESTED(pScrn);
pNested->originX = 0;
pNested->originY = 0;
+ pNested->fullWidth = 0;
+ pNested->fullHeight = 0;
+ pNested->fullscreen = FALSE;
+ pNested->output = NULL;
if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb))
return FALSE;
@@ -370,9 +384,25 @@ static Bool NestedPreInit(ScrnInfoPtr pScrn, int flags) {
pNested->originX, pNested->originY);
}
+ if (xf86GetOptValBool(NestedOptions, OPTION_FULLSCREEN, &pNested->fullscreen))
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fullscreen mode %s\n",
+ pNested->fullscreen ? "enabled" : "disabled");
+
+ if (xf86IsOptionSet(NestedOptions, OPTION_OUTPUT)) {
+ pNested->output = xf86GetOptValString(NestedOptions,
+ OPTION_OUTPUT);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Targeting host X server output \"%s\"\n",
+ pNested->output);
+ }
+
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
- if (!NestedClientCheckDisplay()) {
+ if (!NestedClientCheckDisplay(pScrn->scrnIndex,
+ pNested->output,
+ &pNested->fullWidth,
+ &pNested->fullHeight,
+ &pNested->originX,
+ &pNested->originY)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Can't open display: %s\n",
displayName);
return FALSE;
@@ -422,33 +452,47 @@ NestedValidateModes(ScrnInfoPtr pScrn) {
DisplayModePtr mode;
int i, width, height, ret = 0;
int maxX = 0, maxY = 0;
+ NestedPrivatePtr pNested = PNESTED(pScrn);
- /* Print useless stuff */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor wants these modes:\n");
- for(mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, " %s (%dx%d)\n", mode->name,
- mode->HDisplay, mode->VDisplay);
- }
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Too bad for it...\n");
-
- /* If user requested modes, add them. If not, use 640x480 */
- if (pScrn->display->modes != NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "User wants these modes:\n");
- for(i = 0; pScrn->display->modes[i] != NULL; i++) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, " %s\n",
- pScrn->display->modes[i]);
- if (sscanf(pScrn->display->modes[i], "%dx%d", &width,
- &height) != 2) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "This is not the mode name I was expecting...\n");
- return 0;
+ if (pNested->output != NULL || pNested->fullscreen) {
+ if (!NestedAddMode(pScrn, pNested->fullWidth, pNested->fullHeight)) {
+ return 0;
+ }
+ } else {
+ /* Print useless stuff */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Monitor wants these modes:\n");
+
+ for(mode = pScrn->monitor->Modes; mode != NULL; mode = mode->next) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, " %s (%dx%d)\n", mode->name,
+ mode->HDisplay, mode->VDisplay);
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Too bad for it...\n");
+
+ /* If user requested modes, add them. If not, use 640x480 */
+ if (pScrn->display->modes != NULL && pScrn->display->modes[0] != NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "User wants these modes:\n");
+
+ for(i = 0; pScrn->display->modes[i] != NULL; i++) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, " %s\n",
+ pScrn->display->modes[i]);
+
+ if (sscanf(pScrn->display->modes[i], "%dx%d", &width,
+ &height) != 2) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "This is not the mode name I was expecting...\n");
+ return 0;
+ }
+
+ if (!NestedAddMode(pScrn, width, height)) {
+ return 0;
+ }
}
+
if (!NestedAddMode(pScrn, width, height)) {
return 0;
}
- }
- } else {
- if (!NestedAddMode(pScrn, 640, 480)) {
+ } else if (!NestedAddMode(pScrn, 640, 480)) {
return 0;
}
}
@@ -570,6 +614,7 @@ static Bool NestedScreenInit(SCREEN_INIT_ARGS_DECL)
//Load_Nested_Mouse();
pNested->clientData = NestedClientCreateScreen(pScrn->scrnIndex,
+ pNested->output != NULL || pNested->fullscreen,
pScrn->virtualX,
pScrn->virtualY,
pNested->originX,
diff --git a/src/xlibclient.c b/src/xlibclient.c
index c5aaf96..1ebd643 100644
--- a/src/xlibclient.c
+++ b/src/xlibclient.c
@@ -79,7 +79,12 @@ struct NestedClientPrivate {
/* Checks if a display is open */
Bool
-NestedClientCheckDisplay() {
+NestedClientCheckDisplay(int scrnIndex,
+ const char *output,
+ int *width,
+ int *height,
+ int *x,
+ int *y) {
Display *d;
d = XOpenDisplay(NULL);
@@ -160,6 +165,7 @@ NestedClientTryXShm(NestedClientPrivatePtr pPriv, int scrnIndex, int width, int
NestedClientPrivatePtr
NestedClientCreateScreen(int scrnIndex,
+ Bool wantFullscreenHint,
int width,
int height,
int originX,
--
2.1.4
More information about the xorg-devel
mailing list