WindowServer: Prune more kernel-related gunk.

This commit is contained in:
Andreas Kling 2019-02-16 12:25:47 +01:00
parent 09aaa41e62
commit c3d36a5fe9
Notes: sideshowbarker 2024-07-19 15:41:57 +09:00
4 changed files with 9 additions and 18 deletions

View file

@ -6,7 +6,6 @@
#include <WindowServer/WSWindow.h>
#include <WindowServer/WSWindowManager.h>
#include <WindowServer/WSAPITypes.h>
#include <Kernel/MemoryManager.h>
#include <Kernel/Process.h>
Lockable<HashMap<int, WSClientConnection*>>* s_connections;
@ -42,17 +41,9 @@ WSClientConnection* WSClientConnection::ensure_for_client_id(int client_id)
WSClientConnection::WSClientConnection(int fd)
: m_fd(fd)
{
int rc = WSMessageLoop::the().server_process().sys$ioctl(m_fd, 413, (int)&m_pid);
int rc = current->sys$ioctl(m_fd, 413, (int)&m_pid);
ASSERT(rc == 0);
{
InterruptDisabler disabler;
auto* process = Process::from_pid(m_pid);
ASSERT(process);
m_process = process->make_weak_ptr();
m_client_id = (int)process;
}
if (!s_connections)
s_connections = new Lockable<HashMap<int, WSClientConnection*>>;
LOCKER(s_connections->lock());

View file

@ -13,9 +13,6 @@ class WSMenu;
class WSMenuBar;
struct WSAPI_ServerMessage;
// FIXME: Remove.
class Process;
class WSClientConnection final : public WSMessageReceiver {
public:
explicit WSClientConnection(int fd);
@ -72,7 +69,4 @@ private:
int m_next_menubar_id { 10000 };
int m_next_menu_id { 20000 };
int m_next_window_id { 1982 };
// FIXME: Remove.
WeakPtr<Process> m_process;
};

View file

@ -3,7 +3,6 @@
#include "WSMessage.h"
#include "WSWindowManager.h"
#include <AK/Assertions.h>
#include <Kernel/IO.h>
static WSScreen* s_the;

View file

@ -4,7 +4,6 @@
#include "WSMessageLoop.h"
#include "Process.h"
#include "MemoryManager.h"
#include <Kernel/ProcFS.h>
#include <SharedGraphics/Font.h>
#include <SharedGraphics/Painter.h>
#include <SharedGraphics/CharacterBitmap.h>
@ -14,7 +13,11 @@
#include "WSMenuBar.h"
#include "WSMenuItem.h"
#include <WindowServer/WSClientConnection.h>
#ifdef KERNEL
#include <Kernel/ProcFS.h>
#include <Kernel/RTC.h>
#endif
//#define DEBUG_COUNTERS
//#define DEBUG_WID_IN_TITLE_BAR
@ -175,12 +178,14 @@ WSWindowManager::WSWindowManager()
m_wallpaper = GraphicsBitmap::load_from_file(m_wallpaper_path.resource(), m_screen_rect.size());
}
#ifdef KERNEL
ProcFS::the().add_sys_bool("wm_flash_flush", m_flash_flush);
ProcFS::the().add_sys_string("wm_wallpaper", m_wallpaper_path, [this] {
LOCKER(m_wallpaper_path.lock());
m_wallpaper = GraphicsBitmap::load_from_file(m_wallpaper_path.resource(), m_screen_rect.size());
invalidate(m_screen_rect);
});
#endif
m_menu_selection_color = Color(0x84351a);
@ -695,11 +700,13 @@ void WSWindowManager::draw_menubar()
return true;
});
#ifdef KERNEL
unsigned year, month, day, hour, minute, second;
RTC::read_registers(year, month, day, hour, minute, second);
auto time_text = String::format("%04u-%02u-%02u %02u:%02u:%02u", year, month, day, hour, minute, second);
auto time_rect = menubar_rect().translated(-(menubar_menu_margin() / 2), 0);
m_back_painter->draw_text(time_rect, time_text, TextAlignment::CenterRight, Color::Black);
#endif
}
void WSWindowManager::draw_cursor()