diff options
author | Tom <tomut@yahoo.com> | 2021-06-18 21:42:25 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-20 14:57:26 +0200 |
commit | f232cb8efe67e72d25fd9bcb6788db78c3700008 (patch) | |
tree | 8e1791af9e982a501670dd390e8025518cfef886 /Userland/Utilities | |
parent | 61af9d882e33ac3c9bec583e4651326cac338b29 (diff) | |
download | serenity-f232cb8efe67e72d25fd9bcb6788db78c3700008.zip |
WindowServer: Enable screen capture to span multiple screens
This enables the shot utility to capture all screens or just one, and
enables the Magnifier application to track the mouse cursor across
multiple screens.
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/shot.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp index 7897ea2230..c25ff95573 100644 --- a/Userland/Utilities/shot.cpp +++ b/Userland/Utilities/shot.cpp @@ -21,10 +21,12 @@ int main(int argc, char** argv) String output_path; bool output_to_clipboard = false; int delay = 0; + int screen = -1; args_parser.add_positional_argument(output_path, "Output filename", "output", Core::ArgsParser::Required::No); args_parser.add_option(output_to_clipboard, "Output to clipboard", "clipboard", 'c'); args_parser.add_option(delay, "Seconds to wait before taking a screenshot", "delay", 'd', "seconds"); + args_parser.add_option(screen, "The index of the screen (default: -1 for all screens)", "screen", 's', "index"); args_parser.parse(argc, argv); @@ -34,7 +36,12 @@ int main(int argc, char** argv) auto app = GUI::Application::construct(argc, argv); sleep(delay); - auto shared_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap({}); + Optional<u32> screen_index; + if (screen >= 0) + screen_index = (u32)screen; + dbgln("getting screenshot..."); + auto shared_bitmap = GUI::WindowServerConnection::the().get_screen_bitmap({}, screen_index); + dbgln("got screenshot"); auto* bitmap = shared_bitmap.bitmap(); if (!bitmap) { |