1
/******************************************************************************
3
*******************************************************************************
5
* Copyright (C) 2006,2007,2008 John Varouhakis *
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. *
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. *
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 *
24
* For further information contact me at johnvarouhakis@gmail.com *
25
******************************************************************************/
28
#include <recordmydesktop.h>
30
char *rmdWMCheck(Display *dpy,Window root){
32
Window *wm_child=NULL;
40
char *wm_name_str=NULL;
43
utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
45
nwm_atom =XInternAtom(dpy,"_NET_SUPPORTING_WM_CHECK",True);
46
wm_name_atom =XInternAtom(dpy,"_NET_WM_NAME",True);
48
if(nwm_atom!=None && wm_name_atom!=None){
49
if(XGetWindowProperty( dpy,root,nwm_atom,0,100,
51
&rt,&fmt,&nitems, &nbytes,
52
(unsigned char **)((void*)&wm_child))
54
fprintf(stderr,"Error while trying to get a"
55
" window to identify the window manager.\n");
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))
63
fprintf(stderr,"Warning!!!\nYour window manager appears"
64
" to be non-compliant!\n");
67
fprintf(stderr,"Your window manager appears to be %s\n\n",
68
((wm_name_str!=NULL)?wm_name_str:"Unknown"));