1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:47:34 +00:00

Everywhere: Replace a bundle of dbg with dbgln.

These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
This commit is contained in:
asynts 2021-01-17 18:39:00 +01:00 committed by Andreas Kling
parent 3f23a58fa1
commit 24888457d5
9 changed files with 117 additions and 98 deletions

View file

@ -471,3 +471,45 @@ constexpr bool debug_dhcpv4_client = true;
#else #else
constexpr bool debug_dhcpv4_client = false; constexpr bool debug_dhcpv4_client = false;
#endif #endif
#ifdef IMAGE_DECODER_DEBUG
constexpr bool debug_image_decoder = true;
#else
constexpr bool debug_image_decoder = false;
#endif
#ifdef SYSTEM_MENU_DEBUG
constexpr bool debug_system_menu = true;
#else
constexpr bool debug_system_menu = false;
#endif
#ifdef SYSTEMSERVER_DEBUG
constexpr bool debug_system_server = true;
#else
constexpr bool debug_system_server = false;
#endif
#ifdef SERVICE_DEBUG
constexpr bool debug_service = true;
#else
constexpr bool debug_service = false;
#endif
#ifdef COMPOSE_DEBUG
constexpr bool debug_compose = true;
#else
constexpr bool debug_compose = false;
#endif
#ifdef MINIMIZE_ANIMATION_DEBUG
constexpr bool debug_minimize_animation = true;
#else
constexpr bool debug_minimize_animation = false;
#endif
#ifdef OCCLUSIONS_DEBUG
constexpr bool debug_occlusions = true;
#else
constexpr bool debug_occlusions = false;
#endif

View file

@ -39,7 +39,7 @@ void Client::drain_socket()
while (m_socket->can_read()) { while (m_socket->can_read()) {
auto buf = m_socket->read(1024); auto buf = m_socket->read(1024);
dbg() << "Read " << buf.size() << " bytes: " << buf; dbgln("Read {} bytes.", buf.size());
if (m_socket->eof()) { if (m_socket->eof()) {
quit(); quit();

View file

@ -25,6 +25,7 @@
*/ */
#include "ShutdownDialog.h" #include "ShutdownDialog.h"
#include <AK/Debug.h>
#include <AK/LexicalPath.h> #include <AK/LexicalPath.h>
#include <AK/QuickSort.h> #include <AK/QuickSort.h>
#include <LibCore/ConfigFile.h> #include <LibCore/ConfigFile.h>
@ -42,8 +43,6 @@
#include <serenity.h> #include <serenity.h>
#include <spawn.h> #include <spawn.h>
//#define SYSTEM_MENU_DEBUG
struct AppMetadata { struct AppMetadata {
String executable; String executable;
String name; String name;
@ -143,14 +142,14 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
for (const auto& app : g_apps) { for (const auto& app : g_apps) {
auto icon = GUI::FileIconProvider::icon_for_executable(app.executable).bitmap_for_size(16); auto icon = GUI::FileIconProvider::icon_for_executable(app.executable).bitmap_for_size(16);
#ifdef SYSTEM_MENU_DEBUG if constexpr (debug_system_menu) {
if (icon) if (icon)
dbg() << "App " << app.name << " has icon with size " << icon->size(); dbgln("App {} has icon with size {}", app.name, icon->size());
#endif }
auto parent_menu = app_category_menus.get(app.category).value_or(*system_menu); auto parent_menu = app_category_menus.get(app.category).value_or(*system_menu);
parent_menu->add_action(GUI::Action::create(app.name, icon, [app_identifier](auto&) { parent_menu->add_action(GUI::Action::create(app.name, icon, [app_identifier](auto&) {
dbg() << "Activated app with ID " << app_identifier; dbgln("Activated app with ID {}", app_identifier);
const auto& bin = g_apps[app_identifier].executable; const auto& bin = g_apps[app_identifier].executable;
pid_t child_pid; pid_t child_pid;
const char* argv[] = { bin.characters(), nullptr }; const char* argv[] = { bin.characters(), nullptr };
@ -189,7 +188,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
for (auto& theme : g_themes) { for (auto& theme : g_themes) {
auto action = GUI::Action::create_checkable(theme.name, [theme_identifier](auto&) { auto action = GUI::Action::create_checkable(theme.name, [theme_identifier](auto&) {
auto& theme = g_themes[theme_identifier]; auto& theme = g_themes[theme_identifier];
dbg() << "Theme switched to " << theme.name << " at path " << theme.path; dbgln("Theme switched to {} at path {}", theme.name, theme.path);
auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name); auto response = GUI::WindowServerConnection::the().send_sync<Messages::WindowServer::SetSystemTheme>(theme.path, theme.name);
ASSERT(response->success()); ASSERT(response->success());
}); });

View file

@ -25,6 +25,7 @@
*/ */
#include "Service.h" #include "Service.h"
#include <AK/Debug.h>
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <AK/JsonArray.h> #include <AK/JsonArray.h>
#include <AK/JsonObject.h> #include <AK/JsonObject.h>
@ -83,7 +84,7 @@ void Service::setup_socket()
auto socket_address = Core::SocketAddress::local(m_socket_path); auto socket_address = Core::SocketAddress::local(m_socket_path);
auto un_optional = socket_address.to_sockaddr_un(); auto un_optional = socket_address.to_sockaddr_un();
if (!un_optional.has_value()) { if (!un_optional.has_value()) {
dbg() << "Socket name " << m_socket_path << " is too long. BUG! This should have failed earlier!"; dbgln("Socket name {} is too long. BUG! This should have failed earlier!", m_socket_path);
ASSERT_NOT_REACHED(); ASSERT_NOT_REACHED();
} }
auto un = un_optional.value(); auto un = un_optional.value();
@ -114,9 +115,8 @@ void Service::setup_notifier()
void Service::handle_socket_connection() void Service::handle_socket_connection()
{ {
#ifdef SERVICE_DEBUG dbgln<debug_service>("Ready to read on behalf of {}", name());
dbg() << "Ready to read on behalf of " << name();
#endif
if (m_accept_socket_connections) { if (m_accept_socket_connections) {
int accepted_fd = accept(m_socket_fd, nullptr, nullptr); int accepted_fd = accept(m_socket_fd, nullptr, nullptr);
if (accepted_fd < 0) { if (accepted_fd < 0) {
@ -144,16 +144,14 @@ void Service::activate()
void Service::spawn(int socket_fd) void Service::spawn(int socket_fd)
{ {
#ifdef SERVICE_DEBUG dbgln<debug_service>("Spawning {}", name());
dbg() << "Spawning " << name();
#endif
m_run_timer.start(); m_run_timer.start();
pid_t pid = fork(); pid_t pid = fork();
if (pid < 0) { if (pid < 0) {
perror("fork"); perror("fork");
dbg() << "Failed to spawn " << name() << ". Sucks, dude :("; dbgln("Failed to spawn {}. Sucks, dude :(", name());
} else if (pid == 0) { } else if (pid == 0) {
// We are the child. // We are the child.
@ -241,7 +239,7 @@ void Service::did_exit(int exit_code)
ASSERT(m_pid > 0); ASSERT(m_pid > 0);
ASSERT(!m_multi_instance); ASSERT(!m_multi_instance);
dbg() << "Service " << name() << " has exited with exit code " << exit_code; dbgln("Service {} has exited with exit code {}", name(), exit_code);
s_service_map.remove(m_pid); s_service_map.remove(m_pid);
m_pid = -1; m_pid = -1;
@ -261,7 +259,7 @@ void Service::did_exit(int exit_code)
dbgln("Third time's a charm?"); dbgln("Third time's a charm?");
break; break;
default: default:
dbg() << "Giving up on " << name() << ". Good luck!"; dbgln("Giving up on {}. Good luck!", name());
return; return;
} }
m_restart_attempts++; m_restart_attempts++;

View file

@ -27,6 +27,7 @@
#include "Service.h" #include "Service.h"
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/ByteBuffer.h> #include <AK/ByteBuffer.h>
#include <AK/Debug.h>
#include <LibCore/ConfigFile.h> #include <LibCore/ConfigFile.h>
#include <LibCore/Event.h> #include <LibCore/Event.h>
#include <LibCore/EventLoop.h> #include <LibCore/EventLoop.h>
@ -53,9 +54,7 @@ static void sigchld_handler(int)
if (pid == 0) if (pid == 0)
break; break;
#ifdef SYSTEMSERVER_DEBUG dbgln<debug_system_server>("Reaped child with pid {}, exit status {}", pid, status);
dbg() << "Reaped child with pid " << pid << ", exit status " << status;
#endif
Service* service = Service::find_by_pid(pid); Service* service = Service::find_by_pid(pid);
if (service == nullptr) { if (service == nullptr) {
@ -71,18 +70,18 @@ static void parse_boot_mode()
{ {
auto f = Core::File::construct("/proc/cmdline"); auto f = Core::File::construct("/proc/cmdline");
if (!f->open(Core::IODevice::ReadOnly)) { if (!f->open(Core::IODevice::ReadOnly)) {
dbg() << "Failed to read command line: " << f->error_string(); dbgln("Failed to read command line: {}", f->error_string());
return; return;
} }
const String cmdline = String::copy(f->read_all(), Chomp); const String cmdline = String::copy(f->read_all(), Chomp);
dbg() << "Read command line: " << cmdline; dbgln("Read command line: {}", cmdline);
for (auto& part : cmdline.split_view(' ')) { for (auto& part : cmdline.split_view(' ')) {
auto pair = part.split_view('=', 2); auto pair = part.split_view('=', 2);
if (pair.size() == 2 && pair[0] == "boot_mode") if (pair.size() == 2 && pair[0] == "boot_mode")
g_boot_mode = pair[1]; g_boot_mode = pair[1];
} }
dbg() << "Booting in " << g_boot_mode << " mode"; dbgln("Booting in {} mode", g_boot_mode);
} }
static void prepare_devfs() static void prepare_devfs()
@ -234,7 +233,7 @@ int main(int, char**)
} }
// After we've set them all up, activate them! // After we've set them all up, activate them!
dbg() << "Activating " << services.size() << " services..."; dbgln("Activating {} services...", services.size());
for (auto& service : services) for (auto& service : services)
service.activate(); service.activate();

View file

@ -25,6 +25,7 @@
*/ */
#include <AK/Badge.h> #include <AK/Badge.h>
#include <AK/Debug.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibGfx/SystemTheme.h> #include <LibGfx/SystemTheme.h>
#include <WebContent/ClientConnection.h> #include <WebContent/ClientConnection.h>
@ -79,25 +80,19 @@ void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemThem
void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message) void ClientConnection::handle(const Messages::WebContentServer::LoadURL& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentServer::LoadURL: url={}", message.url());
dbg() << "handle: WebContentServer::LoadURL: url=" << message.url();
#endif
page().load(message.url()); page().load(message.url());
} }
void ClientConnection::handle(const Messages::WebContentServer::LoadHTML& message) void ClientConnection::handle(const Messages::WebContentServer::LoadHTML& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentServer::LoadHTML: html={}, url={}", message.html(), message.url());
dbg() << "handle: WebContentServer::LoadHTML: html=" << message.html() << ", url=" << message.url();
#endif
page().load_html(message.html(), message.url()); page().load_html(message.html(), message.url());
} }
void ClientConnection::handle(const Messages::WebContentServer::SetViewportRect& message) void ClientConnection::handle(const Messages::WebContentServer::SetViewportRect& message)
{ {
#ifdef DEBUG_SPAM dbgln<debug_spam>("handle: WebContentServer::SetViewportRect: rect={}", message.rect());
dbg() << "handle: WebContentServer::SetViewportRect: rect=" << message.rect();
#endif
m_page_host->set_viewport_rect(message.rect()); m_page_host->set_viewport_rect(message.rect());
} }

View file

@ -63,7 +63,7 @@ void Client::start()
return; return;
} }
dbg() << "Got raw request: '" << String::copy(raw_request) << "'"; dbgln("Got raw request: '{}'", String::copy(raw_request));
handle_request(raw_request.bytes()); handle_request(raw_request.bytes());
die(); die();
@ -77,9 +77,9 @@ void Client::handle_request(ReadonlyBytes raw_request)
return; return;
auto& request = request_or_error.value(); auto& request = request_or_error.value();
dbg() << "Got HTTP request: " << request.method_name() << " " << request.resource(); dbgln("Got HTTP request: {} {}", request.method_name(), request.resource());
for (auto& header : request.headers()) { for (auto& header : request.headers()) {
dbg() << " " << header.name << " => " << header.value; dbgln(" {} => {}", header.name, header.value);
} }
if (request.method() != HTTP::HttpRequest::Method::GET) { if (request.method() != HTTP::HttpRequest::Method::GET) {
@ -88,7 +88,7 @@ void Client::handle_request(ReadonlyBytes raw_request)
} }
auto requested_path = LexicalPath::canonicalized_path(request.resource()); auto requested_path = LexicalPath::canonicalized_path(request.resource());
dbg() << "Canonical requested path: '" << requested_path << "'"; dbgln("Canonical requested path: '{}'", requested_path);
StringBuilder path_builder; StringBuilder path_builder;
path_builder.append(m_root_path); path_builder.append(m_root_path);

View file

@ -195,7 +195,7 @@ OwnPtr<Messages::WindowServer::AddMenuItemResponse> ClientConnection::handle(con
unsigned identifier = message.identifier(); unsigned identifier = message.identifier();
auto it = m_menus.find(menu_id); auto it = m_menus.find(menu_id);
if (it == m_menus.end()) { if (it == m_menus.end()) {
dbg() << "AddMenuItem: Bad menu ID: " << menu_id; dbgln("AddMenuItem: Bad menu ID: {}", menu_id);
return {}; return {};
} }
auto& menu = *(*it).value; auto& menu = *(*it).value;

View file

@ -31,6 +31,7 @@
#include "Screen.h" #include "Screen.h"
#include "Window.h" #include "Window.h"
#include "WindowManager.h" #include "WindowManager.h"
#include <AK/Debug.h>
#include <AK/Memory.h> #include <AK/Memory.h>
#include <AK/ScopeGuard.h> #include <AK/ScopeGuard.h>
#include <LibCore/Timer.h> #include <LibCore/Timer.h>
@ -39,9 +40,6 @@
#include <LibGfx/StylePainter.h> #include <LibGfx/StylePainter.h>
#include <LibThread/BackgroundAction.h> #include <LibThread/BackgroundAction.h>
//#define COMPOSE_DEBUG
//#define OCCLUSIONS_DEBUG
namespace WindowServer { namespace WindowServer {
Compositor& Compositor::the() Compositor& Compositor::the()
@ -196,11 +194,12 @@ void Compositor::compose()
if (m_custom_background_color.has_value()) if (m_custom_background_color.has_value())
background_color = m_custom_background_color.value(); background_color = m_custom_background_color.value();
#ifdef COMPOSE_DEBUG if constexpr (debug_compose) {
dbg() << "COMPOSE: invalidated: window:" << m_invalidated_window << " cursor:" << m_invalidated_cursor << " any: " << m_invalidated_any; dbgln("COMPOSE: invalidated: window: {} cursor: {}, any: {}", m_invalidated_window, m_invalidated_cursor, m_invalidated_any);
for (auto& r : dirty_screen_rects.rects()) for (auto& r : dirty_screen_rects.rects())
dbg() << "dirty screen: " << r; dbgln("dirty screen: {}", r);
#endif }
Gfx::DisjointRectSet flush_rects; Gfx::DisjointRectSet flush_rects;
Gfx::DisjointRectSet flush_transparent_rects; Gfx::DisjointRectSet flush_transparent_rects;
Gfx::DisjointRectSet flush_special_rects; Gfx::DisjointRectSet flush_special_rects;
@ -216,9 +215,7 @@ void Compositor::compose()
}; };
auto prepare_rect = [&](const Gfx::IntRect& rect) { auto prepare_rect = [&](const Gfx::IntRect& rect) {
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" -> flush opaque: {}", rect);
dbg() << " -> flush opaque: " << rect;
#endif
ASSERT(!flush_rects.intersects(rect)); ASSERT(!flush_rects.intersects(rect));
ASSERT(!flush_transparent_rects.intersects(rect)); ASSERT(!flush_transparent_rects.intersects(rect));
flush_rects.add(rect); flush_rects.add(rect);
@ -226,9 +223,7 @@ void Compositor::compose()
}; };
auto prepare_transparency_rect = [&](const Gfx::IntRect& rect) { auto prepare_transparency_rect = [&](const Gfx::IntRect& rect) {
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" -> flush transparent: {}", rect);
dbg() << " -> flush transparent: " << rect;
#endif
ASSERT(!flush_rects.intersects(rect)); ASSERT(!flush_rects.intersects(rect));
bool have_rect = false; bool have_rect = false;
for (auto& r : flush_transparent_rects.rects()) { for (auto& r : flush_transparent_rects.rects()) {
@ -275,9 +270,7 @@ void Compositor::compose()
}; };
m_opaque_wallpaper_rects.for_each_intersected(dirty_screen_rects, [&](const Gfx::IntRect& render_rect) { m_opaque_wallpaper_rects.for_each_intersected(dirty_screen_rects, [&](const Gfx::IntRect& render_rect) {
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" render wallpaper opaque: {}", render_rect);
dbg() << " render wallpaper opaque: " << render_rect;
#endif
prepare_rect(render_rect); prepare_rect(render_rect);
paint_wallpaper(back_painter, render_rect); paint_wallpaper(back_painter, render_rect);
return IterationDecision::Continue; return IterationDecision::Continue;
@ -289,9 +282,7 @@ void Compositor::compose()
return IterationDecision::Continue; return IterationDecision::Continue;
auto frame_rects = frame_rect.shatter(window.rect()); auto frame_rects = frame_rect.shatter(window.rect());
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" window {} frame rect: {}", window.title(), frame_rect);
dbg() << " window " << window.title() << " frame rect: " << frame_rect;
#endif
RefPtr<Gfx::Bitmap> backing_store = window.backing_store(); RefPtr<Gfx::Bitmap> backing_store = window.backing_store();
auto compose_window_rect = [&](Gfx::Painter& painter, const Gfx::IntRect& rect) { auto compose_window_rect = [&](Gfx::Painter& painter, const Gfx::IntRect& rect) {
@ -300,9 +291,7 @@ void Compositor::compose()
// TODO: Should optimize this to use a backing buffer // TODO: Should optimize this to use a backing buffer
Gfx::PainterStateSaver saver(painter); Gfx::PainterStateSaver saver(painter);
painter.add_clip_rect(intersected_rect); painter.add_clip_rect(intersected_rect);
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" render frame: {}", intersected_rect);
dbg() << " render frame: " << intersected_rect;
#endif
window.frame().paint(painter); window.frame().paint(painter);
return IterationDecision::Continue; return IterationDecision::Continue;
}); });
@ -370,22 +359,22 @@ void Compositor::compose()
}; };
auto& dirty_rects = window.dirty_rects(); auto& dirty_rects = window.dirty_rects();
#ifdef COMPOSE_DEBUG
for (auto& dirty_rect : dirty_rects.rects()) if constexpr (debug_compose) {
dbg() << " dirty: " << dirty_rect; for (auto& dirty_rect : dirty_rects.rects())
for (auto& r : window.opaque_rects().rects()) dbgln(" dirty: {}", dirty_rect);
dbg() << " opaque: " << r; for (auto& r : window.opaque_rects().rects())
for (auto& r : window.transparency_rects().rects()) dbgln(" opaque: {}", r);
dbg() << " transparent: " << r; for (auto& r : window.transparency_rects().rects())
#endif dbgln(" transparent: {}", r);
}
// Render opaque portions directly to the back buffer // Render opaque portions directly to the back buffer
auto& opaque_rects = window.opaque_rects(); auto& opaque_rects = window.opaque_rects();
if (!opaque_rects.is_empty()) { if (!opaque_rects.is_empty()) {
opaque_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) { opaque_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) {
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" render opaque: {}", render_rect);
dbg() << " render opaque: " << render_rect;
#endif
prepare_rect(render_rect); prepare_rect(render_rect);
Gfx::PainterStateSaver saver(back_painter); Gfx::PainterStateSaver saver(back_painter);
back_painter.add_clip_rect(render_rect); back_painter.add_clip_rect(render_rect);
@ -399,9 +388,8 @@ void Compositor::compose()
auto& transparency_wallpaper_rects = window.transparency_wallpaper_rects(); auto& transparency_wallpaper_rects = window.transparency_wallpaper_rects();
if (!transparency_wallpaper_rects.is_empty()) { if (!transparency_wallpaper_rects.is_empty()) {
transparency_wallpaper_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) { transparency_wallpaper_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) {
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" render wallpaper: {}", render_rect);
dbg() << " render wallpaper: " << render_rect;
#endif
prepare_transparency_rect(render_rect); prepare_transparency_rect(render_rect);
paint_wallpaper(temp_painter, render_rect); paint_wallpaper(temp_painter, render_rect);
return IterationDecision::Continue; return IterationDecision::Continue;
@ -410,9 +398,8 @@ void Compositor::compose()
auto& transparency_rects = window.transparency_rects(); auto& transparency_rects = window.transparency_rects();
if (!transparency_rects.is_empty()) { if (!transparency_rects.is_empty()) {
transparency_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) { transparency_rects.for_each_intersected(dirty_rects, [&](const Gfx::IntRect& render_rect) {
#ifdef COMPOSE_DEBUG dbgln<debug_compose>(" render transparent: {}", render_rect);
dbg() << " render transparent: " << render_rect;
#endif
prepare_transparency_rect(render_rect); prepare_transparency_rect(render_rect);
Gfx::PainterStateSaver saver(temp_painter); Gfx::PainterStateSaver saver(temp_painter);
temp_painter.add_clip_rect(render_rect); temp_painter.add_clip_rect(render_rect);
@ -440,7 +427,7 @@ void Compositor::compose()
for (auto& rect_transparent : flush_transparent_rects.rects()) { for (auto& rect_transparent : flush_transparent_rects.rects()) {
for (auto& rect_opaque : flush_rects.rects()) { for (auto& rect_opaque : flush_rects.rects()) {
if (rect_opaque.intersects(rect_transparent)) { if (rect_opaque.intersects(rect_transparent)) {
dbg() << "Transparent rect " << rect_transparent << " overlaps opaque rect: " << rect_opaque << ": " << rect_opaque.intersected(rect_transparent); dbgln("Transparent rect {} overlaps opaque rect: {}: {}", rect_transparent, rect_opaque, rect_opaque.intersected(rect_transparent));
return true; return true;
} }
} }
@ -684,9 +671,7 @@ void Compositor::run_animations(Gfx::DisjointRectSet& flush_rects)
from_rect.height() - (int)(height_delta_per_step * animation_index) from_rect.height() - (int)(height_delta_per_step * animation_index)
}; };
#ifdef MINIMIZE_ANIMATION_DEBUG dbgln<debug_minimize_animation>("Minimize animation from {} to {} frame# {} {}", from_rect, to_rect, animation_index, rect);
dbg() << "Minimize animation from " << from_rect << " to " << to_rect << " frame# " << animation_index << " " << rect;
#endif
painter.draw_rect(rect, Color::Transparent); // Color doesn't matter, we draw inverted painter.draw_rect(rect, Color::Transparent); // Color doesn't matter, we draw inverted
flush_rects.add(rect); flush_rects.add(rect);
@ -708,7 +693,7 @@ bool Compositor::set_resolution(int desired_width, int desired_height, int scale
// Make sure it's impossible to set an invalid resolution // Make sure it's impossible to set an invalid resolution
if (!(desired_width >= 640 && desired_height >= 480 && scale_factor >= 1)) { if (!(desired_width >= 640 && desired_height >= 480 && scale_factor >= 1)) {
dbg() << "Compositor: Tried to set invalid resolution: " << desired_width << "x" << desired_height << " @ " << scale_factor << "x"; dbgln("Compositor: Tried to set invalid resolution: {}x{}", desired_width, desired_height);
return false; return false;
} }
@ -1016,25 +1001,26 @@ void Compositor::recompute_occlusions()
m_opaque_wallpaper_rects = move(visible_rects); m_opaque_wallpaper_rects = move(visible_rects);
} }
#ifdef OCCLUSIONS_DEBUG if constexpr (debug_occlusions) {
for (auto& r : m_opaque_wallpaper_rects.rects()) for (auto& r : m_opaque_wallpaper_rects.rects())
dbg() << " wallpaper opaque: " << r; dbgln(" wallpaper opaque: {}", r);
#endif }
wm.for_each_visible_window_from_back_to_front([&](Window& w) { wm.for_each_visible_window_from_back_to_front([&](Window& w) {
auto window_frame_rect = w.frame().rect().intersected(screen_rect); auto window_frame_rect = w.frame().rect().intersected(screen_rect);
if (w.is_minimized() || window_frame_rect.is_empty()) if (w.is_minimized() || window_frame_rect.is_empty())
return IterationDecision::Continue; return IterationDecision::Continue;
#ifdef OCCLUSIONS_DEBUG if constexpr (debug_occlusions) {
dbg() << " Window " << w.title() << " frame rect: " << window_frame_rect; dbgln(" Window {} frame rect: {}", w.title(), window_frame_rect);
for (auto& r : w.opaque_rects().rects()) for (auto& r : w.opaque_rects().rects())
dbg() << " opaque: " << r; dbgln(" opaque: {}", r);
for (auto& r : w.transparency_wallpaper_rects().rects()) for (auto& r : w.transparency_wallpaper_rects().rects())
dbg() << " transparent wallpaper: " << r; dbgln(" transparent wallpaper: {}", r);
for (auto& r : w.transparency_rects().rects()) for (auto& r : w.transparency_rects().rects())
dbg() << " transparent: " << r; dbgln(" transparent: {}", r);
#endif }
ASSERT(!w.opaque_rects().intersects(m_opaque_wallpaper_rects)); ASSERT(!w.opaque_rects().intersects(m_opaque_wallpaper_rects));
ASSERT(!w.transparency_rects().intersects(m_opaque_wallpaper_rects)); ASSERT(!w.transparency_rects().intersects(m_opaque_wallpaper_rects));
ASSERT(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects)); ASSERT(!w.transparency_wallpaper_rects().intersects(m_opaque_wallpaper_rects));