[gimp/gimp-2-10] Issue #4009: enables option to capture cursor in screenshot (Windows)
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #4009: enables option to capture cursor in screenshot (Windows)
- Date: Wed, 19 Jan 2022 14:38:44 +0000 (UTC)
commit d0690f3c40a2f20f259296f88dbaf3ae5afa4331
Author: Nikc <nikcdc gmail com>
Date: Wed Jan 19 01:28:47 2022 +0000
Issue #4009: enables option to capture cursor in screenshot (Windows)
(cherry picked from commit 94c7f80282e1deeaa20905b05cb336c805e022c4)
plug-ins/screenshot/screenshot-win32.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/screenshot/screenshot-win32.c b/plug-ins/screenshot/screenshot-win32.c
index e8961f533f..ff8cbc4752 100644
--- a/plug-ins/screenshot/screenshot-win32.c
+++ b/plug-ins/screenshot/screenshot-win32.c
@@ -81,7 +81,8 @@ static ICONINFO iconInfo;
static MAGIMAGEHEADER returnedSrcheader;
static int rectScreensCount = 0;
-static gint32 *image_id;
+static gint32 *image_id;
+static gboolean capturePointer = FALSE;
static void sendBMPToGimp (HBITMAP hBMP,
HDC hDC,
@@ -158,7 +159,8 @@ ScreenshotCapabilities
screenshot_win32_get_capabilities (void)
{
return (SCREENSHOT_CAN_SHOOT_DECORATIONS |
- SCREENSHOT_CAN_SHOOT_WINDOW);
+ SCREENSHOT_CAN_SHOOT_WINDOW |
+ SCREENSHOT_CAN_SHOOT_POINTER);
}
GimpPDBStatusType
@@ -176,6 +178,7 @@ screenshot_win32_shoot (ScreenshotValues *shootvals,
image_id = image_ID;
winsnapvals.delay = shootvals->screenshot_delay;
+ capturePointer = shootvals->show_cursor;
if (shootvals->shoot_type == SHOOT_ROOT)
{
@@ -463,6 +466,14 @@ primDoWindowCapture (HDC hdcWindow,
return NULL;
}
+ /* Draw mouse pointer over screenshot if option was selected */
+ if (capturePointer)
+ {
+ CURSORINFO pointer = { sizeof (pointer) };
+ GetCursorInfo (&pointer);
+ DrawIcon (hdcCompat, pointer.ptScreenPos.x, pointer.ptScreenPos.y, GetCursor());
+ }
+
/* Restore the original object */
SelectObject (hdcCompat, oldObject);
@@ -768,6 +779,7 @@ doCaptureMagnificationAPI (HWND selectedHwnd,
HWND excludeWins[24];
RECT round4Rect;
int excludeWinsCount = 0;
+ int magStyles;
if (!LoadMagnificationLibrary ()) return FALSE;
@@ -788,9 +800,13 @@ doCaptureMagnificationAPI (HWND selectedHwnd,
SetLayeredWindowAttributes (hwndHost, (COLORREF)0, (BYTE)255, (DWORD)0x02);
+ magStyles = WS_CHILD;
+ if (capturePointer)
+ magStyles |= MS_SHOWMAGNIFIEDCURSOR;
+
/* Create the mag child window inside the host window */
hwndMag = CreateWindow (WC_MAGNIFIER, TEXT ("MagnifierWindow"),
- WS_CHILD /*| MS_SHOWMAGNIFIEDCURSOR*/ /*| WS_VISIBLE*/,
+ magStyles,
0, 0, round4Rect.right - round4Rect.left, round4Rect.bottom - round4Rect.top,
hwndHost, NULL, GetModuleHandle (NULL), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]