Re: [PATCH spice-gtk 3/3] win32: clip and move cursor within window region

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

 




----- Original Message -----
> > +    gint xr, yr;
> >  
> > -    gint xr = gdk_screen_get_width(screen) / 2;
> > -    gint yr = gdk_screen_get_height(screen) / 2;
> > -
> > +#ifdef WIN32
> > +    RECT clip;
> > +    g_return_if_fail(GetClipCursor(&clip));
> > +    xr = clip.left + (clip.right - clip.left) / 2;
> > +    yr = clip.top + (clip.bottom - clip.top) / 2;
> > +#endif
> >      if (xr != (gint)motion->x_root || yr != (gint)motion->y_root)
> >      {
> 
> xr and yr are no longer initialized at this point on !WIN32

oops, indeed! I have a bit too much of a windows centric eye these days..

> Patch looks good otherwise.

I am reworking the patch, since it doesn't work when the viewer is in !primary monitor. Something like that:

-    if (!SystemParametersInfo(SPI_GETWORKAREA, 0, &workarea, 0))
+    monitor = MonitorFromRect(&window, MONITOR_DEFAULTTONEAREST);
+    g_return_val_if_fail(monitor != NULL, false);
+
+    mi.cbSize = sizeof(mi);
+    if (!GetMonitorInfo(monitor, &mi))
         goto error;


Unfortunately, I don't have dual-head physical windows machine atm to really test this patch, but it still seems to fail in some corner-cases..


thanks
_______________________________________________
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]