i3
|
#include <time.h>
#include <limits.h>
#include <xcb/randr.h>
#include <X11/XKBlib.h>
#include "all.h"
Go to the source code of this file.
Data Structures | |
struct | property_handler_t |
Defines | |
#define | COPY_MASK_MEMBER(mask_member, event_member) |
#define | NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t)) |
Typedefs | |
typedef bool(* | cb_property_handler_t )(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *property) |
Functions | |
static | SLIST_HEAD (ignore_head, Ignore_Event) |
bool | event_is_ignored (const int sequence, const int response_type) |
Checks if the given sequence is ignored and returns true if so. | |
static int | handle_key_press (xcb_key_press_event_t *event) |
static void | check_crossing_screen_boundary (uint32_t x, uint32_t y) |
static int | handle_enter_notify (xcb_enter_notify_event_t *event) |
static int | handle_motion_notify (xcb_motion_notify_event_t *event) |
static int | handle_mapping_notify (xcb_mapping_notify_event_t *event) |
static int | handle_map_request (xcb_map_request_event_t *event) |
static int | handle_configure_request (xcb_configure_request_event_t *event) |
static int | handle_screen_change (xcb_generic_event_t *e) |
static int | handle_unmap_notify_event (xcb_unmap_notify_event_t *event) |
static int | handle_destroy_notify_event (xcb_destroy_notify_event_t *event) |
static bool | handle_windowname_change (void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) |
static bool | handle_windowname_change_legacy (void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) |
static int | handle_expose_event (xcb_expose_event_t *event) |
static int | handle_client_message (xcb_client_message_event_t *event) |
static bool | handle_normal_hints (void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window, xcb_atom_t name, xcb_get_property_reply_t *reply) |
static bool | handle_hints (void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window, xcb_atom_t name, xcb_get_property_reply_t *reply) |
static bool | handle_transient_for (void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window, xcb_atom_t name, xcb_get_property_reply_t *prop) |
static bool | handle_clientleader_change (void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window, xcb_atom_t name, xcb_get_property_reply_t *prop) |
static int | handle_focus_in (xcb_focus_in_event_t *event) |
void | property_handlers_init () |
Sets the appropriate atoms for the property handlers after the atoms were received from X11. | |
static void | property_notify (uint8_t state, xcb_window_t window, xcb_atom_t atom) |
void | handle_event (int type, xcb_generic_event_t *event) |
Takes an xcb_generic_event_t and calls the appropriate handler, based on the event type. | |
Variables | |
int | randr_base = -1 |
static struct property_handler_t | property_handlers [] |
#define COPY_MASK_MEMBER | ( | mask_member, | |
event_member | |||
) |
do { \ if (event->value_mask & mask_member) { \ mask |= mask_member; \ values[c++] = event->event_member; \ } \ } while (0)
Referenced by handle_configure_request().
#define NUM_HANDLERS (sizeof(property_handlers) / sizeof(struct property_handler_t)) |
Definition at line 955 of file handlers.c.
typedef bool(* cb_property_handler_t)(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *property) |
Definition at line 939 of file handlers.c.
static void check_crossing_screen_boundary | ( | uint32_t | x, |
uint32_t | y | ||
) | [static] |
Definition at line 126 of file handlers.c.
References xoutput::con, con_descend_focused(), con_focus(), config, Config::disable_focus_follows_mouse, ELOG, focused, get_output_containing(), output_get_content(), and tree_render().
Referenced by handle_enter_notify(), and handle_motion_notify().
bool event_is_ignored | ( | const int | sequence, |
const int | response_type | ||
) |
Checks if the given sequence is ignored and returns true if so.
Definition at line 46 of file handlers.c.
References Ignore_Event::added, Ignore_Event::response_type, Ignore_Event::sequence, SLIST_END, SLIST_FIRST, SLIST_FOREACH, SLIST_NEXT, and SLIST_REMOVE.
Referenced by handle_enter_notify(), and xcb_check_cb().
static int handle_client_message | ( | xcb_client_message_event_t * | event | ) | [static] |
Definition at line 624 of file handlers.c.
References _NET_WM_STATE_ADD, _NET_WM_STATE_REMOVE, _NET_WM_STATE_TOGGLE, con_by_window_id(), con_toggle_fullscreen(), croot, DLOG, ELOG, Con::fullscreen_mode, LOG, tree_render(), and x_push_changes().
Referenced by handle_event().
static bool handle_clientleader_change | ( | void * | data, |
xcb_connection_t * | conn, | ||
uint8_t | state, | ||
xcb_window_t | window, | ||
xcb_atom_t | name, | ||
xcb_get_property_reply_t * | prop | ||
) | [static] |
Definition at line 882 of file handlers.c.
References con_by_window_id(), Con::window, and window_update_leader().
static int handle_configure_request | ( | xcb_configure_request_event_t * | event | ) | [static] |
Definition at line 310 of file handlers.c.
References Con::border_style, BS_NORMAL, con_border_style_rect(), con_by_window_id(), con_is_floating(), con_is_leaf(), config, conn, COPY_MASK_MEMBER, DLOG, fake_absolute_configure_notify(), fake_configure_notify(), Config::font, Rect::height, Font::height, height, Con::parent, Con::rect, tree_render(), Rect::width, width, Rect::x, x, Rect::y, and y.
Referenced by handle_event().
static int handle_destroy_notify_event | ( | xcb_destroy_notify_event_t * | event | ) | [static] |
Definition at line 531 of file handlers.c.
References DLOG, and handle_unmap_notify_event().
Referenced by handle_event().
static int handle_enter_notify | ( | xcb_enter_notify_event_t * | event | ) | [static] |
Definition at line 156 of file handlers.c.
References check_crossing_screen_boundary(), con_by_frame_id(), con_by_window_id(), con_descend_focused(), con_focus(), config, Con::deco_rect, Config::disable_focus_follows_mouse, DLOG, event_is_ignored(), Con::layout, LOG, Con::name, Con::parent, rect_contains(), TAILQ_FOREACH, tree_render(), and Con::type.
Referenced by handle_event().
void handle_event | ( | int | type, |
xcb_generic_event_t * | event | ||
) |
Takes an xcb_generic_event_t and calls the appropriate handler, based on the event type.
Definition at line 1003 of file handlers.c.
References DLOG, handle_button_press(), handle_client_message(), handle_configure_request(), handle_destroy_notify_event(), handle_enter_notify(), handle_expose_event(), handle_focus_in(), handle_key_press(), handle_map_request(), handle_mapping_notify(), handle_motion_notify(), handle_screen_change(), handle_unmap_notify_event(), property_notify(), and randr_base.
Referenced by drag_pointer(), and xcb_check_cb().
static int handle_expose_event | ( | xcb_expose_event_t * | event | ) | [static] |
Definition at line 598 of file handlers.c.
References con_by_frame_id(), DLOG, LOG, and x_deco_recurse().
Referenced by handle_event().
static int handle_focus_in | ( | xcb_focus_in_event_t * | event | ) | [static] |
Definition at line 906 of file handlers.c.
References con_by_window_id(), con_focus(), croot, DLOG, focused_id, Con::name, Con::window, and x_push_changes().
Referenced by handle_event().
static bool handle_hints | ( | void * | data, |
xcb_connection_t * | conn, | ||
uint8_t | state, | ||
xcb_window_t | window, | ||
xcb_atom_t | name, | ||
xcb_get_property_reply_t * | reply | ||
) | [static] |
Definition at line 790 of file handlers.c.
References con_by_window_id(), con_get_workspace(), DLOG, focused, FREE, Window::id, LOG, tree_render(), Con::urgent, Con::window, workspace_is_visible(), workspace_update_urgent_flag(), xcb_icccm_get_wm_hints_from_reply, xcb_icccm_get_wm_hints_reply, xcb_icccm_get_wm_hints_unchecked, xcb_icccm_wm_hints_get_urgency, and xcb_icccm_wm_hints_t.
static int handle_key_press | ( | xcb_key_press_event_t * | event | ) | [static] |
Definition at line 83 of file handlers.c.
References BIND_MODE_SWITCH, Binding::command, DLOG, ELOG, get_binding(), parse_cmd(), xcb_numlock_mask, and xkb_current_group.
Referenced by handle_event().
static int handle_map_request | ( | xcb_map_request_event_t * | event | ) | [static] |
Definition at line 291 of file handlers.c.
References add_ignore_event(), conn, croot, DLOG, manage_window(), and x_push_changes().
Referenced by handle_event().
static int handle_mapping_notify | ( | xcb_mapping_notify_event_t * | event | ) | [static] |
Definition at line 270 of file handlers.c.
References conn, DLOG, grab_all_keys(), keysyms, translate_keysyms(), ungrab_all_keys(), and xcb_get_numlock_mask().
Referenced by handle_event().
static int handle_motion_notify | ( | xcb_motion_notify_event_t * | event | ) | [static] |
Definition at line 229 of file handlers.c.
References check_crossing_screen_boundary(), con_by_frame_id(), con_focus(), config, croot, Con::deco_rect, Config::disable_focus_follows_mouse, Con::layout, rect_contains(), TAILQ_FIRST, TAILQ_FOREACH, and x_push_changes().
Referenced by handle_event().
static bool handle_normal_hints | ( | void * | data, |
xcb_connection_t * | conn, | ||
uint8_t | state, | ||
xcb_window_t | window, | ||
xcb_atom_t | name, | ||
xcb_get_property_reply_t * | reply | ||
) | [static] |
Definition at line 678 of file handlers.c.
References Con::base_height, Con::base_width, con_by_window_id(), DLOG, FREE, Rect::height, height, Con::height_increment, Window::id, Con::proportional_height, Con::proportional_width, Con::rect, tree_render(), Rect::width, width, Con::width_increment, Con::window, xcb_icccm_get_wm_normal_hints_reply, xcb_icccm_get_wm_normal_hints_unchecked, xcb_icccm_get_wm_size_hints_from_reply, XCB_ICCCM_SIZE_HINT_BASE_SIZE, XCB_ICCCM_SIZE_HINT_P_ASPECT, XCB_ICCCM_SIZE_HINT_P_MIN_SIZE, and XCB_ICCCM_SIZE_HINT_P_RESIZE_INC.
static int handle_screen_change | ( | xcb_generic_event_t * | e | ) | [static] |
Definition at line 434 of file handlers.c.
References DLOG, ipc_send_event(), and randr_query_outputs().
Referenced by handle_event().
static bool handle_transient_for | ( | void * | data, |
xcb_connection_t * | conn, | ||
uint8_t | state, | ||
xcb_window_t | window, | ||
xcb_atom_t | name, | ||
xcb_get_property_reply_t * | prop | ||
) | [static] |
Definition at line 848 of file handlers.c.
References con_by_window_id(), DLOG, toggle_floating_mode(), Con::window, and window_update_transient_for().
static int handle_unmap_notify_event | ( | xcb_unmap_notify_event_t * | event | ) | [static] |
Definition at line 449 of file handlers.c.
References add_ignore_event(), con_by_frame_id(), con_by_window_id(), conn, croot, DLOG, DONT_KILL_WINDOW, Con::ignore_unmap, ipc_send_event(), LOG, SLIST_EMPTY, SLIST_FIRST, to_focus, tree_close(), tree_render(), workspace_is_visible(), workspace_update_urgent_flag(), and x_push_changes().
Referenced by handle_destroy_notify_event(), and handle_event().
static bool handle_windowname_change | ( | void * | data, |
xcb_connection_t * | conn, | ||
uint8_t | state, | ||
xcb_window_t | window, | ||
xcb_atom_t | atom, | ||
xcb_get_property_reply_t * | prop | ||
) | [static] |
Definition at line 546 of file handlers.c.
References con_by_window_id(), croot, Con::window, window_update_name(), and x_push_changes().
static bool handle_windowname_change_legacy | ( | void * | data, |
xcb_connection_t * | conn, | ||
uint8_t | state, | ||
xcb_window_t | window, | ||
xcb_atom_t | atom, | ||
xcb_get_property_reply_t * | prop | ||
) | [static] |
Definition at line 564 of file handlers.c.
References con_by_window_id(), croot, Con::window, window_update_name_legacy(), and x_push_changes().
void property_handlers_init | ( | ) |
Sets the appropriate atoms for the property handlers after the atoms were received from X11.
Definition at line 962 of file handlers.c.
References property_handler_t::atom.
Referenced by main().
static void property_notify | ( | uint8_t | state, |
xcb_window_t | window, | ||
xcb_atom_t | atom | ||
) | [static] |
Definition at line 971 of file handlers.c.
References property_handler_t::cb, DLOG, FREE, property_handler_t::long_len, and property_handlers.
Referenced by handle_event().
static SLIST_HEAD | ( | ignore_head | , |
Ignore_Event | |||
) | [static] |
Definition at line 22 of file handlers.c.
References Ignore_Event::response_type, Ignore_Event::sequence, SLIST_INSERT_HEAD, and smalloc().
struct property_handler_t property_handlers[] [static] |
{ { 0, 128, handle_windowname_change }, { 0, UINT_MAX, handle_hints }, { 0, 128, handle_windowname_change_legacy }, { 0, UINT_MAX, handle_normal_hints }, { 0, UINT_MAX, handle_clientleader_change }, { 0, UINT_MAX, handle_transient_for } }
Definition at line 947 of file handlers.c.
Referenced by property_notify().
int randr_base = -1 |
Definition at line 17 of file handlers.c.
Referenced by handle_event(), and main().