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