summaryrefslogtreecommitdiff
path: root/Widgets
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-12-02 23:41:10 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-12-02 23:41:10 +0100
commitdd502bb54e37ef97ed4ba59f2bf6c0762c26573c (patch)
tree1b707e368873bf0460f3aee57518752c9b813230 /Widgets
parent85b886c2e0dcffaccc28c6494c32034c83f73ef8 (diff)
downloadserenity-dd502bb54e37ef97ed4ba59f2bf6c0762c26573c.zip
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!
Diffstat (limited to 'Widgets')
-rw-r--r--Widgets/AbstractScreen.h8
-rw-r--r--Widgets/MsgBox.cpp16
-rw-r--r--Widgets/TerminalWidget.cpp8
3 files changed, 19 insertions, 13 deletions
diff --git a/Widgets/AbstractScreen.h b/Widgets/AbstractScreen.h
index 840d94720f..14e83aff13 100644
--- a/Widgets/AbstractScreen.h
+++ b/Widgets/AbstractScreen.h
@@ -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 };
};
diff --git a/Widgets/MsgBox.cpp b/Widgets/MsgBox.cpp
index 4827a5fca9..9c8a41f1db 100644
--- a/Widgets/MsgBox.cpp
+++ b/Widgets/MsgBox.cpp
@@ -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,
diff --git a/Widgets/TerminalWidget.cpp b/Widgets/TerminalWidget.cpp
index 56782eba37..51544ab37a 100644
--- a/Widgets/TerminalWidget.cpp
+++ b/Widgets/TerminalWidget.cpp
@@ -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];