3 #define HASHMASK (NHASH-1)
5 typedef struct Kbdbuf Kbdbuf;
6 typedef struct Mousebuf Mousebuf;
7 typedef struct Tagbuf Tagbuf;
9 typedef struct Client Client;
10 typedef struct DImage DImage;
11 typedef struct DScreen DScreen;
12 typedef struct CScreen CScreen;
13 typedef struct FChar FChar;
14 typedef struct Refresh Refresh;
15 typedef struct Refx Refx;
16 typedef struct DName DName;
50 // wfdlk protects writes to wfd, which can be issued from either
51 // the RPC thread or the graphics thread.
59 // drawlk protects the draw data structures.
60 // It can be acquired by an RPC thread or a graphics thread
61 // but must not be held on one thread while waiting for the other.
64 DImage* dimage[NHASH];
80 Memimage *screenimage;
86 // Only accessed/modified by the graphics thread.
89 // eventlk protects the keyboard and mouse events.
121 int minx; /* left edge of bits */
122 int maxx; /* right edge of bits */
123 uchar miny; /* first non-zero scan-line */
124 uchar maxy; /* last non-zero scan-line + 1 */
125 schar left; /* offset of baseline */
126 uchar width; /* width of baseline */
130 * Reference counts in DImages:
131 * one per open by original client
132 * one per screen image or fill
133 * one per image derived from this one by name
145 DScreen* dscreen; /* 0 if not a window */
146 DImage* fromname; /* image this one is derived from, by name */
168 // For the most part, the graphics driver-specific code in files
169 // like mac-screen.m runs in the graphics library's main thread,
170 // while the RPC service code in srv.c runs on the RPC service thread.
171 // The exceptions in each file, which are called by the other,
172 // are marked with special prefixes: gfx_* indicates code that
173 // is in srv.c but nonetheless runs on the main graphics thread,
174 // while rpc_* indicates code that is in, say, mac-screen.m but
175 // nonetheless runs on the RPC service thread.
177 // The gfx_* and rpc_* calls typically synchronize with the other
178 // code in the file by acquiring a lock (or running a callback on the
179 // target thread, which amounts to the same thing).
180 // To avoid deadlock, callers of those routines must not hold any locks.
182 // gfx_* routines are called on the graphics thread,
183 // invoked from graphics driver callbacks to do RPC work.
184 // No locks are held on entry.
185 void gfx_abortcompose(Client*);
186 void gfx_keystroke(Client*, int);
188 void gfx_mousetrack(Client*, int, int, int, uint);
189 void gfx_replacescreenimage(Client*, Memimage*);
190 void gfx_mouseresized(Client*);
191 void gfx_started(void);
193 // rpc_* routines are called on the RPC thread,
194 // invoked by the RPC server code to do graphics work.
195 // No locks are held on entry.
196 Memimage *rpc_attach(Client*, char*, char*);
197 char* rpc_getsnarf(void);
198 void rpc_putsnarf(char*);
199 void rpc_resizeimg(Client*);
200 void rpc_resizewindow(Client*, Rectangle);
201 void rpc_serve(Client*);
202 void rpc_setcursor(Client*, Cursor*, Cursor2*);
203 void rpc_setlabel(Client*, char*);
204 void rpc_setmouse(Client*, Point);
205 void rpc_shutdown(void);
206 void rpc_topwin(Client*);
208 void rpc_bouncemouse(Client*, Mouse);
209 void rpc_flush(Client*, Rectangle);
211 // rpc_gfxdrawlock and rpc_gfxdrawunlock
212 // are called around drawing operations to lock and unlock
213 // access to the graphics display, for systems where the
214 // individual memdraw operations use the graphics display (X11, not macOS).
215 void rpc_gfxdrawlock(void);
216 void rpc_gfxdrawunlock(void);
218 // draw* routines are called on the RPC thread,
219 // invoked by the RPC server to do pixel pushing.
220 // No locks are held on entry.
221 int draw_dataread(Client*, void*, int);
222 int draw_datawrite(Client*, void*, int);
223 void draw_initdisplaymemimage(Client*, Memimage*);
226 int latin1(Rune*, int);
228 int parsewinsize(char*, Rectangle*, int*);
230 extern Client *client0; // set in single-client mode