mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:17:46 +00:00
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.
This commit is contained in:
parent
61af9d882e
commit
f232cb8efe
6 changed files with 99 additions and 14 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue