diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2014-03-26 19:21:20 +0000 |
---|---|---|
committer | <> | 2014-05-08 15:03:54 +0000 |
commit | fb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch) | |
tree | c2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/x11/VBoxClient/display.cpp | |
parent | 58ed4748338f9466599adfc8a9171280ed99e23f (diff) | |
download | VirtualBox-master.tar.gz |
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/x11/VBoxClient/display.cpp')
-rw-r--r-- | src/VBox/Additions/x11/VBoxClient/display.cpp | 78 |
1 files changed, 65 insertions, 13 deletions
diff --git a/src/VBox/Additions/x11/VBoxClient/display.cpp b/src/VBox/Additions/x11/VBoxClient/display.cpp index d6889023..e4a0eb48 100644 --- a/src/VBox/Additions/x11/VBoxClient/display.cpp +++ b/src/VBox/Additions/x11/VBoxClient/display.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -157,6 +157,7 @@ static int runDisplay(Display *pDisplay) Cursor hClockCursor = XCreateFontCursor(pDisplay, XC_watch); Cursor hArrowCursor = XCreateFontCursor(pDisplay, XC_left_ptr); int RRMaj, RRMin; + bool fExtDispReqSupport = true; if (!XRRQueryVersion(pDisplay, &RRMaj, &RRMin)) RRMin = 0; const char *pcszXrandr = "xrandr"; @@ -168,7 +169,8 @@ static int runDisplay(Display *pDisplay) return rc; while (true) { - uint32_t fEvents = 0, cx = 0, cy = 0, cBits = 0, iDisplay = 0; + uint32_t fEvents = 0, cx = 0, cy = 0, cBits = 0, iDisplay = 0, cxOrg = 0, cyOrg = 0; + bool fEnabled = false; rc = VbglR3WaitEvent( VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST | VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED, RT_INDEFINITE_WAIT, &fEvents); @@ -189,8 +191,20 @@ static int runDisplay(Display *pDisplay) * driver has had a chance to update its list. */ if (RT_SUCCESS(rc) && (fEvents & VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST)) { - int rc2 = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBits, - &iDisplay, true); + int rc2 = VbglR3GetDisplayChangeRequestEx(&cx, &cy, &cBits, + &iDisplay, &cxOrg, &cyOrg, &fEnabled, true); + /* Extended display version not supported on host */ + if (RT_FAILURE(rc2)) + { + LogRel(("GetDisplayChangeReq Extended Version not supported. " + "Trying for Normal Mode with cx=%d & cy=%d\n", cx, cy)); + fExtDispReqSupport = false; + rc2 = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBits, &iDisplay, true); + } + else + LogRelFlowFunc(("Got Extended Param from Host cx=%d, cy=%d, bpp=%d, iDisp=%d, " + "OrgX=%d, OrgY=%d Enb=%d\n", cx, cy, cBits, iDisplay, + cxOrg, cyOrg, fEnabled)); /* If we are not stopping, sleep for a bit to avoid using up too much CPU while retrying. */ if (RT_FAILURE(rc2)) @@ -201,18 +215,56 @@ static int runDisplay(Display *pDisplay) else { char szCommand[256]; - RTStrPrintf(szCommand, sizeof(szCommand), - "%s --output VBOX%u --set VBOX_MODE %dx%d", - pcszXrandr, iDisplay, cx, cy); - system(szCommand); - RTStrPrintf(szCommand, sizeof(szCommand), - "%s --output VBOX%u --preferred", - pcszXrandr, iDisplay); - system(szCommand); + if (fExtDispReqSupport) + { + if (fEnabled) + { + if (cx != 0 && cy != 0) + { + RTStrPrintf(szCommand, sizeof(szCommand), + "%s --output VBOX%u --set VBOX_MODE %dx%d", + pcszXrandr, iDisplay, cx, cy); + system(szCommand); + } + /* Extended Display support possible . Secondary monitor position supported */ + if (cxOrg != 0 || cyOrg != 0) + { + RTStrPrintf(szCommand, sizeof(szCommand), + "%s --output VBOX%u --auto --pos %dx%d", + pcszXrandr, iDisplay, cxOrg, cyOrg); + system(szCommand); + } + RTStrPrintf(szCommand, sizeof(szCommand), + "%s --output VBOX%u --preferred", + pcszXrandr, iDisplay); + system(szCommand); + } + else /* disable the virtual monitor */ + { + RTStrPrintf(szCommand, sizeof(szCommand), + "%s --output VBOX%u --off", + pcszXrandr, iDisplay); + system(szCommand); + } + } + else /* Extended display support not possible */ + { + if (cx != 0 && cy != 0) + { + RTStrPrintf(szCommand, sizeof(szCommand), + "%s --output VBOX%u --set VBOX_MODE %dx%d", + pcszXrandr, iDisplay, cx, cy); + system(szCommand); + RTStrPrintf(szCommand, sizeof(szCommand), + "%s --output VBOX%u --preferred", + pcszXrandr, iDisplay); + system(szCommand); + } + } + } } } - LogRelFlowFunc(("returning VINF_SUCCESS\n")); return VINF_SUCCESS; } |