mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:07:34 +00:00
WindowServer: Add WSClientConnection::create_bitmap().
There we go. Now WSWindow doesn't know about Process at all.
This commit is contained in:
parent
9ab9734da0
commit
5d30c6b00c
3 changed files with 13 additions and 12 deletions
|
@ -65,6 +65,13 @@ void WSClientConnection::post_message(GUI_ServerMessage&& message)
|
||||||
m_process->gui_events().append(move(message));
|
m_process->gui_events().append(move(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RetainPtr<GraphicsBitmap> WSClientConnection::create_bitmap(const Size& size)
|
||||||
|
{
|
||||||
|
if (!m_process)
|
||||||
|
return nullptr;
|
||||||
|
return GraphicsBitmap::create(*m_process, size);
|
||||||
|
}
|
||||||
|
|
||||||
void WSClientConnection::on_message(WSMessage& message)
|
void WSClientConnection::on_message(WSMessage& message)
|
||||||
{
|
{
|
||||||
if (message.is_client_request()) {
|
if (message.is_client_request()) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <AK/WeakPtr.h>
|
#include <AK/WeakPtr.h>
|
||||||
|
#include <SharedGraphics/GraphicsBitmap.h>
|
||||||
#include <WindowServer/WSMessageReceiver.h>
|
#include <WindowServer/WSMessageReceiver.h>
|
||||||
#include <WindowServer/WSMessage.h>
|
#include <WindowServer/WSMessage.h>
|
||||||
|
|
||||||
|
@ -23,9 +24,7 @@ public:
|
||||||
static WSClientConnection* ensure_for_client_id(int client_id);
|
static WSClientConnection* ensure_for_client_id(int client_id);
|
||||||
|
|
||||||
void post_message(GUI_ServerMessage&&);
|
void post_message(GUI_ServerMessage&&);
|
||||||
|
RetainPtr<GraphicsBitmap> create_bitmap(const Size&);
|
||||||
// FIXME: Remove.
|
|
||||||
Process* process() { return m_process.ptr(); }
|
|
||||||
|
|
||||||
int client_id() const { return m_client_id; }
|
int client_id() const { return m_client_id; }
|
||||||
WSMenuBar* app_menubar() { return m_app_menubar.ptr(); }
|
WSMenuBar* app_menubar() { return m_app_menubar.ptr(); }
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include "WSWindowManager.h"
|
#include "WSWindowManager.h"
|
||||||
#include "WSMessage.h"
|
#include "WSMessage.h"
|
||||||
#include "WSMessageLoop.h"
|
#include "WSMessageLoop.h"
|
||||||
#include "Process.h"
|
|
||||||
#include <WindowServer/WSClientConnection.h>
|
#include <WindowServer/WSClientConnection.h>
|
||||||
|
|
||||||
WSWindow::WSWindow(WSMenu& menu)
|
WSWindow::WSWindow(WSMenu& menu)
|
||||||
|
@ -44,23 +43,19 @@ void WSWindow::set_rect(const Rect& rect)
|
||||||
Rect old_rect;
|
Rect old_rect;
|
||||||
{
|
{
|
||||||
WSWindowLocker locker(*this);
|
WSWindowLocker locker(*this);
|
||||||
|
|
||||||
Process* process = nullptr;
|
|
||||||
auto* client = WSClientConnection::from_client_id(m_client_id);
|
auto* client = WSClientConnection::from_client_id(m_client_id);
|
||||||
if (client)
|
if (!client && !m_menu)
|
||||||
process = client->process();
|
|
||||||
|
|
||||||
if (!process && !m_menu)
|
|
||||||
return;
|
return;
|
||||||
if (m_rect == rect)
|
if (m_rect == rect)
|
||||||
return;
|
return;
|
||||||
old_rect = m_rect;
|
old_rect = m_rect;
|
||||||
m_rect = rect;
|
m_rect = rect;
|
||||||
if (!m_backing || old_rect.size() != rect.size()) {
|
if (!m_backing || old_rect.size() != rect.size()) {
|
||||||
if (process)
|
|
||||||
m_backing = GraphicsBitmap::create(*process, m_rect.size());
|
|
||||||
if (m_menu)
|
if (m_menu)
|
||||||
m_backing = GraphicsBitmap::create_kernel_only(m_rect.size());
|
m_backing = GraphicsBitmap::create_kernel_only(m_rect.size());
|
||||||
|
else if (client)
|
||||||
|
m_backing = client->create_bitmap(m_rect.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WSWindowManager::the().notify_rect_changed(*this, old_rect, rect);
|
WSWindowManager::the().notify_rect_changed(*this, old_rect, rect);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue