]> git.sur5r.net Git - i3/i3/blob - include/floating.h
aa9d9d5f62a1c76a45db7dd75e1293274ff12fed
[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 /** Callback for dragging */
15 typedef void(*callback_t)(xcb_connection_t*, Client*, Rect*, uint32_t, uint32_t, void*);
16
17 /** Macro to create a callback function for dragging */
18 #define DRAGGING_CB(name) \
19         static void name(xcb_connection_t *conn, Client *client, \
20                          Rect *old_rect, uint32_t new_x, uint32_t new_y, \
21                          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  * Enters floating mode for the given client.  Correctly takes care of the
31  * position/size (separately stored for tiling/floating mode) and
32  * repositions/resizes/redecorates the client.
33  *
34  * If the automatic flag is set to true, this was an automatic update by a
35  * change of the window class from the application which can be overwritten by
36  * the user.
37  *
38  */
39 void toggle_floating_mode(xcb_connection_t *conn, Client *client,
40                           bool automatic);
41
42 /**
43  * Removes the floating client from its workspace and attaches it to the new
44  * workspace. This is centralized here because it may happen if you move it
45  * via keyboard and if you move it using your mouse.
46  *
47  */
48 void floating_assign_to_workspace(Client *client, Workspace *new_workspace);
49
50 /**
51  * Called whenever the user clicks on a border (not the titlebar!) of a
52  * floating window. Determines on which border the user clicked and launches
53  * the drag_pointer function with the resize_callback.
54  *
55  */
56 int floating_border_click(xcb_connection_t *conn, Client *client,
57                           xcb_button_press_event_t *event);
58
59 /**
60  * Called when the user clicked on the titlebar of a floating window.
61  * Calls the drag_pointer function with the drag_window callback
62  *
63  */
64 void floating_drag_window(xcb_connection_t *conn, Client *client,
65                           xcb_button_press_event_t *event);
66
67 /**
68  * Called when the user clicked on a floating window while holding the
69  * floating_modifier and the right mouse button.
70  * Calls the drag_pointer function with the resize_window callback
71  *
72  */
73 void floating_resize_window(xcb_connection_t *conn, Client *client,
74                             bool proportional, xcb_button_press_event_t *event);
75
76 /**
77  * Changes focus in the given direction for floating clients.
78  *
79  * Changing to the left/right means going to the previous/next floating client,
80  * changing to top/bottom means cycling through the Z-index.
81  *
82  */
83 void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused,
84                               direction_t direction);
85
86 /**
87  * Moves the client 10px to the specified direction.
88  *
89  */
90 void floating_move(xcb_connection_t *conn, Client *currently_focused,
91                    direction_t direction);
92
93 /**
94  * Hides all floating clients (or show them if they are currently hidden) on
95  * the specified workspace.
96  *
97  */
98 void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace);
99
100 /**
101  * This function grabs your pointer and lets you drag stuff around (borders).
102  * Every time you move your mouse, an XCB_MOTION_NOTIFY event will be received
103  * and the given callback will be called with the parameters specified (client,
104  * border on which the click originally was), the original rect of the client,
105  * the event and the new coordinates (x, y).
106  *
107  */
108 void drag_pointer(xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event,
109                   xcb_window_t confine_to, border_t border, callback_t callback,
110                   void *extra);
111
112 #endif