+#include "log.h"
+
+/*
+ * This is an ugly data structure which we need because there is no standard
+ * way of having nested functions (only available as a gcc extension at the
+ * moment, clang doesn’t support it) or blocks (only available as a clang
+ * extension and only on Mac OS X systems at the moment).
+ *
+ */
+struct callback_params {
+ resize_orientation_t orientation;
+ Output *screen;
+ xcb_window_t helpwin;
+ uint32_t *new_position;
+};
+
+DRAGGING_CB(resize_callback) {
+ struct callback_params *params = extra;
+ Output *screen = params->screen;
+ DLOG("new x = %d, y = %d\n", new_x, new_y);
+ if (params->orientation == O_VERTICAL) {
+ /* Check if the new coordinates are within screen boundaries */
+ if (new_x > (screen->rect.x + screen->rect.width - 25) ||
+ new_x < (screen->rect.x + 25))
+ return;
+
+ *(params->new_position) = new_x;
+ xcb_configure_window(conn, params->helpwin, XCB_CONFIG_WINDOW_X, params->new_position);
+ } else {
+ if (new_y > (screen->rect.y + screen->rect.height - 25) ||
+ new_y < (screen->rect.y + 25))
+ return;
+
+ *(params->new_position) = new_y;
+ xcb_configure_window(conn, params->helpwin, XCB_CONFIG_WINDOW_Y, params->new_position);
+ }
+
+ xcb_flush(conn);
+}