i3
Data Structures | Macros | Typedefs | Functions | Variables
handlers.c File Reference
#include "all.h"
#include <time.h>
#include <float.h>
#include <sys/time.h>
#include <xcb/randr.h>
#include <X11/XKBlib.h>
#include <libsn/sn-monitor.h>
Include dependency graph for handlers.c:

Go to the source code of this file.

Data Structures

struct  property_handler_t
 

Macros

#define I3__FILE__   "handlers.c"
 
#define SN_API_NOT_YET_FROZEN   1
 
#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. More...
 
static void check_crossing_screen_boundary (uint32_t x, uint32_t y)
 
static void handle_enter_notify (xcb_enter_notify_event_t *event)
 
static void handle_motion_notify (xcb_motion_notify_event_t *event)
 
static void handle_mapping_notify (xcb_mapping_notify_event_t *event)
 
static void handle_map_request (xcb_map_request_event_t *event)
 
static void handle_configure_request (xcb_configure_request_event_t *event)
 
static void handle_screen_change (xcb_generic_event_t *e)
 
static void handle_unmap_notify_event (xcb_unmap_notify_event_t *event)
 
static void 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 bool handle_windowrole_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 void handle_expose_event (xcb_expose_event_t *event)
 
static void 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 void handle_focus_in (xcb_focus_in_event_t *event)
 
void property_handlers_init (void)
 Sets the appropriate atoms for the property handlers after the atoms were received from X11. More...
 
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. More...
 

Variables

int randr_base = -1
 
static struct property_handler_t property_handlers []
 

Macro Definition Documentation

#define COPY_MASK_MEMBER (   mask_member,
  event_member 
)
Value:
do { \
if (event->value_mask & mask_member) { \
mask |= mask_member; \
values[c++] = event->event_member; \
} \
} while (0)

Referenced by handle_configure_request().

#define I3__FILE__   "handlers.c"

Definition at line 2 of file handlers.c.

#define NUM_HANDLERS   (sizeof(property_handlers) / sizeof(struct property_handler_t))

Definition at line 1013 of file handlers.c.

#define SN_API_NOT_YET_FROZEN   1

Definition at line 20 of file handlers.c.

Typedef Documentation

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 996 of file handlers.c.

Function Documentation

static void check_crossing_screen_boundary ( uint32_t  x,
uint32_t  y 
)
static
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 52 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 void handle_client_message ( xcb_client_message_event_t *  event)
static
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 925 of file handlers.c.

References con_by_window_id(), Con::window, window_update_leader(), and XCB_ATOM_WINDOW.

Here is the call graph for this function:

static void handle_configure_request ( xcb_configure_request_event_t *  event)
static
static void handle_destroy_notify_event ( xcb_destroy_notify_event_t *  event)
static

Definition at line 520 of file handlers.c.

References DLOG, and handle_unmap_notify_event().

Referenced by handle_event().

Here is the call graph for this function:

static void handle_enter_notify ( xcb_enter_notify_event_t *  event)
static
void handle_event ( int  type,
xcb_generic_event_t *  event 
)
static void handle_expose_event ( xcb_expose_event_t *  event)
static

Definition at line 602 of file handlers.c.

References con_by_frame_id(), DLOG, Con::frame, LOG, Con::pixmap, and Con::pm_gc.

Referenced by handle_event().

Here is the call graph for this function:

static void handle_focus_in ( xcb_focus_in_event_t *  event)
static

Definition at line 949 of file handlers.c.

References con_by_window_id(), con_focus(), con_get_workspace(), croot, DLOG, focused, focused_id, Con::name, Con::parent, Con::type, Con::window, workspace_show(), and x_push_changes().

Referenced by handle_event().

Here is the call graph for this function:

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 874 of file handlers.c.

References con_by_window_id(), con_set_urgency(), DLOG, tree_render(), Con::window, window_update_hints(), and xcb_icccm_get_wm_hints.

Here is the call graph for this function:

static void handle_map_request ( xcb_map_request_event_t *  event)
static

Definition at line 272 of file handlers.c.

References add_ignore_event(), conn, croot, DLOG, manage_window(), and x_push_changes().

Referenced by handle_event().

Here is the call graph for this function:

static void handle_mapping_notify ( xcb_mapping_notify_event_t *  event)
static

Definition at line 251 of file handlers.c.

References aio_get_mod_mask_for(), conn, DLOG, grab_all_keys(), keysyms, translate_keysyms(), ungrab_all_keys(), XCB_NUM_LOCK, and xcb_numlock_mask.

Referenced by handle_event().

Here is the call graph for this function:

static void handle_motion_notify ( xcb_motion_notify_event_t *  event)
static
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
static void handle_screen_change ( xcb_generic_event_t *  e)
static

Definition at line 423 of file handlers.c.

References conn, croot, DLOG, ELOG, Rect::height, ipc_send_event(), randr_query_outputs(), Con::rect, root, scratchpad_fix_resolution(), and Rect::width.

Referenced by handle_event().

Here is the call graph for this function:

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 899 of file handlers.c.

References con_by_window_id(), DLOG, Con::window, window_update_transient_for(), XCB_ATOM_WINDOW, and XCB_ATOM_WM_TRANSIENT_FOR.

Here is the call graph for this function:

static void handle_unmap_notify_event ( xcb_unmap_notify_event_t *  event)
static

Definition at line 453 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, LOG, tree_close(), tree_render(), and x_push_changes().

Referenced by handle_destroy_notify_event(), and handle_event().

Here is the call graph for this function:

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 535 of file handlers.c.

References con_by_window_id(), croot, Con::window, window_update_name(), and x_push_changes().

Here is the call graph for this function:

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 553 of file handlers.c.

References con_by_window_id(), croot, Con::window, window_update_name_legacy(), and x_push_changes().

Here is the call graph for this function:

static bool handle_windowrole_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 570 of file handlers.c.

References con_by_window_id(), Con::window, and window_update_role().

Here is the call graph for this function:

void property_handlers_init ( void  )

Sets the appropriate atoms for the property handlers after the atoms were received from X11.

Definition at line 1020 of file handlers.c.

References property_handler_t::atom, conn_screen, sndisplay, startup_monitor_event(), XCB_ATOM_WM_HINTS, XCB_ATOM_WM_NAME, XCB_ATOM_WM_NORMAL_HINTS, and XCB_ATOM_WM_TRANSIENT_FOR.

Referenced by main().

Here is the call graph for this function:

static void property_notify ( uint8_t  state,
xcb_window_t  window,
xcb_atom_t  atom 
)
static

Definition at line 1033 of file handlers.c.

References property_handler_t::cb, FREE, property_handler_t::long_len, and property_handlers.

Referenced by handle_event().

static SLIST_HEAD ( ignore_head  ,
Ignore_Event   
)
static

Definition at line 28 of file handlers.c.

References Ignore_Event::response_type, Ignore_Event::sequence, SLIST_INSERT_HEAD, and smalloc().

Here is the call graph for this function:

Variable Documentation

struct property_handler_t property_handlers[]
static
Initial value:
= {
{ 0, UINT_MAX, handle_hints },
{ 0, UINT_MAX, handle_normal_hints },
{ 0, UINT_MAX, handle_clientleader_change },
{ 0, UINT_MAX, handle_transient_for },
}

Definition at line 1004 of file handlers.c.

Referenced by property_notify().

int randr_base = -1

Definition at line 23 of file handlers.c.

Referenced by handle_event(), and main().