Debian Codegraph @

sent.c

raw symbols SCIP
1 /* See LICENSE file for copyright and license details. */cxx . . $ `<file>/sent.c`/
2 #include <sys/types.h>
3 #include <arpa/inet.h>
4
5 #include <errno.h>
6 #include <fcntl.h>
7 #include <math.h>
8 #include <regex.h>
9 #include <stdarg.h>
10 #include <stdio.h>
11 #include <stdint.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <unistd.h>
15 #include <X11/keysym.h>
16 #include <X11/XKBlib.h>
17 #include <X11/Xatom.h>
18 #include <X11/Xlib.h>
19 #include <X11/Xutil.h>
20 #include <X11/Xft/Xft.h>
21
22 #include "arg.h"cxx . . $ `<file>/arg.h`/
23 #include "util.h"cxx . . $ `<file>/util.h`/
24 #include "drw.h"cxx . . $ `<file>/drw.h`/
25
26 char *argv0cxx . . $ argv0.;
27
28 /* macros */
29 #define LENcxx . . $ `sent.c:29:9`!(a) (sizeof(a) / sizeof(a)[0])
30 #define LIMITcxx . . $ `sent.c:30:9`!(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
31 #define MAXFONTSTRLENcxx . . $ `sent.c:31:9`! 128
32
33 typedef enumcxx . . $ $anonymous_type_7ac7a1588dfe8a91_0# {
34 NONEcxx . . $ NONE. = 0,
35 SCALEDcxx . . $ SCALED. = 1,
36 } imgstatecxx . . $ imgstate#;
37
38 typedef structcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1# {
39 unsigned char *bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.;
40 unsigned int bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth., bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight.;
41 imgstatecxx . . $ imgstate# statecxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#state.;
42 XImagecxx . . $ XImage# *ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.;
43 int numpassescxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#numpasses.;
44 } Imagecxx . . $ Image#;
45
46 typedef structcxx . . $ $anonymous_type_7ac7a1588dfe8a91_2# {
47 char *regexcxx . . $ $anonymous_type_7ac7a1588dfe8a91_2#regex.;
48 char *bincxx . . $ $anonymous_type_7ac7a1588dfe8a91_2#bin.;
49 } Filtercxx . . $ Filter#;
50
51 typedef structcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3# {
52 unsigned int linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.;
53 char **linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.;
54 Imagecxx . . $ Image# *imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.;
55 char *embedcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#embed.;
56 } Slidecxx . . $ Slide#;
57
58 /* Purely graphic info */
59 typedef structcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4# {
60 Displaycxx . . $ Display# *dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy.;
61 Windowcxx . . $ Window# wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win.;
62 Atomcxx . . $ Atom# wmdeletewincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#wmdeletewin., netwmnamecxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#netwmname.;
63 Visualcxx . . $ Visual# *viscxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#vis.;
64 XSetWindowAttributescxx . . $ XSetWindowAttributes# attrscxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#attrs.;
65 int scrcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#scr.;
66 int wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w., hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h.;
67 int uwcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uw., uhcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uh.; /* usable dimensions for drawing text and images */
68 } XWindowcxx . . $ XWindow#;
69
70 typedef unioncxx . . $ $anonymous_type_7ac7a1588dfe8a91_5# {
71 int icxx . . $ $anonymous_type_7ac7a1588dfe8a91_5#i.;
72 unsigned int uicxx . . $ $anonymous_type_7ac7a1588dfe8a91_5#ui.;
73 float fcxx . . $ $anonymous_type_7ac7a1588dfe8a91_5#f.;
74 const void *vcxx . . $ $anonymous_type_7ac7a1588dfe8a91_5#v.;
75 } Argcxx . . $ Arg#;
76
77 typedef structcxx . . $ $anonymous_type_7ac7a1588dfe8a91_6# {
78 unsigned int bcxx . . $ $anonymous_type_7ac7a1588dfe8a91_6#b.;
79 void (*funccxx . . $ $anonymous_type_7ac7a1588dfe8a91_6#func.)(const Argcxx . . $ Arg# *);
80 const Argcxx . . $ Arg# argcxx . . $ $anonymous_type_7ac7a1588dfe8a91_6#arg.;
81 } Mousekeycxx . . $ Mousekey#;
82
83 typedef structcxx . . $ $anonymous_type_7ac7a1588dfe8a91_7# {
84 KeySymcxx . . $ KeySym# keysymcxx . . $ $anonymous_type_7ac7a1588dfe8a91_7#keysym.;
85 void (*funccxx . . $ $anonymous_type_7ac7a1588dfe8a91_7#func.)(const Argcxx . . $ Arg# *);
86 const Argcxx . . $ Arg# argcxx . . $ $anonymous_type_7ac7a1588dfe8a91_7#arg.;
87 } Shortcutcxx . . $ Shortcut#;
88
89 static void fffreecxx . . $ fffree(a128c3a12b3620fe).(Imagecxx . . $ Image# *img);
90 static void ffloadcxx . . $ ffload(419852b7353d968d).(Slidecxx . . $ Slide# *s);
91 static void ffpreparecxx . . $ ffprepare(a128c3a12b3620fe).(Imagecxx . . $ Image# *img);
92 static void ffscalecxx . . $ ffscale(a128c3a12b3620fe).(Imagecxx . . $ Image# *img);
93 static void ffdrawcxx . . $ ffdraw(a128c3a12b3620fe).(Imagecxx . . $ Image# *img);
94
95 static void getfontsizecxx . . $ getfontsize(3781f83f5c31c4d1).(Slidecxx . . $ Slide# *s, unsigned int *width, unsigned int *height);
96 static void cleanupcxx . . $ cleanup(d4f767463ce0a6b3).(int slidesonly);
97 static void reloadcxx . . $ reload(a44448170a8cccdb).(const Argcxx . . $ Arg# *arg);
98 static void loadcxx . . $ load(8d4262d45fc644ab).(FILEcxx . . $ FILE# *fp);
99 static void advancecxx . . $ advance(a44448170a8cccdb).(const Argcxx . . $ Arg# *arg);
100 static void quitcxx . . $ quit(a44448170a8cccdb).(const Argcxx . . $ Arg# *arg);
101 static void resizecxx . . $ resize(3e454b8ccf442868).(int width, int height);
102 static void runcxx . . $ run(d878ad36e69247c7).();
103 static void usagecxx . . $ usage(d878ad36e69247c7).();
104 static void xdrawcxx . . $ xdraw(d878ad36e69247c7).();
105 static void xhintscxx . . $ xhints(d878ad36e69247c7).();
106 static void xinitcxx . . $ xinit(d878ad36e69247c7).();
107 static void xloadfontscxx . . $ xloadfonts(d878ad36e69247c7).();
108
109 static void bpresscxx . . $ bpress(5e4454ece1be6921).(XEventcxx . . $ XEvent# *);
110 static void cmessagecxx . . $ cmessage(5e4454ece1be6921).(XEventcxx . . $ XEvent# *);
111 static void exposecxx . . $ expose(5e4454ece1be6921).(XEventcxx . . $ XEvent# *);
112 static void kpresscxx . . $ kpress(5e4454ece1be6921).(XEventcxx . . $ XEvent# *);
113 static void configurecxx . . $ configure(5e4454ece1be6921).(XEventcxx . . $ XEvent# *);
114
115 /* config.h for applying patches and the configuration. */
116 #include "config.h"cxx . . $ `<file>/config.h`/
117
118 /* Globals */
119 static const char *fnamecxx . . $ fname. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
120 static Slidecxx . . $ Slide# *slidescxx . . $ slides. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
121 static int idxcxx . . $ idx. = 0;
122 static int slidecountcxx . . $ slidecount. = 0;
123 static XWindowcxx . . $ XWindow# xwcxx . . $ xw.;
124 static Drwcxx . . $ Drw# *dcxx . . $ d. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
125 static Clrcxx . . $ Clr# *sccxx . . $ sc.;
126 static Fntcxx . . $ Fnt# *fontscxx . . $ fonts.[NUMFONTSCALEScxx . . $ `config.h:8:9`!];
127 static int runningcxx . . $ running. = 1;
128
129 static void (*handlercxx . . $ handler.[LASTEventcxx . . $ `<external>/1208737181511191802/X.h:215:9`!])(XEventcxx . . $ XEvent# *) = {
130 [ButtonPresscxx . . $ `<external>/1208737181511191802/X.h:183:9`!] = bpresscxx . . $ bpress(5e4454ece1be6921).,
131 [ClientMessagecxx . . $ `<external>/1208737181511191802/X.h:212:9`!] = cmessagecxx . . $ cmessage(5e4454ece1be6921).,
132 [ConfigureNotifycxx . . $ `<external>/1208737181511191802/X.h:201:9`!] = configurecxx . . $ configure(5e4454ece1be6921).,
133 [Exposecxx . . $ `<external>/1208737181511191802/X.h:191:9`!] = exposecxx . . $ expose(5e4454ece1be6921).,
134 [KeyPresscxx . . $ `<external>/1208737181511191802/X.h:181:9`!] = kpresscxx . . $ kpress(5e4454ece1be6921).,
135 };
136
137 int
138 filtercxx . . $ filter(95e580389a7cc305).(int fd, const char *cmd)
139 {
140 int fds[2];
141
142 if (pipecxx . . $ pipe(a5f7824ee4986326).(fds) < 0)
143 diecxx . . $ die(326aeb464d16410c).("sent: Unable to create pipe:");
144
145 switch (forkcxx . . $ fork(b126dc7c1de90089).()) {
146 case -1:
147 diecxx . . $ die(326aeb464d16410c).("sent: Unable to fork:");
148 case 0:
149 dup2cxx . . $ dup2(9b79fb6aee4c0440).(fd, 0);
150 dup2cxx . . $ dup2(9b79fb6aee4c0440).(fds[1], 1);
151 closecxx . . $ close(7864480464b09eea).(fds[0]);
152 closecxx . . $ close(7864480464b09eea).(fds[1]);
153 execlpcxx . . $ execlp(5e8a2c12db2ea735).("sh", "sh", "-c", cmd, (char *)0);
154 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "sent: execlp sh -c '%s': %s\n", cmd, strerrorcxx . . $ strerror(ff224f080444ee45).(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
155 _exitcxx . . $ _exit(3ca292c338df9bb3).(1);
156 }
157 closecxx . . $ close(7864480464b09eea).(fds[1]);
158 return fds[0];
159 }
160
161 void
162 fffreecxx . . $ fffree(a128c3a12b3620fe).(Imagecxx . . $ Image# *img)
163 {
164 freecxx . . $ free(5d22bdacc48458e8).(img->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.);
165 if (img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.)
166 XDestroyImagecxx . . $ `<external>/9110752858362169270/Xutil.h:216:9`!(img->ximg);
167 freecxx . . $ free(5d22bdacc48458e8).(img);
168 }
169
170 void
171 ffloadcxx . . $ ffload(419852b7353d968d).(Slidecxx . . $ Slide# *s)
172 {
173 uint32_tcxx . . $ uint32_t# y, x;
174 uint16_tcxx . . $ uint16_t# *row;
175 uint8_tcxx . . $ uint8_t# opac, fg_r, fg_g, fg_b, bg_r, bg_g, bg_b;
176 size_t rowlen, off, nbytes, i;
177 ssize_tcxx . . $ ssize_t# count;
178 unsigned char hdr[16];
179 char *bin = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
180 char *filename;
181 regex_tcxx . . $ regex_t# regex;
182 int fdin, fdout;
183
184 if (s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img. || !(filename = s->embedcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#embed.) || !s->embedcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#embed.[0])
185 return; /* already done */
186
187 for (i = 0; i < LENcxx . . $ `sent.c:29:9`!(filters); i++) {
188 if (regcompcxx . . $ regcomp(aa05013d3db24b3e).(&regex, filterscxx . . $ filters.[i].regexcxx . . $ $anonymous_type_7ac7a1588dfe8a91_2#regex.,
189 REG_NOSUBcxx . . $ `<external>/18190116149591951179/regex.h:323:9`! | REG_EXTENDEDcxx . . $ `<external>/18190116149591951179/regex.h:310:9`! | REG_ICASEcxx . . $ `<external>/18190116149591951179/regex.h:314:9`!)) {
190 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "sent: Invalid regex '%s'\n", filterscxx . . $ filters.[i].regexcxx . . $ $anonymous_type_7ac7a1588dfe8a91_2#regex.);
191 continue;
192 }
193 if (!regexeccxx . . $ regexec(7b724a18a85d26ac).(&regex, filename, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0)) {
194 bin = filterscxx . . $ filters.[i].bincxx . . $ $anonymous_type_7ac7a1588dfe8a91_2#bin.;
195 regfreecxx . . $ regfree(b1814a8fd6af504b).(&regex);
196 break;
197 }
198 regfreecxx . . $ regfree(b1814a8fd6af504b).(&regex);
199 }
200 if (!bin)
201 diecxx . . $ die(326aeb464d16410c).("sent: Unable to find matching filter for '%s'", filename);
202
203 if ((fdin = opencxx . . $ open(e156e3aa1e5c4ad1).(filename, O_RDONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:43:9`!)) < 0)
204 diecxx . . $ die(326aeb464d16410c).("sent: Unable to open '%s':", filename);
205
206 if ((fdout = filtercxx . . $ filter(95e580389a7cc305).(fdin, bin)) < 0)
207 diecxx . . $ die(326aeb464d16410c).("sent: Unable to filter '%s':", filename);
208 closecxx . . $ close(7864480464b09eea).(fdin);
209
210 if (readcxx . . $ read(7e34d0a36f355389).(fdout, hdr, 16) != 16)
211 diecxx . . $ die(326aeb464d16410c).("sent: Unable to read filtered file '%s':", filename);
212 if (memcmpcxx . . $ memcmp(36f949851efa3055).("farbfeld", hdr, 8))
213 diecxx . . $ die(326aeb464d16410c).("sent: Filtered file '%s' has no valid farbfeld header", filename);
214
215 s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img. = ecalloccxx . . $ ecalloc(63a7bf2941bfcd7a).(1, sizeof(Imagecxx . . $ Image#));
216 s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth. = ntohlcxx . . $ ntohl(2141b656ce2cc063).(*(uint32_tcxx . . $ uint32_t# *)&hdr[8]);
217 s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight. = ntohlcxx . . $ ntohl(2141b656ce2cc063).(*(uint32_tcxx . . $ uint32_t# *)&hdr[12]);
218
219 if (s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.)
220 freecxx . . $ free(5d22bdacc48458e8).(s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.);
221 /* internally the image is stored in 888 format */
222 s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf. = ecalloccxx . . $ ecalloc(63a7bf2941bfcd7a).(s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth. * s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight., strlencxx . . $ strlen(751346f8406fd082).("888"));
223
224 /* scratch buffer to read row by row */
225 rowlen = s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth. * 2 * strlencxx . . $ strlen(751346f8406fd082).("RGBA");
226 row = ecalloccxx . . $ ecalloc(63a7bf2941bfcd7a).(1, rowlen);
227
228 /* extract window background color channels for transparency */
229 bg_r = (sccxx . . $ sc.[ColBgcxx . . $ ColBg.].pixelcxx . . $ _XftColor#pixel. >> 16) % 256;
230 bg_g = (sccxx . . $ sc.[ColBgcxx . . $ ColBg.].pixelcxx . . $ _XftColor#pixel. >> 8) % 256;
231 bg_b = (sccxx . . $ sc.[ColBgcxx . . $ ColBg.].pixelcxx . . $ _XftColor#pixel. >> 0) % 256;
232
233 for (off = 0, y = 0; y < s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight.; y++) {
234 nbytes = 0;
235 while (nbytes < rowlen) {
236 count = readcxx . . $ read(7e34d0a36f355389).(fdout, (char *)row + nbytes, rowlen - nbytes);
237 if (count < 0)
238 diecxx . . $ die(326aeb464d16410c).("sent: Unable to read from pipe:");
239 nbytes += count;
240 }
241 for (x = 0; x < rowlen / 2; x += 4) {
242 fg_r = ntohscxx . . $ ntohs(a18c05e4017afb3d).(row[x + 0]) / 257;
243 fg_g = ntohscxx . . $ ntohs(a18c05e4017afb3d).(row[x + 1]) / 257;
244 fg_b = ntohscxx . . $ ntohs(a18c05e4017afb3d).(row[x + 2]) / 257;
245 opac = ntohscxx . . $ ntohs(a18c05e4017afb3d).(row[x + 3]) / 257;
246 /* blend opaque part of image data with window background color to
247 * emulate transparency */
248 s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.[off++] = (fg_r * opac + bg_r * (255 - opac)) / 255;
249 s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.[off++] = (fg_g * opac + bg_g * (255 - opac)) / 255;
250 s->imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.[off++] = (fg_b * opac + bg_b * (255 - opac)) / 255;
251 }
252 }
253
254 freecxx . . $ free(5d22bdacc48458e8).(row);
255 closecxx . . $ close(7864480464b09eea).(fdout);
256 }
257
258 void
259 ffpreparecxx . . $ ffprepare(a128c3a12b3620fe).(Imagecxx . . $ Image# *img)
260 {
261 int depth = DefaultDepthcxx . . $ `<external>/7073035915403465041/Xlib.h:109:9`!(xw.dpy, xw.scr);
262 int width = xwcxx . . $ xw..uwcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uw.;
263 int height = xwcxx . . $ xw..uhcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uh.;
264
265 if (xwcxx . . $ xw..uwcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uw. * img->bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight. > xwcxx . . $ xw..uhcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uh. * img->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth.)
266 width = img->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth. * xwcxx . . $ xw..uhcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uh. / img->bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight.;
267 else
268 height = img->bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight. * xwcxx . . $ xw..uwcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uw. / img->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth.;
269
270 if (depth < 24)
271 diecxx . . $ die(326aeb464d16410c).("sent: Display color depths < 24 not supported");
272
273 if (!(img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg. = XCreateImagecxx . . $ XCreateImage(afa2ecd49422f22c).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., CopyFromParentcxx . . $ `<external>/1208737181511191802/X.h:121:9`!, depth, ZPixmapcxx . . $ `<external>/1208737181511191802/X.h:608:9`!, 0,
274 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, width, height, 32, 0)))
275 diecxx . . $ die(326aeb464d16410c).("sent: Unable to create XImage");
276
277 img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->datacxx . . $ _XImage#data. = ecalloccxx . . $ ecalloc(63a7bf2941bfcd7a).(height, img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->bytes_per_linecxx . . $ _XImage#bytes_per_line.);
278 if (!XInitImagecxx . . $ XInitImage(c1939de494f16665).(img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.))
279 diecxx . . $ die(326aeb464d16410c).("sent: Unable to initiate XImage");
280
281 ffscalecxx . . $ ffscale(a128c3a12b3620fe).(img);
282 img->statecxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#state. |= SCALEDcxx . . $ SCALED.;
283 }
284
285 void
286 ffscalecxx . . $ ffscale(a128c3a12b3620fe).(Imagecxx . . $ Image# *img)
287 {
288 unsigned int x, y;
289 unsigned int width = img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->widthcxx . . $ _XImage#width.;
290 unsigned int height = img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->heightcxx . . $ _XImage#height.;
291 char* newBuf = img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->datacxx . . $ _XImage#data.;
292 unsigned char* ibuf;
293 unsigned int jdy = img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->bytes_per_linecxx . . $ _XImage#bytes_per_line. / 4 - width;
294 unsigned int dx = (img->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth. << 10) / width;
295
296 for (y = 0; y < height; y++) {
297 unsigned int bufx = img->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth. / width;
298 ibuf = &img->bufcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#buf.[y * img->bufheightcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufheight. / height * img->bufwidthcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#bufwidth. * 3];
299
300 for (x = 0; x < width; x++) {
301 *newBuf++ = (ibuf[(bufx >> 10)*3+2]);
302 *newBuf++ = (ibuf[(bufx >> 10)*3+1]);
303 *newBuf++ = (ibuf[(bufx >> 10)*3+0]);
304 newBuf++;
305 bufx += dx;
306 }
307 newBuf += jdy;
308 }
309 }
310
311 void
312 ffdrawcxx . . $ ffdraw(a128c3a12b3620fe).(Imagecxx . . $ Image# *img)
313 {
314 int xoffset = (xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w. - img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->widthcxx . . $ _XImage#width.) / 2;
315 int yoffset = (xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h. - img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->heightcxx . . $ _XImage#height.) / 2;
316 XPutImagecxx . . $ XPutImage(ff04145409108030).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., dcxx . . $ d.->gccxx . . $ $anonymous_type_bb5ce8a44c4f204f_2#gc., img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg., 0, 0,
317 xoffset, yoffset, img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->widthcxx . . $ _XImage#width., img->ximgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#ximg.->heightcxx . . $ _XImage#height.);
318 XFlushcxx . . $ XFlush(62a385dbb0483707).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy.);
319 }
320
321 void
322 getfontsizecxx . . $ getfontsize(3781f83f5c31c4d1).(Slidecxx . . $ Slide# *s, unsigned int *width, unsigned int *height)
323 {
324 int i, j;
325 unsigned int curw, newmax;
326 float lfac = linespacingcxx . . $ linespacing. * (s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount. - 1) + 1;
327
328 /* fit height */
329 for (j = NUMFONTSCALEScxx . . $ `config.h:8:9`! - 1; j >= 0; j--)
330 if (fontscxx . . $ fonts.[j]->hcxx . . $ Fnt#h. * lfac <= xwcxx . . $ xw..uhcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uh.)
331 break;
332 LIMITcxx . . $ `sent.c:30:9`!(j, 0, NUMFONTSCALEScxx . . $ `config.h:8:9`! - 1);
333 drw_setfontsetcxx . . $ drw_setfontset(2efbef2cdcecf91c).(dcxx . . $ d., fontscxx . . $ fonts.[j]);
334
335 /* fit width */
336 *width = 0;
337 for (i = 0; i < s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.; i++) {
338 curw = drw_fontset_getwidthcxx . . $ drw_fontset_getwidth(d6c993fe6b1c750a).(dcxx . . $ d., s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[i]);
339 newmax = (curw >= *width);
340 while (j > 0 && curw > xwcxx . . $ xw..uwcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uw.) {
341 drw_setfontsetcxx . . $ drw_setfontset(2efbef2cdcecf91c).(dcxx . . $ d., fontscxx . . $ fonts.[--j]);
342 curw = drw_fontset_getwidthcxx . . $ drw_fontset_getwidth(d6c993fe6b1c750a).(dcxx . . $ d., s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[i]);
343 }
344 if (newmax)
345 *width = curw;
346 }
347 *height = fontscxx . . $ fonts.[j]->hcxx . . $ Fnt#h. * lfac;
348 }
349
350 void
351 cleanupcxx . . $ cleanup(d4f767463ce0a6b3).(int slidesonly)
352 {
353 unsigned int i, j;
354
355 if (!slidesonly) {
356 for (i = 0; i < NUMFONTSCALEScxx . . $ `config.h:8:9`!; i++)
357 drw_fontset_freecxx . . $ drw_fontset_free(24a24cfeadec3a17).(fontscxx . . $ fonts.[i]);
358 freecxx . . $ free(5d22bdacc48458e8).(sccxx . . $ sc.);
359 drw_freecxx . . $ drw_free(9f8a8a57df31cd06).(dcxx . . $ d.);
360
361 XDestroyWindowcxx . . $ XDestroyWindow(5223c1f954fb9eb9).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win.);
362 XSynccxx . . $ XSync(3212536831777fd4).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., Falsecxx . . $ `<external>/7073035915403465041/Xlib.h:81:9`!);
363 XCloseDisplaycxx . . $ XCloseDisplay(62a385dbb0483707).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy.);
364 }
365
366 if (slidescxx . . $ slides.) {
367 for (i = 0; i < slidecountcxx . . $ slidecount.; i++) {
368 for (j = 0; j < slidescxx . . $ slides.[i].linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.; j++)
369 freecxx . . $ free(5d22bdacc48458e8).(slidescxx . . $ slides.[i].linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[j]);
370 freecxx . . $ free(5d22bdacc48458e8).(slidescxx . . $ slides.[i].linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.);
371 if (slidescxx . . $ slides.[i].imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.)
372 fffreecxx . . $ fffree(a128c3a12b3620fe).(slidescxx . . $ slides.[i].imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.);
373 }
374 if (!slidesonly) {
375 freecxx . . $ free(5d22bdacc48458e8).(slidescxx . . $ slides.);
376 slidescxx . . $ slides. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
377 }
378 }
379 }
380
381 void
382 reloadcxx . . $ reload(a44448170a8cccdb).(const Argcxx . . $ Arg# *arg)
383 {
384 FILEcxx . . $ FILE# *fp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
385 unsigned int i;
386
387 if (!fnamecxx . . $ fname.) {
388 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "sent: Cannot reload from stdin. Use a file!\n");
389 return;
390 }
391
392 cleanupcxx . . $ cleanup(d4f767463ce0a6b3).(1);
393 slidecountcxx . . $ slidecount. = 0;
394
395 if (!(fp = fopencxx . . $ fopen(82ec0787cd37e0a3).(fnamecxx . . $ fname., "r")))
396 diecxx . . $ die(326aeb464d16410c).("sent: Unable to open '%s' for reading:", fnamecxx . . $ fname.);
397 loadcxx . . $ load(8d4262d45fc644ab).(fp);
398 fclosecxx . . $ fclose(89bc1efcdac0ca22).(fp);
399
400 LIMITcxx . . $ `sent.c:30:9`!(idx, 0, slidecount-1);
401 for (i = 0; i < slidecountcxx . . $ slidecount.; i++)
402 ffloadcxx . . $ ffload(419852b7353d968d).(&slidescxx . . $ slides.[i]);
403 xdrawcxx . . $ xdraw(d878ad36e69247c7).();
404 }
405
406 void
407 loadcxx . . $ load(8d4262d45fc644ab).(FILEcxx . . $ FILE# *fp)
408 {
409 static size_t size = 0;
410 size_t blen, maxlines;
411 char buf[BUFSIZcxx . . $ `<external>/232824719582829767/stdio.h:100:9`!], *p;
412 Slidecxx . . $ Slide# *s;
413
414 /* read each line from fp and add it to the item list */
415 while (1) {
416 /* eat consecutive empty lines */
417 while ((p = fgetscxx . . $ fgets(efb0aaba7ac866ae).(buf, sizeof(buf), fp)))
418 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(buf, "\n") != 0 && buf[0] != '#')
419 break;
420 if (!p)
421 break;
422
423 if ((slidecountcxx . . $ slidecount.+1) * sizeof(*slidescxx . . $ slides.) >= size)
424 if (!(slidescxx . . $ slides. = realloccxx . . $ realloc(417ab160f6baadc6).(slidescxx . . $ slides., (size += BUFSIZcxx . . $ `<external>/232824719582829767/stdio.h:100:9`!))))
425 diecxx . . $ die(326aeb464d16410c).("sent: Unable to reallocate %u bytes:", size);
426
427 /* read one slide */
428 maxlines = 0;
429 memsetcxx . . $ memset(d1de1e4fb215f1c6).((s = &slidescxx . . $ slides.[slidecountcxx . . $ slidecount.]), 0, sizeof(Slidecxx . . $ Slide#));
430 do {
431 if (buf[0] == '#')
432 continue;
433
434 /* grow lines array */
435 if (s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount. >= maxlines) {
436 maxlines = 2 * s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount. + 1;
437 if (!(s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines. = realloccxx . . $ realloc(417ab160f6baadc6).(s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines., maxlines * sizeof(s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[0]))))
438 diecxx . . $ die(326aeb464d16410c).("sent: Unable to reallocate %u bytes:", maxlines * sizeof(s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[0]));
439 }
440
441 blen = strlencxx . . $ strlen(751346f8406fd082).(buf);
442 if (!(s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.] = strdupcxx . . $ strdup(a8b8e32347182212).(buf)))
443 diecxx . . $ die(326aeb464d16410c).("sent: Unable to strdup:");
444 if (s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.][blen-1] == '\n')
445 s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.][blen-1] = '\0';
446
447 /* mark as image slide if first line of a slide starts with @ */
448 if (s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount. == 0 && s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[0][0] == '@')
449 s->embedcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#embed. = &s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[0][1];
450
451 if (s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.][0] == '\\')
452 memmovecxx . . $ memmove(cc817cb175f282d).(s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.], &s->linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.][1], blen);
453 s->linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.++;
454 } while ((p = fgetscxx . . $ fgets(efb0aaba7ac866ae).(buf, sizeof(buf), fp)) && strcmpcxx . . $ strcmp(5ae29d726ae57f88).(buf, "\n") != 0);
455
456 slidecountcxx . . $ slidecount.++;
457 if (!p)
458 break;
459 }
460 }
461
462 void
463 advancecxx . . $ advance(a44448170a8cccdb).(const Argcxx . . $ Arg# *arg)
464 {
465 int new_idx = idxcxx . . $ idx. + arg->icxx . . $ $anonymous_type_7ac7a1588dfe8a91_5#i.;
466 LIMITcxx . . $ `sent.c:30:9`!(new_idx, 0, slidecount-1);
467 if (new_idx != idxcxx . . $ idx.) {
468 if (slidescxx . . $ slides.[idxcxx . . $ idx.].imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.)
469 slidescxx . . $ slides.[idxcxx . . $ idx.].imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->statecxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#state. &= ~SCALEDcxx . . $ SCALED.;
470 idxcxx . . $ idx. = new_idx;
471 xdrawcxx . . $ xdraw(d878ad36e69247c7).();
472 }
473 }
474
475 void
476 quitcxx . . $ quit(a44448170a8cccdb).(const Argcxx . . $ Arg# *arg)
477 {
478 runningcxx . . $ running. = 0;
479 }
480
481 void
482 resizecxx . . $ resize(3e454b8ccf442868).(int width, int height)
483 {
484 xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w. = width;
485 xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h. = height;
486 xwcxx . . $ xw..uwcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uw. = usablewidthcxx . . $ usablewidth. * width;
487 xwcxx . . $ xw..uhcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#uh. = usableheightcxx . . $ usableheight. * height;
488 drw_resizecxx . . $ drw_resize(8ce1eee632a66a2d).(dcxx . . $ d., width, height);
489 }
490
491 void
492 runcxx . . $ run(d878ad36e69247c7).()
493 {
494 XEventcxx . . $ XEvent# ev;
495
496 /* Waiting for window mapping */
497 while (1) {
498 XNextEventcxx . . $ XNextEvent(7bd19ba365808ffb).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., &ev);
499 if (ev.typecxx . . $ _XEvent#type. == ConfigureNotifycxx . . $ `<external>/1208737181511191802/X.h:201:9`!) {
500 resizecxx . . $ resize(3e454b8ccf442868).(ev.xconfigurecxx . . $ _XEvent#xconfigure..widthcxx . . $ $anonymous_type_17d7f07cf933eea7_38#width., ev.xconfigurecxx . . $ _XEvent#xconfigure..heightcxx . . $ $anonymous_type_17d7f07cf933eea7_38#height.);
501 } else if (ev.typecxx . . $ _XEvent#type. == MapNotifycxx . . $ `<external>/1208737181511191802/X.h:198:9`!) {
502 break;
503 }
504 }
505
506 while (runningcxx . . $ running.) {
507 XNextEventcxx . . $ XNextEvent(7bd19ba365808ffb).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., &ev);
508 if (handlercxx . . $ handler.[ev.typecxx . . $ _XEvent#type.])
509 (handlercxx . . $ handler.[ev.typecxx . . $ _XEvent#type.])(&ev);
510 }
511 }
512
513 void
514 xdrawcxx . . $ xdraw(d878ad36e69247c7).()
515 {
516 unsigned int height, width, i;
517 Imagecxx . . $ Image# *im = slidescxx . . $ slides.[idxcxx . . $ idx.].imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.;
518
519 getfontsizecxx . . $ getfontsize(3781f83f5c31c4d1).(&slidescxx . . $ slides.[idxcxx . . $ idx.], &width, &height);
520 XClearWindowcxx . . $ XClearWindow(5223c1f954fb9eb9).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win.);
521
522 if (!im) {
523 drw_rectcxx . . $ drw_rect(1b458623c78a9550).(dcxx . . $ d., 0, 0, xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w., xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h., 1, 1);
524 for (i = 0; i < slidescxx . . $ slides.[idxcxx . . $ idx.].linecountcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#linecount.; i++)
525 drw_textcxx . . $ drw_text(deadee800938824).(dcxx . . $ d.,
526 (xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w. - width) / 2,
527 (xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h. - height) / 2 + i * linespacingcxx . . $ linespacing. * dcxx . . $ d.->fontscxx . . $ $anonymous_type_bb5ce8a44c4f204f_2#fonts.->hcxx . . $ Fnt#h.,
528 width,
529 dcxx . . $ d.->fontscxx . . $ $anonymous_type_bb5ce8a44c4f204f_2#fonts.->hcxx . . $ Fnt#h.,
530 0,
531 slidescxx . . $ slides.[idxcxx . . $ idx.].linescxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#lines.[i],
532 0);
533 drw_mapcxx . . $ drw_map(dbd1941aae78263e).(dcxx . . $ d., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., 0, 0, xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w., xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h.);
534 } else {
535 if (!(im->statecxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#state. & SCALEDcxx . . $ SCALED.))
536 ffpreparecxx . . $ ffprepare(a128c3a12b3620fe).(im);
537 ffdrawcxx . . $ ffdraw(a128c3a12b3620fe).(im);
538 }
539 }
540
541 void
542 xhintscxx . . $ xhints(d878ad36e69247c7).()
543 {
544 XClassHintcxx . . $ XClassHint# class = {.res_name = "sent", .res_class = "presenter"};
545 XWMHintscxx . . $ XWMHints# wm = {.flags = InputHintcxx . . $ `<external>/9110752858362169270/Xutil.h:134:9`!, .input = Truecxx . . $ `<external>/7073035915403465041/Xlib.h:80:9`!};
546 XSizeHintscxx . . $ XSizeHints# *sizeh = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
547
548 if (!(sizeh = XAllocSizeHintscxx . . $ XAllocSizeHints(466a3690980f7f93).()))
549 diecxx . . $ die(326aeb464d16410c).("sent: Unable to allocate size hints");
550
551 sizeh->flagscxx . . $ $anonymous_type_c787e362e16f063b_0#flags. = PSizecxx . . $ `<external>/9110752858362169270/Xutil.h:106:9`!;
552 sizeh->heightcxx . . $ $anonymous_type_c787e362e16f063b_0#height. = xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h.;
553 sizeh->widthcxx . . $ $anonymous_type_c787e362e16f063b_0#width. = xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w.;
554
555 XSetWMPropertiescxx . . $ XSetWMProperties(2849f89b4da8708b).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, sizeh, &wm, &class);
556 XFreecxx . . $ XFree(dedf1e9b1c614a07).(sizeh);
557 }
558
559 void
560 xinitcxx . . $ xinit(d878ad36e69247c7).()
561 {
562 XTextPropertycxx . . $ XTextProperty# prop;
563 unsigned int i;
564
565 if (!(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy. = XOpenDisplaycxx . . $ XOpenDisplay(f2c82aea04a05a19).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)))
566 diecxx . . $ die(326aeb464d16410c).("sent: Unable to open display");
567 xwcxx . . $ xw..scrcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#scr. = XDefaultScreencxx . . $ XDefaultScreen(62a385dbb0483707).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy.);
568 xwcxx . . $ xw..viscxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#vis. = XDefaultVisualcxx . . $ XDefaultVisual(5a36fbf7e85237b0).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..scrcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#scr.);
569 resizecxx . . $ resize(3e454b8ccf442868).(DisplayWidthcxx . . $ `<external>/7073035915403465041/Xlib.h:97:9`!(xw.dpy, xw.scr), DisplayHeightcxx . . $ `<external>/7073035915403465041/Xlib.h:98:9`!(xw.dpy, xw.scr));
570
571 xwcxx . . $ xw..attrscxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#attrs..bit_gravitycxx . . $ $anonymous_type_17d7f07cf933eea7_7#bit_gravity. = CenterGravitycxx . . $ `<external>/1208737181511191802/X.h:426:9`!;
572 xwcxx . . $ xw..attrscxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#attrs..event_maskcxx . . $ $anonymous_type_17d7f07cf933eea7_7#event_mask. = KeyPressMaskcxx . . $ `<external>/1208737181511191802/X.h:151:9`! | ExposureMaskcxx . . $ `<external>/1208737181511191802/X.h:166:9`! | StructureNotifyMaskcxx . . $ `<external>/1208737181511191802/X.h:168:9`! |
573 ButtonMotionMaskcxx . . $ `<external>/1208737181511191802/X.h:164:9`! | ButtonPressMaskcxx . . $ `<external>/1208737181511191802/X.h:153:9`!;
574
575 xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win. = XCreateWindowcxx . . $ XCreateWindow(fa7f8352c846d326).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., XRootWindowcxx . . $ XRootWindow(87141f1aff7122b9).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..scrcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#scr.), 0, 0,
576 xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w., xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h., 0, XDefaultDepthcxx . . $ XDefaultDepth(3212536831777fd4).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..scrcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#scr.),
577 InputOutputcxx . . $ `<external>/1208737181511191802/X.h:387:9`!, xwcxx . . $ xw..viscxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#vis., CWBitGravitycxx . . $ `<external>/1208737181511191802/X.h:396:9`! | CWEventMaskcxx . . $ `<external>/1208737181511191802/X.h:403:9`!,
578 &xwcxx . . $ xw..attrscxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#attrs.);
579
580 xwcxx . . $ xw..wmdeletewincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#wmdeletewin. = XInternAtomcxx . . $ XInternAtom(cce9092df7d5c4bb).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., "WM_DELETE_WINDOW", Falsecxx . . $ `<external>/7073035915403465041/Xlib.h:81:9`!);
581 xwcxx . . $ xw..netwmnamecxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#netwmname. = XInternAtomcxx . . $ XInternAtom(cce9092df7d5c4bb).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., "_NET_WM_NAME", Falsecxx . . $ `<external>/7073035915403465041/Xlib.h:81:9`!);
582 XSetWMProtocolscxx . . $ XSetWMProtocols(37eb7fb4ae7beca6).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., &xwcxx . . $ xw..wmdeletewincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#wmdeletewin., 1);
583
584 if (!(dcxx . . $ d. = drw_createcxx . . $ drw_create(383bceeabb247e2e).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..scrcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#scr., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., xwcxx . . $ xw..wcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#w., xwcxx . . $ xw..hcxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#h.)))
585 diecxx . . $ die(326aeb464d16410c).("sent: Unable to create drawing context");
586 sccxx . . $ sc. = drw_scm_createcxx . . $ drw_scm_create(878101a786c67ee5).(dcxx . . $ d., colorscxx . . $ colors., 2);
587 drw_setschemecxx . . $ drw_setscheme(d73c2bf9bbeb9f1a).(dcxx . . $ d., sccxx . . $ sc.);
588 XSetWindowBackgroundcxx . . $ XSetWindowBackground(b373b037aa36b05f).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., sccxx . . $ sc.[ColBgcxx . . $ ColBg.].pixelcxx . . $ _XftColor#pixel.);
589
590 xloadfontscxx . . $ xloadfonts(d878ad36e69247c7).();
591 for (i = 0; i < slidecountcxx . . $ slidecount.; i++)
592 ffloadcxx . . $ ffload(419852b7353d968d).(&slidescxx . . $ slides.[i]);
593
594 XStringListToTextPropertycxx . . $ XStringListToTextProperty(6ec36b29d137dc97).(&argv0cxx . . $ argv0., 1, &prop);
595 XSetWMNamecxx . . $ XSetWMName(1ce82a4ae25a6fa2).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., &prop);
596 XSetTextPropertycxx . . $ XSetTextProperty(16992351152f076b).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win., &prop, xwcxx . . $ xw..netwmnamecxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#netwmname.);
597 XFreecxx . . $ XFree(dedf1e9b1c614a07).(prop.valuecxx . . $ $anonymous_type_c787e362e16f063b_3#value.);
598 XMapWindowcxx . . $ XMapWindow(5223c1f954fb9eb9).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., xwcxx . . $ xw..wincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#win.);
599 xhintscxx . . $ xhints(d878ad36e69247c7).();
600 XSynccxx . . $ XSync(3212536831777fd4).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., Falsecxx . . $ `<external>/7073035915403465041/Xlib.h:81:9`!);
601 }
602
603 void
604 xloadfontscxx . . $ xloadfonts(d878ad36e69247c7).()
605 {
606 int i, j;
607 char *fstrs[LENcxx . . $ `sent.c:29:9`!(fontfallbacks)];
608
609 for (j = 0; j < LENcxx . . $ `sent.c:29:9`!(fontfallbacks); j++) {
610 fstrs[j] = ecalloccxx . . $ ecalloc(63a7bf2941bfcd7a).(1, MAXFONTSTRLENcxx . . $ `sent.c:31:9`!);
611 }
612
613 for (i = 0; i < NUMFONTSCALEScxx . . $ `config.h:8:9`!; i++) {
614 for (j = 0; j < LENcxx . . $ `sent.c:29:9`!(fontfallbacks); j++) {
615 if (MAXFONTSTRLENcxx . . $ `sent.c:31:9`! < snprintfcxx . . $ snprintf(ea502d73e74c754c).(fstrs[j], MAXFONTSTRLENcxx . . $ `sent.c:31:9`!, "%s:size=%d", fontfallbackscxx . . $ fontfallbacks.[j], FONTSZcxx . . $ `config.h:9:9`!(i)))
616 diecxx . . $ die(326aeb464d16410c).("sent: Font string too long");
617 }
618 if (!(fontscxx . . $ fonts.[i] = drw_fontset_createcxx . . $ drw_fontset_create(2c3ebfe73e2d42a2).(dcxx . . $ d., (const char**)fstrs, LENcxx . . $ `sent.c:29:9`!(fstrs))))
619 diecxx . . $ die(326aeb464d16410c).("sent: Unable to load any font for size %d", FONTSZcxx . . $ `config.h:9:9`!(i));
620 }
621
622 for (j = 0; j < LENcxx . . $ `sent.c:29:9`!(fontfallbacks); j++)
623 if (fstrs[j])
624 freecxx . . $ free(5d22bdacc48458e8).(fstrs[j]);
625 }
626
627 void
628 bpresscxx . . $ bpress(5e4454ece1be6921).(XEventcxx . . $ XEvent# *e)
629 {
630 unsigned int i;
631
632 for (i = 0; i < LENcxx . . $ `sent.c:29:9`!(mshortcuts); i++)
633 if (e->xbuttoncxx . . $ _XEvent#xbutton..buttoncxx . . $ $anonymous_type_17d7f07cf933eea7_23#button. == mshortcutscxx . . $ mshortcuts.[i].bcxx . . $ $anonymous_type_7ac7a1588dfe8a91_6#b. && mshortcutscxx . . $ mshortcuts.[i].funccxx . . $ $anonymous_type_7ac7a1588dfe8a91_6#func.)
634 mshortcutscxx . . $ mshortcuts.[i].funccxx . . $ $anonymous_type_7ac7a1588dfe8a91_6#func.(&(mshortcutscxx . . $ mshortcuts.[i].argcxx . . $ $anonymous_type_7ac7a1588dfe8a91_6#arg.));
635 }
636
637 void
638 cmessagecxx . . $ cmessage(5e4454ece1be6921).(XEventcxx . . $ XEvent# *e)
639 {
640 if (e->xclientcxx . . $ _XEvent#xclient..datacxx . . $ $anonymous_type_17d7f07cf933eea7_49#data..lcxx . . $ $anonymous_type_17d7f07cf933eea7_49#$anonymous_type_50#l.[0] == xwcxx . . $ xw..wmdeletewincxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#wmdeletewin.)
641 runningcxx . . $ running. = 0;
642 }
643
644 void
645 exposecxx . . $ expose(5e4454ece1be6921).(XEventcxx . . $ XEvent# *e)
646 {
647 if (0 == e->xexposecxx . . $ _XEvent#xexpose..countcxx . . $ $anonymous_type_17d7f07cf933eea7_28#count.)
648 xdrawcxx . . $ xdraw(d878ad36e69247c7).();
649 }
650
651 void
652 kpresscxx . . $ kpress(5e4454ece1be6921).(XEventcxx . . $ XEvent# *e)
653 {
654 unsigned int i;
655 KeySymcxx . . $ KeySym# sym;
656
657 sym = XkbKeycodeToKeysymcxx . . $ XkbKeycodeToKeysym(81a3e138d6a03200).(xwcxx . . $ xw..dpycxx . . $ $anonymous_type_7ac7a1588dfe8a91_4#dpy., (KeyCodecxx . . $ KeyCode#)e->xkeycxx . . $ _XEvent#xkey..keycodecxx . . $ $anonymous_type_17d7f07cf933eea7_22#keycode., 0, 0);
658 for (i = 0; i < LENcxx . . $ `sent.c:29:9`!(shortcuts); i++)
659 if (sym == shortcutscxx . . $ shortcuts.[i].keysymcxx . . $ $anonymous_type_7ac7a1588dfe8a91_7#keysym. && shortcutscxx . . $ shortcuts.[i].funccxx . . $ $anonymous_type_7ac7a1588dfe8a91_7#func.)
660 shortcutscxx . . $ shortcuts.[i].funccxx . . $ $anonymous_type_7ac7a1588dfe8a91_7#func.(&(shortcutscxx . . $ shortcuts.[i].argcxx . . $ $anonymous_type_7ac7a1588dfe8a91_7#arg.));
661 }
662
663 void
664 configurecxx . . $ configure(5e4454ece1be6921).(XEventcxx . . $ XEvent# *e)
665 {
666 resizecxx . . $ resize(3e454b8ccf442868).(e->xconfigurecxx . . $ _XEvent#xconfigure..widthcxx . . $ $anonymous_type_17d7f07cf933eea7_38#width., e->xconfigurecxx . . $ _XEvent#xconfigure..heightcxx . . $ $anonymous_type_17d7f07cf933eea7_38#height.);
667 if (slidescxx . . $ slides.[idxcxx . . $ idx.].imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.)
668 slidescxx . . $ slides.[idxcxx . . $ idx.].imgcxx . . $ $anonymous_type_7ac7a1588dfe8a91_3#img.->statecxx . . $ $anonymous_type_7ac7a1588dfe8a91_1#state. &= ~SCALEDcxx . . $ SCALED.;
669 xdrawcxx . . $ xdraw(d878ad36e69247c7).();
670 }
671
672 void
673 usagecxx . . $ usage(d878ad36e69247c7).()
674 {
675 diecxx . . $ die(326aeb464d16410c).("usage: %s [file]", argv0cxx . . $ argv0.);
676 }
677
678 int
679 maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[])
680 {
681 FILEcxx . . $ FILE# *fp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
682
683 ARGBEGINcxx . . $ `arg.h:24:9`! {
684 case 'v':
685 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "sent-"VERSIONcxx . . $ `<built-in>:411:9`!"\n");
686 return 0;
687 default:
688 usagecxx . . $ usage(d878ad36e69247c7).();
689 } ARGENDcxx . . $ `arg.h:33:9`!
690
691 if (!argv[0] || !strcmpcxx . . $ strcmp(5ae29d726ae57f88).(argv[0], "-"))
692 fp = stdincxx . . $ `<external>/232824719582829767/stdio.h:153:9`!;
693 else if (!(fp = fopencxx . . $ fopen(82ec0787cd37e0a3).(fnamecxx . . $ fname. = argv[0], "r")))
694 diecxx . . $ die(326aeb464d16410c).("sent: Unable to open '%s' for reading:", fnamecxx . . $ fname.);
695 loadcxx . . $ load(8d4262d45fc644ab).(fp);
696 fclosecxx . . $ fclose(89bc1efcdac0ca22).(fp);
697
698 if (!slidecountcxx . . $ slidecount.)
699 usagecxx . . $ usage(d878ad36e69247c7).();
700
701 xinitcxx . . $ xinit(d878ad36e69247c7).();
702 runcxx . . $ run(d878ad36e69247c7).();
703
704 cleanupcxx . . $ cleanup(d4f767463ce0a6b3).(0);
705 return 0;
706 }