MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / doInteractiveTest

Function doInteractiveTest

util/fbxvtest.c:169–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168
169static int doInteractiveTest(int id, char *name)
170{
171 int iter = 0, retval = 0;
172 printf("Interactive test, %s format (ID=0x%.8x) %s...\n", name, id,
173 useShm ? "[SHM] " : "");
174 memset(&s, 0, sizeof(s));
175
176 while(1)
177 {
178 int doDisplay = 0;
179
180 while(1)
181 {
182 XEvent event;
183 XNextEvent(dpy, &event);
184 switch(event.type)
185 {
186 case Expose:
187 doDisplay = 1;
188 break;
189 case ConfigureNotify:
190 width = event.xconfigure.width; height = event.xconfigure.height;
191 break;
192 case KeyPress:
193 {
194 char buf[10];
195 XLookupString(&event.xkey, buf, sizeof(buf), NULL, NULL);
196 switch(buf[0])
197 {
198 case 27: case 'q': case 'Q':
199 return 0;
200 }
201 break;
202 }
203 case MotionNotify:
204 if(event.xmotion.state & Button1Mask) doDisplay = 1;
205 break;
206 case ClientMessage:
207 {
208 XClientMessageEvent *cme = (XClientMessageEvent *)&event;
209 if(cme->message_type == protoAtom
210 && cme->data.l[0] == (long)deleteAtom)
211 return 0;
212 }
213 }
214 if(XPending(dpy) <= 0) break;
215 }
216 if(doDisplay)
217 {
218 TRY_FBXV(fbxv_init(&s, dpy, win, width / scale, height / scale, id,
219 useShm));
220 initBuf(&s, id, iter); iter++;
221 TRY_FBXV(fbxv_write(&s, 0, 0, 0, 0, 0, 0, width, height));
222 }
223 }
224
225 bailout:
226 return retval;

Callers 1

mainFunction · 0.85

Calls 4

XNextEventFunction · 0.85
fbxv_initFunction · 0.85
fbxv_writeFunction · 0.85
initBufFunction · 0.70

Tested by

no test coverage detected