i3
include/xcb.h
Go to the documentation of this file.
00001 /*
00002  * vim:ts=4:sw=4:expandtab
00003  *
00004  * i3 - an improved dynamic tiling window manager
00005  *
00006  * © 2009-2011 Michael Stapelberg and contributors
00007  *
00008  * See file LICENSE for license information.
00009  *
00010  */
00011 #ifndef _XCB_H
00012 #define _XCB_H
00013 
00014 #include "data.h"
00015 #include "xcursor.h"
00016 
00017 #define _NET_WM_STATE_REMOVE    0
00018 #define _NET_WM_STATE_ADD       1
00019 #define _NET_WM_STATE_TOGGLE    2
00020 
00023 #define XCB_CURSOR_LEFT_PTR     68
00024 #define XCB_CURSOR_SB_H_DOUBLE_ARROW 108
00025 #define XCB_CURSOR_SB_V_DOUBLE_ARROW 116
00026 
00027 /* from X11/keysymdef.h */
00028 #define XCB_NUM_LOCK                    0xff7f
00029 
00030 /* The event masks are defined here because we don’t only set them once but we
00031    need to set slight variations of them (without XCB_EVENT_MASK_ENTER_WINDOW
00032    while rendering the layout) */
00034 #define CHILD_EVENT_MASK (XCB_EVENT_MASK_PROPERTY_CHANGE | \
00035                           XCB_EVENT_MASK_STRUCTURE_NOTIFY | \
00036                           XCB_EVENT_MASK_FOCUS_CHANGE)
00037 
00039 #define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS |          /* …mouse is pressed/released */ \
00040                           XCB_EVENT_MASK_BUTTON_RELEASE | \
00041                           XCB_EVENT_MASK_POINTER_MOTION |        /* …mouse is moved */ \
00042                           XCB_EVENT_MASK_EXPOSURE |              /* …our window needs to be redrawn */ \
00043                           XCB_EVENT_MASK_STRUCTURE_NOTIFY |      /* …the frame gets destroyed */ \
00044                           XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …the application tries to resize itself */ \
00045                           XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |   /* …subwindows get notifies */ \
00046                           XCB_EVENT_MASK_ENTER_WINDOW)           /* …user moves cursor inside our window */
00047 
00048 #define xmacro(atom) xcb_atom_t A_ ## atom;
00049 #include "atoms.xmacro"
00050 #undef xmacro
00051 
00052 extern unsigned int xcb_numlock_mask;
00053 
00060 i3Font load_font(const char *pattern, bool fallback);
00061 
00071 uint32_t get_colorpixel(char *hex);
00072 
00078 xcb_window_t create_window(xcb_connection_t *conn, Rect r, uint16_t window_class,
00079         enum xcursor_cursor_t cursor, bool map, uint32_t mask, uint32_t *values);
00080 
00086 void xcb_change_gc_single(xcb_connection_t *conn, xcb_gcontext_t gc,
00087                           uint32_t mask, uint32_t value);
00088 
00093 void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable,
00094                    xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x,
00095                    uint32_t y, uint32_t to_x, uint32_t to_y);
00096 
00101 void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable,
00102                    xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x,
00103                    uint32_t y, uint32_t width, uint32_t height);
00104 
00111 void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window);
00112 
00118 void fake_absolute_configure_notify(Con *con);
00119 
00124 void send_take_focus(xcb_window_t window);
00125 
00131 void xcb_get_numlock_mask(xcb_connection_t *conn);
00132 
00137 void xcb_raise_window(xcb_connection_t *conn, xcb_window_t window);
00138 
00144 int predict_text_width(char *text, int length);
00145 
00150 void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r);
00151 
00152 
00153 bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom);
00154 
00155 #endif