i3
floating.h
Go to the documentation of this file.
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * floating.c: Floating windows.
8  *
9  */
10 #pragma once
11 
12 #include "tree.h"
13 
15 typedef void (*callback_t)(Con *, Rect *, uint32_t, uint32_t, const void *);
16 
18 #define DRAGGING_CB(name) \
19  static void name(Con *con, Rect *old_rect, uint32_t new_x, \
20  uint32_t new_y, const void *extra)
21 
23 typedef enum { BORDER_LEFT = (1 << 0),
24  BORDER_RIGHT = (1 << 1),
25  BORDER_TOP = (1 << 2),
26  BORDER_BOTTOM = (1 << 3) } border_t;
27 
34 void floating_enable(Con *con, bool automatic);
35 
41 void floating_disable(Con *con, bool automatic);
42 
52 void toggle_floating_mode(Con *con, bool automatic);
53 
58 void floating_raise_con(Con *con);
59 
66 
71 void floating_center(Con *con, Rect rect);
72 
77 void floating_move_to_pointer(Con *con);
78 
79 #if 0
80 
86 void floating_assign_to_workspace(Client *client, Workspace *new_workspace);
87 
94 int floating_border_click(xcb_connection_t *conn, Client *client,
95  xcb_button_press_event_t *event);
96 
97 #endif
98 
103 void floating_drag_window(Con *con, const xcb_button_press_event_t *event);
104 
111 void floating_resize_window(Con *con, const bool proportional, const xcb_button_press_event_t *event);
112 
119 void floating_check_size(Con *floating_con);
120 
121 #if 0
122 
129 void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused,
130  direction_t direction);
131 
136 void floating_move(xcb_connection_t *conn, Client *currently_focused,
137  direction_t direction);
138 
144 void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace);
145 
146 #endif
147 
163 typedef enum {
164  DRAGGING = 0,
168 } drag_result_t;
169 
178 drag_result_t drag_pointer(Con *con, const xcb_button_press_event_t *event,
179  xcb_window_t confine_to, border_t border, int cursor,
180  callback_t callback, const void *extra);
181 
189 void floating_reposition(Con *con, Rect newrect);
190 
198 void floating_resize(Con *floating_con, int x, int y);
199 
205 void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect);
void floating_disable(Con *con, bool automatic)
Disables floating mode for the given container by re-attaching the container to its old parent...
Definition: floating.c:307
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).
Definition: floating.c:725
void floating_enable(Con *con, bool automatic)
Enables floating mode for the given container by detaching it from its parent, creating a new contain...
Definition: floating.c:134
void floating_drag_window(Con *con, const xcb_button_press_event_t *event)
Called when the user clicked on the titlebar of a floating window.
Definition: floating.c:487
border_t
On which border was the dragging initiated?
Definition: floating.h:23
void floating_resize_window(Con *con, const bool proportional, const xcb_button_press_event_t *event)
Called when the user clicked on a floating window while holding the floating_modifier and the right m...
Definition: floating.c:582
void floating_reposition(Con *con, Rect newrect)
Repositions the CT_FLOATING_CON to have the coordinates specified by newrect, but only if the coordin...
Definition: floating.c:807
xcb_connection_t * conn
XCB connection and root screen.
Definition: main.c:43
void floating_center(Con *con, Rect rect)
Centers a floating con above the specified rect.
Definition: floating.c:422
bool floating_maybe_reassign_ws(Con *con)
Checks if con’s coordinates are within its workspace and re-assigns it to the actual workspace if not...
Definition: floating.c:393
void floating_raise_con(Con *con)
Raises the given container in the list of floating containers.
Definition: floating.c:382
void toggle_floating_mode(Con *con, bool automatic)
Calls floating_enable() for tiling containers and floating_disable() for floating containers...
Definition: floating.c:360
uint32_t x
Definition: data.h:120
Stores a rectangle, for example the size of a window, the child window etc.
Definition: data.h:141
drag_result_t
This is the return value of a drag operation like drag_pointer.
Definition: floating.h:163
direction_t
Definition: data.h:54
uint32_t y
Definition: data.h:121
A &#39;Con&#39; represents everything from the X11 root window down to a single X11 window.
Definition: data.h:544
void floating_move_to_pointer(Con *con)
Moves the given floating con to the current pointer position.
Definition: floating.c:431
void(* callback_t)(Con *, Rect *, uint32_t, uint32_t, const void *)
Callback for dragging.
Definition: floating.h:15
void floating_check_size(Con *floating_con)
Called when a floating window is created or resized.
Definition: floating.c:66
void floating_resize(Con *floating_con, int x, int y)
Sets size of the CT_FLOATING_CON to specified dimensions.
Definition: floating.c:833
void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect)
Fixes the coordinates of the floating window whenever the window gets reassigned to a different outpu...
Definition: floating.c:862