1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

Let userland retain the window backing store while drawing into it.

To start painting, call:
gui$get_window_backing_store()

Then finish up with:
gui$release_window_backing_store()

Process will retain the underlying GraphicsBitmap behind the scenes.
This fixes racing between the WindowServer and GUI clients.

This patch also adds a WSWindowLocker that is exactly what it sounds like.
This commit is contained in:
Andreas Kling 2019-01-24 23:40:12 +01:00
parent ccf3fc4618
commit 86eae0f8df
22 changed files with 244 additions and 102 deletions

View file

@ -4,11 +4,13 @@
#include <SharedGraphics/GraphicsBitmap.h>
#include <AK/AKString.h>
#include <AK/InlineLinkedList.h>
#include <AK/Lock.h>
#include "WSEventReceiver.h"
class Process;
class WSWindow final : public WSEventReceiver, public InlineLinkedListNode<WSWindow> {
friend class WSWindowLocker;
public:
WSWindow(Process&, int window_id);
virtual ~WSWindow() override;
@ -46,6 +48,7 @@ public:
WSWindow* m_prev { nullptr };
private:
Lock m_lock;
String m_title;
Rect m_rect;
bool m_is_being_dragged { false };
@ -56,3 +59,11 @@ private:
pid_t m_pid { -1 };
};
class WSWindowLocker {
public:
WSWindowLocker(WSWindow& window) : m_locker(window.m_lock) { }
~WSWindowLocker() { }
private:
Locker m_locker;
};