mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Clock menu applet: launch the new Calendar on click
This commit is contained in:
parent
632231cc0c
commit
9ba9bba529
Notes:
sideshowbarker
2024-07-19 08:01:21 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/9ba9bba529c Pull-request: https://github.com/SerenityOS/serenity/pull/1556 Reviewed-by: https://github.com/awesomekling
1 changed files with 22 additions and 2 deletions
|
@ -79,6 +79,21 @@ private:
|
|||
painter.draw_text(event.rect(), time_text, Gfx::Font::default_font(), Gfx::TextAlignment::Center, palette().window_text());
|
||||
}
|
||||
|
||||
virtual void mousedown_event(GUI::MouseEvent& event) override
|
||||
{
|
||||
if (event.button() != GUI::MouseButton::Left)
|
||||
return;
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) {
|
||||
perror("fork");
|
||||
} else if (pid == 0) {
|
||||
execl("/bin/Calendar", "Calendar", nullptr);
|
||||
perror("execl");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
void tick_clock()
|
||||
{
|
||||
update();
|
||||
|
@ -90,14 +105,14 @@ private:
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (pledge("stdio shared_buffer accept rpath unix cpath fattr", nullptr) < 0) {
|
||||
if (pledge("stdio shared_buffer accept rpath unix cpath fattr exec proc", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
GUI::Application app(argc, argv);
|
||||
|
||||
if (pledge("stdio shared_buffer accept rpath", nullptr) < 0) {
|
||||
if (pledge("stdio shared_buffer accept rpath exec proc", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
@ -115,6 +130,11 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/bin/Calendar", "x") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
unveil(nullptr, nullptr);
|
||||
|
||||
return app.exec();
|
||||
|
|
Loading…
Reference in a new issue