2 #define I3__FILE__ "resize.c"
14 extern xcb_connection_t *
conn;
33 DLOG(
"new x = %d, y = %d\n", new_x, new_y);
37 new_x < (output->
rect.
x + 25))
44 new_y < (output->
rect.
y + 25))
55 DLOG(
"resize handler\n");
69 mask = XCB_CW_OVERRIDE_REDIRECT;
78 if (orientation ==
HORIZ) {
79 helprect.
x =
event->root_x;
80 helprect.
y = output->
rect.
y;
83 new_position =
event->root_x;
85 helprect.
x = output->
rect.
x;
86 helprect.
y =
event->root_y;
89 new_position =
event->root_y;
92 mask = XCB_CW_BACK_PIXEL;
95 mask |= XCB_CW_OVERRIDE_REDIRECT;
99 XCB_WINDOW_CLASS_INPUT_OUTPUT, (orientation ==
HORIZ ?
103 xcb_circulate_window(
conn, XCB_CIRCULATE_RAISE_LOWEST, helpwin);
111 xcb_destroy_window(
conn, helpwin);
112 xcb_destroy_window(
conn, grabwin);
116 if (orientation ==
HORIZ)
117 pixels = (new_position -
event->root_x);
118 else pixels = (new_position -
event->root_y);
120 DLOG(
"Done, pixels = %d\n", pixels);
128 double new_percent, difference;
129 double percent = first->
percent;
130 DLOG(
"percent = %f\n", percent);
132 DLOG(
"original = %d\n", original);
133 new_percent = (original + pixels) * (percent / original);
134 difference = percent - new_percent;
135 DLOG(
"difference = %f\n", difference);
136 DLOG(
"new percent = %f\n", new_percent);
140 double s_percent = second->
percent;
141 second->
percent = s_percent + difference;
A 'Con' represents everything from the X11 root window down to a single X11 window.
Stores a rectangle, for example the size of a window, the child window etc.
#define DRAGGING_CB(name)
Macro to create a callback function for dragging.
void x_mask_event_mask(uint32_t mask)
Applies the given mask to the event mask of every i3 window decoration X11 window.
int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, const xcb_button_press_event_t *event)
struct Config::config_client client
void con_fix_percent(Con *con)
Updates the percent attribute of the children of the given container.
void 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 lets you drag stuff around (borders).
struct Colortriple focused
Con * con_get_output(Con *con)
Gets the output container (first container with CT_OUTPUT in hierarchy) this node is on...
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...
orientation_t orientation