mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
WindowServer: Rename WSEvent to WSMessage.
Also do the same for WSMessageLoop and WSMessageReceiver. More to come.
This commit is contained in:
parent
7cf3c7461c
commit
bba21adae3
Notes:
sideshowbarker
2024-07-19 15:56:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/bba21adae37
16 changed files with 129 additions and 151 deletions
|
@ -55,8 +55,8 @@ SHAREDGRAPHICS_OBJS = \
|
||||||
../SharedGraphics/GraphicsBitmap.o
|
../SharedGraphics/GraphicsBitmap.o
|
||||||
|
|
||||||
WINDOWSERVER_OBJS = \
|
WINDOWSERVER_OBJS = \
|
||||||
../WindowServer/WSEventReceiver.o \
|
../WindowServer/WSMessageReceiver.o \
|
||||||
../WindowServer/WSEventLoop.o \
|
../WindowServer/WSMessageLoop.o \
|
||||||
../WindowServer/WSWindow.o \
|
../WindowServer/WSWindow.o \
|
||||||
../WindowServer/WSWindowManager.o \
|
../WindowServer/WSWindowManager.o \
|
||||||
../WindowServer/WSScreen.o \
|
../WindowServer/WSScreen.o \
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
#include <SharedGraphics/Font.h>
|
#include <SharedGraphics/Font.h>
|
||||||
#include <WindowServer/WSScreen.h>
|
#include <WindowServer/WSScreen.h>
|
||||||
#include <WindowServer/WSEventLoop.h>
|
#include <WindowServer/WSMessageLoop.h>
|
||||||
#include <WindowServer/WSWindow.h>
|
#include <WindowServer/WSWindow.h>
|
||||||
#include <WindowServer/WSWindowManager.h>
|
#include <WindowServer/WSWindowManager.h>
|
||||||
|
|
||||||
|
@ -12,11 +12,11 @@
|
||||||
void Process::initialize_gui_statics()
|
void Process::initialize_gui_statics()
|
||||||
{
|
{
|
||||||
Font::initialize();
|
Font::initialize();
|
||||||
WSEventLoop::initialize();
|
WSMessageLoop::initialize();
|
||||||
WSWindowManager::initialize();
|
WSWindowManager::initialize();
|
||||||
WSScreen::initialize();
|
WSScreen::initialize();
|
||||||
|
|
||||||
new WSEventLoop;
|
new WSMessageLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Process::make_window_id()
|
int Process::make_window_id()
|
||||||
|
@ -33,7 +33,7 @@ int Process::make_window_id()
|
||||||
static void wait_for_gui_server()
|
static void wait_for_gui_server()
|
||||||
{
|
{
|
||||||
// FIXME: Time out after a while and return an error.
|
// FIXME: Time out after a while and return an error.
|
||||||
while (!WSEventLoop::the().running())
|
while (!WSMessageLoop::the().running())
|
||||||
sleep(10);
|
sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ int Process::gui$create_window(const GUI_WindowParameters* user_params)
|
||||||
if (rect.is_empty())
|
if (rect.is_empty())
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ProcessPagingScope scope(WSEventLoop::the().server_process());
|
ProcessPagingScope scope(WSMessageLoop::the().server_process());
|
||||||
|
|
||||||
int window_id = make_window_id();
|
int window_id = make_window_id();
|
||||||
if (!window_id)
|
if (!window_id)
|
||||||
|
@ -145,8 +145,8 @@ int Process::gui$invalidate_window(int window_id, const GUI_Rect* a_rect)
|
||||||
Rect rect;
|
Rect rect;
|
||||||
if (a_rect)
|
if (a_rect)
|
||||||
rect = *a_rect;
|
rect = *a_rect;
|
||||||
WSEventLoop::the().post_event(&window, make<WSPaintEvent>(rect));
|
WSMessageLoop::the().post_event(&window, make<WSPaintEvent>(rect));
|
||||||
WSEventLoop::the().server_process().request_wakeup();
|
WSMessageLoop::the().server_process().request_wakeup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,8 +169,8 @@ int Process::gui$notify_paint_finished(int window_id, const GUI_Rect* a_rect)
|
||||||
Rect rect;
|
Rect rect;
|
||||||
if (a_rect)
|
if (a_rect)
|
||||||
rect = *a_rect;
|
rect = *a_rect;
|
||||||
WSEventLoop::the().post_event(&window, make<WSWindowInvalidationEvent>(rect));
|
WSMessageLoop::the().post_event(&window, make<WSWindowInvalidationEvent>(rect));
|
||||||
WSEventLoop::the().server_process().request_wakeup();
|
WSMessageLoop::the().server_process().request_wakeup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,8 +207,8 @@ int Process::gui$set_window_title(int window_id, const char* title, size_t size)
|
||||||
return -EBADWINDOW;
|
return -EBADWINDOW;
|
||||||
auto& window = *(*it).value;
|
auto& window = *(*it).value;
|
||||||
String new_title(title, size);
|
String new_title(title, size);
|
||||||
WSEventLoop::the().post_event(&window, make<WSSetWindowTitle>(move(new_title)));
|
WSMessageLoop::the().post_event(&window, make<WSSetWindowTitle>(move(new_title)));
|
||||||
WSEventLoop::the().server_process().request_wakeup();
|
WSMessageLoop::the().server_process().request_wakeup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ int Process::gui$set_window_rect(int window_id, const GUI_Rect* rect)
|
||||||
return -EBADWINDOW;
|
return -EBADWINDOW;
|
||||||
auto& window = *(*it).value;
|
auto& window = *(*it).value;
|
||||||
Rect new_rect = *rect;
|
Rect new_rect = *rect;
|
||||||
WSEventLoop::the().post_event(&window, make<WSSetWindowRect>(new_rect));
|
WSMessageLoop::the().post_event(&window, make<WSSetWindowRect>(new_rect));
|
||||||
WSEventLoop::the().server_process().request_wakeup();
|
WSMessageLoop::the().server_process().request_wakeup();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <Kernel/MemoryManager.h>
|
#include <Kernel/MemoryManager.h>
|
||||||
#include <WindowServer/WSEventLoop.h>
|
#include <WindowServer/WSMessageLoop.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KERNEL
|
#ifdef KERNEL
|
||||||
|
@ -24,7 +24,7 @@ GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size)
|
||||||
m_client_region = process.allocate_region_with_vmo(LinearAddress(), size_in_bytes, vmo.copyRef(), 0, "GraphicsBitmap (client)", true, true);
|
m_client_region = process.allocate_region_with_vmo(LinearAddress(), size_in_bytes, vmo.copyRef(), 0, "GraphicsBitmap (client)", true, true);
|
||||||
m_client_region->set_shared(true);
|
m_client_region->set_shared(true);
|
||||||
m_client_region->commit();
|
m_client_region->commit();
|
||||||
auto& server = WSEventLoop::the().server_process();
|
auto& server = WSMessageLoop::the().server_process();
|
||||||
m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (server)", true, false);
|
m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (server)", true, false);
|
||||||
m_server_region->set_shared(true);
|
m_server_region->set_shared(true);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ GraphicsBitmap::~GraphicsBitmap()
|
||||||
if (m_client_region)
|
if (m_client_region)
|
||||||
m_client_process->deallocate_region(*m_client_region);
|
m_client_process->deallocate_region(*m_client_region);
|
||||||
if (m_server_region)
|
if (m_server_region)
|
||||||
WSEventLoop::the().server_process().deallocate_region(*m_server_region);
|
WSMessageLoop::the().server_process().deallocate_region(*m_server_region);
|
||||||
#endif
|
#endif
|
||||||
m_data = nullptr;
|
m_data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#include "WSEventReceiver.h"
|
|
||||||
#include <AK/Assertions.h>
|
|
||||||
|
|
||||||
WSEventReceiver::WSEventReceiver()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
WSEventReceiver::~WSEventReceiver()
|
|
||||||
{
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <AK/Weakable.h>
|
|
||||||
|
|
||||||
class WSEvent;
|
|
||||||
|
|
||||||
class WSEventReceiver : public Weakable<WSEventReceiver> {
|
|
||||||
public:
|
|
||||||
WSEventReceiver();
|
|
||||||
virtual ~WSEventReceiver();
|
|
||||||
|
|
||||||
virtual void event(WSEvent&) = 0;
|
|
||||||
};
|
|
|
@ -5,36 +5,16 @@
|
||||||
#include <AK/AKString.h>
|
#include <AK/AKString.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
|
||||||
static const char* WSEvent_names[] = {
|
class WSMessage {
|
||||||
"Invalid",
|
|
||||||
"Show",
|
|
||||||
"Hide",
|
|
||||||
"Paint",
|
|
||||||
"MouseMove",
|
|
||||||
"MouseDown",
|
|
||||||
"MouseUp",
|
|
||||||
"KeyDown",
|
|
||||||
"KeyUp",
|
|
||||||
"Timer",
|
|
||||||
"WM_Compose",
|
|
||||||
"WM_Invalidate",
|
|
||||||
"WindowActivated",
|
|
||||||
"WindowDeactivated",
|
|
||||||
};
|
|
||||||
|
|
||||||
class WSEvent {
|
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
Invalid = 0,
|
Invalid = 0,
|
||||||
Show,
|
|
||||||
Hide,
|
|
||||||
Paint,
|
Paint,
|
||||||
MouseMove,
|
MouseMove,
|
||||||
MouseDown,
|
MouseDown,
|
||||||
MouseUp,
|
MouseUp,
|
||||||
KeyDown,
|
KeyDown,
|
||||||
KeyUp,
|
KeyUp,
|
||||||
Timer,
|
|
||||||
WM_Compose,
|
WM_Compose,
|
||||||
WM_Invalidate,
|
WM_Invalidate,
|
||||||
WindowActivated,
|
WindowActivated,
|
||||||
|
@ -43,14 +23,12 @@ public:
|
||||||
WM_SetWindowRect,
|
WM_SetWindowRect,
|
||||||
};
|
};
|
||||||
|
|
||||||
WSEvent() { }
|
WSMessage() { }
|
||||||
explicit WSEvent(Type type) : m_type(type) { }
|
explicit WSMessage(Type type) : m_type(type) { }
|
||||||
virtual ~WSEvent() { }
|
virtual ~WSMessage() { }
|
||||||
|
|
||||||
Type type() const { return m_type; }
|
Type type() const { return m_type; }
|
||||||
|
|
||||||
const char* name() const { return WSEvent_names[(unsigned)m_type]; }
|
|
||||||
|
|
||||||
bool is_mouse_event() const { return m_type == MouseMove || m_type == MouseDown || m_type == MouseUp; }
|
bool is_mouse_event() const { return m_type == MouseMove || m_type == MouseDown || m_type == MouseUp; }
|
||||||
bool is_key_event() const { return m_type == KeyUp || m_type == KeyDown; }
|
bool is_key_event() const { return m_type == KeyUp || m_type == KeyDown; }
|
||||||
bool is_paint_event() const { return m_type == Paint; }
|
bool is_paint_event() const { return m_type == Paint; }
|
||||||
|
@ -59,10 +37,10 @@ private:
|
||||||
Type m_type { Invalid };
|
Type m_type { Invalid };
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSWindowInvalidationEvent final : public WSEvent {
|
class WSWindowInvalidationEvent final : public WSMessage {
|
||||||
public:
|
public:
|
||||||
explicit WSWindowInvalidationEvent(const Rect& rect = Rect())
|
explicit WSWindowInvalidationEvent(const Rect& rect = Rect())
|
||||||
: WSEvent(WSEvent::WM_Invalidate)
|
: WSMessage(WSMessage::WM_Invalidate)
|
||||||
, m_rect(rect)
|
, m_rect(rect)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -72,10 +50,10 @@ private:
|
||||||
Rect m_rect;
|
Rect m_rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSSetWindowTitle final : public WSEvent {
|
class WSSetWindowTitle final : public WSMessage {
|
||||||
public:
|
public:
|
||||||
explicit WSSetWindowTitle(String&& title)
|
explicit WSSetWindowTitle(String&& title)
|
||||||
: WSEvent(WSEvent::WM_SetWindowTitle)
|
: WSMessage(WSMessage::WM_SetWindowTitle)
|
||||||
, m_title(move(title))
|
, m_title(move(title))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -86,10 +64,10 @@ private:
|
||||||
String m_title;
|
String m_title;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSSetWindowRect final : public WSEvent {
|
class WSSetWindowRect final : public WSMessage {
|
||||||
public:
|
public:
|
||||||
explicit WSSetWindowRect(const Rect& rect)
|
explicit WSSetWindowRect(const Rect& rect)
|
||||||
: WSEvent(WSEvent::WM_SetWindowRect)
|
: WSMessage(WSMessage::WM_SetWindowRect)
|
||||||
, m_rect(rect)
|
, m_rect(rect)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -100,10 +78,10 @@ private:
|
||||||
Rect m_rect;
|
Rect m_rect;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSPaintEvent final : public WSEvent {
|
class WSPaintEvent final : public WSMessage {
|
||||||
public:
|
public:
|
||||||
explicit WSPaintEvent(const Rect& rect = Rect())
|
explicit WSPaintEvent(const Rect& rect = Rect())
|
||||||
: WSEvent(WSEvent::Paint)
|
: WSMessage(WSMessage::Paint)
|
||||||
, m_rect(rect)
|
, m_rect(rect)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -121,10 +99,10 @@ enum class MouseButton : byte {
|
||||||
Middle = 4,
|
Middle = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSKeyEvent final : public WSEvent {
|
class WSKeyEvent final : public WSMessage {
|
||||||
public:
|
public:
|
||||||
WSKeyEvent(Type type, int key, char character)
|
WSKeyEvent(Type type, int key, char character)
|
||||||
: WSEvent(type)
|
: WSMessage(type)
|
||||||
, m_key(key)
|
, m_key(key)
|
||||||
, m_character(character)
|
, m_character(character)
|
||||||
{
|
{
|
||||||
|
@ -137,7 +115,7 @@ public:
|
||||||
char character() const { return m_character; }
|
char character() const { return m_character; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class WSEventLoop;
|
friend class WSMessageLoop;
|
||||||
friend class WSScreen;
|
friend class WSScreen;
|
||||||
int m_key { 0 };
|
int m_key { 0 };
|
||||||
bool m_ctrl { false };
|
bool m_ctrl { false };
|
||||||
|
@ -146,10 +124,10 @@ private:
|
||||||
char m_character { 0 };
|
char m_character { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class WSMouseEvent final : public WSEvent {
|
class WSMouseEvent final : public WSMessage {
|
||||||
public:
|
public:
|
||||||
WSMouseEvent(Type type, const Point& position, unsigned buttons, MouseButton button = MouseButton::None)
|
WSMouseEvent(Type type, const Point& position, unsigned buttons, MouseButton button = MouseButton::None)
|
||||||
: WSEvent(type)
|
: WSMessage(type)
|
||||||
, m_position(position)
|
, m_position(position)
|
||||||
, m_buttons(buttons)
|
, m_buttons(buttons)
|
||||||
, m_button(button)
|
, m_button(button)
|
|
@ -1,6 +1,6 @@
|
||||||
#include "WSEventLoop.h"
|
#include "WSMessageLoop.h"
|
||||||
#include "WSEvent.h"
|
#include "WSMessage.h"
|
||||||
#include "WSEventReceiver.h"
|
#include "WSMessageReceiver.h"
|
||||||
#include "WSWindowManager.h"
|
#include "WSWindowManager.h"
|
||||||
#include "WSScreen.h"
|
#include "WSScreen.h"
|
||||||
#include "PS2MouseDevice.h"
|
#include "PS2MouseDevice.h"
|
||||||
|
@ -10,30 +10,30 @@
|
||||||
|
|
||||||
//#define WSEVENTLOOP_DEBUG
|
//#define WSEVENTLOOP_DEBUG
|
||||||
|
|
||||||
static WSEventLoop* s_the;
|
static WSMessageLoop* s_the;
|
||||||
|
|
||||||
void WSEventLoop::initialize()
|
void WSMessageLoop::initialize()
|
||||||
{
|
{
|
||||||
s_the = nullptr;
|
s_the = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
WSEventLoop::WSEventLoop()
|
WSMessageLoop::WSMessageLoop()
|
||||||
{
|
{
|
||||||
if (!s_the)
|
if (!s_the)
|
||||||
s_the = this;
|
s_the = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
WSEventLoop::~WSEventLoop()
|
WSMessageLoop::~WSMessageLoop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
WSEventLoop& WSEventLoop::the()
|
WSMessageLoop& WSMessageLoop::the()
|
||||||
{
|
{
|
||||||
ASSERT(s_the);
|
ASSERT(s_the);
|
||||||
return *s_the;
|
return *s_the;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WSEventLoop::exec()
|
int WSMessageLoop::exec()
|
||||||
{
|
{
|
||||||
m_server_process = current;
|
m_server_process = current;
|
||||||
|
|
||||||
|
@ -58,10 +58,10 @@ int WSEventLoop::exec()
|
||||||
auto* receiver = queued_event.receiver;
|
auto* receiver = queued_event.receiver;
|
||||||
auto& event = *queued_event.event;
|
auto& event = *queued_event.event;
|
||||||
#ifdef WSEVENTLOOP_DEBUG
|
#ifdef WSEVENTLOOP_DEBUG
|
||||||
dbgprintf("WSEventLoop: receiver{%p} event %u (%s)\n", receiver, (unsigned)event.type(), event.name());
|
dbgprintf("WSMessageLoop: receiver{%p} event %u (%s)\n", receiver, (unsigned)event.type(), event.name());
|
||||||
#endif
|
#endif
|
||||||
if (!receiver) {
|
if (!receiver) {
|
||||||
dbgprintf("WSEvent type %u with no receiver :(\n", event.type());
|
dbgprintf("WSMessage type %u with no receiver :(\n", event.type());
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -71,18 +71,18 @@ int WSEventLoop::exec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSEventLoop::post_event(WSEventReceiver* receiver, OwnPtr<WSEvent>&& event)
|
void WSMessageLoop::post_event(WSMessageReceiver* receiver, OwnPtr<WSMessage>&& event)
|
||||||
{
|
{
|
||||||
ASSERT_INTERRUPTS_ENABLED();
|
ASSERT_INTERRUPTS_ENABLED();
|
||||||
LOCKER(m_lock);
|
LOCKER(m_lock);
|
||||||
#ifdef WSEVENTLOOP_DEBUG
|
#ifdef WSEVENTLOOP_DEBUG
|
||||||
dbgprintf("WSEventLoop::post_event: {%u} << receiver=%p, event=%p\n", m_queued_events.size(), receiver, event.ptr());
|
dbgprintf("WSMessageLoop::post_event: {%u} << receiver=%p, event=%p\n", m_queued_events.size(), receiver, event.ptr());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (event->type() == WSEvent::WM_Invalidate) {
|
if (event->type() == WSMessage::WM_Invalidate) {
|
||||||
auto& invalidation_event = static_cast<WSWindowInvalidationEvent&>(*event);
|
auto& invalidation_event = static_cast<WSWindowInvalidationEvent&>(*event);
|
||||||
for (auto& queued_event : m_queued_events) {
|
for (auto& queued_event : m_queued_events) {
|
||||||
if (receiver == queued_event.receiver && queued_event.event->type() == WSEvent::WM_Invalidate) {
|
if (receiver == queued_event.receiver && queued_event.event->type() == WSMessage::WM_Invalidate) {
|
||||||
auto& queued_invalidation_event = static_cast<WSWindowInvalidationEvent&>(*queued_event.event);
|
auto& queued_invalidation_event = static_cast<WSWindowInvalidationEvent&>(*queued_event.event);
|
||||||
if (queued_invalidation_event.rect().is_empty() || queued_invalidation_event.rect().contains(invalidation_event.rect())) {
|
if (queued_invalidation_event.rect().is_empty() || queued_invalidation_event.rect().contains(invalidation_event.rect())) {
|
||||||
#ifdef WSEVENTLOOP_DEBUG
|
#ifdef WSEVENTLOOP_DEBUG
|
||||||
|
@ -94,10 +94,10 @@ void WSEventLoop::post_event(WSEventReceiver* receiver, OwnPtr<WSEvent>&& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->type() == WSEvent::Paint) {
|
if (event->type() == WSMessage::Paint) {
|
||||||
auto& invalidation_event = static_cast<WSPaintEvent&>(*event);
|
auto& invalidation_event = static_cast<WSPaintEvent&>(*event);
|
||||||
for (auto& queued_event : m_queued_events) {
|
for (auto& queued_event : m_queued_events) {
|
||||||
if (receiver == queued_event.receiver && queued_event.event->type() == WSEvent::Paint) {
|
if (receiver == queued_event.receiver && queued_event.event->type() == WSMessage::Paint) {
|
||||||
auto& queued_invalidation_event = static_cast<WSPaintEvent&>(*queued_event.event);
|
auto& queued_invalidation_event = static_cast<WSPaintEvent&>(*queued_event.event);
|
||||||
if (queued_invalidation_event.rect().is_empty() || queued_invalidation_event.rect().contains(invalidation_event.rect())) {
|
if (queued_invalidation_event.rect().is_empty() || queued_invalidation_event.rect().contains(invalidation_event.rect())) {
|
||||||
#ifdef WSEVENTLOOP_DEBUG
|
#ifdef WSEVENTLOOP_DEBUG
|
||||||
|
@ -115,7 +115,7 @@ void WSEventLoop::post_event(WSEventReceiver* receiver, OwnPtr<WSEvent>&& event)
|
||||||
m_server_process->request_wakeup();
|
m_server_process->request_wakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSEventLoop::wait_for_event()
|
void WSMessageLoop::wait_for_event()
|
||||||
{
|
{
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
memset(&rfds, 0, sizeof(rfds));
|
memset(&rfds, 0, sizeof(rfds));
|
||||||
|
@ -144,7 +144,7 @@ void WSEventLoop::wait_for_event()
|
||||||
drain_mouse();
|
drain_mouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSEventLoop::drain_mouse()
|
void WSMessageLoop::drain_mouse()
|
||||||
{
|
{
|
||||||
auto& screen = WSScreen::the();
|
auto& screen = WSScreen::the();
|
||||||
auto& mouse = PS2MouseDevice::the();
|
auto& mouse = PS2MouseDevice::the();
|
||||||
|
@ -170,7 +170,7 @@ void WSEventLoop::drain_mouse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSEventLoop::drain_keyboard()
|
void WSMessageLoop::drain_keyboard()
|
||||||
{
|
{
|
||||||
auto& screen = WSScreen::the();
|
auto& screen = WSScreen::the();
|
||||||
auto& keyboard = Keyboard::the();
|
auto& keyboard = Keyboard::the();
|
|
@ -1,23 +1,23 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "WSEvent.h"
|
#include "WSMessage.h"
|
||||||
#include <AK/Lock.h>
|
#include <AK/Lock.h>
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
|
||||||
class WSEventReceiver;
|
class WSMessageReceiver;
|
||||||
class Process;
|
class Process;
|
||||||
|
|
||||||
class WSEventLoop {
|
class WSMessageLoop {
|
||||||
public:
|
public:
|
||||||
WSEventLoop();
|
WSMessageLoop();
|
||||||
~WSEventLoop();
|
~WSMessageLoop();
|
||||||
|
|
||||||
int exec();
|
int exec();
|
||||||
|
|
||||||
void post_event(WSEventReceiver* receiver, OwnPtr<WSEvent>&&);
|
void post_event(WSMessageReceiver* receiver, OwnPtr<WSMessage>&&);
|
||||||
|
|
||||||
static WSEventLoop& the();
|
static WSMessageLoop& the();
|
||||||
|
|
||||||
static void initialize();
|
static void initialize();
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ private:
|
||||||
Lock m_lock;
|
Lock m_lock;
|
||||||
|
|
||||||
struct QueuedEvent {
|
struct QueuedEvent {
|
||||||
WSEventReceiver* receiver { nullptr };
|
WSMessageReceiver* receiver { nullptr };
|
||||||
OwnPtr<WSEvent> event;
|
OwnPtr<WSMessage> event;
|
||||||
};
|
};
|
||||||
Vector<QueuedEvent> m_queued_events;
|
Vector<QueuedEvent> m_queued_events;
|
||||||
|
|
10
WindowServer/WSMessageReceiver.cpp
Normal file
10
WindowServer/WSMessageReceiver.cpp
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include "WSMessageReceiver.h"
|
||||||
|
#include <AK/Assertions.h>
|
||||||
|
|
||||||
|
WSMessageReceiver::WSMessageReceiver()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
WSMessageReceiver::~WSMessageReceiver()
|
||||||
|
{
|
||||||
|
}
|
13
WindowServer/WSMessageReceiver.h
Normal file
13
WindowServer/WSMessageReceiver.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Weakable.h>
|
||||||
|
|
||||||
|
class WSMessage;
|
||||||
|
|
||||||
|
class WSMessageReceiver : public Weakable<WSMessageReceiver> {
|
||||||
|
public:
|
||||||
|
WSMessageReceiver();
|
||||||
|
virtual ~WSMessageReceiver();
|
||||||
|
|
||||||
|
virtual void event(WSMessage&) = 0;
|
||||||
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
#include "WSScreen.h"
|
#include "WSScreen.h"
|
||||||
#include "WSEventLoop.h"
|
#include "WSMessageLoop.h"
|
||||||
#include "WSEvent.h"
|
#include "WSMessage.h"
|
||||||
#include "WSWindowManager.h"
|
#include "WSWindowManager.h"
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
|
|
||||||
|
@ -47,20 +47,20 @@ void WSScreen::on_receive_mouse_data(int dx, int dy, bool left_button, bool righ
|
||||||
if (right_button)
|
if (right_button)
|
||||||
buttons |= (unsigned)MouseButton::Right;
|
buttons |= (unsigned)MouseButton::Right;
|
||||||
if (m_cursor_location != prev_location) {
|
if (m_cursor_location != prev_location) {
|
||||||
auto event = make<WSMouseEvent>(WSEvent::MouseMove, m_cursor_location, buttons);
|
auto event = make<WSMouseEvent>(WSMessage::MouseMove, m_cursor_location, buttons);
|
||||||
WSEventLoop::the().post_event(&WSWindowManager::the(), move(event));
|
WSMessageLoop::the().post_event(&WSWindowManager::the(), move(event));
|
||||||
}
|
}
|
||||||
bool prev_left_button = m_left_mouse_button_pressed;
|
bool prev_left_button = m_left_mouse_button_pressed;
|
||||||
bool prev_right_button = m_right_mouse_button_pressed;
|
bool prev_right_button = m_right_mouse_button_pressed;
|
||||||
m_left_mouse_button_pressed = left_button;
|
m_left_mouse_button_pressed = left_button;
|
||||||
m_right_mouse_button_pressed = right_button;
|
m_right_mouse_button_pressed = right_button;
|
||||||
if (prev_left_button != left_button) {
|
if (prev_left_button != left_button) {
|
||||||
auto event = make<WSMouseEvent>(left_button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location, buttons, MouseButton::Left);
|
auto event = make<WSMouseEvent>(left_button ? WSMessage::MouseDown : WSMessage::MouseUp, m_cursor_location, buttons, MouseButton::Left);
|
||||||
WSEventLoop::the().post_event(&WSWindowManager::the(), move(event));
|
WSMessageLoop::the().post_event(&WSWindowManager::the(), move(event));
|
||||||
}
|
}
|
||||||
if (prev_right_button != right_button) {
|
if (prev_right_button != right_button) {
|
||||||
auto event = make<WSMouseEvent>(right_button ? WSEvent::MouseDown : WSEvent::MouseUp, m_cursor_location, buttons, MouseButton::Right);
|
auto event = make<WSMouseEvent>(right_button ? WSMessage::MouseDown : WSMessage::MouseUp, m_cursor_location, buttons, MouseButton::Right);
|
||||||
WSEventLoop::the().post_event(&WSWindowManager::the(), move(event));
|
WSMessageLoop::the().post_event(&WSWindowManager::the(), move(event));
|
||||||
}
|
}
|
||||||
if (m_cursor_location != prev_location || prev_left_button != left_button)
|
if (m_cursor_location != prev_location || prev_left_button != left_button)
|
||||||
WSWindowManager::the().draw_cursor();
|
WSWindowManager::the().draw_cursor();
|
||||||
|
@ -68,9 +68,9 @@ void WSScreen::on_receive_mouse_data(int dx, int dy, bool left_button, bool righ
|
||||||
|
|
||||||
void WSScreen::on_receive_keyboard_data(Keyboard::Event kernel_event)
|
void WSScreen::on_receive_keyboard_data(Keyboard::Event kernel_event)
|
||||||
{
|
{
|
||||||
auto event = make<WSKeyEvent>(kernel_event.is_press() ? WSEvent::KeyDown : WSEvent::KeyUp, kernel_event.key, kernel_event.character);
|
auto event = make<WSKeyEvent>(kernel_event.is_press() ? WSMessage::KeyDown : WSMessage::KeyUp, kernel_event.key, kernel_event.character);
|
||||||
event->m_shift = kernel_event.shift();
|
event->m_shift = kernel_event.shift();
|
||||||
event->m_ctrl = kernel_event.ctrl();
|
event->m_ctrl = kernel_event.ctrl();
|
||||||
event->m_alt = kernel_event.alt();
|
event->m_alt = kernel_event.alt();
|
||||||
WSEventLoop::the().post_event(&WSWindowManager::the(), move(event));
|
WSMessageLoop::the().post_event(&WSWindowManager::the(), move(event));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "WSWindow.h"
|
#include "WSWindow.h"
|
||||||
#include "WSWindowManager.h"
|
#include "WSWindowManager.h"
|
||||||
#include "WSEvent.h"
|
#include "WSMessage.h"
|
||||||
#include "WSEventLoop.h"
|
#include "WSMessageLoop.h"
|
||||||
#include "Process.h"
|
#include "Process.h"
|
||||||
|
|
||||||
WSWindow::WSWindow(Process& process, int window_id)
|
WSWindow::WSWindow(Process& process, int window_id)
|
||||||
|
@ -54,35 +54,35 @@ static GUI_MouseButton to_api(MouseButton button)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSWindow::event(WSEvent& event)
|
void WSWindow::event(WSMessage& event)
|
||||||
{
|
{
|
||||||
GUI_Event gui_event;
|
GUI_Event gui_event;
|
||||||
gui_event.window_id = window_id();
|
gui_event.window_id = window_id();
|
||||||
|
|
||||||
switch (event.type()) {
|
switch (event.type()) {
|
||||||
case WSEvent::Paint:
|
case WSMessage::Paint:
|
||||||
gui_event.type = GUI_Event::Type::Paint;
|
gui_event.type = GUI_Event::Type::Paint;
|
||||||
gui_event.paint.rect = static_cast<WSPaintEvent&>(event).rect();
|
gui_event.paint.rect = static_cast<WSPaintEvent&>(event).rect();
|
||||||
break;
|
break;
|
||||||
case WSEvent::MouseMove:
|
case WSMessage::MouseMove:
|
||||||
gui_event.type = GUI_Event::Type::MouseMove;
|
gui_event.type = GUI_Event::Type::MouseMove;
|
||||||
gui_event.mouse.position = static_cast<WSMouseEvent&>(event).position();
|
gui_event.mouse.position = static_cast<WSMouseEvent&>(event).position();
|
||||||
gui_event.mouse.button = GUI_MouseButton::NoButton;
|
gui_event.mouse.button = GUI_MouseButton::NoButton;
|
||||||
gui_event.mouse.buttons = static_cast<WSMouseEvent&>(event).buttons();
|
gui_event.mouse.buttons = static_cast<WSMouseEvent&>(event).buttons();
|
||||||
break;
|
break;
|
||||||
case WSEvent::MouseDown:
|
case WSMessage::MouseDown:
|
||||||
gui_event.type = GUI_Event::Type::MouseDown;
|
gui_event.type = GUI_Event::Type::MouseDown;
|
||||||
gui_event.mouse.position = static_cast<WSMouseEvent&>(event).position();
|
gui_event.mouse.position = static_cast<WSMouseEvent&>(event).position();
|
||||||
gui_event.mouse.button = to_api(static_cast<WSMouseEvent&>(event).button());
|
gui_event.mouse.button = to_api(static_cast<WSMouseEvent&>(event).button());
|
||||||
gui_event.mouse.buttons = static_cast<WSMouseEvent&>(event).buttons();
|
gui_event.mouse.buttons = static_cast<WSMouseEvent&>(event).buttons();
|
||||||
break;
|
break;
|
||||||
case WSEvent::MouseUp:
|
case WSMessage::MouseUp:
|
||||||
gui_event.type = GUI_Event::Type::MouseUp;
|
gui_event.type = GUI_Event::Type::MouseUp;
|
||||||
gui_event.mouse.position = static_cast<WSMouseEvent&>(event).position();
|
gui_event.mouse.position = static_cast<WSMouseEvent&>(event).position();
|
||||||
gui_event.mouse.button = to_api(static_cast<WSMouseEvent&>(event).button());
|
gui_event.mouse.button = to_api(static_cast<WSMouseEvent&>(event).button());
|
||||||
gui_event.mouse.buttons = static_cast<WSMouseEvent&>(event).buttons();
|
gui_event.mouse.buttons = static_cast<WSMouseEvent&>(event).buttons();
|
||||||
break;
|
break;
|
||||||
case WSEvent::KeyDown:
|
case WSMessage::KeyDown:
|
||||||
gui_event.type = GUI_Event::Type::KeyDown;
|
gui_event.type = GUI_Event::Type::KeyDown;
|
||||||
gui_event.key.character = static_cast<WSKeyEvent&>(event).character();
|
gui_event.key.character = static_cast<WSKeyEvent&>(event).character();
|
||||||
gui_event.key.key = static_cast<WSKeyEvent&>(event).key();
|
gui_event.key.key = static_cast<WSKeyEvent&>(event).key();
|
||||||
|
@ -90,19 +90,19 @@ void WSWindow::event(WSEvent& event)
|
||||||
gui_event.key.ctrl = static_cast<WSKeyEvent&>(event).ctrl();
|
gui_event.key.ctrl = static_cast<WSKeyEvent&>(event).ctrl();
|
||||||
gui_event.key.shift = static_cast<WSKeyEvent&>(event).shift();
|
gui_event.key.shift = static_cast<WSKeyEvent&>(event).shift();
|
||||||
break;
|
break;
|
||||||
case WSEvent::WM_Invalidate:
|
case WSMessage::WM_Invalidate:
|
||||||
WSWindowManager::the().invalidate(*this, static_cast<WSWindowInvalidationEvent&>(event).rect());
|
WSWindowManager::the().invalidate(*this, static_cast<WSWindowInvalidationEvent&>(event).rect());
|
||||||
return;
|
return;
|
||||||
case WSEvent::WM_SetWindowRect:
|
case WSMessage::WM_SetWindowRect:
|
||||||
set_rect(static_cast<WSSetWindowRect&>(event).rect());
|
set_rect(static_cast<WSSetWindowRect&>(event).rect());
|
||||||
return;
|
return;
|
||||||
case WSEvent::WM_SetWindowTitle:
|
case WSMessage::WM_SetWindowTitle:
|
||||||
set_title(static_cast<WSSetWindowTitle&>(event).title());
|
set_title(static_cast<WSSetWindowTitle&>(event).title());
|
||||||
return;
|
return;
|
||||||
case WSEvent::WindowActivated:
|
case WSMessage::WindowActivated:
|
||||||
gui_event.type = GUI_Event::Type::WindowActivated;
|
gui_event.type = GUI_Event::Type::WindowActivated;
|
||||||
break;
|
break;
|
||||||
case WSEvent::WindowDeactivated:
|
case WSMessage::WindowDeactivated:
|
||||||
gui_event.type = GUI_Event::Type::WindowDeactivated;
|
gui_event.type = GUI_Event::Type::WindowDeactivated;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#include <AK/AKString.h>
|
#include <AK/AKString.h>
|
||||||
#include <AK/InlineLinkedList.h>
|
#include <AK/InlineLinkedList.h>
|
||||||
#include <AK/Lock.h>
|
#include <AK/Lock.h>
|
||||||
#include "WSEventReceiver.h"
|
#include "WSMessageReceiver.h"
|
||||||
|
|
||||||
class Process;
|
class Process;
|
||||||
|
|
||||||
class WSWindow final : public WSEventReceiver, public InlineLinkedListNode<WSWindow> {
|
class WSWindow final : public WSMessageReceiver, public InlineLinkedListNode<WSWindow> {
|
||||||
friend class WSWindowLocker;
|
friend class WSWindowLocker;
|
||||||
public:
|
public:
|
||||||
WSWindow(Process&, int window_id);
|
WSWindow(Process&, int window_id);
|
||||||
|
@ -33,7 +33,7 @@ public:
|
||||||
void set_position(const Point& position) { set_rect({ position.x(), position.y(), width(), height() }); }
|
void set_position(const Point& position) { set_rect({ position.x(), position.y(), width(), height() }); }
|
||||||
void set_position_without_repaint(const Point& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
|
void set_position_without_repaint(const Point& position) { set_rect_without_repaint({ position.x(), position.y(), width(), height() }); }
|
||||||
|
|
||||||
virtual void event(WSEvent&) override;
|
virtual void event(WSMessage&) override;
|
||||||
|
|
||||||
bool is_being_dragged() const { return m_is_being_dragged; }
|
bool is_being_dragged() const { return m_is_being_dragged; }
|
||||||
void set_is_being_dragged(bool b) { m_is_being_dragged = b; }
|
void set_is_being_dragged(bool b) { m_is_being_dragged = b; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "WSWindowManager.h"
|
#include "WSWindowManager.h"
|
||||||
#include "WSWindow.h"
|
#include "WSWindow.h"
|
||||||
#include "WSScreen.h"
|
#include "WSScreen.h"
|
||||||
#include "WSEventLoop.h"
|
#include "WSMessageLoop.h"
|
||||||
#include "Process.h"
|
#include "Process.h"
|
||||||
#include "MemoryManager.h"
|
#include "MemoryManager.h"
|
||||||
#include <Kernel/ProcFileSystem.h>
|
#include <Kernel/ProcFileSystem.h>
|
||||||
|
@ -243,7 +243,7 @@ void WSWindowManager::notify_rect_changed(WSWindow& window, const Rect& old_rect
|
||||||
|
|
||||||
void WSWindowManager::handle_titlebar_mouse_event(WSWindow& window, WSMouseEvent& event)
|
void WSWindowManager::handle_titlebar_mouse_event(WSWindow& window, WSMouseEvent& event)
|
||||||
{
|
{
|
||||||
if (event.type() == WSEvent::MouseDown && event.button() == MouseButton::Left) {
|
if (event.type() == WSMessage::MouseDown && event.button() == MouseButton::Left) {
|
||||||
#ifdef DRAG_DEBUG
|
#ifdef DRAG_DEBUG
|
||||||
printf("[WM] Begin dragging WSWindow{%p}\n", &window);
|
printf("[WM] Begin dragging WSWindow{%p}\n", &window);
|
||||||
#endif
|
#endif
|
||||||
|
@ -259,7 +259,7 @@ void WSWindowManager::handle_titlebar_mouse_event(WSWindow& window, WSMouseEvent
|
||||||
|
|
||||||
void WSWindowManager::process_mouse_event(WSMouseEvent& event)
|
void WSWindowManager::process_mouse_event(WSMouseEvent& event)
|
||||||
{
|
{
|
||||||
if (event.type() == WSEvent::MouseUp && event.button() == MouseButton::Left) {
|
if (event.type() == WSMessage::MouseUp && event.button() == MouseButton::Left) {
|
||||||
if (m_drag_window) {
|
if (m_drag_window) {
|
||||||
#ifdef DRAG_DEBUG
|
#ifdef DRAG_DEBUG
|
||||||
printf("[WM] Finish dragging WSWindow{%p}\n", m_dragWindow.ptr());
|
printf("[WM] Finish dragging WSWindow{%p}\n", m_dragWindow.ptr());
|
||||||
|
@ -272,7 +272,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type() == WSEvent::MouseMove) {
|
if (event.type() == WSMessage::MouseMove) {
|
||||||
if (m_drag_window) {
|
if (m_drag_window) {
|
||||||
auto old_window_rect = m_drag_window->rect();
|
auto old_window_rect = m_drag_window->rect();
|
||||||
Point pos = m_drag_window_origin;
|
Point pos = m_drag_window_origin;
|
||||||
|
@ -289,7 +289,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event)
|
||||||
|
|
||||||
for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) {
|
for (auto* window = m_windows_in_order.tail(); window; window = window->prev()) {
|
||||||
if (title_bar_rect(window->rect()).contains(event.position())) {
|
if (title_bar_rect(window->rect()).contains(event.position())) {
|
||||||
if (event.type() == WSEvent::MouseDown) {
|
if (event.type() == WSMessage::MouseDown) {
|
||||||
move_to_front(*window);
|
move_to_front(*window);
|
||||||
set_active_window(window);
|
set_active_window(window);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ void WSWindowManager::process_mouse_event(WSMouseEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->rect().contains(event.position())) {
|
if (window->rect().contains(event.position())) {
|
||||||
if (event.type() == WSEvent::MouseDown) {
|
if (event.type() == WSMessage::MouseDown) {
|
||||||
move_to_front(*window);
|
move_to_front(*window);
|
||||||
set_active_window(window);
|
set_active_window(window);
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ void WSWindowManager::draw_cursor()
|
||||||
m_last_cursor_rect = cursor_rect;
|
m_last_cursor_rect = cursor_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WSWindowManager::event(WSEvent& event)
|
void WSWindowManager::event(WSMessage& event)
|
||||||
{
|
{
|
||||||
ASSERT_INTERRUPTS_ENABLED();
|
ASSERT_INTERRUPTS_ENABLED();
|
||||||
LOCKER(m_lock);
|
LOCKER(m_lock);
|
||||||
|
@ -401,7 +401,7 @@ void WSWindowManager::event(WSEvent& event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type() == WSEvent::WM_Compose) {
|
if (event.type() == WSMessage::WM_Compose) {
|
||||||
m_pending_compose_event = false;
|
m_pending_compose_event = false;
|
||||||
compose();
|
compose();
|
||||||
return;
|
return;
|
||||||
|
@ -415,12 +415,12 @@ void WSWindowManager::set_active_window(WSWindow* window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (auto* previously_active_window = m_active_window.ptr()) {
|
if (auto* previously_active_window = m_active_window.ptr()) {
|
||||||
WSEventLoop::the().post_event(previously_active_window, make<WSEvent>(WSEvent::WindowDeactivated));
|
WSMessageLoop::the().post_event(previously_active_window, make<WSMessage>(WSMessage::WindowDeactivated));
|
||||||
invalidate(*previously_active_window);
|
invalidate(*previously_active_window);
|
||||||
}
|
}
|
||||||
m_active_window = window->makeWeakPtr();
|
m_active_window = window->makeWeakPtr();
|
||||||
if (m_active_window) {
|
if (m_active_window) {
|
||||||
WSEventLoop::the().post_event(m_active_window.ptr(), make<WSEvent>(WSEvent::WindowActivated));
|
WSMessageLoop::the().post_event(m_active_window.ptr(), make<WSMessage>(WSMessage::WindowActivated));
|
||||||
invalidate(*m_active_window);
|
invalidate(*m_active_window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ void WSWindowManager::invalidate(const Rect& a_rect)
|
||||||
|
|
||||||
if (!m_pending_compose_event) {
|
if (!m_pending_compose_event) {
|
||||||
ASSERT_INTERRUPTS_ENABLED();
|
ASSERT_INTERRUPTS_ENABLED();
|
||||||
WSEventLoop::the().post_event(this, make<WSEvent>(WSEvent::WM_Compose));
|
WSMessageLoop::the().post_event(this, make<WSMessage>(WSMessage::WM_Compose));
|
||||||
m_pending_compose_event = true;
|
m_pending_compose_event = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <AK/InlineLinkedList.h>
|
#include <AK/InlineLinkedList.h>
|
||||||
#include <AK/WeakPtr.h>
|
#include <AK/WeakPtr.h>
|
||||||
#include <AK/Lock.h>
|
#include <AK/Lock.h>
|
||||||
#include "WSEventReceiver.h"
|
#include "WSMessageReceiver.h"
|
||||||
|
|
||||||
class WSScreen;
|
class WSScreen;
|
||||||
class WSMouseEvent;
|
class WSMouseEvent;
|
||||||
|
@ -16,7 +16,7 @@ class WSWindow;
|
||||||
class CharacterBitmap;
|
class CharacterBitmap;
|
||||||
class GraphicsBitmap;
|
class GraphicsBitmap;
|
||||||
|
|
||||||
class WSWindowManager : public WSEventReceiver {
|
class WSWindowManager : public WSMessageReceiver {
|
||||||
public:
|
public:
|
||||||
static WSWindowManager& the();
|
static WSWindowManager& the();
|
||||||
void add_window(WSWindow&);
|
void add_window(WSWindow&);
|
||||||
|
@ -48,7 +48,7 @@ private:
|
||||||
|
|
||||||
void set_active_window(WSWindow*);
|
void set_active_window(WSWindow*);
|
||||||
|
|
||||||
virtual void event(WSEvent&) override;
|
virtual void event(WSMessage&) override;
|
||||||
|
|
||||||
void compose();
|
void compose();
|
||||||
void paint_window_frame(WSWindow&);
|
void paint_window_frame(WSWindow&);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <SharedGraphics/Font.h>
|
#include <SharedGraphics/Font.h>
|
||||||
#include <WindowServer/WSScreen.h>
|
#include <WindowServer/WSScreen.h>
|
||||||
#include <WindowServer/WSWindowManager.h>
|
#include <WindowServer/WSWindowManager.h>
|
||||||
#include <WindowServer/WSEventLoop.h>
|
#include <WindowServer/WSMessageLoop.h>
|
||||||
#include <WindowServer/WSWindow.h>
|
#include <WindowServer/WSWindow.h>
|
||||||
|
|
||||||
// NOTE: This actually runs as a kernel process.
|
// NOTE: This actually runs as a kernel process.
|
||||||
|
@ -19,7 +19,7 @@ void WindowServer_main()
|
||||||
WSWindowManager::the();
|
WSWindowManager::the();
|
||||||
|
|
||||||
dbgprintf("Entering WindowServer main loop.\n");
|
dbgprintf("Entering WindowServer main loop.\n");
|
||||||
WSEventLoop::the().exec();
|
WSMessageLoop::the().exec();
|
||||||
|
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue