mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00

Color themes are loaded from .ini files in /res/themes/ The theme can be switched from the "Themes" section in the system menu. The basic mechanism is that WindowServer broadcasts a SharedBuffer with all of the color values of the current theme. Clients receive this with the response to their initial WindowServer::Greet handshake. When the theme is changed, WindowServer tells everyone by sending out an UpdateSystemTheme message with a new SharedBuffer to use. This does feel somewhat bloated somehow, but I'm sure we can iterate on it over time and improve things. To get one of the theme colors, use the Color(SystemColor) constructor: painter.fill_rect(rect, SystemColor::HoverHighlight); Some things don't work 100% right without a reboot. Specifically, when constructing a GWidget, it will set its own background and foreground colors based on the current SystemColor::Window and SystemColor::Text. The widget is then stuck with these values, and they don't update on system theme change, only on app restart. All in all though, this is pretty cool. Merry Christmas! :^)
37 lines
1.8 KiB
Text
37 lines
1.8 KiB
Text
endpoint WindowClient = 4
|
|
{
|
|
Paint(i32 window_id, Size window_size, Vector<Rect> rects) =|
|
|
MouseMove(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
|
MouseDown(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
|
MouseDoubleClick(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
|
MouseUp(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
|
MouseWheel(i32 window_id, Point mouse_position, u32 button, u32 buttons, u32 modifiers, i32 wheel_delta) =|
|
|
WindowEntered(i32 window_id) =|
|
|
WindowLeft(i32 window_id) =|
|
|
KeyDown(i32 window_id, u8 character, u32 key, u32 modifiers) =|
|
|
KeyUp(i32 window_id, u8 character, u32 key, u32 modifiers) =|
|
|
WindowActivated(i32 window_id) =|
|
|
WindowDeactivated(i32 window_id) =|
|
|
WindowCloseRequest(i32 window_id) =|
|
|
WindowResized(i32 window_id, Rect old_rect, Rect new_rect) =|
|
|
|
|
MenuItemActivated(i32 menu_id, i32 identifier) =|
|
|
|
|
ScreenRectChanged(Rect rect) =|
|
|
|
|
ClipboardContentsChanged(String content_type) =|
|
|
|
|
WM_WindowRemoved(i32 client_id, i32 window_id) =|
|
|
WM_WindowStateChanged(i32 client_id, i32 window_id, bool is_active, bool is_minimized, i32 window_type, String title, Rect rect) =|
|
|
WM_WindowIconBitmapChanged(i32 client_id, i32 window_id, i32 icon_buffer_id, Size icon_size) =|
|
|
WM_WindowRectChanged(i32 client_id, i32 window_id, Rect rect) =|
|
|
|
|
AsyncSetWallpaperFinished(bool success) =|
|
|
|
|
DragAccepted() =|
|
|
DragCancelled() =|
|
|
|
|
DragDropped(i32 window_id, Point mouse_position, String text, String data_type, String data) =|
|
|
|
|
UpdateSystemTheme(i32 system_theme_buffer_id) =|
|
|
}
|