29 DLOG(
"new x = %d, y = %d\n", new_x, new_y);
33 new_x < (output->
rect.
x + 25))
40 new_y < (output->
rect.
y + 25))
51 DLOG(
"Find two participants for resizing container=%p in direction=%i\n", other, direction);
52 Con *first = *current;
55 DLOG(
"Current container is NULL, aborting.\n");
61 const bool dir_backwards = (direction ==
D_UP || direction ==
D_LEFT);
62 while (first->
type != CT_WORKSPACE &&
63 first->
type != CT_FLOATING_CON &&
77 if (second == NULL && both_sides ==
true) {
82 if (second == NULL && both_sides ==
true) {
88 DLOG(
"No second container in this direction found, trying to look further up in the tree...\n");
93 DLOG(
"Found participants: first=%p and second=%p.\n", first, second);
96 if (first == NULL || second == NULL) {
97 DLOG(
"Could not find two participants for this resize request.\n");
114 return ((
double)target / (double)total);
127 return ((
double)target / (double)total);
139 assert(px * ppt == 0);
142 double new_first_percent;
143 double new_second_percent;
145 new_first_percent = first->
percent + ((double)ppt / 100.0);
146 new_second_percent = second->
percent - ((double)ppt / 100.0);
149 new_second_percent = second->
percent + first->
percent - new_first_percent;
157 first->
percent = new_first_percent;
158 second->
percent = new_second_percent;
173 mask = XCB_CW_OVERRIDE_REDIRECT;
188 helprect.
x = second->
rect.
x;
189 helprect.
y = second->
rect.
y;
190 if (orientation ==
HORIZ) {
193 initial_position = second->
rect.
x;
194 xcb_warp_pointer(
conn, XCB_NONE, event->root, 0, 0, 0, 0,
195 second->
rect.
x, event->root_y);
199 initial_position = second->
rect.
y;
200 xcb_warp_pointer(
conn, XCB_NONE, event->root, 0, 0, 0, 0,
201 event->root_x, second->
rect.
y);
204 mask = XCB_CW_BACK_PIXEL;
207 mask |= XCB_CW_OVERRIDE_REDIRECT;
213 xcb_circulate_window(
conn, XCB_CIRCULATE_RAISE_LOWEST, helpwin);
218 new_position = initial_position;
225 xcb_destroy_window(
conn, helpwin);
226 xcb_destroy_window(
conn, grabwin);
234 int pixels = (new_position - initial_position);
235 DLOG(
"Done, pixels = %d\n", pixels);
241 DLOG(
"Graphical resize %s: first->percent = %f, second->percent = %f.\n",
242 result ?
"successful" :
"failed", first->
percent, second->
percent);
void con_fix_percent(Con *con)
Updates the percent attribute of the children of the given container.
double percent_for_1px(Con *con)
Calculate the minimum percent needed for the given container to be at least 1 pixel.
orientation_t orientation_from_direction(direction_t direction)
Convert a direction to its corresponding orientation.
int logical_px(const int logical)
Convert a logical amount of pixels (e.g.
bool resize_find_tiling_participants(Con **current, Con **other, direction_t direction, bool both_sides)
xcb_connection_t * conn
XCB connection and root screen.
bool resize_neighboring_cons(Con *first, Con *second, int px, int ppt)
Resize the two given containers using the given amount of pixels or percentage points.
orientation_t orientation
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on...
Stores a rectangle, for example the size of a window, the child window etc.
orientation_t con_orientation(Con *con)
Returns the orientation of the given container (for stacked containers, vertical orientation is used ...
#define TAILQ_NEXT(elm, field)
drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t confine_to, border_t border, int cursor, callback_t callback, const void *extra)
This function grabs your pointer and keyboard and lets you drag stuff around (borders).
void x_mask_event_mask(uint32_t mask)
Applies the given mask to the event mask of every i3 window decoration X11 window.
void resize_graphical_handler(Con *first, Con *second, orientation_t orientation, const xcb_button_press_event_t *event)
struct Config::config_client client[QUBE_NUM_LABELS]
A 'Con' represents everything from the X11 root window down to a single X11 window.
DRAGGING_CB(resize_callback)
#define TAILQ_PREV(elm, headname, field)
drag_result_t
This is the return value of a drag operation like drag_pointer.
xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t depth, xcb_visualid_t visual, uint16_t window_class, enum xcursor_cursor_t cursor, bool map, uint32_t mask, uint32_t *values)
Convenience wrapper around xcb_create_window which takes care of depth, generating an ID and checking...
double px_resize_to_percent(Con *con, int px_diff)
Calculate the given container's new percent given a change in pixels.
struct Colortriple focused