1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:37:46 +00:00

LibGUI: Include keyboard modifier state with button on_click calls

This will allow you us to implement special behavior when Ctrl+clicking
a button.
This commit is contained in:
Andreas Kling 2020-05-12 20:30:33 +02:00
parent 3a905aed06
commit 977863ea07
37 changed files with 76 additions and 76 deletions

View file

@ -102,13 +102,13 @@ PowerDialog::PowerDialog()
button_box.layout()->set_spacing(8);
auto& ok_button = button_box.add<GUI::Button>();
ok_button.on_click = [this] {
ok_button.on_click = [this](auto) {
done(ExecResult::ExecOK);
};
ok_button.set_text("OK");
auto& cancel_button = button_box.add<GUI::Button>();
cancel_button.on_click = [this] {
cancel_button.on_click = [this](auto) {
done(ExecResult::ExecCancel);
};
cancel_button.set_text("Cancel");

View file

@ -116,7 +116,7 @@ void TaskbarWindow::create_quick_launch_bar()
button.set_icon(Gfx::Bitmap::load_from_file(app_icon_path));
button.set_tooltip(name);
button.on_click = [app_executable] {
button.on_click = [app_executable](auto) {
pid_t pid = fork();
if (pid < 0) {
perror("fork");

View file

@ -50,7 +50,7 @@ Window& WindowList::ensure_window(const WindowIdentifier& identifier)
return *it->value;
auto window = make<Window>(identifier);
window->set_button(aid_create_button(identifier));
window->button()->on_click = [window = window.ptr(), identifier] {
window->button()->on_click = [window = window.ptr(), identifier](auto) {
if (window->is_minimized() || !window->is_active()) {
GUI::WindowServerConnection::the().post_message(Messages::WindowServer::WM_SetActiveWindow(identifier.client_id(), identifier.window_id()));
} else {