Re: [PATCH win-vdagent] Don't refresh displays config when updating

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/19/2014 08:20 PM, Marc-André Lureau wrote:
> wnd_proc() is called during ChangeDisplaySettings(), when handling
> monitors config. However, calling get_displays() will overwrite the
> desired config.
> 
> So, while updating from 1 to 4 enabled monitors, when the 2nd monitor
> config is enabled, the current config is read, and overwrite the rest of
> the config, so first time only 2nd monitor is enabled, second time, 3rd
> monitor etc.
> 

ACK

nice comment ;)

> https://bugzilla.redhat.com/show_bug.cgi?id=1111144
> ---
>  vdagent/vdagent.cpp | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
> index 15216d9..aa44383 100644
> --- a/vdagent/vdagent.cpp
> +++ b/vdagent/vdagent.cpp
> @@ -148,6 +148,7 @@ private:
>      bool _running;
>      bool _desktop_switch;
>      DesktopLayout* _desktop_layout;
> +    bool _updating_display_config;
>      DisplaySetting _display_setting;
>      FileXfer _file_xfer;
>      HANDLE _vio_serial;
> @@ -615,11 +616,14 @@ bool VDAgent::handle_mouse_event(VDAgentMouseState* state)
>  
>  bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port)
>  {
> +    VDAgent* a = _singleton;
>      VDIChunk* reply_chunk;
>      VDAgentMessage* reply_msg;
>      VDAgentReply* reply;
>      size_t display_count;
>  
> +    a->_updating_display_config = true;
> +
>      display_count = _desktop_layout->get_display_count();
>      for (uint32_t i = 0; i < display_count; i++) {
>          DisplayMode* mode = _desktop_layout->get_display(i);
> @@ -649,6 +653,10 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port
>          _desktop_layout->set_displays();
>      }
>  
> +    a->_updating_display_config = false;
> +    /* refresh again, in case something else changed */
> +    a->_desktop_layout->get_displays();
> +
>      DWORD msg_size = VD_MESSAGE_HEADER_SIZE + sizeof(VDAgentReply);
>      reply_chunk = new_chunk(msg_size);
>      if (!reply_chunk) {
> @@ -1439,7 +1447,8 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
>          vd_printf("Display change");
>          // the desktop layout needs to be updated for the mouse
>          // position to be scaled correctly
> -        a->_desktop_layout->get_displays();
> +        if (!a->_updating_display_config)
> +            a->_desktop_layout->get_displays();
>          break;
>      case WM_TIMER:
>          a->send_input();
> 

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]