Merge branch 'master' of github.com:FreeRDP/FreeRDP

This commit is contained in:
Marc-André Moreau
2013-03-21 16:46:35 -04:00
10 changed files with 77 additions and 36 deletions

View File

@@ -52,6 +52,7 @@ BOOL CALLBACK moncb(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARA
int main(int argc, char* argv[])
{
BOOL screen_selected = FALSE;
int index;
wfServer* server;
@@ -108,6 +109,7 @@ int main(int argc, char* argv[])
if (strcmp("--screen", argv[index]) == 0)
{
screen_selected = TRUE;
index++;
if (index == argc)
{
@@ -127,6 +129,38 @@ int main(int argc, char* argv[])
}
}
if (screen_selected == FALSE)
{
_TCHAR name[128];
int width;
int height;
int bpp;
int i;
_tprintf(_T("screen id not provided. attempting to detect...\n"));
_tprintf(_T("Detecting screens...\n"));
_tprintf(_T("\nID\tResolution\t\tName (Interface)\n\n"));
for (i=0; ; i++)
{
if (get_screen_info(i, name, &width, &height, &bpp) != 0)
{
if ( (width * height * bpp) == 0 )
continue;
_tprintf(_T("%d\t%dx%dx%d\t"), i, width, height, bpp);
_tprintf(_T("%s\n"), name);
set_screen_id(i);
break;
}
else
{
break;
}
}
}
printf("Starting server\n");
wfreerdp_server_start(server);

View File

@@ -50,7 +50,7 @@ int get_screen_info(int id, _TCHAR* name, int* width, int* height, int* bpp)
if (name != NULL)
_stprintf(name, _T("%s (%s)"), dd.DeviceName, dd.DeviceString);
dc = CreateDC(NULL, dd.DeviceName, NULL, NULL);
dc = CreateDC(dd.DeviceName, NULL, NULL, NULL);
*width = GetDeviceCaps(dc, HORZRES);
*height = GetDeviceCaps(dc, VERTRES);
*bpp = GetDeviceCaps(dc, BITSPIXEL);

View File

@@ -186,30 +186,8 @@ BOOL wf_mirror_driver_update(wfInfo* wfi, int mode)
DEVMODE* deviceMode;
LONG disp_change_status;
DWORD dmf_devmodewext_magic_sig = 0xDF20C0DE;
if (mode == MIRROR_LOAD)
{
//first let's get the virtual screen dimentions
wfi->virtscreen_width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
wfi->virtscreen_height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
/*
* Will have to come back to this for supporting non primary displays and multimonitor setups
*/
/*dc = GetDC(NULL);
wfi->servscreen_width = GetDeviceCaps(dc, HORZRES);
wfi->servscreen_height = GetDeviceCaps(dc, VERTRES);
wfi->bitsPerPixel = GetDeviceCaps(dc, BITSPIXEL);
ReleaseDC(NULL, dc);*/
}
else if (mode == MIRROR_UNLOAD)
{
wfi->servscreen_width = 0;
wfi->servscreen_height = 0;
wfi->bitsPerPixel = 0;
}
else
if ( (mode != MIRROR_LOAD) && (mode != MIRROR_UNLOAD) )
{
printf("Invalid mirror mode!\n");
return FALSE;
@@ -227,11 +205,17 @@ BOOL wf_mirror_driver_update(wfInfo* wfi, int mode)
deviceMode->dmSize = sizeof(DEVMODE);
deviceMode->dmDriverExtra = drvExtraSaved;
deviceMode->dmPelsWidth = wfi->virtscreen_width;
deviceMode->dmPelsHeight = wfi->virtscreen_height;
deviceMode->dmBitsPerPel = wfi->bitsPerPixel;
deviceMode->dmPosition.x = wfi->servscreen_xoffset;
deviceMode->dmPosition.y = wfi->servscreen_yoffset;
if (mode == MIRROR_LOAD)
{
wfi->virtscreen_width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
wfi->virtscreen_height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
deviceMode->dmPelsWidth = wfi->virtscreen_width;
deviceMode->dmPelsHeight = wfi->virtscreen_height;
deviceMode->dmBitsPerPel = wfi->bitsPerPixel;
deviceMode->dmPosition.x = wfi->servscreen_xoffset;
deviceMode->dmPosition.y = wfi->servscreen_yoffset;
}
deviceMode->dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_POSITION;

View File

@@ -85,6 +85,7 @@ BOOL wf_peer_post_connect(freerdp_peer* client)
(wfi->bitsPerPixel == 0) )
{
_tprintf(_T("postconnect: error getting screen info for screen %d\n"), wfi->screenID);
_tprintf(_T("\t%dx%dx%d\n"), wfi->servscreen_height, wfi->servscreen_width, wfi->bitsPerPixel);
return FALSE;
}
@@ -224,6 +225,14 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
wfPeerContext* context;
freerdp_peer* client = (freerdp_peer*) lpParam;
if (!getenv("HOME"))
{
char home[MAX_PATH * 2] = "HOME=";
strcat(home, getenv("HOMEDRIVE"));
strcat(home, getenv("HOMEPATH"));
_putenv(home);
}
wf_peer_init(client);
settings = client->settings;