[Spice-devel] [PATCH vdagent-win] vdagent: enable disabled monitor with default resolution

agilboa at redhat.com agilboa at redhat.com
Sun Apr 21 02:12:46 PDT 2013


On 04/19/2013 12:31 PM, Christophe Fergeau wrote:
> On Thu, Apr 18, 2013 at 11:44:15PM +0300, agilboa at redhat.com wrote:
>> On 04/18/2013 09:30 PM, Christophe Fergeau wrote:
>>> Hey Arnon,
>>>
>>> On Thu, Apr 18, 2013 at 08:58:30PM +0300, Arnon Gilboa wrote:
>>>> When enabling a disabled monitor, init_dev_mod() "failed to create DC",
>>>> and therefore due to the custom resolution received, in set_displays()
>>>> "No suitable mode found for display".
>>> Looking at init_dev_mode(), I don't really think this is related to the
>>> custom resolution. If I'm reading init_dev_mode() properly, the "failed to
>>> create DC" error is returned before trying to use the custom resolution. My
>>> guess would be that this function fails because the monitor is
>>> disabled/turned off.
>> sure, but when it's disabled -> you fail to create a DC -> cannot
>> set a custom resolution when you enable it.
> To my eyes, the root cause is that the monitor is disabled, and the way the
> code is laid out does not cope well with disabled monitors.
> After reading
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd162617%28v=vs.85%29.aspx
> I wonder if it would be enough to move the
> LONG ret = ChangeDisplaySettingsEx(dev_info.DeviceName, &dev_mode, NULL,
>                                     CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
>
> call from set_displays() to before setting the custom resolution with
> ExtEscape. This ChangeDisplaySettingsEx call will be done with
> DM_POSITION set in dev_mode->dmFields, and the link above says:
> "To add a display monitor to a multiple-monitor system programmatically,
> set DEVMODE.dmFields to DM_POSITION and specify a position (using
> DEVMODE.dmPosition ) for the monitor you are adding " (I read this as 'this
> call will enable the monitor')
But this exact ChangeDisplaySettingsEx call is already there before 
ExtEscape, isn't it?
http://git.app.eng.bos.redhat.com/?p=spice/win/vdagent.git;a=blob;f=vdagent/desktop_layout.cpp;h=bce9ac0e#l256

>
> Christophe



More information about the Spice-devel mailing list