mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00

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.
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "GObject.h"
|
|
#include <SharedGraphics/Rect.h>
|
|
#include <SharedGraphics/GraphicsBitmap.h>
|
|
#include <AK/AKString.h>
|
|
|
|
class GWidget;
|
|
|
|
class GWindow final : public GObject {
|
|
public:
|
|
GWindow(GObject* parent = nullptr);
|
|
virtual ~GWindow() override;
|
|
|
|
static GWindow* from_window_id(int);
|
|
|
|
int window_id() const { return m_window_id; }
|
|
|
|
void set_title(String&&);
|
|
|
|
int x() const { return rect().x(); }
|
|
int y() const { return rect().y(); }
|
|
int width() const { return rect().width(); }
|
|
int height() const { return rect().height(); }
|
|
|
|
Rect rect() const;
|
|
void set_rect(const Rect&);
|
|
|
|
Point position() const { return rect().location(); }
|
|
|
|
virtual void event(GEvent&) override;
|
|
|
|
bool is_visible() const;
|
|
|
|
void close();
|
|
|
|
GWidget* main_widget() { return m_main_widget; }
|
|
const GWidget* main_widget() const { return m_main_widget; }
|
|
void set_main_widget(GWidget*);
|
|
|
|
void show();
|
|
|
|
void update();
|
|
|
|
private:
|
|
RetainPtr<GraphicsBitmap> m_backing;
|
|
int m_window_id { -1 };
|
|
GWidget* m_main_widget { nullptr };
|
|
};
|
|
|