]> git.sur5r.net Git - i3/i3/blob - include/floating.h
Merge branch 'next'
[i3/i3] / include / floating.h
1 /*
2  * vim:ts=8:expandtab
3  *
4  * i3 - an improved dynamic tiling window manager
5  *
6  * © 2009 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)(Rect*, uint32_t, uint32_t);
16
17 /** On which border was the dragging initiated? */
18 typedef enum { BORDER_LEFT, BORDER_RIGHT, BORDER_TOP, BORDER_BOTTOM} border_t;
19
20 /**
21  * Enters floating mode for the given client.  Correctly takes care of the
22  * position/size (separately stored for tiling/floating mode) and
23  * repositions/resizes/redecorates the client.
24  *
25  * If the automatic flag is set to true, this was an automatic update by a
26  * change of the window class from the application which can be overwritten by
27  * the user.
28  *
29  */
30 void toggle_floating_mode(xcb_connection_t *conn, Client *client,
31                           bool automatic);
32
33 /**
34  * Removes the floating client from its workspace and attaches it to the new
35  * workspace. This is centralized here because it may happen if you move it
36  * via keyboard and if you move it using your mouse.
37  *
38  */
39 void floating_assign_to_workspace(Client *client, Workspace *new_workspace);
40
41 /**
42  * Called whenever the user clicks on a border (not the titlebar!) of a
43  * floating window. Determines on which border the user clicked and launches
44  * the drag_pointer function with the resize_callback.
45  *
46  */
47 int floating_border_click(xcb_connection_t *conn, Client *client,
48                           xcb_button_press_event_t *event);
49
50 /**
51  * Called when the user clicked on the titlebar of a floating window.
52  * Calls the drag_pointer function with the drag_window callback
53  *
54  */
55 void floating_drag_window(xcb_connection_t *conn, Client *client,
56                           xcb_button_press_event_t *event);
57
58 /**
59  * Changes focus in the given direction for floating clients.
60  *
61  * Changing to the left/right means going to the previous/next floating client,
62  * changing to top/bottom means cycling through the Z-index.
63  *
64  */
65 void floating_focus_direction(xcb_connection_t *conn, Client *currently_focused,
66                               direction_t direction);
67
68 /**
69  * Moves the client 10px to the specified direction.
70  *
71  */
72 void floating_move(xcb_connection_t *conn, Client *currently_focused,
73                    direction_t direction);
74
75 /**
76  * Hides all floating clients (or show them if they are currently hidden) on
77  * the specified workspace.
78  *
79  */
80 void floating_toggle_hide(xcb_connection_t *conn, Workspace *workspace);
81
82 /**
83  * This function grabs your pointer and lets you drag stuff around (borders).
84  * Every time you move your mouse, an XCB_MOTION_NOTIFY event will be received
85  * and the given callback will be called with the parameters specified (client,
86  * border on which the click originally was), the original rect of the client,
87  * the event and the new coordinates (x, y).
88  *
89  */
90 void drag_pointer(xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event,
91                   xcb_window_t confine_to, border_t border, callback_t callback);
92
93 #endif