mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 21:10:30 +00:00
Make the widgets code build on macOS.
Funny, I haven't looked at this code in a few weeks and there's so much to change!
This commit is contained in:
parent
85b886c2e0
commit
dd502bb54e
Notes:
sideshowbarker
2024-07-19 16:09:19 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/dd502bb54e3
3 changed files with 19 additions and 13 deletions
|
@ -7,8 +7,8 @@ class AbstractScreen : public Object {
|
|||
public:
|
||||
virtual ~AbstractScreen();
|
||||
|
||||
unsigned width() const { return m_width; }
|
||||
unsigned height() const { return m_height; }
|
||||
int width() const { return m_width; }
|
||||
int height() const { return m_height; }
|
||||
|
||||
static AbstractScreen& the();
|
||||
|
||||
|
@ -18,7 +18,7 @@ protected:
|
|||
AbstractScreen(unsigned width, unsigned height);
|
||||
|
||||
private:
|
||||
unsigned m_width { 0 };
|
||||
unsigned m_height { 0 };
|
||||
int m_width { 0 };
|
||||
int m_height { 0 };
|
||||
};
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ void MsgBox(Window* owner, String&& text)
|
|||
Font& font = Font::defaultFont();
|
||||
auto screenRect = AbstractScreen::the().rect();
|
||||
|
||||
unsigned textWidth = text.length() * font.glyphWidth() + 8;
|
||||
unsigned textHeight = font.glyphHeight() + 8;
|
||||
unsigned horizontalPadding = 16;
|
||||
unsigned verticalPadding = 16;
|
||||
unsigned buttonWidth = 60;
|
||||
unsigned buttonHeight = 20;
|
||||
unsigned windowWidth = textWidth + horizontalPadding * 2;
|
||||
unsigned windowHeight = textHeight + buttonHeight + verticalPadding * 3;
|
||||
int textWidth = text.length() * font.glyphWidth() + 8;
|
||||
int textHeight = font.glyphHeight() + 8;
|
||||
int horizontalPadding = 16;
|
||||
int verticalPadding = 16;
|
||||
int buttonWidth = 60;
|
||||
int buttonHeight = 20;
|
||||
int windowWidth = textWidth + horizontalPadding * 2;
|
||||
int windowHeight = textHeight + buttonHeight + verticalPadding * 3;
|
||||
|
||||
Rect windowRect(
|
||||
screenRect.center().x() - windowWidth / 2,
|
||||
|
|
|
@ -14,7 +14,7 @@ TerminalWidget::TerminalWidget(Widget* parent)
|
|||
{
|
||||
g_tw = this;
|
||||
|
||||
setWindowRelativeRect({ 0, 0, (columns() * font().glyphWidth()) + 4, (rows() * font().glyphHeight()) + 4 });
|
||||
setWindowRelativeRect({ 0, 0, int(columns() * font().glyphWidth()) + 4, int(rows() * font().glyphHeight()) + 4 });
|
||||
|
||||
printf("rekt: %d x %d\n", width(), height());
|
||||
m_screen = new CharacterWithAttributes[rows() * columns()];
|
||||
|
@ -24,7 +24,13 @@ TerminalWidget::TerminalWidget(Widget* parent)
|
|||
at(row, column).attribute = 0x07;
|
||||
}
|
||||
}
|
||||
|
||||
#if __APPLE__
|
||||
g_fd = posix_openpt(O_RDWR);
|
||||
#else
|
||||
g_fd = getpt();
|
||||
#endif
|
||||
|
||||
grantpt(g_fd);
|
||||
unlockpt(g_fd);
|
||||
char buf[1024];
|
||||
|
|
Loading…
Reference in a new issue