mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
WindowServer: Slap everything with locks.
This commit is contained in:
parent
5983a217c3
commit
133f9aa352
Notes:
sideshowbarker
2024-07-19 16:00:51 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/133f9aa3522
@ -51,6 +51,7 @@ int WSEventLoop::exec()
|
||||
|
||||
Vector<QueuedEvent> events;
|
||||
{
|
||||
ASSERT_INTERRUPTS_ENABLED();
|
||||
LOCKER(m_lock);
|
||||
events = move(m_queued_events);
|
||||
}
|
||||
|
@ -141,6 +141,7 @@ WSWindowManager::~WSWindowManager()
|
||||
|
||||
void WSWindowManager::paintWindowFrame(WSWindow& window)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
//printf("[WM] paintWindowFrame {%p}, rect: %d,%d %dx%d\n", &window, window.rect().x(), window.rect().y(), window.rect().width(), window.rect().height());
|
||||
|
||||
auto titleBarRect = titleBarRectForWindow(window.rect());
|
||||
@ -167,6 +168,7 @@ void WSWindowManager::paintWindowFrame(WSWindow& window)
|
||||
|
||||
void WSWindowManager::addWindow(WSWindow& window)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
m_windows.set(&window);
|
||||
m_windows_in_order.append(&window);
|
||||
if (!activeWindow())
|
||||
@ -175,12 +177,14 @@ void WSWindowManager::addWindow(WSWindow& window)
|
||||
|
||||
void WSWindowManager::move_to_front(WSWindow& window)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
m_windows_in_order.remove(&window);
|
||||
m_windows_in_order.append(&window);
|
||||
}
|
||||
|
||||
void WSWindowManager::removeWindow(WSWindow& window)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
if (!m_windows.contains(&window))
|
||||
return;
|
||||
|
||||
@ -270,6 +274,7 @@ void WSWindowManager::processMouseEvent(MouseEvent& event)
|
||||
|
||||
void WSWindowManager::compose()
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
auto invalidated_rects = move(m_invalidated_rects);
|
||||
#ifdef DEBUG_COUNTERS
|
||||
dbgprintf("[WM] compose #%u (%u rects)\n", ++m_recompose_count, invalidated_rects.size());
|
||||
@ -351,6 +356,7 @@ void WSWindowManager::event(WSEvent& event)
|
||||
|
||||
void WSWindowManager::setActiveWindow(WSWindow* window)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
if (window == m_activeWindow.ptr())
|
||||
return;
|
||||
|
||||
@ -363,12 +369,14 @@ void WSWindowManager::setActiveWindow(WSWindow* window)
|
||||
|
||||
void WSWindowManager::invalidate()
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
m_invalidated_rects.clear_with_capacity();
|
||||
m_invalidated_rects.append(m_screen_rect);
|
||||
}
|
||||
|
||||
void WSWindowManager::invalidate(const Rect& a_rect)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
auto rect = Rect::intersection(a_rect, m_screen_rect);
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user