Closed N-R-K closed 1 year ago
(this may help with: https://github.com/resurrecting-open-source-projects/scrot/issues/284)
Just noticed that that bug happens on classic selection mode, not edge. I'll remove that part of the commit message before merging.
This PR breaks what you want to avoid. That the selection line does not appear in the capture.
scrot --select=hide --line mode=edge,width=4,color=red
This PR breaks what you want to avoid. That the selection line does not appear in the capture.
Weird, it's working fine on my end. The selection line doesn't appear on the shot:
@daltomi A couple questions
diff --git a/src/selection_edge.c b/src/selection_edge.c
index f0cc3c7..94ac4d1 100644
--- a/src/selection_edge.c
+++ b/src/selection_edge.c
@@ -135,6 +135,7 @@ void selectionEdgeDestroy(void)
if (ev.type == DestroyNotify && ev.xdestroywindow.window == pe->wndDraw)
break;
}
+ nanosleep(&(struct timespec){ .tv_nsec = 120 * 1000L * 1000L }, NULL);
XFree(pe->classHint);
}
Yes with composer, but it also fails without composer: if you select on a window that plays video, the drag is shown:
The master
branch works fine. (I originally implemented the delay to avoid these issues, answering your second question)
I originally implemented the delay to avoid these issues, answering your second question
I see, I think I understand why this is happening a bit better now. Although we received a DestroyNotify
event, the frame still might not have been updated. Or a compositor might be buffering frames.
I pushed a new commit adding the delay back. I think it should fix the issue. (I've also added a comment, because it's not obvious why there's a sleep there).
Now it works well.
Thanks for confirming. Looks like my understanding was correct.
I've merged the sleep for now, but I think we'd want to see if there's a more reliable way to detect repaint. I'll open a separate issue for it soon.
None
rather than0
. no functional difference, but usingNone
is more idiomatic for X11 things.