summaryrefslogtreecommitdiff
path: root/Demos
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2020-11-01 19:37:48 +0000
committerAndreas Kling <kling@serenityos.org>2020-11-02 13:15:54 +0100
commit9faca895d36a2929a81a50890ccecb112d643388 (patch)
treec5fef694a74d9db6814bad0e8596dfd5a275689b /Demos
parente8ff7c895ba991f9d9a5ef2b5c276c7b8674ce1b (diff)
downloadserenity-9faca895d36a2929a81a50890ccecb112d643388.zip
Demos: Use pledge and unveil
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Cube/Cube.cpp15
-rw-r--r--Demos/Eyes/main.cpp10
-rw-r--r--Demos/Fire/Fire.cpp15
-rw-r--r--Demos/HelloWorld/main.cpp15
-rw-r--r--Demos/LibGfxDemo/main.cpp15
-rw-r--r--Demos/Mouse/main.cpp15
-rw-r--r--Demos/Screensaver/Screensaver.cpp15
-rw-r--r--Demos/WidgetGallery/main.cpp15
8 files changed, 115 insertions, 0 deletions
diff --git a/Demos/Cube/Cube.cpp b/Demos/Cube/Cube.cpp
index cdb2f6c484..f7273c7d79 100644
--- a/Demos/Cube/Cube.cpp
+++ b/Demos/Cube/Cube.cpp
@@ -193,6 +193,21 @@ int main(int argc, char** 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();
window->set_double_buffering_enabled(true);
window->set_title("Cube");
diff --git a/Demos/Eyes/main.cpp b/Demos/Eyes/main.cpp
index 35fcf28331..c7218465d3 100644
--- a/Demos/Eyes/main.cpp
+++ b/Demos/Eyes/main.cpp
@@ -62,6 +62,16 @@ int main(int argc, char* argv[])
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)) {
warnln("Expected either both or none of 'grid-rows' and 'grid-cols' to be passed.");
return 1;
diff --git a/Demos/Fire/Fire.cpp b/Demos/Fire/Fire.cpp
index 52b4d2167b..2e91c78333 100644
--- a/Demos/Fire/Fire.cpp
+++ b/Demos/Fire/Fire.cpp
@@ -216,6 +216,21 @@ int main(int argc, char** 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();
window->set_double_buffering_enabled(false);
window->set_title("Fire");
diff --git a/Demos/HelloWorld/main.cpp b/Demos/HelloWorld/main.cpp
index 6097ca7169..7f2b70fc54 100644
--- a/Demos/HelloWorld/main.cpp
+++ b/Demos/HelloWorld/main.cpp
@@ -37,6 +37,21 @@ int main(int argc, char** argv)
auto app = GUI::Application::construct(argc, argv);
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();
window->resize(240, 160);
window->set_title("Hello World!");
diff --git a/Demos/LibGfxDemo/main.cpp b/Demos/LibGfxDemo/main.cpp
index d9ce949652..9a5d6caa34 100644
--- a/Demos/LibGfxDemo/main.cpp
+++ b/Demos/LibGfxDemo/main.cpp
@@ -199,6 +199,21 @@ int main(int argc, char** 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();
window->set_double_buffering_enabled(true);
window->set_title("LibGfx Demo");
diff --git a/Demos/Mouse/main.cpp b/Demos/Mouse/main.cpp
index 0146cf376b..31379eb049 100644
--- a/Demos/Mouse/main.cpp
+++ b/Demos/Mouse/main.cpp
@@ -175,6 +175,21 @@ int main(int argc, char** argv)
auto app = GUI::Application::construct(argc, argv);
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();
window->set_title("Mouse button demo");
window->set_icon(app_icon.bitmap_for_size(16));
diff --git a/Demos/Screensaver/Screensaver.cpp b/Demos/Screensaver/Screensaver.cpp
index 593c80958a..85792909bf 100644
--- a/Demos/Screensaver/Screensaver.cpp
+++ b/Demos/Screensaver/Screensaver.cpp
@@ -136,6 +136,21 @@ int main(int argc, char** 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();
window->set_double_buffering_enabled(true);
window->set_title("Screensaver");
diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp
index 93d5175032..6f389b74c3 100644
--- a/Demos/WidgetGallery/main.cpp
+++ b/Demos/WidgetGallery/main.cpp
@@ -85,6 +85,21 @@ int main(int argc, char** 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 window = GUI::Window::construct();