[FFmpeg-devel] [PATCH 1/2] libavdevice/gdigrab: make region window click-throughable
1160386205 at qq.com
1160386205 at qq.com
Wed Mar 31 14:49:52 EEST 2021
From: He Yang <1160386205 at qq.com>
the region window created by option `-show_region`, though only 3 pixel
width, is not click-throughable.
Signed-off-by: He Yang <1160386205 at qq.com>
---
libavdevice/gdigrab.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
index 9b2c55fe90..e9d646999f 100644
--- a/libavdevice/gdigrab.c
+++ b/libavdevice/gdigrab.c
@@ -126,7 +126,7 @@ gdigrab_region_wnd_init(AVFormatContext *s1, struct gdigrab *gdigrab)
HRGN region_interior = NULL;
DWORD style = WS_POPUP | WS_VISIBLE;
- DWORD ex = WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_TRANSPARENT;
+ DWORD ex = WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_LAYERED | WS_EX_TRANSPARENT;
rect.left -= REGION_WND_BORDER; rect.top -= REGION_WND_BORDER;
rect.right += REGION_WND_BORDER; rect.bottom += REGION_WND_BORDER;
@@ -143,6 +143,9 @@ gdigrab_region_wnd_init(AVFormatContext *s1, struct gdigrab *gdigrab)
goto error;
}
+ // Set the window transparency to 255 (opaque)
+ SetLayeredWindowAttributes(hwnd, 0, 255, LWA_ALPHA);
+
// Set the window shape to only include the border area
GetClientRect(hwnd, &rect);
region = CreateRectRgn(0, 0,
--
2.30.0.windows.2
More information about the ffmpeg-devel
mailing list