1 /******************************************************************************
2 *                            recordMyDesktop                                  *
3 *******************************************************************************
4 *                                                                             *
5 *            Copyright (C) 2006,2007,2008 John Varouhakis                     *
6 *                                                                             *
7 *                                                                             *
8 *   This program is free software; you can redistribute it and/or modify      *
9 *   it under the terms of the GNU General Public License as published by      *
10 *   the Free Software Foundation; either version 2 of the License, or         *
11 *   (at your option) any later version.                                       *
12 *                                                                             *
13 *   This program is distributed in the hope that it will be useful,           *
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of            *
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
16 *   GNU General Public License for more details.                              *
17 *                                                                             *
18 *   You should have received a copy of the GNU General Public License         *
19 *   along with this program; if not, write to the Free Software               *
20 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  *
21 *                                                                             *
22 *                                                                             *
23 *                                                                             *
24 *   For further information contact me at johnvarouhakis@gmail.com            *
25 ******************************************************************************/
26 
27 #include "config.h"
28 #include "rmd_queryextensions.h"
29 
30 #include "rmd_types.h"
31 
32 #include <X11/extensions/shape.h>
33 #include <X11/extensions/Xfixes.h>
34 #include <X11/extensions/Xdamage.h>
35 #include <stdlib.h>
36 
37 
38 
QueryExtensions(Display * dpy,ProgArgs * args,int * damage_event,int * damage_error,int * shm_opcode)39 void QueryExtensions(Display *dpy,
40                      ProgArgs *args,
41                      int *damage_event,
42                      int *damage_error,
43                      int *shm_opcode){
44     int xf_event_basep,
45         xf_error_basep,
46         shm_event_base,
47         shm_error_base,
48         shape_event_base,
49         shape_error_base;
50 
51     if((!(args->full_shots))&&(!XDamageQueryExtension( dpy, damage_event, damage_error))){
52         fprintf(stderr,"XDamage extension not found!!!\n"
53                        "Try again using the --full-shots option, though\n"
54                        "enabling XDamage is highly recommended,\n"
55                        "for performance reasons.\n");
56         exit(4);
57     }
58     if((!args->noshared)&&(!XQueryExtension(dpy,
59                                            "MIT-SHM",
60                                            shm_opcode,
61                                            &shm_event_base,
62                                            &shm_error_base))){
63         args->noshared=1;
64         fprintf(stderr,"Shared Memory extension not present!\n"
65                        "Try again using the --no-shared option\n");
66         exit(5);
67     }
68     if((args->xfixes_cursor)&&
69        (XFixesQueryExtension(dpy,&xf_event_basep,&xf_error_basep)==False)){
70         args->xfixes_cursor=0;
71         fprintf(stderr,"Xfixes extension not present!\n"
72                        "Please run with the -dummy-cursor or"
73                        " --no-cursor option.\n");
74         exit(6);
75     }
76     if((!args->noframe)&&
77        (!XShapeQueryExtension(dpy,&shape_event_base,&shape_error_base))){
78         fprintf(stderr,"XShape Not Found!!!\n"
79                        "Frame won't be available.\n");
80 
81         args->noframe=1;
82     }
83 
84 }
85