mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
Demos: Use pledge and unveil
This commit is contained in:
parent
e8ff7c895b
commit
9faca895d3
8 changed files with 115 additions and 0 deletions
|
@ -193,6 +193,21 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
|
|
||||||
|
if (pledge("stdio rpath shared_buffer", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_double_buffering_enabled(true);
|
window->set_double_buffering_enabled(true);
|
||||||
window->set_title("Cube");
|
window->set_title("Cube");
|
||||||
|
|
|
@ -62,6 +62,16 @@ int main(int argc, char* argv[])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ((grid_rows > 0) ^ (grid_columns > 0)) {
|
if ((grid_rows > 0) ^ (grid_columns > 0)) {
|
||||||
warnln("Expected either both or none of 'grid-rows' and 'grid-cols' to be passed.");
|
warnln("Expected either both or none of 'grid-rows' and 'grid-cols' to be passed.");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -216,6 +216,21 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
|
|
||||||
|
if (pledge("stdio rpath shared_buffer", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_double_buffering_enabled(false);
|
window->set_double_buffering_enabled(false);
|
||||||
window->set_title("Fire");
|
window->set_title("Fire");
|
||||||
|
|
|
@ -37,6 +37,21 @@ int main(int argc, char** argv)
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
auto app_icon = GUI::Icon::default_icon("app-hello-world");
|
auto app_icon = GUI::Icon::default_icon("app-hello-world");
|
||||||
|
|
||||||
|
if (pledge("stdio rpath shared_buffer", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->resize(240, 160);
|
window->resize(240, 160);
|
||||||
window->set_title("Hello World!");
|
window->set_title("Hello World!");
|
||||||
|
|
|
@ -199,6 +199,21 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
|
|
||||||
|
if (pledge("stdio rpath shared_buffer", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_double_buffering_enabled(true);
|
window->set_double_buffering_enabled(true);
|
||||||
window->set_title("LibGfx Demo");
|
window->set_title("LibGfx Demo");
|
||||||
|
|
|
@ -175,6 +175,21 @@ int main(int argc, char** argv)
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
auto app_icon = GUI::Icon::default_icon("app-mouse");
|
auto app_icon = GUI::Icon::default_icon("app-mouse");
|
||||||
|
|
||||||
|
if (pledge("stdio rpath shared_buffer", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_title("Mouse button demo");
|
window->set_title("Mouse button demo");
|
||||||
window->set_icon(app_icon.bitmap_for_size(16));
|
window->set_icon(app_icon.bitmap_for_size(16));
|
||||||
|
|
|
@ -136,6 +136,21 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
|
|
||||||
|
if (pledge("stdio rpath shared_buffer", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->set_double_buffering_enabled(true);
|
window->set_double_buffering_enabled(true);
|
||||||
window->set_title("Screensaver");
|
window->set_title("Screensaver");
|
||||||
|
|
|
@ -85,6 +85,21 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(argc, argv);
|
||||||
|
|
||||||
|
if (pledge("stdio rpath shared_buffer", nullptr) < 0) {
|
||||||
|
perror("pledge");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil("/res", "r") < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto app_icon = GUI::Icon::default_icon("app-widget-gallery");
|
auto app_icon = GUI::Icon::default_icon("app-widget-gallery");
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue