i3

include/xcb.h

Go to the documentation of this file.
00001 /*
00002  * vim:ts=8:expandtab
00003  *
00004  * i3 - an improved dynamic tiling window manager
00005  *
00006  * (c) 2009 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 
00016 #define _NET_WM_STATE_REMOVE    0
00017 #define _NET_WM_STATE_ADD       1
00018 #define _NET_WM_STATE_TOGGLE    2
00019 
00022 #define XCB_CURSOR_LEFT_PTR     68
00023 #define XCB_CURSOR_SB_H_DOUBLE_ARROW 108
00024 #define XCB_CURSOR_SB_V_DOUBLE_ARROW 116
00025 
00026 /* from X11/keysymdef.h */
00027 #define XCB_NUM_LOCK                    0xff7f
00028 
00029 /* The event masks are defined here because we don’t only set them once but we
00030    need to set slight variations of them (without XCB_EVENT_MASK_ENTER_WINDOW
00031    while rendering the layout) */
00033 #define CHILD_EVENT_MASK (XCB_EVENT_MASK_PROPERTY_CHANGE | \
00034                           XCB_EVENT_MASK_STRUCTURE_NOTIFY | \
00035                           XCB_EVENT_MASK_ENTER_WINDOW)
00036 
00038 #define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS |          /* …mouse is pressed/released */ \
00039                           XCB_EVENT_MASK_BUTTON_RELEASE | \
00040                           XCB_EVENT_MASK_EXPOSURE |              /* …our window needs to be redrawn */ \
00041                           XCB_EVENT_MASK_STRUCTURE_NOTIFY |      /* …the frame gets destroyed */ \
00042                           XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …the application tries to resize itself */ \
00043                           XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |   /* …subwindows get notifies */ \
00044                           XCB_EVENT_MASK_ENTER_WINDOW)           /* …user moves cursor inside our window */
00045 
00046 
00047 enum { _NET_SUPPORTED = 0,
00048         _NET_SUPPORTING_WM_CHECK,
00049         _NET_WM_NAME,
00050         _NET_WM_STATE_FULLSCREEN,
00051         _NET_WM_STATE,
00052         _NET_WM_WINDOW_TYPE,
00053         _NET_WM_WINDOW_TYPE_DOCK,
00054         _NET_WM_WINDOW_TYPE_DIALOG,
00055         _NET_WM_WINDOW_TYPE_UTILITY,
00056         _NET_WM_WINDOW_TYPE_TOOLBAR,
00057         _NET_WM_WINDOW_TYPE_SPLASH,
00058         _NET_WM_DESKTOP,
00059         _NET_WM_STRUT_PARTIAL,
00060         WM_PROTOCOLS,
00061         WM_DELETE_WINDOW,
00062         UTF8_STRING,
00063         WM_STATE,
00064         WM_CLIENT_LEADER,
00065         _NET_CURRENT_DESKTOP,
00066         _NET_ACTIVE_WINDOW,
00067         _NET_WORKAREA
00068 };
00069 
00070 extern unsigned int xcb_numlock_mask;
00071 
00077 i3Font *load_font(xcb_connection_t *conn, const char *pattern);
00078 
00088 uint32_t get_colorpixel(xcb_connection_t *conn, char *hex);
00089 
00095 xcb_window_t create_window(xcb_connection_t *conn, Rect r, uint16_t window_class,
00096                            int cursor, bool map, uint32_t mask, uint32_t *values);
00097 
00103 void xcb_change_gc_single(xcb_connection_t *conn, xcb_gcontext_t gc,
00104                           uint32_t mask, uint32_t value);
00105 
00110 void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable,
00111                    xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x,
00112                    uint32_t y, uint32_t to_x, uint32_t to_y);
00113 
00118 void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable,
00119                    xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x,
00120                    uint32_t y, uint32_t width, uint32_t height);
00121 
00128 void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window);
00129 
00135 void fake_absolute_configure_notify(xcb_connection_t *conn, Client *client);
00136 
00142 void xcb_get_numlock_mask(xcb_connection_t *conn);
00143 
00148 void xcb_raise_window(xcb_connection_t *conn, xcb_window_t window);
00149 
00157 void cached_pixmap_prepare(xcb_connection_t *conn, struct Cached_Pixmap *pixmap);
00158 
00164 int predict_text_width(xcb_connection_t *conn, const char *font_pattern, char *text,
00165                        int length);
00166 
00171 void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r);
00172 
00173 #endif