diff --git a/src/conky.cc b/src/conky.cc index efddb42d8..c376772bb 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -909,7 +909,7 @@ void update_text_area() { if (own_window.get(*state) && (fixed_pos == 0)) { int border_total = get_border_total(); - text_start = conky::point(border_total, border_total); + text_start = conky::point::repeat(border_total); window.geometry.pos = conky::point(x, y) - text_start; } else #endif diff --git a/src/display-wayland.cc b/src/display-wayland.cc index c18651195..7bbe68f6a 100644 --- a/src/display-wayland.cc +++ b/src/display-wayland.cc @@ -1227,8 +1227,7 @@ void window_destroy(struct window *window) { void window_resize(struct window *window, int width, int height) { window_free_buffer(window); - window->rectangle.set_width(width); - window->rectangle.set_height(height); + window->rectangle.size = conky::point(width, height); window_allocate_buffer(window); window_layer_surface_set_size(window); } diff --git a/src/display-x11.cc b/src/display-x11.cc index fb42edb9c..391d43263 100644 --- a/src/display-x11.cc +++ b/src/display-x11.cc @@ -729,11 +729,12 @@ bool handle_event(conky::display_output_x11 *surface, bool *consumed, void **cookie) { if (ev.type != Expose) return false; - XRectangle r; - r.x = ev.xexpose.x; - r.y = ev.xexpose.y; - r.width = ev.xexpose.width; - r.height = ev.xexpose.height; + XRectangle r{ + .x = ev.xexpose.x, + .y = ev.xexpose.y, + .width = ev.xexpose.width, + .height = ev.xexpose.height, + }; XUnionRectWithRegion(&r, x11_stuff.region, x11_stuff.region); XSync(display, False); return true; diff --git a/src/geometry.h b/src/geometry.h index e4a54d0ab..87657e78e 100644 --- a/src/geometry.h +++ b/src/geometry.h @@ -5,6 +5,10 @@ #include #include +#ifdef BUILD_X11 +#include +#endif /* BUILD_X11 */ + #ifdef Success // Undefine X11 Success definition; not used by us; conflicts with Eigen // (namespaced) enum declarations @@ -241,6 +245,15 @@ struct rect { bool intersects(rect other) const { return this->_intersects_partial(other) || other._intersects_partial(*this); } + +#ifdef BUILD_X11 + XRectangle to_xrectangle() const { + return XRectangle{.x = static_cast(this->x()), + .y = static_cast(this->y()), + .width = static_cast(this->width()), + .height = static_cast(this->height())}; + } +#endif /* BUILD_X11 */ }; } // namespace conky diff --git a/src/x11.cc b/src/x11.cc index 6df4130aa..08880eb85 100644 --- a/src/x11.cc +++ b/src/x11.cc @@ -1315,8 +1315,7 @@ void propagate_xinput_event(const conky::xi_event_data *ev) { XTranslateCoordinates(display, window.desktop, ev->event, ev->pos_absolute.x(), ev->pos_absolute.y(), &read_x, &read_y, &child); - target_pos.set_x(read_x); - target_pos.set_x(read_y); + target_pos = conky::point(read_x, read_y); } }