mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:25:06 +00:00
Share GraphicsBitmaps between the windowing server and the client process.
This is pretty cool. :^) GraphicsBitmaps are now mapped into both the server and the client address space (usually at different addresses but that doesn't matter.) Added a GUI syscall for getting a window's backing store, and another one for invalidating a window so that the server redraws it.
This commit is contained in:
parent
b0e3f73375
commit
0c5ecd303c
13 changed files with 139 additions and 46 deletions
|
@ -25,8 +25,11 @@ void Process::initialize_gui_statics()
|
|||
int Process::make_window_id()
|
||||
{
|
||||
int new_id = m_next_window_id++;
|
||||
while (!new_id || m_windows.contains(new_id))
|
||||
while (!new_id || m_windows.contains(new_id)) {
|
||||
new_id = m_next_window_id++;
|
||||
if (new_id < 0)
|
||||
new_id = 1;
|
||||
}
|
||||
return new_id;
|
||||
}
|
||||
|
||||
|
@ -74,11 +77,40 @@ int Process::gui$destroy_window(int window_id)
|
|||
dbgprintf("%s<%u> gui$destroy_window (window_id=%d)\n", name().characters(), pid(), window_id);
|
||||
if (window_id < 0)
|
||||
return -EINVAL;
|
||||
if (window_id >= static_cast<int>(m_windows.size()))
|
||||
return -EBADWINDOW;
|
||||
auto it = m_windows.find(window_id);
|
||||
if (it == m_windows.end())
|
||||
return -EBADWINDOW;
|
||||
m_windows.remove(window_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::gui$get_window_backing_store(int window_id, GUI_WindowBackingStoreInfo* info)
|
||||
{
|
||||
dbgprintf("%s<%u> gui$get_window_backing_store (window_id=%d, info=%p)\n", name().characters(), pid(), window_id, info);
|
||||
if (!validate_write_typed(info))
|
||||
return -EFAULT;
|
||||
if (window_id < 0)
|
||||
return -EINVAL;
|
||||
auto it = m_windows.find(window_id);
|
||||
if (it == m_windows.end())
|
||||
return -EBADWINDOW;
|
||||
auto& window = *(*it).value;
|
||||
info->bpp = sizeof(RGBA32);
|
||||
info->pitch = window.backing()->pitch();
|
||||
info->size = window.backing()->size();
|
||||
info->pixels = reinterpret_cast<RGBA32*>(window.backing()->client_region()->linearAddress.asPtr());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::gui$invalidate_window(int window_id)
|
||||
{
|
||||
dbgprintf("%s<%u> gui$invalidate_window (window_id=%d)\n", name().characters(), pid(), window_id);
|
||||
if (window_id < 0)
|
||||
return -EINVAL;
|
||||
auto it = m_windows.find(window_id);
|
||||
if (it == m_windows.end())
|
||||
return -EBADWINDOW;
|
||||
auto& window = *(*it).value;
|
||||
WindowManager::the().invalidate(window);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue