mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 02:45:07 +00:00
More window manager hacking. Get rid of TerminalWidget for now.
This commit is contained in:
parent
ceb373cf71
commit
077f1007eb
7 changed files with 18 additions and 34 deletions
|
@ -3,12 +3,9 @@
|
|||
#include "Widget.h"
|
||||
#include "Window.h"
|
||||
#include "AbstractScreen.h"
|
||||
#include "TerminalWidget.h"
|
||||
#include "EventLoop.h"
|
||||
#include "FrameBufferSDL.h"
|
||||
|
||||
extern TerminalWidget* g_tw;
|
||||
|
||||
static const int windowFrameWidth = 2;
|
||||
static const int windowTitleBarHeight = 16;
|
||||
|
||||
|
@ -22,6 +19,17 @@ static inline Rect titleBarRectForWindow(const Window& window)
|
|||
};
|
||||
}
|
||||
|
||||
static inline Rect titleBarTitleRectForWindow(const Window& window)
|
||||
{
|
||||
auto titleBarRect = titleBarRectForWindow(window);
|
||||
return {
|
||||
titleBarRect.x() + windowFrameWidth,
|
||||
titleBarRect.y(),
|
||||
titleBarRect.width() - windowFrameWidth * 2,
|
||||
titleBarRect.height()
|
||||
};
|
||||
}
|
||||
|
||||
static inline Rect borderRectForWindow(const Window& window)
|
||||
{
|
||||
auto titleBarRect = titleBarRectForWindow(window);
|
||||
|
@ -65,6 +73,7 @@ void WindowManager::paintWindowFrame(Window& window)
|
|||
//printf("[WM] paintWindowFrame {%p}, rect: %d,%d %dx%d\n", &window, window.rect().x(), window.rect().y(), window.rect().width(), window.rect().height());
|
||||
|
||||
auto titleBarRect = titleBarRectForWindow(window);
|
||||
auto titleBarTitleRect = titleBarTitleRectForWindow(window);
|
||||
auto outerRect = outerRectForWindow(window);
|
||||
auto borderRect = borderRectForWindow(window);
|
||||
|
||||
|
@ -111,7 +120,7 @@ void WindowManager::paintWindowFrame(Window& window)
|
|||
p.fillRect(leftRect, borderColor);
|
||||
p.fillRect(rightRect, borderColor);
|
||||
|
||||
p.drawText(titleBarRect, window.title(), Painter::TextAlignment::Center, titleColor);
|
||||
p.drawText(titleBarTitleRect, window.title(), Painter::TextAlignment::CenterLeft, titleColor);
|
||||
}
|
||||
|
||||
void WindowManager::addWindow(Window& window)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue