comparison src/video/Xext/XME/xme.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
210 210
211 211
212 /* 212 /*
213 * find_display - locate the display info block 213 * find_display - locate the display info block
214 */ 214 */
215 static int XiGMiscCloseDisplay (); 215 static int XiGMiscCloseDisplay();
216 216
217 static XExtensionHooks xigmisc_extension_hooks = { 217 static XExtensionHooks xigmisc_extension_hooks = {
218 NULL, /* create_gc */ 218 NULL, /* create_gc */
219 NULL, /* copy_gc */ 219 NULL, /* copy_gc */
220 NULL, /* flush_gc */ 220 NULL, /* flush_gc */
228 NULL, /* error_string */ 228 NULL, /* error_string */
229 }; 229 };
230 230
231 231
232 static 232 static
233 XEXT_GENERATE_CLOSE_DISPLAY (XiGMiscCloseDisplay, xigmisc_info) 233 XEXT_GENERATE_CLOSE_DISPLAY(XiGMiscCloseDisplay, xigmisc_info)
234 static XEXT_GENERATE_FIND_DISPLAY (XiGMiscFindDisplay, xigmisc_info, 234 static XEXT_GENERATE_FIND_DISPLAY(XiGMiscFindDisplay, xigmisc_info,
235 xigmisc_extension_name, 235 xigmisc_extension_name,
236 &xigmisc_extension_hooks, 236 &xigmisc_extension_hooks,
237 XiGMiscNumberEvents, NULL) 237 XiGMiscNumberEvents, NULL)
238 /*****************************************************************************/ 238 /*****************************************************************************/
239 Bool XiGMiscQueryVersion (Display * dpy, int *major, int *minor) 239 Bool XiGMiscQueryVersion(Display * dpy, int *major, int *minor)
240 { 240 {
241 int opcode, event, error; 241 int opcode, event, error;
242 xXiGMiscQueryVersionReq *req; 242 xXiGMiscQueryVersionReq *req;
243 xXiGMiscQueryVersionReply rep; 243 xXiGMiscQueryVersionReply rep;
244 XExtDisplayInfo *info = XiGMiscFindDisplay (dpy); 244 XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);
245 245
246 if (!XQueryExtension 246 if (!XQueryExtension(dpy, XIGMISC_PROTOCOL_NAME, &opcode, &event, &error))
247 (dpy, XIGMISC_PROTOCOL_NAME, &opcode, &event, &error))
248 return xFalse; 247 return xFalse;
249 248
250 XiGMiscCheckExtension (dpy, info, xFalse); 249 XiGMiscCheckExtension(dpy, info, xFalse);
251 250
252 LockDisplay (dpy); 251 LockDisplay(dpy);
253 XiGMiscGetReq (XiGMiscQueryVersion, req, info); 252 XiGMiscGetReq(XiGMiscQueryVersion, req, info);
254 253
255 req->major = XIGMISC_MAJOR_VERSION; 254 req->major = XIGMISC_MAJOR_VERSION;
256 req->minor = XIGMISC_MINOR_VERSION; 255 req->minor = XIGMISC_MINOR_VERSION;
257 256
258 if (!_XReply (dpy, (xReply *) & rep, 0, xTrue)) { 257 if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
259 UnlockDisplay (dpy); 258 UnlockDisplay(dpy);
260 SyncHandle (); 259 SyncHandle();
261 return xFalse; 260 return xFalse;
262 } 261 }
263 262
264 *major = rep.major; 263 *major = rep.major;
265 *minor = rep.minor; 264 *minor = rep.minor;
266 UnlockDisplay (dpy); 265 UnlockDisplay(dpy);
267 SyncHandle (); 266 SyncHandle();
268 267
269 return xTrue; 268 return xTrue;
270 } 269 }
271 270
272 int 271 int
273 XiGMiscQueryViews (Display * dpy, int screen, XiGMiscViewInfo ** pviews) 272 XiGMiscQueryViews(Display * dpy, int screen, XiGMiscViewInfo ** pviews)
274 { 273 {
275 int n, size; 274 int n, size;
276 XiGMiscViewInfo *views; 275 XiGMiscViewInfo *views;
277 xXiGMiscQueryViewsReq *req; 276 xXiGMiscQueryViewsReq *req;
278 xXiGMiscQueryViewsReply rep; 277 xXiGMiscQueryViewsReply rep;
279 XExtDisplayInfo *info = XiGMiscFindDisplay (dpy); 278 XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);
280 XiGMiscCheckExtension (dpy, info, 0); 279 XiGMiscCheckExtension(dpy, info, 0);
281 280
282 LockDisplay (dpy); 281 LockDisplay(dpy);
283 XiGMiscGetReq (XiGMiscQueryViews, req, info); 282 XiGMiscGetReq(XiGMiscQueryViews, req, info);
284 req->screen = screen; 283 req->screen = screen;
285 284
286 if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) { 285 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
287 UnlockDisplay (dpy); 286 UnlockDisplay(dpy);
288 SyncHandle (); 287 SyncHandle();
289 return 0; 288 return 0;
290 } 289 }
291 290
292 n = rep.nviews; 291 n = rep.nviews;
293 292
294 if (n > 0) { 293 if (n > 0) {
295 size = sizeof (XiGMiscViewInfo) * n; 294 size = sizeof(XiGMiscViewInfo) * n;
296 views = (XiGMiscViewInfo *) Xmalloc (size); 295 views = (XiGMiscViewInfo *) Xmalloc(size);
297 if (!views) { 296 if (!views) {
298 _XEatData (dpy, (unsigned long) size); 297 _XEatData(dpy, (unsigned long) size);
299 UnlockDisplay (dpy); 298 UnlockDisplay(dpy);
300 SyncHandle (); 299 SyncHandle();
301 return 0; 300 return 0;
302 } 301 }
303 302
304 _XReadPad (dpy, (void *) views, size); 303 _XReadPad(dpy, (void *) views, size);
305 304
306 *pviews = views; 305 *pviews = views;
307 } 306 }
308 307
309 UnlockDisplay (dpy); 308 UnlockDisplay(dpy);
310 SyncHandle (); 309 SyncHandle();
311 310
312 return n; 311 return n;
313 } 312 }
314 313
315 int 314 int
316 XiGMiscQueryResolutions (Display * dpy, int screen, int view, int *pactive, 315 XiGMiscQueryResolutions(Display * dpy, int screen, int view, int *pactive,
317 XiGMiscResolutionInfo ** presolutions) 316 XiGMiscResolutionInfo ** presolutions)
318 { 317 {
319 int n, size; 318 int n, size;
320 XiGMiscResolutionInfo *resolutions; 319 XiGMiscResolutionInfo *resolutions;
321 xXiGMiscQueryResolutionsReq *req; 320 xXiGMiscQueryResolutionsReq *req;
322 xXiGMiscQueryResolutionsReply rep; 321 xXiGMiscQueryResolutionsReply rep;
323 XExtDisplayInfo *info = XiGMiscFindDisplay (dpy); 322 XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);
324 XiGMiscCheckExtension (dpy, info, 0); 323 XiGMiscCheckExtension(dpy, info, 0);
325 324
326 LockDisplay (dpy); 325 LockDisplay(dpy);
327 XiGMiscGetReq (XiGMiscQueryResolutions, req, info); 326 XiGMiscGetReq(XiGMiscQueryResolutions, req, info);
328 req->screen = screen; 327 req->screen = screen;
329 req->view = view; 328 req->view = view;
330 329
331 if (!_XReply (dpy, (xReply *) & rep, 0, xFalse)) { 330 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
332 UnlockDisplay (dpy); 331 UnlockDisplay(dpy);
333 SyncHandle (); 332 SyncHandle();
334 return 0; 333 return 0;
335 } 334 }
336 335
337 n = rep.nresolutions; 336 n = rep.nresolutions;
338 337
339 if (n > 0) { 338 if (n > 0) {
340 size = sizeof (XiGMiscResolutionInfo) * n; 339 size = sizeof(XiGMiscResolutionInfo) * n;
341 resolutions = (XiGMiscResolutionInfo *) Xmalloc (size); 340 resolutions = (XiGMiscResolutionInfo *) Xmalloc(size);
342 if (!resolutions) { 341 if (!resolutions) {
343 _XEatData (dpy, (unsigned long) size); 342 _XEatData(dpy, (unsigned long) size);
344 UnlockDisplay (dpy); 343 UnlockDisplay(dpy);
345 SyncHandle (); 344 SyncHandle();
346 return 0; 345 return 0;
347 } 346 }
348 347
349 _XReadPad (dpy, (void *) resolutions, size); 348 _XReadPad(dpy, (void *) resolutions, size);
350 349
351 *presolutions = resolutions; 350 *presolutions = resolutions;
352 *pactive = rep.active; 351 *pactive = rep.active;
353 } 352 }
354 353
355 UnlockDisplay (dpy); 354 UnlockDisplay(dpy);
356 SyncHandle (); 355 SyncHandle();
357 356
358 return n; 357 return n;
359 } 358 }
360 359
361 void 360 void
362 XiGMiscChangeResolution (Display * dpy, int screen, int view, int width, 361 XiGMiscChangeResolution(Display * dpy, int screen, int view, int width,
363 int height, int refresh) 362 int height, int refresh)
364 { 363 {
365 xXiGMiscChangeResolutionReq *req; 364 xXiGMiscChangeResolutionReq *req;
366 XExtDisplayInfo *info = XiGMiscFindDisplay (dpy); 365 XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);
367 366
368 XiGMiscSimpleCheckExtension (dpy, info); 367 XiGMiscSimpleCheckExtension(dpy, info);
369 368
370 LockDisplay (dpy); 369 LockDisplay(dpy);
371 XiGMiscGetReq (XiGMiscChangeResolution, req, info); 370 XiGMiscGetReq(XiGMiscChangeResolution, req, info);
372 req->screen = screen; 371 req->screen = screen;
373 req->view = view; 372 req->view = view;
374 req->width = width; 373 req->width = width;
375 req->height = height; 374 req->height = height;
376 req->refresh = refresh; 375 req->refresh = refresh;
377 376
378 UnlockDisplay (dpy); 377 UnlockDisplay(dpy);
379 SyncHandle (); 378 SyncHandle();
380 } 379 }
381 380
382 381
383 Bool 382 Bool
384 XiGMiscFullScreen (Display * dpy, int screen, XID window, XID cmap) 383 XiGMiscFullScreen(Display * dpy, int screen, XID window, XID cmap)
385 { 384 {
386 xXiGMiscFullScreenReq *req; 385 xXiGMiscFullScreenReq *req;
387 xXiGMiscFullScreenReply rep; 386 xXiGMiscFullScreenReply rep;
388 XExtDisplayInfo *info = XiGMiscFindDisplay (dpy); 387 XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);
389 388
390 XiGMiscCheckExtension (dpy, info, xFalse); 389 XiGMiscCheckExtension(dpy, info, xFalse);
391 390
392 LockDisplay (dpy); 391 LockDisplay(dpy);
393 XiGMiscGetReq (XiGMiscFullScreen, req, info); 392 XiGMiscGetReq(XiGMiscFullScreen, req, info);
394 req->screen = screen; 393 req->screen = screen;
395 req->pad0 = 0; 394 req->pad0 = 0;
396 req->pad1 = 0; 395 req->pad1 = 0;
397 req->window = window; 396 req->window = window;
398 req->cmap = cmap; 397 req->cmap = cmap;
399 398
400 if (!_XReply (dpy, (xReply *) & rep, 0, xTrue)) { 399 if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
401 UnlockDisplay (dpy); 400 UnlockDisplay(dpy);
402 SyncHandle (); 401 SyncHandle();
403 return xFalse; 402 return xFalse;
404 } 403 }
405 404
406 UnlockDisplay (dpy); 405 UnlockDisplay(dpy);
407 SyncHandle (); 406 SyncHandle();
408 407
409 return (rep.success ? xTrue : xFalse); 408 return (rep.success ? xTrue : xFalse);
410 } 409 }
411 410
412 /* vi: set ts=4 sw=4 expandtab: */ 411 /* vi: set ts=4 sw=4 expandtab: */