29 if (fs != NULL && fs != con) {
59 Con *visible_ws = NULL;
66 return drop_targets > 1;
111 rect.
width = threshold;
117 rect.
x += (rect.
width - threshold);
118 rect.
width = threshold;
121 rect.
y += (rect.
height - threshold);
136 reverse_direction =
D_LEFT;
139 reverse_direction =
D_DOWN;
142 reverse_direction =
D_UP;
161 const double sibling_indicator_percent_of_rect = 0.3;
168 if (target == NULL) {
176 bool draw_window =
true;
180 goto create_indicator;
186 const uint32_t sibling_indicator_size =
max(
logical_px(2), (uint32_t)(sibling_indicator_percent_of_rect * min_rect_dimension));
187 const uint32_t parent_indicator_size =
min(
188 parent_indicator_max_size,
192 sibling_indicator_size - 1);
195 const uint32_t d_left = new_x - rect.
x;
196 const uint32_t d_top = new_y - rect.
y;
197 const uint32_t d_right = rect.
x + rect.
width - new_x;
198 const uint32_t d_bottom = rect.
y + rect.
height - new_y;
199 const uint32_t d_min =
min(
min(d_left, d_right),
min(d_top, d_bottom));
201 if (d_left == d_min) {
203 }
else if (d_top == d_min) {
205 }
else if (d_right == d_min) {
207 }
else if (d_bottom == d_min) {
211 ELOG(
"min() is broken\n");
214 const bool target_parent = (d_min < parent_indicator_size &&
216 const bool target_sibling = (d_min < sibling_indicator_size);
224 goto create_indicator;
236 rect.
x += sibling_indicator_size;
237 rect.
y += sibling_indicator_size;
238 rect.
width -= sibling_indicator_size * 2;
239 rect.
height -= sibling_indicator_size * 2;
251 const uint32_t values[4] = {rect.
x, rect.
y, rect.
width, rect.
height};
252 const uint32_t mask = XCB_CONFIG_WINDOW_X |
253 XCB_CONFIG_WINDOW_Y |
254 XCB_CONFIG_WINDOW_WIDTH |
255 XCB_CONFIG_WINDOW_HEIGHT;
256 xcb_configure_window(
conn, *(params->
indicator), mask, values);
275 mask = XCB_CW_BACK_PIXEL;
278 mask |= XCB_CW_OVERRIDE_REDIRECT;
286 xcb_change_property(
conn,
287 XCB_PROP_MODE_REPLACE,
292 (strlen(
"i3-drag") + 1) * 2,
293 "i3-drag\0i3-drag\0");
295 xcb_circulate_window(
conn, XCB_CIRCULATE_RAISE_LOWEST,
indicator);
305 DLOG(
"Start dragging tiled container: con = %p\n", con);
306 bool set_focus = (con ==
focused);
329 DLOG(
"drop aborted\n");
342 const bool swap_pressed = (mod != 0 && (
event->state & mod) == mod);
371 DLOG(
"drop %s (%s) of %s%p\n",
374 parent_tabbed_or_stacked ?
"tabbed/stacked " :
"",
376 if (parent_tabbed_or_stacked) {
402 if (set_focus || set_fs) {
405 ELOG(
"dragged container somehow got fullscreen again.\n");
407 }
else if (fs && set_focus && set_fs) {
412 set_fs = set_focus =
false;
413 }
else if (!set_focus) {
bool con_move_to_target(Con *con, Con *target)
bool con_is_floating(Con *con)
Returns true if the node is floating.
orientation_t con_orientation(Con *con)
Returns the orientation of the given container (for stacked containers, vertical orientation is used ...
bool con_has_managed_window(Con *con)
Returns true when this con is a leaf node with a managed X11 window (e.g., excluding dock containers)
Con * con_descend_direction(Con *con, direction_t direction)
Returns the leftmost, rightmost, etc.
bool con_is_hidden(Con *con)
This will only return true for containers which have some parent with a tabbed / stacked parent of wh...
Con * con_get_workspace(Con *con)
Gets the workspace container this node is on.
Con * con_descend_tiling_focused(Con *con)
Returns the focused con inside this client, descending the tree as far as possible.
void con_disable_fullscreen(Con *con)
Disables fullscreen mode for the given container, if necessary.
Con * con_get_fullscreen_covering_ws(Con *ws)
Returns the fullscreen node that covers the given workspace if it exists.
bool con_swap(Con *first, Con *second)
Swaps the two containers.
bool con_is_internal(Con *con)
Returns true if the container is internal, such as __i3_scratch.
bool con_exists(Con *con)
Returns true if the given container (still) exists.
int con_num_children(Con *con)
Returns the number of children of this container.
void con_activate(Con *con)
Sets input focus to the given container and raises it to the top.
void con_enable_fullscreen(Con *con, fullscreen_mode_t fullscreen_mode)
Enables fullscreen mode for the given container, if necessary.
void con_focus(Con *con)
Sets input focus to the given container.
drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t confine_to, int cursor, bool use_threshold, callback_t callback, const void *extra)
This function grabs your pointer and keyboard and lets you drag stuff around (borders).
void insert_con_into(Con *con, Con *target, position_t position)
This function detaches 'con' from its parent and inserts it either before or after 'target'.
void tree_move(Con *con, direction_t direction)
Moves the given container in the given direction.
Con * output_get_content(Con *output)
Returns the output container below the given output container.
Output * get_output_containing(unsigned int x, unsigned int y)
Returns the active (!) output which contains the coordinates x, y or NULL if there is no output which...
int render_deco_height(void)
Returns the height for the decorations.
static bool con_on_side_of_parent(Con *con, direction_t direction)
static bool is_tiling_drop_target(Con *con)
static xcb_window_t create_drop_indicator(Rect rect)
void tiling_drag(Con *con, xcb_button_press_event_t *event, bool use_threshold)
Initiates a mouse drag operation on a tiled window.
static Rect adjust_rect(Rect rect, direction_t direction, uint32_t threshold)
static Con * find_drop_target(uint32_t x, uint32_t y)
bool has_drop_targets(void)
Returns whether there currently are any drop targets.
struct all_cons_head all_cons
void tree_render(void)
Renders the tree, that is rendering all outputs using render_con() and pushing the changes to X11 usi...
void tree_split(Con *con, orientation_t orientation)
Splits (horizontally or vertically) the given container by creating a new container which contains th...
orientation_t orientation_from_direction(direction_t direction)
Convert a direction to its corresponding orientation.
position_t position_from_direction(direction_t direction)
Convert a direction to its corresponding position.
bool rect_contains(Rect rect, uint32_t x, uint32_t y)
const char * position_to_string(position_t position)
Converts position to a string representation.
const char * direction_to_string(direction_t direction)
Converts direction to a string representation.
void workspace_show(Con *workspace)
Switches to the given workspace.
bool workspace_is_visible(Con *ws)
Returns true if the workspace is currently visible.
void x_mask_event_mask(uint32_t mask)
Applies the given mask to the event mask of every i3 window decoration X11 window.
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...
void ipc_send_window_event(const char *property, Con *con)
For the window events we send, along the usual "change" field, also the window container,...
xcb_connection_t * conn
XCB connection and root screen.
layout_t
Container layouts.
#define DRAGGING_CB(name)
Macro to create a callback function for dragging.
drag_result_t
This is the return value of a drag operation like drag_pointer.
int logical_px(const int logical)
Convert a logical amount of pixels (e.g.
#define TAILQ_FOREACH(var, head, field)
#define TAILQ_FIRST(head)
#define TAILQ_LAST(head, headname)
#define GREP_FIRST(dest, head, condition)
orientation_t orientation
uint32_t swap_modifier
The modifier which needs to be pressed in combination with the floating modifier and your mouse butto...
struct Config::config_client client
struct Colortriple focused
Stores a rectangle, for example the size of a window, the child window etc.
An Output is a physical output on your graphics driver.
Con * con
Pointer to the Con which represents this output.
A 'Con' represents everything from the X11 root window down to a single X11 window.
fullscreen_mode_t fullscreen_mode