On Fri, 12 Sep 2014 18:05:38 +0200
Luca Barbato <[email protected]> wrote:

> On 12/09/14 17:06, Antonio Ospite wrote:
> > What do you think?
> 
> I prepared a couple of patches that _should_ fix that. The main idea is
> to just register to get the mouse event for the right window (the
> selected screen root window) and just handle the NULL returned when the
> mouse is outside the screen.
>

Hi Luca,

those changes are not enough to cover the multi-screen case, as I
said in
https://lists.libav.org/pipermail/libav-devel/2014-September/063219.html

So the fix in x11grab_read_packet() is still needed, I'll prepare a
proper patch soon.

> The patches are in the ml, I'll put them in the xcb branch in github if
> you want to give them a go.
> 
> > From a logic viewpoint I liked the dedicated XQueryPointer() check inside
> > paint_mouse_pointer() but it's a bit of duplication now that we always
> > call XQueryPointer in x11grab_read_packet() too.
> 
> In xcbgrab the pointer query happens in a separate function and is
> called only once, if you could test and review it on your system would
> be great.
> 

I tried, and the same logic applies to xcbgrab, these changes are
needed to fix the multi-screen scenario:

----------------------------------------------------------------------
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index c7ed168..872c391 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -373,7 +373,7 @@ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     XCBGrabContext *c = s->priv_data;
     xcb_query_pointer_cookie_t pc;
     xcb_get_geometry_cookie_t gc;
-    xcb_query_pointer_reply_t *p  = NULL;
+    xcb_query_pointer_reply_t *p = NULL;
     xcb_get_geometry_reply_t *geo = NULL;
     int ret = 0;

@@ -386,11 +386,10 @@ static int xcbgrab_read_packet(AVFormatContext *s, 
AVPacket *pkt)
         geo = xcb_get_geometry_reply(c->conn, gc, NULL);
     }

-    if (c->follow_mouse) {
+    if (p && p->same_screen && c->follow_mouse)
         xcbgrab_reposition(s, p, geo);
-    }

-    if (c->show_region)
+    if (p && p->same_screen && c->show_region)
         xcbgrab_update_region(s);

 #if CONFIG_LIBXCB_SHM
@@ -401,7 +400,7 @@ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         ret = xcbgrab_frame(s, pkt);

 #if CONFIG_LIBXCB_XFIXES
-    if (c->draw_mouse)
+    if (p && p->same_screen && c->draw_mouse)
         xcbgrab_draw_mouse(s, pkt, p, geo);
 #endif
----------------------------------------------------------------------

maybe the calls to xcb_query_pointer{,_reply} can even be made
unconditional to make the code more readable, let me know what you
think.

Let me know  also if you plan to try the multi-screen setup yourself
with the dummy driver as I outlined in the aforementioned message.

BTW with xcbgrab and show_region on I experience some artifacts in
the region indicator on my setup with the nouveau driver, do you get
them too?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to