These changes should fix some issues with losing focus before capturing. [skip ci]

This commit is contained in:
RKrom 2014-12-14 22:19:46 +01:00
parent ccd809d4ed
commit dda5b53976
2 changed files with 37 additions and 16 deletions

View file

@ -589,12 +589,20 @@ namespace GreenshotPlugin.Core {
if (capture == null) {
capture = new Capture();
}
Image capturedImage = null;
// If the CaptureHandler has a handle use this, otherwise use the CaptureRectangle here
capture.Image = CaptureHandler.CaptureScreenRectangle != null ? CaptureHandler.CaptureScreenRectangle(captureBounds) : CaptureRectangle(captureBounds);
capture.Location = captureBounds.Location;
if (capture.CaptureDetails != null) {
((Bitmap)capture.Image).SetResolution(capture.CaptureDetails.DpiX, capture.CaptureDetails.DpiY);
if (CaptureHandler.CaptureScreenRectangle != null) {
try {
capturedImage = CaptureHandler.CaptureScreenRectangle(captureBounds);
} catch {
}
}
// If no capture, use the normal screen capture
if (capturedImage == null) {
capturedImage = CaptureRectangle(captureBounds);
}
capture.Image = capturedImage;
capture.Location = captureBounds.Location;
return capture.Image == null ? null : capture;
}