mirror of https://github.com/odrling/Aegisub
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:
parent
8336c7d97c
commit
238dbb386d
|
@ -386,7 +386,13 @@ void ColorPickerScreenDropper::DropFromScreenXY(int x, int y) {
|
||||||
wxMemoryDC capdc(capture);
|
wxMemoryDC capdc(capture);
|
||||||
capdc.SetPen(*wxTRANSPARENT_PEN);
|
capdc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
#ifndef __WXMAC__
|
#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,
|
capdc.StretchBlit(0, 0, resx * magnification, resy * magnification,
|
||||||
&screen, x - resx / 2, y - resy / 2, resx, resy);
|
&screen, x - resx / 2, y - resy / 2, resx, resy);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue