ProcessGUI.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "Process.h"
  2. #include "MemoryManager.h"
  3. #include <LibC/errno_numbers.h>
  4. #include <SharedGraphics/Font.h>
  5. #include <WindowServer/WSScreen.h>
  6. #include <WindowServer/WSMessageLoop.h>
  7. #include <WindowServer/WSWindow.h>
  8. #include <WindowServer/WSWindowManager.h>
  9. #include <WindowServer/WSMenuBar.h>
  10. #include <Kernel/BochsVGADevice.h>
  11. //#define LOG_GUI_SYSCALLS
  12. void Process::initialize_gui_statics()
  13. {
  14. new WSMessageLoop;
  15. }
  16. void Process::destroy_all_windows()
  17. {
  18. if (!WSMessageLoop::the().running())
  19. return;
  20. dbgprintf("Sending death notification for client_id %d\n", gui_client_id());
  21. WSMessageLoop::the().notify_client_died(gui_client_id());
  22. }
  23. DisplayInfo Process::set_video_resolution(int width, int height)
  24. {
  25. DisplayInfo info;
  26. info.width = width;
  27. info.height = height;
  28. info.bpp = 32;
  29. info.pitch = width * 4;
  30. size_t framebuffer_size = width * height * 4 * 2;
  31. if (!m_display_framebuffer_region) {
  32. auto framebuffer_vmo = VMObject::create_framebuffer_wrapper(BochsVGADevice::the().framebuffer_address(), framebuffer_size);
  33. m_display_framebuffer_region = allocate_region_with_vmo(LinearAddress(0xe0000000), framebuffer_size, move(framebuffer_vmo), 0, "framebuffer", true, true);
  34. }
  35. info.framebuffer = m_display_framebuffer_region->laddr().as_ptr();
  36. BochsVGADevice::the().set_resolution(width, height);
  37. return info;
  38. }