Skip to content

Commit

Permalink
Review all replaced variables and fix errors
Browse files Browse the repository at this point in the history
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
  • Loading branch information
Caellian committed Apr 25, 2024
1 parent ce684cf commit cac4361
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/conky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(border_total, border_total);
text_start = conky::point<int>::repeat(border_total);
window.geometry.pos = conky::point<int>(x, y) - text_start;
} else
#endif
Expand Down
3 changes: 1 addition & 2 deletions src/display-wayland.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(width, height);
window_allocate_buffer(window);
window_layer_surface_set_size(window);
}
Expand Down
11 changes: 6 additions & 5 deletions src/display-x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -729,11 +729,12 @@ bool handle_event<x_event_handler::EXPOSE>(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;
Expand Down
13 changes: 13 additions & 0 deletions src/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <cstdint>
#include <type_traits>

#ifdef BUILD_X11
#include <X11/Xlib.h>
#endif /* BUILD_X11 */

#ifdef Success
// Undefine X11 Success definition; not used by us; conflicts with Eigen
// (namespaced) enum declarations
Expand Down Expand Up @@ -241,6 +245,15 @@ struct rect {
bool intersects(rect<O> other) const {
return this->_intersects_partial(other) || other._intersects_partial(*this);
}

#ifdef BUILD_X11
XRectangle to_xrectangle() const {
return XRectangle{.x = static_cast<short>(this->x()),
.y = static_cast<short>(this->y()),
.width = static_cast<unsigned short>(this->width()),
.height = static_cast<unsigned short>(this->height())};
}
#endif /* BUILD_X11 */
};

} // namespace conky
Expand Down
3 changes: 1 addition & 2 deletions src/x11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(read_x, read_y);
}
}

Expand Down

0 comments on commit cac4361

Please sign in to comment.