Restrict color picker's screenshot to window

This fixes issues like Aegisub/Aegisub#264 with taking
screenshots on linux, especially with wxgtk3 or wayland.
This commit is contained in:
arch1t3cht 2022-07-12 20:27:56 +02:00
parent 8336c7d97c
commit 238dbb386d
1 changed files with 7 additions and 1 deletions

View File

@ -386,7 +386,13 @@ void ColorPickerScreenDropper::DropFromScreenXY(int x, int y) {
wxMemoryDC capdc(capture);
capdc.SetPen(*wxTRANSPARENT_PEN);
#ifndef __WXMAC__
wxScreenDC screen;
wxWindow *superparent = GetParent();
while (superparent->GetParent() != nullptr) {
superparent = superparent->GetParent();
}
superparent->ScreenToClient(&x, &y);
wxWindowDC screen(superparent);
capdc.StretchBlit(0, 0, resx * magnification, resy * magnification,
&screen, x - resx / 2, y - resy / 2, resx, resy);
#else