summaryrefslogtreecommitdiff
path: root/WindowServer
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-17 16:21:04 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-17 16:21:04 +0100
commit133f9aa3522645c35f76496f6b0a1b4951f9afae (patch)
treee1b7116bc95fee7bd43267f8a33619594850f9b7 /WindowServer
parent5983a217c31595bca583451d074563013118a218 (diff)
downloadserenity-133f9aa3522645c35f76496f6b0a1b4951f9afae.zip
WindowServer: Slap everything with locks.
Diffstat (limited to 'WindowServer')
-rw-r--r--WindowServer/WSEventLoop.cpp1
-rw-r--r--WindowServer/WSWindowManager.cpp8
2 files changed, 9 insertions, 0 deletions
diff --git a/WindowServer/WSEventLoop.cpp b/WindowServer/WSEventLoop.cpp
index 95f2493260..37d77fc0b9 100644
--- a/WindowServer/WSEventLoop.cpp
+++ b/WindowServer/WSEventLoop.cpp
@@ -51,6 +51,7 @@ int WSEventLoop::exec()
Vector<QueuedEvent> events;
{
+ ASSERT_INTERRUPTS_ENABLED();
LOCKER(m_lock);
events = move(m_queued_events);
}
diff --git a/WindowServer/WSWindowManager.cpp b/WindowServer/WSWindowManager.cpp
index 43ae59535a..e0ab2d8d13 100644
--- a/WindowServer/WSWindowManager.cpp
+++ b/WindowServer/WSWindowManager.cpp
@@ -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;