]> git.sur5r.net Git - i3/i3/blob - include/floating.h
normalize file headers across **/*.{h,c}
[i3/i3] / include / floating.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
6  *
7  * floating.c: Floating windows.
8  *
9  */
10 #ifndef _FLOATING_H
11 #define _FLOATING_H
12
13 #include "tree.h"
14
15 /** Callback for dragging */
16 typedef void(*callback_t)(Con*, Rect*, uint32_t, uint32_t, void*);
17
18 /** Macro to create a callback function for dragging */
19 #define DRAGGING_CB(name) \
20         static void name(Con *con, Rect *old_rect, uint32_t new_x, \
21                          uint32_t new_y, void *extra)
22
23 /** On which border was the dragging initiated? */
24 typedef enum { BORDER_LEFT   = (1 << 0),
25                BORDER_RIGHT  = (1 << 1),
26                BORDER_TOP    = (1 << 2),
27                BORDER_BOTTOM = (1 << 3)} border_t;
28
29 /**
30  * Enables floating mode for the given container by detaching it from its
31  * parent, creating a new container around it and storing this container in the
32  * floating_windows list of the workspace.
33  *
34  */
35 void floating_enable(Con *con, bool automatic);
36
37 /**
38  * Disables floating mode for the given container by re-attaching the container
39  * to its old parent.
40  *
41  */
42 void floating_disable(Con *con, bool automatic);
43
44 /**
45  * Calls floating_enable() for tiling containers and floating_disable() for
46  * floating containers.
47  *
48  * If the automatic flag is set to true, this was an automatic update by a
49  * change of the window class from the application which can be overwritten by
50  * the user.
51  *
52  */
53 void toggle_floating_mode(Con *con, bool automatic);
54
55 /**
56  * Raises the given container in the list of floating containers
57  *
58  */
59 void floating_raise_con(Con *con);
60
61 /**
62  * Checks if con’s coordinates are within its workspace and re-assigns it to
63  * the actual workspace if not.
64  *
65  */
66 bool floating_maybe_reassign_ws(Con *con);
67
68 #if 0
69 /**
70  * Removes the floating client from its workspace and attaches it to the new
71  * workspace. This is centralized here because it may happen if you move it
72  * via keyboard and if you move it using your mouse.
73  *
74  */
75 void floating_assign_to_workspace(Client *client, Workspace *new_workspace);
76
77 /**
78  * Called whenever the user clicks on a border (not the titlebar!) of a
79  * floating window. Determines on which border the user clicked and launches
80  * the drag_pointer function with the resize_callback.
81  *
82  */
83 int floating_border_click(xcb_connection_t *conn, Client *client,
84                           xcb_button_press_event_t *event);
85
86 #endif
87 /**
88  * Called when the user clicked on the titlebar of a floating window.
89  * Calls the drag_pointer function with the drag_window callback
90  *
91  */
92 void floating_drag_window(Con *con, xcb_button_press_event_t *event);
93
94 /**
95  * Called when the user clicked on a floating window while holding the
96  * floating_modifier and the right mouse button.
97  * Calls the drag_pointer function with the resize_window callback
98  *
99  */
100 void floating_resize_window(Con *con, bool proportional, xcb_button_press_event_t *event);
101
102 #if 0
103 /**
104  * Changes focus in the given direction for floating clients.
105  *
106  * Changing to the left/right means going to the previous/next floating client,
107  * changing to top/bottom means cycling through the Z-index.
108  *
109  */
110 void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused,
111                               direction_t direction);
112
113 /**
114  * Moves the client 10px to the specified direction.
115  *
116  */
117 void floating_move(xcb_connection_t *conn, Client *currently_focused,
118                    direction_t direction);
119
120 /**
121  * Hides all floating clients (or show them if they are currently hidden) on
122  * the specified workspace.
123  *
124  */
125 void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace);
126
127 #endif
128 /**
129  * This function grabs your pointer and lets you drag stuff around (borders).
130  * Every time you move your mouse, an XCB_MOTION_NOTIFY event will be received
131  * and the given callback will be called with the parameters specified (client,
132  * border on which the click originally was), the original rect of the client,
133  * the event and the new coordinates (x, y).
134  *
135  */
136 void drag_pointer(Con *con, xcb_button_press_event_t *event,
137                   xcb_window_t confine_to, border_t border, callback_t callback,
138                   void *extra);
139
140 #endif