ladybird/Userland/Services/WindowServer/WindowServer.ipc
Jelle Raaijmakers 634d1e0197 LibGUI+WindowServer: Improve window resizing performance
The old `GUI::Window` resizing behavior created a new backing store for
each resize event (i.e. every visible window size). This caused a lot of
trashing and on my machine, caused up to 25% of CPU time spent in
creating new backing stores.

The new behavior is a bit more sensible:

  * If the window size is shrinking, the backing store is already large
    enough to contain the entire window - so we don't create a new one.

  * If the window size is growing, as soon as the backing store can no
    longer contain the window, it is inflated with a large margin (of an
    arbitrary chosen 64 pixels) in both directions to accommodate some
    leeway in resizing before an even larger backing store is required.

  * When the user stops resizing the window, the backing store is
    resized to the exact dimensions of the window.

For me, this brings the CPU time for creating backing stores down to 0%.
2023-01-17 18:16:02 +01:00

196 lines
7.4 KiB
Text

#include <LibCore/AnonymousBuffer.h>
#include <LibGfx/ShareableBitmap.h>
#include <LibGfx/Color.h>
endpoint WindowServer
{
create_menu(i32 menu_id, [UTF8] DeprecatedString menu_title) =|
destroy_menu(i32 menu_id) =|
add_menu(i32 window_id, i32 menu_id) =|
add_menu_item(
i32 menu_id,
i32 identifier,
i32 submenu_id,
[UTF8] DeprecatedString text,
bool enabled,
bool visible,
bool checkable,
bool checked,
bool is_default,
[UTF8] DeprecatedString shortcut,
Gfx::ShareableBitmap icon,
bool exclusive) =|
add_menu_separator(i32 menu_id) =|
update_menu_item(
i32 menu_id,
i32 identifier,
i32 submenu_id,
[UTF8] DeprecatedString text,
bool enabled,
bool visible,
bool checkable,
bool checked,
bool is_default,
[UTF8] DeprecatedString shortcut,
Gfx::ShareableBitmap icon) =|
remove_menu_item(i32 menu_id, i32 identifier) =|
flash_menubar_menu(i32 window_id, i32 menu_id) =|
create_window(
i32 window_id,
Gfx::IntRect rect,
bool auto_position,
bool has_alpha_channel,
bool minimizable,
bool closeable,
bool resizable,
bool fullscreen,
bool frameless,
bool forced_shadow,
float opacity,
float alpha_hit_threshold,
Gfx::IntSize base_size,
Gfx::IntSize size_increment,
Gfx::IntSize minimum_size,
Optional<Gfx::IntSize> resize_aspect_ratio,
i32 type,
i32 mode,
[UTF8] DeprecatedString title,
i32 parent_window_id,
Gfx::IntRect launch_origin_rect) =|
destroy_window(i32 window_id) => (Vector<i32> destroyed_window_ids)
set_window_title(i32 window_id, [UTF8] DeprecatedString title) =|
get_window_title(i32 window_id) => ([UTF8] DeprecatedString title)
set_window_progress(i32 window_id, Optional<i32> progress) =|
set_window_modified(i32 window_id, bool modified) =|
is_window_modified(i32 window_id) => (bool modified)
set_window_rect(i32 window_id, Gfx::IntRect rect) => (Gfx::IntRect rect)
get_window_rect(i32 window_id) => (Gfx::IntRect rect)
set_window_minimum_size(i32 window_id, Gfx::IntSize size) =|
get_window_minimum_size(i32 window_id) => (Gfx::IntSize size)
get_applet_rect_on_screen(i32 window_id) => (Gfx::IntRect rect)
start_window_resize(i32 window_id, i32 resize_direction) =|
is_maximized(i32 window_id) => (bool maximized)
set_maximized(i32 window_id, bool maximized) =|
is_minimized(i32 window_id) => (bool minimized)
set_minimized(i32 window_id, bool minimized) =|
invalidate_rect(i32 window_id, Vector<Gfx::IntRect> rects, bool ignore_occlusion) =|
did_finish_painting(i32 window_id, Vector<Gfx::IntRect> rects) =|
set_global_mouse_tracking(bool enabled) =|
set_window_opacity(i32 window_id, float opacity) =|
set_window_alpha_hit_threshold(i32 window_id, float threshold) =|
set_window_backing_store(i32 window_id, i32 bpp, i32 pitch, IPC::File anon_file, i32 serial, bool has_alpha_channel, Gfx::IntSize size, Gfx::IntSize visible_size, bool flush_immediately) => ()
set_window_has_alpha_channel(i32 window_id, bool has_alpha_channel) =|
move_window_to_front(i32 window_id) =|
set_fullscreen(i32 window_id, bool fullscreen) =|
set_frameless(i32 window_id, bool frameless) =|
set_forced_shadow(i32 window_id, bool shadow) =|
popup_menu(i32 menu_id, Gfx::IntPoint screen_position, Gfx::IntRect button_rect) =|
dismiss_menu(i32 menu_id) =|
set_wallpaper(Gfx::ShareableBitmap wallpaper_bitmap) => (bool success)
set_background_color(DeprecatedString background_color) =|
set_wallpaper_mode(DeprecatedString mode) =|
set_screen_layout(::WindowServer::ScreenLayout screen_layout, bool save) => (bool success, DeprecatedString error_msg)
get_screen_layout() => (::WindowServer::ScreenLayout screen_layout)
save_screen_layout() => (bool success, DeprecatedString error_msg)
show_screen_numbers(bool show) =|
apply_workspace_settings(u32 rows, u32 columns, bool save) => (bool success)
get_workspace_settings() => (u32 rows, u32 columns, u32 max_rows, u32 max_columns)
set_window_icon_bitmap(i32 window_id, Gfx::ShareableBitmap icon) =|
get_wallpaper() => (Gfx::ShareableBitmap wallpaper_bitmap)
set_window_cursor(i32 window_id, i32 cursor_type) =|
set_window_custom_cursor(i32 window_id, Gfx::ShareableBitmap cursor) =|
start_drag([UTF8] DeprecatedString text, HashMap<DeprecatedString,ByteBuffer> mime_data, Gfx::ShareableBitmap drag_bitmap) => (bool started)
set_accepts_drag(bool accepts) =|
set_system_theme(DeprecatedString theme_path, [UTF8] DeprecatedString theme_name, bool keep_desktop_background) => (bool success)
get_system_theme() => ([UTF8] DeprecatedString theme_name)
refresh_system_theme() =|
set_system_theme_override(Core::AnonymousBuffer buffer) => (bool success)
get_system_theme_override() => (Optional<Core::AnonymousBuffer> buffer)
clear_system_theme_override() =|
is_system_theme_overridden() => (bool overridden)
apply_cursor_theme(DeprecatedString name) =|
get_cursor_theme() => (DeprecatedString name)
set_cursor_highlight_radius(int radius) =|
get_cursor_highlight_radius() => (int radius)
set_cursor_highlight_color(Gfx::Color color) =|
get_cursor_highlight_color() => (Gfx::Color color)
set_system_fonts(DeprecatedString default_font_query, DeprecatedString fixed_width_font_query, DeprecatedString window_title_font_query) => (bool success)
set_system_effects(Vector<bool> effects, u8 geometry) =|
set_window_base_size_and_size_increment(i32 window_id, Gfx::IntSize base_size, Gfx::IntSize size_increment) =|
set_window_resize_aspect_ratio(i32 window_id, Optional<Gfx::IntSize> resize_aspect_ratio) =|
enable_display_link() =|
disable_display_link() =|
set_global_cursor_position(Gfx::IntPoint position) =|
get_global_cursor_position() => (Gfx::IntPoint position)
set_mouse_acceleration(float factor) =|
get_mouse_acceleration() => (float factor)
set_scroll_step_size(u32 step_size) =|
get_scroll_step_size() => (u32 step_size)
get_screen_bitmap(Optional<Gfx::IntRect> rect, Optional<u32> screen_index) => (Gfx::ShareableBitmap bitmap)
get_screen_bitmap_around_cursor(Gfx::IntSize size) => (Gfx::ShareableBitmap bitmap)
get_screen_bitmap_around_location(Gfx::IntSize size, Gfx::IntPoint location) => (Gfx::ShareableBitmap bitmap)
get_color_under_cursor() => (Optional<Gfx::Color> color)
pong() =|
set_double_click_speed(int speed) =|
get_double_click_speed() => (int speed)
set_mouse_buttons_switched(bool switched) =|
are_mouse_buttons_switched() => (bool switched)
set_natural_scroll(bool inverted) =|
is_natural_scroll() => (bool inverted)
get_desktop_display_scale(u32 screen_index) => (int desktop_display_scale)
set_flash_flush(bool enabled) =|
set_window_parent_from_client(i32 client_id, i32 parent_id, i32 child_id) => ()
get_window_rect_from_client(i32 client_id, i32 window_id) => (Gfx::IntRect rect)
add_window_stealing_for_client(i32 client_id, i32 window_id) => ()
remove_window_stealing_for_client(i32 client_id, i32 window_id) => ()
remove_window_stealing(i32 window_id) => ()
set_always_on_top(i32 window_id, bool always_on_top) => ()
}