src/server.h (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
/************************************************************************** * server : * - * * Check COPYING file for Copyright * **************************************************************************/ #ifndef SERVER_H #define SERVER_H #include <X11/Xlib.h> #include <X11/Xatom.h> #include <X11/extensions/Xinerama.h> #ifdef HAVE_SN #include <libsn/sn.h> #endif #include <glib.h> extern gboolean primary_monitor_first; typedef struct Global_atom { Atom _XROOTPMAP_ID; Atom _XROOTMAP_ID; Atom _NET_CURRENT_DESKTOP; Atom _NET_NUMBER_OF_DESKTOPS; Atom _NET_DESKTOP_NAMES; Atom _NET_DESKTOP_GEOMETRY; Atom _NET_DESKTOP_VIEWPORT; Atom _NET_WORKAREA; Atom _NET_ACTIVE_WINDOW; Atom _NET_WM_WINDOW_TYPE; Atom _NET_WM_STATE_SKIP_PAGER; Atom _NET_WM_STATE_SKIP_TASKBAR; Atom _NET_WM_STATE_STICKY; Atom _NET_WM_STATE_DEMANDS_ATTENTION; Atom _NET_WM_WINDOW_TYPE_DOCK; Atom _NET_WM_WINDOW_TYPE_DESKTOP; Atom _NET_WM_WINDOW_TYPE_TOOLBAR; Atom _NET_WM_WINDOW_TYPE_MENU; Atom _NET_WM_WINDOW_TYPE_SPLASH; Atom _NET_WM_WINDOW_TYPE_DIALOG; Atom _NET_WM_WINDOW_TYPE_NORMAL; Atom _NET_WM_DESKTOP; Atom WM_STATE; Atom _NET_WM_STATE; Atom _NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_SHADED; Atom _NET_WM_STATE_HIDDEN; Atom _NET_WM_STATE_BELOW; Atom _NET_WM_STATE_ABOVE; Atom _NET_WM_STATE_MODAL; Atom _NET_CLIENT_LIST; Atom _NET_WM_NAME; Atom _NET_WM_VISIBLE_NAME; Atom _NET_WM_STRUT; Atom _NET_WM_ICON; Atom _NET_WM_ICON_GEOMETRY; Atom _NET_WM_ICON_NAME; Atom _NET_CLOSE_WINDOW; Atom UTF8_STRING; Atom _NET_SUPPORTING_WM_CHECK; Atom _NET_WM_CM_S0; Atom _NET_WM_STRUT_PARTIAL; Atom WM_NAME; Atom __SWM_VROOT; Atom _MOTIF_WM_HINTS; Atom WM_HINTS; Atom _NET_SYSTEM_TRAY_SCREEN; Atom _NET_SYSTEM_TRAY_OPCODE; Atom MANAGER; Atom _NET_SYSTEM_TRAY_MESSAGE_DATA; Atom _NET_SYSTEM_TRAY_ORIENTATION; Atom _NET_SYSTEM_TRAY_ICON_SIZE; Atom _NET_SYSTEM_TRAY_PADDING; Atom _XEMBED; Atom _XEMBED_INFO; Atom _NET_WM_PID; Atom _XSETTINGS_SCREEN; Atom _XSETTINGS_SETTINGS; Atom XdndAware; Atom XdndEnter; Atom XdndPosition; Atom XdndStatus; Atom XdndDrop; Atom XdndLeave; Atom XdndSelection; Atom XdndTypeList; Atom XdndActionCopy; Atom XdndFinished; Atom TARGETS; } Global_atom; typedef struct Property { unsigned char *data; int format, nitems; Atom type; } Property; // Returns the name of an Atom as string. Do not free the string. const char *GetAtomName(Display *disp, Atom a); // This function takes a list of targets which can be converted to (atom_list, nitems) // and a list of acceptable targets with prioritees (datatypes). It returns the highest // entry in datatypes which is also in atom_list: ie it finds the best match. Atom pick_target_from_list(Display *disp, Atom *atom_list, int nitems); // Finds the best target given up to three atoms provided (any can be None). // Useful for part of the Xdnd protocol. Atom pick_target_from_atoms(Display *disp, Atom t1, Atom t2, Atom t3); // Finds the best target given a local copy of a property. Atom pick_target_from_targets(Display *disp, Property p); // This fetches all the data from a property struct Property read_property(Display *disp, Window w, Atom property); typedef struct Monitor { int x; int y; int width; int height; gboolean primary; gchar **names; } Monitor; typedef struct Viewport { int x; int y; int width; int height; } Viewport; typedef struct Server { Display *display; int x11_fd; Window root_win; Window composite_manager; gboolean real_transparency; gboolean disable_transparency; // current desktop int desktop; int screen; int depth; int num_desktops; // number of monitor (without monitor included into another one) int num_monitors; // Non-null only if WM uses viewports (compiz) and number of viewports > 1. // In that case there are num_desktops viewports. Viewport *viewports; Monitor *monitors; gboolean got_root_win; Visual *visual; Visual *visual32; // root background Pixmap root_pmap; GC gc; Colormap colormap; Colormap colormap32; Global_atom atom; int xdamage_event_type; int xdamage_event_error_type; #ifdef HAVE_SN SnDisplay *sn_display; GTree *pids; #endif // HAVE_SN } Server; extern Server server; // freed memory void cleanup_server(); void send_event32(Window win, Atom at, long data1, long data2, long data3); int get_property32(Window win, Atom at, Atom type); void *server_get_property(Window win, Atom at, Atom type, int *num_results); Atom server_get_atom(char *atom_name); void server_catch_error(Display *d, XErrorEvent *ev); void server_init_atoms(); void server_init_visual(); void server_init_xdamage(); void x11_io_error(Display *display); void handle_crash(const char *reason); // detect root background void get_root_pixmap(); // detect monitors and desktops void get_monitors(); void sort_monitors(); void print_monitors(); void get_desktops(); void server_get_number_of_desktops(); GSList *get_desktop_names(); int get_current_desktop(); void change_desktop(int desktop); // Forward mouse click to the desktop window void forward_click(XEvent *e); #ifdef HAVE_SN void error_trap_push(SnDisplay *display, Display *xdisplay); void error_trap_pop(SnDisplay *display, Display *xdisplay); #endif #endif |