30 DLOG(
"new x = %d, y = %d\n", new_x, new_y);
38 xcb_warp_pointer(
conn, XCB_NONE, event->root, 0, 0, 0, 0,
42 xcb_warp_pointer(
conn, XCB_NONE, event->root, 0, 0, 0, 0,
71 DLOG(
"Find two participants for resizing container=%p in direction=%i\n", other,
direction);
72 Con *first = *current;
75 DLOG(
"Current container is NULL, aborting.\n");
82 while (first->
type != CT_WORKSPACE &&
83 first->
type != CT_FLOATING_CON &&
97 if (second == NULL && both_sides ==
true) {
102 if (second == NULL && both_sides ==
true) {
103 second =
TAILQ_PREV(first, nodes_head, nodes);
107 if (second == NULL) {
108 DLOG(
"No second container in this direction found, trying to look further up in the tree...\n");
113 DLOG(
"Found participants: first=%p and second=%p.\n", first, second);
116 if (first == NULL || second == NULL) {
117 DLOG(
"Could not find two participants for this resize request.\n");
133 return ((
double)min_size / (double)parent_size);
145 assert(px * ppt == 0);
148 double new_first_percent;
149 double new_second_percent;
151 new_first_percent = first->
percent + ((double)ppt / 100.0);
152 new_second_percent = second->
percent - ((double)ppt / 100.0);
156 new_first_percent = first->
percent + pct;
157 new_second_percent = second->
percent - pct;
165 first->
percent = new_first_percent;
166 second->
percent = new_second_percent;
172 const xcb_button_press_event_t *event,
173 bool use_threshold) {
176 DLOG(
"first = %p / %s\n", first, first->
name);
177 DLOG(
"second = %p / %s\n", second, second->
name);
185 mask = XCB_CW_OVERRIDE_REDIRECT;
200 helprect.
x = second->
rect.
x;
201 helprect.
y = second->
rect.
y;
210 const uint32_t ffirst_right = ffirst->
rect.
x + ffirst->
rect.
width;
211 const uint32_t gap = (fsecond->
rect.
x - ffirst_right);
212 const uint32_t middle = fsecond->
rect.
x - (gap / 2);
214 DLOG(
"fsecond->rect = {.x = %u, .width = %u}\n", fsecond->
rect.
x, fsecond->
rect.
width);
215 DLOG(
"gap = %u, middle = %u\n", gap, middle);
216 initial_position = middle;
221 const uint32_t gap = (fsecond->
rect.
y - ffirst_bottom);
222 const uint32_t middle = fsecond->
rect.
y - (gap / 2);
225 DLOG(
"gap = %u, middle = %u\n", gap, middle);
226 initial_position = middle;
229 mask = XCB_CW_BACK_PIXEL;
232 mask |= XCB_CW_OVERRIDE_REDIRECT;
238 if (!use_threshold) {
241 xcb_warp_pointer(
conn, XCB_NONE, event->root, 0, 0, 0, 0,
242 initial_position, event->root_y);
244 xcb_warp_pointer(
conn, XCB_NONE, event->root, 0, 0, 0, 0,
245 event->root_x, initial_position);
249 xcb_circulate_window(
conn, XCB_CIRCULATE_RAISE_LOWEST,
helpwin);
268 xcb_destroy_window(
conn, grabwin);
277 DLOG(
"Done, pixels = %d\n", pixels);
288 DLOG(
"Graphical resize %s: first->percent = %f, second->percent = %f.\n",
289 result ?
"successful" :
"failed", first->
percent, second->
percent);