i3
|
00001 /* 00002 * vim:ts=4:sw=4:expandtab 00003 * 00004 * i3 - an improved dynamic tiling window manager 00005 * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) 00006 * 00007 * xcb.c: Helper functions for easier usage of XCB 00008 * 00009 */ 00010 #ifndef _XCB_H 00011 #define _XCB_H 00012 00013 #include "data.h" 00014 #include "xcursor.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 #define XCB_CURSOR_WATCH 150 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 00059 xcb_window_t create_window(xcb_connection_t *conn, Rect r, uint16_t window_class, 00060 enum xcursor_cursor_t cursor, bool map, uint32_t mask, uint32_t *values); 00061 00066 void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable, 00067 xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x, 00068 uint32_t y, uint32_t to_x, uint32_t to_y); 00069 00074 void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, 00075 xcb_gcontext_t gc, uint32_t colorpixel, uint32_t x, 00076 uint32_t y, uint32_t width, uint32_t height); 00077 00083 void fake_absolute_configure_notify(Con *con); 00084 00089 void send_take_focus(xcb_window_t window); 00090 00095 void xcb_raise_window(xcb_connection_t *conn, xcb_window_t window); 00096 00102 int predict_text_width(char *text, int length); 00103 00108 void xcb_set_window_rect(xcb_connection_t *conn, xcb_window_t window, Rect r); 00109 00110 00111 bool xcb_reply_contains_atom(xcb_get_property_reply_t *prop, xcb_atom_t atom); 00112 00117 void xcb_warp_pointer_rect(xcb_connection_t *conn, Rect *rect); 00118 00125 void xcb_set_root_cursor(int cursor); 00126 00127 #endif