1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:35:09 +00:00

Add WindowActivated and WindowDeactivated events.

Use this to implement different looking Terminal cursors depending on
the window active state.
This commit is contained in:
Andreas Kling 2019-01-17 17:38:04 +01:00
parent 135ff48bb9
commit dad58db757
9 changed files with 66 additions and 42 deletions

View file

@ -118,6 +118,8 @@ int main(int, char**)
case GUI_Event::Type::MouseUp: dbgprintf("WID=%x MouseUp %d,%d\n", event.window_id, event.mouse.position.x, event.mouse.position.y); break;
case GUI_Event::Type::MouseMove: dbgprintf("WID=%x MouseMove %d,%d\n", event.window_id, event.mouse.position.x, event.mouse.position.y); break;
case GUI_Event::Type::KeyDown: dbgprintf("WID=%x KeyDown 0x%b (%c)\n", event.window_id, event.key.character, event.key.character); break;
case GUI_Event::Type::WindowActivated: dbgprintf("WID=%x WindowActivated\n", event.window_id); break;
case GUI_Event::Type::WindowDeactivated: dbgprintf("WID=%x WindowDeactivated\n", event.window_id); break;
default:
ASSERT_NOT_REACHED();
}
@ -126,6 +128,10 @@ int main(int, char**)
terminal.paint();
} else if (event.type == GUI_Event::Type::KeyDown) {
write(ptm_fd, &event.key.character, 1);
} else if (event.type == GUI_Event::Type::WindowActivated) {
terminal.set_in_active_window(true);
} else if (event.type == GUI_Event::Type::WindowDeactivated) {
terminal.set_in_active_window(false);
}
}
}