mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
1682f0b760
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2021, Nico Weber <thakis@chromium.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibCore/ArgsParser.h>
|
|
#include <LibGUI/Application.h>
|
|
#include <LibGUI/WindowServerConnection.h>
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
int width = -1;
|
|
int height = -1;
|
|
int scale = 1;
|
|
|
|
Core::ArgsParser args_parser;
|
|
args_parser.set_general_help("Change the screen resolution.");
|
|
args_parser.add_positional_argument(width, "Width", "width");
|
|
args_parser.add_positional_argument(height, "Height", "height");
|
|
args_parser.add_positional_argument(scale, "Scale Factor", "scale", Core::ArgsParser::Required::No);
|
|
args_parser.parse(argc, argv);
|
|
|
|
// A Core::EventLoop is all we need, but WindowServerConnection needs a full Application object.
|
|
char* dummy_argv[] = { argv[0] };
|
|
auto app = GUI::Application::construct(1, dummy_argv);
|
|
auto result = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetResolution>(Gfx::IntSize { width, height }, scale);
|
|
if (!result->success()) {
|
|
warnln("failed to set resolution");
|
|
return 1;
|
|
}
|
|
}
|