#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <xcb/xcb.h>
#include <xcb/xcb_event.h>
#include "i3.h"
#include "config.h"
#include "data.h"
#include "util.h"
#include "xcb.h"
#include "debug.h"
#include "layout.h"
#include "client.h"
#include "floating.h"
#include "workspace.h"
#include "log.h"
Go to the source code of this file.
Data Structures | |
struct | resize_callback_params |
struct | resize_window_callback_params |
Functions | |
void | toggle_floating_mode (xcb_connection_t *conn, Client *client, bool automatic) |
Enters floating mode for the given client. | |
void | floating_assign_to_workspace (Client *client, Workspace *new_workspace) |
Removes the floating client from its workspace and attaches it to the new workspace. | |
DRAGGING_CB (resize_callback) | |
int | floating_border_click (xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event) |
Called whenever the user clicks on a border (not the titlebar!) of a floating window. | |
DRAGGING_CB (drag_window_callback) | |
void | floating_drag_window (xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event) |
Called when the user clicked on the titlebar of a floating window. | |
DRAGGING_CB (resize_window_callback) | |
void | floating_resize_window (xcb_connection_t *conn, Client *client, bool proportional, xcb_button_press_event_t *event) |
Called when the user clicked on a floating window while holding the floating_modifier and the right mouse button. | |
void | drag_pointer (xcb_connection_t *conn, Client *client, xcb_button_press_event_t *event, xcb_window_t confine_to, border_t border, callback_t callback, void *extra) |
This function grabs your pointer and lets you drag stuff around (borders). | |
void | floating_focus_direction (xcb_connection_t *conn, Client *currently_focused, direction_t direction) |
Changes focus in the given direction for floating clients. | |
void | floating_move (xcb_connection_t *conn, Client *currently_focused, direction_t direction) |
Moves the client 10px to the specified direction. | |
void | floating_toggle_hide (xcb_connection_t *conn, Workspace *workspace) |
Hides all floating clients (or show them if they are currently hidden) on the specified workspace. |
void drag_pointer | ( | xcb_connection_t * | conn, | |
Client * | client, | |||
xcb_button_press_event_t * | event, | |||
xcb_window_t | confine_to, | |||
border_t | border, | |||
callback_t | callback, | |||
void * | extra | |||
) |
This function grabs your pointer and lets you drag stuff around (borders).
Every time you move your mouse, an XCB_MOTION_NOTIFY event will be received and the given callback will be called with the parameters specified (client, border on which the click originally was), the original rect of the client, the event and the new coordinates (x, y).
Definition at line 380 of file floating.c.
References DLOG, evenths, FREE, handle_event(), Client::rect, and root.
Referenced by floating_border_click(), floating_drag_window(), floating_resize_window(), and resize_graphical_handler().
DRAGGING_CB | ( | resize_callback | ) |
Definition at line 177 of file floating.c.
References resize_callback_params::border, BORDER_BOTTOM, BORDER_LEFT, BORDER_RIGHT, BORDER_TOP, client_min_height(), client_min_width(), resize_callback_params::event, reposition_client(), and resize_client().
DRAGGING_CB | ( | drag_window_callback | ) |
Definition at line 261 of file floating.c.
References fake_absolute_configure_notify(), and reposition_client().
DRAGGING_CB | ( | resize_window_callback | ) |
Definition at line 298 of file floating.c.
References BORDER_LEFT, BORDER_TOP, client_min_height(), client_min_width(), resize_window_callback_params::corner, resize_window_callback_params::event, max(), resize_window_callback_params::proportional, and resize_client().
Removes the floating client from its workspace and attaches it to the new workspace.
This is centralized here because it may happen if you move it via keyboard and if you move it using your mouse.
Definition at line 149 of file floating.c.
References Client::fullscreen, Workspace::fullscreen_client, SLIST_INSERT_HEAD, SLIST_REMOVE, TAILQ_INSERT_TAIL, TAILQ_REMOVE, and Client::workspace.
Referenced by move_floating_window_to_workspace(), and reposition_client().
int floating_border_click | ( | xcb_connection_t * | conn, | |
Client * | client, | |||
xcb_button_press_event_t * | event | |||
) |
Called whenever the user clicks on a border (not the titlebar!) of a floating window.
Determines on which border the user clicked and launches the drag_pointer function with the resize_callback.
Definition at line 234 of file floating.c.
References resize_callback_params::border, DLOG, drag_pointer(), Rect::height, Client::rect, and Rect::width.
Referenced by handle_button_press().
void floating_drag_window | ( | xcb_connection_t * | conn, | |
Client * | client, | |||
xcb_button_press_event_t * | event | |||
) |
Called when the user clicked on the titlebar of a floating window.
Calls the drag_pointer function with the drag_window callback
Definition at line 279 of file floating.c.
References BORDER_TOP, DLOG, and drag_pointer().
Referenced by handle_button_press().
void floating_focus_direction | ( | xcb_connection_t * | conn, | |
Client * | currently_focused, | |||
direction_t | direction | |||
) |
Changes focus in the given direction for floating clients.
Changing to the left/right means going to the previous/next floating client, changing to top/bottom means cycling through the Z-index.
Definition at line 465 of file floating.c.
References D_LEFT, D_RIGHT, DLOG, Client::floating, set_focus(), TAILQ_END, TAILQ_NEXT, TAILQ_PREV, and Client::workspace.
Referenced by parse_command().
void floating_move | ( | xcb_connection_t * | conn, | |
Client * | currently_focused, | |||
direction_t | direction | |||
) |
Moves the client 10px to the specified direction.
Definition at line 487 of file floating.c.
References D_DOWN, D_LEFT, D_RIGHT, D_UP, DLOG, fake_absolute_configure_notify(), Client::fullscreen, Rect::height, Workspace::output, xoutput::rect, Client::rect, reposition_client(), Rect::width, Client::workspace, Rect::x, and Rect::y.
Referenced by parse_command().
void floating_resize_window | ( | xcb_connection_t * | conn, | |
Client * | client, | |||
bool | proportional, | |||
xcb_button_press_event_t * | event | |||
) |
Called when the user clicked on a floating window while holding the floating_modifier and the right mouse button.
Calls the drag_pointer function with the resize_window callback
Definition at line 350 of file floating.c.
References BORDER_TOP, resize_window_callback_params::corner, DLOG, drag_pointer(), Rect::height, Client::rect, and Rect::width.
Referenced by handle_button_press().
void floating_toggle_hide | ( | xcb_connection_t * | conn, | |
Workspace * | workspace | |||
) |
Hides all floating clients (or show them if they are currently hidden) on the specified workspace.
Definition at line 539 of file floating.c.
References client_is_floating(), client_map(), client_unmap(), DLOG, Workspace::floating_hidden, set_focus(), SLIST_FOREACH, and TAILQ_FOREACH.
Referenced by parse_command().
void toggle_floating_mode | ( | xcb_connection_t * | conn, | |
Client * | client, | |||
bool | automatic | |||
) |
Enters floating mode for the given client.
Correctly takes care of the position/size (separately stored for tiling/floating mode) and repositions/resizes/redecorates the client.
If the automatic flag is set to true, this was an automatic update by a change of the window class from the application which can be overwritten by the user.
Definition at line 41 of file floating.c.
References Client::child, Client::child_rect, CIRCLEQ_INSERT_AFTER, CIRCLEQ_INSERT_TAIL, client_is_floating(), client_remove_from_container(), client_set_below_floating(), config, Client::container, Container::currently_focused, DLOG, Client::dock, Client::floating, Client::floating_rect, Config::font, Client::frame, get_last_focused_client(), Font::height, Rect::height, load_font(), Client::rect, redecorate_window(), render_container(), reposition_client(), resize_client(), SLIST_FOREACH, Workspace::table, TAILQ_END, TAILQ_INSERT_TAIL, TAILQ_REMOVE, Rect::width, Client::workspace, Rect::x, xcb_raise_window(), and Rect::y.
Referenced by handle_transient_for(), and parse_command().