829378bba8
For some window managers (fvwm2 and fvwm3) if the X server isn't running and has output it's possible for the window manager to fail or reconfigure randr incorrectly. With xrdp-waitfox: - Install xrdp-waitfox to the BIN dir. - sesman will run xrdp-waitfox as the logged in user. - Set an alarm to exit after 30 seconds. - Try to open env DISPLAY value's display (10 seconds). - Test for RandR extension. - Wait for outputs to appear (10 seconds).
48 lines
978 B
C
48 lines
978 B
C
#if defined(HAVE_CONFIG_H)
|
|
#include "config_ac.h"
|
|
#endif
|
|
|
|
#include "log.h"
|
|
#include "os_calls.h"
|
|
#include "string_calls.h"
|
|
#include "xwait.h"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
/******************************************************************************/
|
|
int
|
|
wait_for_xserver(int display)
|
|
{
|
|
FILE *dp = NULL;
|
|
int ret = 0;
|
|
char buffer[100];
|
|
char exe_cmd[262];
|
|
|
|
LOG(LOG_LEVEL_DEBUG, "Waiting for X server to start on display %d", display);
|
|
|
|
g_snprintf(exe_cmd, sizeof(exe_cmd), "%s/xrdp-waitforx", XRDP_BIN_PATH);
|
|
dp = popen(exe_cmd, "r");
|
|
if (dp == NULL)
|
|
{
|
|
LOG(LOG_LEVEL_ERROR, "Unable to launch xrdp-waitforx");
|
|
return 1;
|
|
}
|
|
|
|
while (fgets(buffer, 100, dp))
|
|
{
|
|
g_strtrim(buffer, 2);
|
|
LOG(LOG_LEVEL_DEBUG, "%s", buffer);
|
|
}
|
|
|
|
ret = pclose(dp);
|
|
if (ret != 0)
|
|
{
|
|
LOG(LOG_LEVEL_ERROR, "An error occurred while running xrdp-waitforx");
|
|
return 0;
|
|
}
|
|
|
|
|
|
return 1;
|
|
}
|