From 1aec5d3e443887ecd2509ee1db7bdaef81a05341 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sat, 30 Apr 2022 09:40:09 +0300 Subject: [PATCH] =?UTF-8?q?=E2=98=A2=EF=B8=8F=E2=98=A2=EF=B8=8F=E2=98=A2?= =?UTF-8?q?=EF=B8=8F=E2=98=A2=EF=B8=8F=E2=98=A2=EF=B8=8F=E2=98=A2=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Box.cpp | 10 +++++----- src/Box.hpp | 16 ++++++++-------- src/Button.cpp | 18 +++++++++--------- src/Button.hpp | 2 +- src/DocumentLayout.cpp | 14 +++++++------- src/DocumentLayout.hpp | 2 +- src/Events.hpp | 42 +++++++++++++++++++++--------------------- src/Label.cpp | 14 +++++++------- src/Label.hpp | 2 +- src/Layout.hpp | 2 +- src/Painter.cpp | 22 +++++++++++----------- src/Painter.hpp | 4 ++-- src/Point.hpp | 10 +++++----- src/PropMacros.hpp | 2 +- src/RGB.hpp | 6 +++--- src/TopLevelStyles.hpp | 2 +- src/Widget.cpp | 24 ++++++++++++------------ src/Widget.hpp | 22 +++++++++++----------- src/Window.cpp | 14 +++++++------- src/Window.hpp | 12 ++++++------ 20 files changed, 120 insertions(+), 120 deletions(-) diff --git a/src/Box.cpp b/src/Box.cpp index 204a3b2..1bb054a 100644 --- a/src/Box.cpp +++ b/src/Box.cpp @@ -8,7 +8,7 @@ bool Box::contains_point(double x, double y) const { } bool Box::contains_point(const Point &point) const { - return point.get_x() >= m_x && m_x + m_width >= point.get_x() && point.get_y() >= m_y && m_y + m_height >= point.get_y(); + return point.x() >= m_x && m_x + m_width >= point.x() && point.y() >= m_y && m_y + m_height >= point.y(); } bool Box::contains_box(const Box &other) const { @@ -17,10 +17,10 @@ bool Box::contains_box(const Box &other) const { double ay1 = m_y; double ay2 = m_y + m_height; - double bx1 = other.get_x(); - double bx2 = other.get_x() + other.get_width(); - double by1 = other.get_y(); - double by2 = other.get_y() + other.get_height(); + double bx1 = other.x(); + double bx2 = other.x() + other.width(); + double by1 = other.y(); + double by2 = other.y() + other.height(); // https://stackoverflow.com/a/306332 bool boxes_overlap = (ax1 < bx2 && ax2 > bx1 && ay1 < by2 && ay2 > by1); diff --git a/src/Box.hpp b/src/Box.hpp index 5f734fa..4a6e92a 100644 --- a/src/Box.hpp +++ b/src/Box.hpp @@ -21,15 +21,15 @@ public: } - double get_x() { return m_x; } - double get_y() { return m_y; } - double get_width() { return m_width; } - double get_height() { return m_height; } + double x() { return m_x; } + double y() { return m_y; } + double width() { return m_width; } + double height() { return m_height; } - double get_x() const { return m_x; } - double get_y() const { return m_y; } - double get_width() const { return m_width; } - double get_height() const { return m_height; } + double x() const { return m_x; } + double y() const { return m_y; } + double width() const { return m_width; } + double height() const { return m_height; } void set_x(double x) { m_x = x; } void set_y(double y) { m_y = y; } diff --git a/src/Button.cpp b/src/Button.cpp index 4a67742..c32283e 100644 --- a/src/Button.cpp +++ b/src/Button.cpp @@ -9,7 +9,7 @@ namespace Raven { void Button::on_init() { - set_background_fill_color(get_styles()->get_button_normal_color()); + set_background_fill_color(styles()->button_normal_color()); set_do_background_fill(true); set_did_init(true); @@ -17,21 +17,21 @@ void Button::on_init() { void Button::update_color() { if (is_active()) { - set_background_fill_color(get_styles()->get_button_active_color()); + set_background_fill_color(styles()->button_active_color()); } else if (is_focused()) { - set_background_fill_color(get_styles()->get_button_focused_color()); + set_background_fill_color(styles()->button_focused_color()); } else { - set_background_fill_color(get_styles()->get_button_normal_color()); + set_background_fill_color(styles()->button_normal_color()); } } void Button::on_paint() { - auto painter = get_window()->get_painter(); + auto painter = window()->painter(); - auto text_color = get_styles()->get_button_text_color(); + auto text_color = styles()->button_text_color(); painter.source_rgb(text_color); - painter.set_pango_font_description(get_styles()->get_controls_font_description()); - painter.text(get_current_geometry(), m_text, PaintTextAlign::Center, PANGO_ELLIPSIZE_END); + painter.set_pango_font_description(styles()->controls_font_description()); + painter.text(current_geometry(), m_text, PaintTextAlign::Center, PANGO_ELLIPSIZE_END); painter.fill(); } @@ -41,7 +41,7 @@ void Button::on_focus_update(FocusUpdateEvent &event) { void Button::on_activation_update(ActivationUpdateEvent &event) { update_color(); - if (event.get_activation_status() == false) { + if (event.activation_status() == false) { on_click(); } } diff --git a/src/Button.hpp b/src/Button.hpp index 1b4bc06..3b880ad 100644 --- a/src/Button.hpp +++ b/src/Button.hpp @@ -18,7 +18,7 @@ public: , m_text(text) {} void set_text(std::string text) { m_text = text; wants_repaint(); } - std::string &get_text() { return m_text; } + std::string &text() { return m_text; } std::function on_click { [](){} }; protected: diff --git a/src/DocumentLayout.cpp b/src/DocumentLayout.cpp index dcedf6f..cd3d44b 100644 --- a/src/DocumentLayout.cpp +++ b/src/DocumentLayout.cpp @@ -8,22 +8,22 @@ void DocumentLayout::run() { if (!m_target) return; - Point point { m_target->get_current_geometry().get_x() + m_margin, m_target->get_current_geometry().get_y() + m_margin }; + Point point { m_target->current_geometry().x() + m_margin, m_target->current_geometry().y() + m_margin }; double row_largest_height = 0.0; - auto children = m_target->get_children(); + auto children = m_target->children(); for (auto& c : children) { - if (c->get_control_type() == ControlWidgetType::NewRow && row_largest_height) { + if (c->control_type() == ControlWidgetType::NewRow && row_largest_height) { point.add(0, row_largest_height + m_margin); row_largest_height = 0.0; point.set_x(0); } - if (c->get_current_geometry().get_height() > row_largest_height) { - row_largest_height = c->get_current_geometry().get_height(); + if (c->current_geometry().height() > row_largest_height) { + row_largest_height = c->current_geometry().height(); } - auto new_geometry = Box{ point.get_x(), point.get_y(), c->get_current_geometry().get_width(), c->get_current_geometry().get_height() }; + auto new_geometry = Box{ point.x(), point.y(), c->current_geometry().width(), c->current_geometry().height() }; c->set_current_geometry(std::move(new_geometry), true); - point.add(c->get_current_geometry().get_width() + m_margin, 0); + point.add(c->current_geometry().width() + m_margin, 0); } } diff --git a/src/DocumentLayout.hpp b/src/DocumentLayout.hpp index 046bf5a..87e9dcf 100644 --- a/src/DocumentLayout.hpp +++ b/src/DocumentLayout.hpp @@ -17,7 +17,7 @@ public: void run(); - double get_margin() { return m_margin; } + double margin() { return m_margin; } void set_margin(double margin) { m_margin = margin; run(); } }; diff --git a/src/Events.hpp b/src/Events.hpp index cca08f8..8140130 100644 --- a/src/Events.hpp +++ b/src/Events.hpp @@ -23,11 +23,11 @@ private: public: Event() {} - virtual EventType get_type() { return EventType::NoneEvent; } - virtual const char *get_name() { return "NoneEvent"; } + virtual EventType type() { return EventType::NoneEvent; } + virtual const char *name() { return "NoneEvent"; } void accept() { m_accepted = true; } - bool get_accepted() { return m_accepted; } + bool accepted() { return m_accepted; } virtual ~Event() = default; }; @@ -43,13 +43,13 @@ public: , m_was_right_button_pressed(was_right_button_pressed) , m_point(point) {} - EventType get_type() { return EventType::MouseButton; } - const char *get_name() { return "MouseButton"; } + EventType type() { return EventType::MouseButton; } + const char *name() { return "MouseButton"; } - bool get_was_left_button_pressed() { return m_was_left_button_pressed; } - bool get_was_right_button_pressed() { return m_was_right_button_pressed; } + bool was_left_button_pressed() { return m_was_left_button_pressed; } + bool was_right_button_pressed() { return m_was_right_button_pressed; } - Point &get_point() { return m_point; } + Point &point() { return m_point; } }; class MouseMoveEvent : public Event { @@ -59,10 +59,10 @@ public: MouseMoveEvent(Point point) : m_point(point) {} - EventType get_type() { return EventType::MouseMove; } - const char *get_name() { return "MouseMove"; } + EventType type() { return EventType::MouseMove; } + const char *name() { return "MouseMove"; } - Point &get_point() { return m_point; } + Point &point() { return m_point; } }; class WidgetRepaintRequestedEvent : public Event { @@ -72,8 +72,8 @@ public: WidgetRepaintRequestedEvent(bool should_do_group) : m_should_do_group(should_do_group) {} - EventType get_type() { return EventType::WidgetRepaintRequested; } - const char *get_name() { return "WidgetRepaintRequested"; } + EventType type() { return EventType::WidgetRepaintRequested; } + const char *name() { return "WidgetRepaintRequested"; } bool should_do_group() { return m_should_do_group; } void set_should_do_group(bool should_do_group) { m_should_do_group = should_do_group; } @@ -83,8 +83,8 @@ class WidgetRelayoutRequestedEvent : public Event { public: WidgetRelayoutRequestedEvent() {} - EventType get_type() { return EventType::WidgetRelayoutRequestedEvent; } - const char *get_name() { return "WidgetRelayoutRequestedEvent"; } + EventType type() { return EventType::WidgetRelayoutRequestedEvent; } + const char *name() { return "WidgetRelayoutRequestedEvent"; } }; class FocusUpdateEvent : public Event { @@ -94,10 +94,10 @@ public: FocusUpdateEvent(bool focus_status) : m_focus_status(focus_status) {} - EventType get_type() { return EventType::FocusUpdate; } - const char *get_name() { return "FocusUpdate"; } + EventType type() { return EventType::FocusUpdate; } + const char *name() { return "FocusUpdate"; } - bool get_focus_status() { return m_focus_status; } + bool focus_status() { return m_focus_status; } }; class ActivationUpdateEvent : public Event { @@ -107,10 +107,10 @@ public: ActivationUpdateEvent(bool activation_status) : m_activation_status(activation_status) {} - EventType get_type() { return EventType::ActivationUpdate; } - const char *get_name() { return "ActivationUpdate"; } + EventType type() { return EventType::ActivationUpdate; } + const char *name() { return "ActivationUpdate"; } - bool get_activation_status() { return m_activation_status; } + bool activation_status() { return m_activation_status; } }; } diff --git a/src/Label.cpp b/src/Label.cpp index 52fb983..39e921d 100644 --- a/src/Label.cpp +++ b/src/Label.cpp @@ -6,20 +6,20 @@ namespace Raven { void Label::on_init() { // the label will inherit the background color properties from the parent - if (Widget *parent = get_parent()) { - set_do_background_fill(parent->get_do_background_fill()); - set_background_fill_color(parent->get_background_fill_color()); + if (parent()) { + set_do_background_fill(parent()->do_background_fill()); + set_background_fill_color(parent()->background_fill_color()); } set_did_init(true); } void Label::on_paint() { - auto painter = get_window()->get_painter(); - auto text_color = get_styles()->get_label_text_color(); + auto painter = window()->painter(); + auto text_color = styles()->label_text_color(); painter.source_rgb(text_color); - painter.set_pango_font_description(get_styles()->get_controls_font_description()); - painter.text(get_current_geometry(), m_text, PaintTextAlign::Left, PANGO_ELLIPSIZE_NONE); + painter.set_pango_font_description(styles()->controls_font_description()); + painter.text(current_geometry(), m_text, PaintTextAlign::Left, PANGO_ELLIPSIZE_NONE); painter.fill(); } diff --git a/src/Label.hpp b/src/Label.hpp index 9a13188..6cf6ad5 100644 --- a/src/Label.hpp +++ b/src/Label.hpp @@ -15,7 +15,7 @@ public: ~Label() {} - std::string &get_text() { return m_text; } + std::string &text() { return m_text; } void set_text(std::string text) { m_text = text; wants_repaint(); } protected: WidgetType m_type { WidgetType::Label }; diff --git a/src/Layout.hpp b/src/Layout.hpp index 30f69e9..50cf7a6 100644 --- a/src/Layout.hpp +++ b/src/Layout.hpp @@ -13,7 +13,7 @@ public: virtual void run() {}; void bind_to(Widget *target) { m_target = target; } - Widget *get_target() { return m_target; } + Widget *target() { return m_target; } virtual ~Layout() {} }; diff --git a/src/Painter.cpp b/src/Painter.cpp index 4ee4824..330e392 100644 --- a/src/Painter.cpp +++ b/src/Painter.cpp @@ -9,10 +9,10 @@ void Painter::rounded_rectangle(Box &geometry, double border_radius) { double aspect = 1.0; double radius = border_radius / aspect; double degrees = M_PI / 180.0; - double x = geometry.get_x(); - double y = geometry.get_y(); - double w = geometry.get_width(); - double h = geometry.get_height(); + double x = geometry.x(); + double y = geometry.y(); + double w = geometry.width(); + double h = geometry.height(); m_cairo->begin_new_sub_path(); m_cairo->arc(x + w - radius, y + radius, radius, -90 * degrees, 0 * degrees); @@ -31,7 +31,7 @@ bool Painter::text(Point &where, std::string &text) { pango_layout_set_font_description(layout, m_pango_font_description); pango_layout_set_text(layout, text.c_str(), -1); - m_cairo->move_to(where.get_x(), where.get_y()); + m_cairo->move_to(where.x(), where.y()); pango_cairo_show_layout(m_cairo->cobj(), layout); g_object_unref(layout); @@ -49,20 +49,20 @@ bool Painter::text(Box &geometry, std::string &text, PaintTextAlign align, Pango int font_height; pango_layout_set_font_description(layout, m_pango_font_description); - pango_layout_set_width(layout, pango_units_from_double(geometry.get_width())); - pango_layout_set_height(layout, pango_units_from_double(geometry.get_height())); + pango_layout_set_width(layout, pango_units_from_double(geometry.width())); + pango_layout_set_height(layout, pango_units_from_double(geometry.height())); pango_layout_set_ellipsize(layout, ellipsize); pango_layout_set_text(layout, text.c_str(), -1); pango_layout_get_pixel_size(layout, &font_width, &font_height); double x = -1; - double y = geometry.get_y() + ((geometry.get_height() - font_height) / 2); + double y = geometry.y() + ((geometry.height() - font_height) / 2); if (align == PaintTextAlign::Center) { - x = geometry.get_x() + ((geometry.get_width() - font_width) / 2); + x = geometry.x() + ((geometry.width() - font_width) / 2); } else { - x = geometry.get_x(); + x = geometry.x(); } m_cairo->move_to(x, y); @@ -74,7 +74,7 @@ bool Painter::text(Box &geometry, std::string &text, PaintTextAlign align, Pango } void Painter::source_rgb(RGB &source_rgb) { - m_cairo->set_source_rgb(source_rgb.get_r(), source_rgb.get_g(), source_rgb.get_b()); + m_cairo->set_source_rgb(source_rgb.r(), source_rgb.g(), source_rgb.b()); } void Painter::fill() { diff --git a/src/Painter.hpp b/src/Painter.hpp index 82c96c6..ecbae09 100644 --- a/src/Painter.hpp +++ b/src/Painter.hpp @@ -21,11 +21,11 @@ private: public: Painter() {} - Cairo::RefPtr get_cairo() { return m_cairo; } + Cairo::RefPtr cairo() { return m_cairo; } void set_cairo(Cairo::RefPtr cairo) { m_cairo = cairo; } void set_pango_font_description(PangoFontDescription *pango_font_description) { m_pango_font_description = pango_font_description; } - PangoFontDescription *get_pango_font_description() { return m_pango_font_description; } + PangoFontDescription *pango_font_description() { return m_pango_font_description; } void rounded_rectangle(Box &geometry, double border_radius); bool text(Point &where, std::string &text); diff --git a/src/Point.hpp b/src/Point.hpp index ee5db3e..6ea8e5f 100644 --- a/src/Point.hpp +++ b/src/Point.hpp @@ -11,16 +11,16 @@ public: : m_x(x) , m_y(y) {} - double get_x() { return m_x; } - const double get_x() const { return m_x; } - double get_y() { return m_y; } - const double get_y() const { return m_y; } + double x() { return m_x; } + const double x() const { return m_x; } + double y() { return m_y; } + const double y() const { return m_y; } void set_x(double x) { m_x = x; } void set_y(double y) { m_y = y; } void add(double x, double y) { m_x += x; m_y += y; } - void add(Point const& other) { m_x += other.get_x(); m_y += other.get_y(); } + void add(Point const& other) { m_x += other.x(); m_y += other.y(); } }; } \ No newline at end of file diff --git a/src/PropMacros.hpp b/src/PropMacros.hpp index c6fbc90..2c6dd5b 100644 --- a/src/PropMacros.hpp +++ b/src/PropMacros.hpp @@ -5,5 +5,5 @@ type m_##name {__VA_ARGS__}; \ public: \ void set_##name(type new_prop_value) { m_##name = new_prop_value; wants_repaint(); } \ - type get_##name() { return m_##name; } \ + type name() { return m_##name; } \ private: diff --git a/src/RGB.hpp b/src/RGB.hpp index 66ea5b4..5ecb908 100644 --- a/src/RGB.hpp +++ b/src/RGB.hpp @@ -18,9 +18,9 @@ public: void set_g(double g) { m_g = g; } void set_b(double b) { m_b = b; } - double get_r() { return m_r; } - double get_g() { return m_g; } - double get_b() { return m_b; } + double r() { return m_r; } + double g() { return m_g; } + double b() { return m_b; } }; } \ No newline at end of file diff --git a/src/TopLevelStyles.hpp b/src/TopLevelStyles.hpp index dbbc59a..e9f0a03 100644 --- a/src/TopLevelStyles.hpp +++ b/src/TopLevelStyles.hpp @@ -48,7 +48,7 @@ public: } } - Window *get_window() { return m_window; } + Window *window() { return m_window; } void set_window(Window *window) { m_window = window; } void wants_repaint(); diff --git a/src/Widget.cpp b/src/Widget.cpp index 5bb2939..93577c9 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -26,13 +26,13 @@ void Widget::set_window(Window *window) { throw std::logic_error{"null window value for set_window"}; m_window = window; - m_styles = m_window->get_top_level_styles(); + m_styles = m_window->top_level_styles(); on_init(); } bool Widget::add_child(std::shared_ptr child) { - if (child->get_parent()) { + if (child->parent()) { return false; } m_children.push_back(child); @@ -50,8 +50,8 @@ void Widget::remove_child(std::shared_ptr child) { void Widget::do_generic_paint() { if (m_do_background_fill) { - auto painter = m_window->get_painter(); - auto cr = painter.get_cairo(); + auto painter = m_window->painter(); + auto cr = painter.cairo(); cr->save(); @@ -100,12 +100,12 @@ void Widget::handle_repaint(WidgetRepaintRequestedEvent &event) { if (!m_did_init) return; - auto painter = m_window->get_painter(); + auto painter = m_window->painter(); if (!painter.can_paint()) return; - auto cr = painter.get_cairo(); + auto cr = painter.cairo(); auto event_should_do_group = event.should_do_group(); if (event_should_do_group) { @@ -133,7 +133,7 @@ void Widget::handle_repaint(WidgetRepaintRequestedEvent &event) { void Widget::handle_mouse_move_event(MouseMoveEvent &event) { bool update_focus_to = true; - if (!m_current_geometry.contains_point(event.get_point())) { + if (!m_current_geometry.contains_point(event.point())) { // we just became unfocused if (m_is_focused) { update_focus_to = false; @@ -155,9 +155,9 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) { } void Widget::handle_mouse_button_event(MouseButtonEvent &event) { - bool update_activation_to = event.get_was_left_button_pressed(); + bool update_activation_to = event.was_left_button_pressed(); - if (!m_current_geometry.contains_point(event.get_point())) { + if (!m_current_geometry.contains_point(event.point())) { event.accept(); return; } @@ -179,7 +179,7 @@ void Widget::dispatch_event(Event &event) { if (!m_accepts_events) return; - switch (event.get_type()) { + switch (event.type()) { case EventType::MouseMove: { handle_mouse_move_event(reinterpret_cast(event)); break; @@ -204,7 +204,7 @@ void Widget::dispatch_event(Event &event) { } } - if (!event.get_accepted()) { + if (!event.accepted()) { for (auto& child : m_children) { child->dispatch_event(event); } @@ -212,7 +212,7 @@ void Widget::dispatch_event(Event &event) { } void Widget::on_init() { - set_background_fill_color(get_styles()->get_background_color()); + set_background_fill_color(styles()->background_color()); set_do_background_fill(true); set_did_init(true); } diff --git a/src/Widget.hpp b/src/Widget.hpp index 6ff82eb..4b73d13 100644 --- a/src/Widget.hpp +++ b/src/Widget.hpp @@ -55,41 +55,41 @@ public: m_accepts_events = false; } - Box &get_current_geometry() { return m_current_geometry; } + Box ¤t_geometry() { return m_current_geometry; } void set_current_geometry(Box current_geometry) { m_current_geometry = current_geometry; wants_full_relayout(); } void set_current_geometry(Box current_geometry, bool is_pure) { m_current_geometry = current_geometry; if (!is_pure) { wants_full_relayout(); } } - std::vector> &get_children() { return m_children; } + std::vector> &children() { return m_children; } bool add_child(std::shared_ptr child); void remove_child(std::shared_ptr child); - Widget *get_parent() { return m_parent; } + Widget *parent() { return m_parent; } void set_parent(Widget *parent) { m_parent = parent; } - Window *get_window() { return m_window; } + Window *window() { return m_window; } void set_window(Window *window); - std::shared_ptr get_styles() { return m_styles; } + std::shared_ptr styles() { return m_styles; } void set_styles(std::shared_ptr styles) { m_styles = styles; wants_relayout(); } void set_did_init(bool did_init) { m_did_init = did_init; } - bool get_did_init() { return m_did_init; } + bool did_init() { return m_did_init; } bool is_focused() { return m_is_focused; } bool is_active() { return m_is_active; } - bool get_consumes_hits() { return m_consumes_hits; } + bool consumes_hits() { return m_consumes_hits; } void set_consumes_hits(bool consumes_hits) { m_consumes_hits = consumes_hits; } - bool get_accepts_events() { return m_accepts_events; } + bool accepts_events() { return m_accepts_events; } void set_accepts_events(bool accepts_events) { m_accepts_events = accepts_events; } void set_layout(std::shared_ptr layout); - std::shared_ptr get_layout() { return m_layout; } + std::shared_ptr layout() { return m_layout; } - WidgetType get_type() { return m_type; } - ControlWidgetType get_control_type() { return m_control_type; } + WidgetType type() { return m_type; } + ControlWidgetType control_type() { return m_control_type; } void dispatch_event(Event &event); void wants_repaint(); diff --git a/src/Window.cpp b/src/Window.cpp index 55b2f41..2fe04d2 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -33,8 +33,8 @@ bool Window::spawn_window() { DefaultRootWindow(dsp), 0, 0, - m_current_geometry.get_width(), - m_current_geometry.get_height(), + m_current_geometry.width(), + m_current_geometry.height(), 0, 0, CopyFromParent, @@ -50,8 +50,8 @@ bool Window::spawn_window() { dsp, da, DefaultVisual(dsp, screen), - get_current_geometry().get_width(), - get_current_geometry().get_height() + current_geometry().width(), + current_geometry().height() ); auto cairo_context = Cairo::Context::create(m_xlib_surface); @@ -103,14 +103,14 @@ void Window::run(bool block) { break; } case ConfigureNotify: { - if (e.xconfigure.width != m_current_geometry.get_width() || e.xconfigure.height != m_current_geometry.get_height()) { + if (e.xconfigure.width != m_current_geometry.width() || e.xconfigure.height != m_current_geometry.height()) { m_xlib_surface->set_size(e.xconfigure.width, e.xconfigure.height); m_current_geometry.set_width(e.xconfigure.width); m_current_geometry.set_height(e.xconfigure.height); // if we have a main widget, we are going to have to resize it as well if (m_main_widget) { - m_main_widget->get_current_geometry().set_width(m_current_geometry.get_width()); - m_main_widget->get_current_geometry().set_height(m_current_geometry.get_height()); + m_main_widget->current_geometry().set_width(m_current_geometry.width()); + m_main_widget->current_geometry().set_height(m_current_geometry.height()); } dispatch_full_repaint(); } diff --git a/src/Window.hpp b/src/Window.hpp index 7494299..f319840 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -23,18 +23,18 @@ private: public: Window() {} - Painter &get_painter() { return m_painter; } + Painter &painter() { return m_painter; } - Widget *get_focused_widget() { return m_focused_widget; } + Widget *focused_widget() { return m_focused_widget; } void set_focused_widget(Widget *focused_widget) { m_focused_widget = focused_widget; } - Widget *get_active_widget() { return m_active_widget; } + Widget *active_widget() { return m_active_widget; } void set_active_widget(Widget *active_widget) { m_active_widget = active_widget; } - std::shared_ptr get_main_widget() { return m_main_widget; } + std::shared_ptr main_widget() { return m_main_widget; } void set_main_widget(std::shared_ptr main_widget); - std::shared_ptr get_top_level_styles() { return m_top_level_styles; } + std::shared_ptr top_level_styles() { return m_top_level_styles; } void widget_repaint(Widget *target); void widget_relayout(Widget *target); @@ -44,7 +44,7 @@ public: bool dispatch_full_relayout(); bool dispatch_to_main_widget(Event &event); - Box &get_current_geometry() { return m_current_geometry; } + Box ¤t_geometry() { return m_current_geometry; } bool spawn_window(); void run(bool block);