summaryrefslogtreecommitdiff
path: root/Userland/Services/WindowServer
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-23 23:59:27 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-25 09:47:36 +0100
commit8465683dcf1ede4dbab46915113dd2ce4e4b7dfb (patch)
tree392cdf423fabec6af5550d831e07217fd0e3287b /Userland/Services/WindowServer
parentbb483f7ef4693582d34aa7a30fa2916fdcc8b6f4 (diff)
downloadserenity-8465683dcf1ede4dbab46915113dd2ce4e4b7dfb.zip
Everywhere: Debug macros instead of constexpr.
This was done with the following script: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r--Userland/Services/WindowServer/Compositor.cpp26
-rw-r--r--Userland/Services/WindowServer/MenuManager.cpp2
-rw-r--r--Userland/Services/WindowServer/Screen.cpp2
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp24
4 files changed, 27 insertions, 27 deletions
diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp
index b9beeaec47..af57c53fbd 100644
--- a/Userland/Services/WindowServer/Compositor.cpp
+++ b/Userland/Services/WindowServer/Compositor.cpp
@@ -194,7 +194,7 @@ void Compositor::compose()
if (m_custom_background_color.has_value())
background_color = m_custom_background_color.value();
- if constexpr (debug_compose) {
+ if constexpr (COMPOSE_DEBUG) {
dbgln("COMPOSE: invalidated: window: {} cursor: {}, any: {}", m_invalidated_window, m_invalidated_cursor, m_invalidated_any);
for (auto& r : dirty_screen_rects.rects())
dbgln("dirty screen: {}", r);
@@ -215,7 +215,7 @@ void Compositor::compose()
};
auto prepare_rect = [&](const Gfx::IntRect& rect) {
- dbgln<debug_compose>(" -> flush opaque: {}", rect);
+ dbgln<COMPOSE_DEBUG>(" -> flush opaque: {}", rect);
ASSERT(!flush_rects.intersects(rect));
ASSERT(!flush_transparent_rects.intersects(rect));
flush_rects.add(rect);
@@ -223,7 +223,7 @@ void Compositor::compose()
};
auto prepare_transparency_rect = [&](const Gfx::IntRect& rect) {
- dbgln<debug_compose>(" -> flush transparent: {}", rect);
+ dbgln<COMPOSE_DEBUG>(" -> flush transparent: {}", rect);
ASSERT(!flush_rects.intersects(rect));
bool have_rect = false;
for (auto& r : flush_transparent_rects.rects()) {
@@ -270,7 +270,7 @@ void Compositor::compose()
};
m_opaque_wallpaper_rects.for_each_intersected(dirty_screen_rects, [&](const Gfx::IntRect& render_rect) {
- dbgln<debug_compose>(" render wallpaper opaque: {}", render_rect);
+ dbgln<COMPOSE_DEBUG>(" render wallpaper opaque: {}", render_rect);
prepare_rect(render_rect);
paint_wallpaper(back_painter, render_rect);
return IterationDecision::Continue;
@@ -282,7 +282,7 @@ void Compositor::compose()
return IterationDecision::Continue;
auto frame_rects = frame_rect.shatter(window.rect());
- dbgln<debug_compose>(" window {} frame rect: {}", window.title(), frame_rect);
+ dbgln<COMPOSE_DEBUG>(" window {} frame rect: {}", window.title(), frame_rect);
RefPtr<Gfx::Bitmap> backing_store = window.backing_store();
auto compose_window_rect = [&](Gfx::Painter& painter, const Gfx::IntRect& rect) {
@@ -291,7 +291,7 @@ void Compositor::compose()
// TODO: Should optimize this to use a backing buffer
Gfx::PainterStateSaver saver(painter);
painter.add_clip_rect(intersected_rect);
- dbgln<debug_compose>(" render frame: {}", intersected_rect);
+ dbgln<COMPOSE_DEBUG>(" render frame: {}", intersected_rect);
window.frame().paint(painter);
return IterationDecision::Continue;
});
@@ -360,7 +360,7 @@ void Compositor::compose()
auto& dirty_rects = window.dirty_rects();
- if constexpr (debug_compose) {
+ if constexpr (COMPOSE_DEBUG) {
for (auto& dirty_rect : dirty_rects.rects())
dbgln(" dirty: {}", dirty_rect);
for (auto& r : window.opaque_rects().rects())
@@ -373,7 +373,7 @@ void Compositor::compose()
auto& opaque_rects = window.opaque_rects();
if (!opaque_rects.is_empty()) {
opaque_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) {
- dbgln<debug_compose>(" render opaque: {}", render_rect);
+ dbgln<COMPOSE_DEBUG>(" render opaque: {}", render_rect);
prepare_rect(render_rect);
Gfx::PainterStateSaver saver(back_painter);
@@ -388,7 +388,7 @@ void Compositor::compose()
auto& transparency_wallpaper_rects = window.transparency_wallpaper_rects();
if (!transparency_wallpaper_rects.is_empty()) {
transparency_wallpaper_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) {
- dbgln<debug_compose>(" render wallpaper: {}", render_rect);
+ dbgln<COMPOSE_DEBUG>(" render wallpaper: {}", render_rect);
prepare_transparency_rect(render_rect);
paint_wallpaper(temp_painter, render_rect);
@@ -398,7 +398,7 @@ void Compositor::compose()
auto& transparency_rects = window.transparency_rects();
if (!transparency_rects.is_empty()) {
transparency_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) {
- dbgln<debug_compose>(" render transparent: {}", render_rect);
+ dbgln<COMPOSE_DEBUG>(" render transparent: {}", render_rect);
prepare_transparency_rect(render_rect);
Gfx::PainterStateSaver saver(temp_painter);
@@ -671,7 +671,7 @@ void Compositor::run_animations(Gfx::DisjointRectSet& flush_rects)
from_rect.height() - (int)(height_delta_per_step * animation_index)
};
- dbgln<debug_minimize_animation>("Minimize animation from {} to {} frame# {} {}", from_rect, to_rect, animation_index, rect);
+ dbgln<MINIMIZE_ANIMATION_DEBUG>("Minimize animation from {} to {} frame# {} {}", from_rect, to_rect, animation_index, rect);
painter.draw_rect(rect, Color::Transparent); // Color doesn't matter, we draw inverted
flush_rects.add(rect);
@@ -1001,7 +1001,7 @@ void Compositor::recompute_occlusions()
m_opaque_wallpaper_rects = move(visible_rects);
}
- if constexpr (debug_occlusions) {
+ if constexpr (OCCLUSIONS_DEBUG) {
for (auto& r : m_opaque_wallpaper_rects.rects())
dbgln(" wallpaper opaque: {}", r);
}
@@ -1011,7 +1011,7 @@ void Compositor::recompute_occlusions()
if (w.is_minimized() || window_frame_rect.is_empty())
return IterationDecision::Continue;
- if constexpr (debug_occlusions) {
+ if constexpr (OCCLUSIONS_DEBUG) {
dbgln(" Window {} frame rect: {}", w.title(), window_frame_rect);
for (auto& r : w.opaque_rects().rects())
dbgln(" opaque: {}", r);
diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp
index b50cb800b4..8069383abf 100644
--- a/Userland/Services/WindowServer/MenuManager.cpp
+++ b/Userland/Services/WindowServer/MenuManager.cpp
@@ -459,7 +459,7 @@ void MenuManager::set_current_menubar(MenuBar* menubar)
else
m_current_menubar = nullptr;
- dbgln<debug_menus>("[WM] Current menubar is now {}", menubar);
+ dbgln<MENUS_DEBUG>("[WM] Current menubar is now {}", menubar);
Gfx::IntPoint next_menu_location { MenuManager::menubar_menu_margin() / 2, 0 };
for_each_active_menubar_menu([&](Menu& menu) {
diff --git a/Userland/Services/WindowServer/Screen.cpp b/Userland/Services/WindowServer/Screen.cpp
index a10ab03d60..1ed3e0bbc7 100644
--- a/Userland/Services/WindowServer/Screen.cpp
+++ b/Userland/Services/WindowServer/Screen.cpp
@@ -82,7 +82,7 @@ bool Screen::set_resolution(int width, int height, int new_scale_factor)
FBResolution physical_resolution { 0, (unsigned)new_physical_width, (unsigned)new_physical_height };
int rc = fb_set_resolution(m_framebuffer_fd, &physical_resolution);
- dbgln<debug_wsscreen>("fb_set_resolution() - return code {}", rc);
+ dbgln<WSSCREEN_DEBUG>("fb_set_resolution() - return code {}", rc);
if (rc == 0) {
on_change_resolution(physical_resolution.pitch, physical_resolution.width, physical_resolution.height, new_scale_factor);
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index 3e2cfeca05..3a445e8542 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -343,7 +343,7 @@ void WindowManager::notify_title_changed(Window& window)
if (window.type() != WindowType::Normal)
return;
- dbgln<debug_window_manager>("[WM] Window({}) title set to '{}'", &window, window.title());
+ dbgln<WINDOWMANAGER_DEBUG>("[WM] Window({}) title set to '{}'", &window, window.title());
if (m_switcher.is_visible())
m_switcher.refresh();
@@ -356,7 +356,7 @@ void WindowManager::notify_modal_unparented(Window& window)
if (window.type() != WindowType::Normal)
return;
- dbgln<debug_window_manager>("[WM] Window({}) was unparented", &window);
+ dbgln<WINDOWMANAGER_DEBUG>("[WM] Window({}) was unparented", &window);
if (m_switcher.is_visible())
m_switcher.refresh();
@@ -366,7 +366,7 @@ void WindowManager::notify_modal_unparented(Window& window)
void WindowManager::notify_rect_changed(Window& window, const Gfx::IntRect& old_rect, const Gfx::IntRect& new_rect)
{
- dbgln<debug_resize>("[WM] Window({}) rect changed {} -> {}", &window, old_rect, new_rect);
+ dbgln<RESIZE_DEBUG>("[WM] Window({}) rect changed {} -> {}", &window, old_rect, new_rect);
if (m_switcher.is_visible() && window.type() != WindowType::WindowSwitcher)
m_switcher.refresh();
@@ -431,7 +431,7 @@ bool WindowManager::pick_new_active_window(Window* previous_active)
void WindowManager::start_window_move(Window& window, const MouseEvent& event)
{
- dbgln<debug_move>("[WM] Begin moving Window({})", &window);
+ dbgln<MOVE_DEBUG>("[WM] Begin moving Window({})", &window);
move_to_front_and_make_active(window);
m_move_window = window;
@@ -464,7 +464,7 @@ void WindowManager::start_window_resize(Window& window, const Gfx::IntPoint& pos
return;
}
- dbgln<debug_resize>("[WM] Begin resizing Window({})", &window);
+ dbgln<RESIZE_DEBUG>("[WM] Begin resizing Window({})", &window);
m_resizing_mouse_button = button;
m_resize_window = window;
@@ -491,7 +491,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove
return false;
if (event.type() == Event::MouseUp && event.button() == MouseButton::Left) {
- dbgln<debug_move>("[WM] Finish moving Window({})", m_move_window);
+ dbgln<MOVE_DEBUG>("[WM] Finish moving Window({})", m_move_window);
m_move_window->invalidate();
if (m_move_window->rect().contains(event.position()))
@@ -509,7 +509,7 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove
return true;
}
if (event.type() == Event::MouseMove) {
- if constexpr (debug_move) {
+ if constexpr (MOVE_DEBUG) {
dbgln("[WM] Moving, origin: {}, now: {}", m_move_origin, event.position());
if (m_move_window->is_maximized())
dbgln(" [!] The window is still maximized. Not moving yet.");
@@ -575,7 +575,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
return false;
if (event.type() == Event::MouseUp && event.button() == m_resizing_mouse_button) {
- dbgln<debug_resize>("[WM] Finish resizing Window({})", m_resize_window);
+ dbgln<RESIZE_DEBUG>("[WM] Finish resizing Window({})", m_resize_window);
Core::EventLoop::current().post_event(*m_resize_window, make<ResizeEvent>(m_resize_window->rect()));
m_resize_window->invalidate();
@@ -683,7 +683,7 @@ bool WindowManager::process_ongoing_window_resize(const MouseEvent& event, Windo
if (m_resize_window->rect() == new_rect)
return true;
- dbgln<debug_resize>("[WM] Resizing, original: {}, now: {}", m_resize_window_original_rect, new_rect);
+ dbgln<RESIZE_DEBUG>("[WM] Resizing, original: {}, now: {}", m_resize_window_original_rect, new_rect);
m_resize_window->set_rect(new_rect);
Core::EventLoop::current().post_event(*m_resize_window, make<ResizeEvent>(new_rect));
@@ -805,7 +805,7 @@ void WindowManager::start_menu_doubleclick(Window& window, const MouseEvent& eve
// we either haven't clicked anywhere, or we haven't clicked on this
// window. set the current click window, and reset the timers.
- dbgln<debug_double_click>("Initial mousedown on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window);
+ dbgln<DOUBLECLICK_DEBUG>("Initial mousedown on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window);
m_double_click_info.m_clicked_window = window;
m_double_click_info.reset();
@@ -837,7 +837,7 @@ void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& ev
if (&window != m_double_click_info.m_clicked_window) {
// we either haven't clicked anywhere, or we haven't clicked on this
// window. set the current click window, and reset the timers.
- dbgln<debug_double_click>("Initial mouseup on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window);
+ dbgln<DOUBLECLICK_DEBUG>("Initial mouseup on Window({}) for menus (previous was {})", &window, m_double_click_info.m_clicked_window);
m_double_click_info.m_clicked_window = window;
m_double_click_info.reset();
@@ -852,7 +852,7 @@ void WindowManager::process_event_for_doubleclick(Window& window, MouseEvent& ev
// clock
metadata.clock.start();
} else {
- dbgln<debug_double_click>("Transforming MouseUp to MouseDoubleClick ({} < {})!", metadata.clock.elapsed(), m_double_click_speed);
+ dbgln<DOUBLECLICK_DEBUG>("Transforming MouseUp to MouseDoubleClick ({} < {})!", metadata.clock.elapsed(), m_double_click_speed);
event = MouseEvent(Event::MouseDoubleClick, event.position(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta());
// invalidate this now we've delivered a doubleclick, otherwise