~ubuntu-branches/ubuntu/karmic/recordmydesktop/karmic

« back to all changes in this revision

Viewing changes to src/wm_check.c

  • Committer: Bazaar Package Importer
  • Author(s): Alan Pope
  • Date: 2009-04-21 10:57:22 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090421105722-w6l4gz958gva15wn
Tags: 0.3.8.1-0ubuntu1
* New upstream release (LP: #364674)
* debian/control: Fixed libjack0.100.0-dev dependancy
* debian/control: Fixed project home page

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 
28
 
#include <recordmydesktop.h>
29
 
 
30
 
char *rmdWMCheck(Display *dpy,Window root){
31
 
 
32
 
    Window  *wm_child=NULL;
33
 
    Atom    nwm_atom,
34
 
            utf8_string,
35
 
            wm_name_atom,
36
 
            rt;
37
 
    unsigned long   nbytes,
38
 
                    nitems;
39
 
 
40
 
    char *wm_name_str=NULL;
41
 
    int fmt;
42
 
 
43
 
    utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
44
 
 
45
 
    nwm_atom =XInternAtom(dpy,"_NET_SUPPORTING_WM_CHECK",True);
46
 
    wm_name_atom =XInternAtom(dpy,"_NET_WM_NAME",True);
47
 
 
48
 
    if(nwm_atom!=None && wm_name_atom!=None){
49
 
        if(XGetWindowProperty(  dpy,root,nwm_atom,0,100,
50
 
                                False,XA_WINDOW,
51
 
                                &rt,&fmt,&nitems, &nbytes,
52
 
                                (unsigned char **)((void*)&wm_child))
53
 
                            != Success ){
54
 
            fprintf(stderr,"Error while trying to get a"
55
 
                           " window to identify the window manager.\n");
56
 
        }
57
 
        if((wm_child == NULL)||
58
 
           (XGetWindowProperty(dpy,*wm_child,wm_name_atom,0,100,
59
 
                               False,utf8_string,&rt,
60
 
                               &fmt,&nitems, &nbytes,
61
 
                               (unsigned char **)((void*)&wm_name_str))
62
 
            !=Success)){
63
 
            fprintf(stderr,"Warning!!!\nYour window manager appears"
64
 
                           " to be non-compliant!\n");
65
 
        }
66
 
    }
67
 
    fprintf(stderr,"Your window manager appears to be %s\n\n",
68
 
                    ((wm_name_str!=NULL)?wm_name_str:"Unknown"));
69
 
 
70
 
 
71
 
    return wm_name_str;
72
 
}
73