summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recordmydesktop/src/Makefile.am2
-rw-r--r--recordmydesktop/src/rmd.c23
-rw-r--r--recordmydesktop/src/rmd_types.h1
-rw-r--r--recordmydesktop/src/rmd_wm_is_compositing.c66
-rw-r--r--recordmydesktop/src/rmd_wm_is_compositing.h48
5 files changed, 122 insertions, 18 deletions
diff --git a/recordmydesktop/src/Makefile.am b/recordmydesktop/src/Makefile.am
index f572bed..47b3320 100644
--- a/recordmydesktop/src/Makefile.am
+++ b/recordmydesktop/src/Makefile.am
@@ -68,6 +68,8 @@ recordmydesktop_SOURCES = \
rmd_update_image.h \
rmd_wm_check.c \
rmd_wm_check.h \
+ rmd_wm_is_compositing.c \
+ rmd_wm_is_compositing.h \
rmd_yuv_utils.c \
rmd_yuv_utils.h \
skeleton.c \
diff --git a/recordmydesktop/src/rmd.c b/recordmydesktop/src/rmd.c
index 6c3edfa..c88a4c4 100644
--- a/recordmydesktop/src/rmd.c
+++ b/recordmydesktop/src/rmd.c
@@ -38,7 +38,7 @@
#include "rmd_setbrwindow.h"
#include "rmd_shortcuts.h"
#include "rmd_threads.h"
-#include "rmd_wm_check.h"
+#include "rmd_wm_is_compositing.h"
int main(int argc,char **argv){
@@ -99,28 +99,17 @@ int main(int argc,char **argv){
if (!SetBRWindow(pdata.dpy, &pdata.brwin, &pdata.specs, &pdata.args))
exit(11);
- //check if we are under compiz or beryl,
- //in which case we must enable full-shots
- //and with it use of shared memory.User can override this
- pdata.window_manager=((pdata.args.nowmcheck)?
- NULL:rmdWMCheck(pdata.dpy,pdata.specs.root));
- if(pdata.window_manager==NULL){
- fprintf(stderr,"Not taking window manager into account.\n");
- }
- //Right now only wm's that I know of performing
- //3d compositing are beryl and compiz.
- //No, the blue screen in metacity doesn't count :)
- //names can be compiz for compiz and beryl/beryl-co/beryl-core
- //for beryl(so it's strncmp )
- else if(!strcmp(pdata.window_manager,"compiz") ||
- !strncmp(pdata.window_manager,"beryl",5)){
- fprintf(stderr,"\nDetected 3d compositing window manager.\n"
+ if( !pdata.args.nowmcheck &&
+ rmdWMIsCompositing( pdata.dpy, pdata.specs.screen ) ) {
+
+ fprintf(stderr,"\nDetected compositing window manager.\n"
"Reverting to full screen capture at every frame.\n"
"To disable this check run with --no-wm-check\n"
"(though that is not advised, since it will "
"probably produce faulty results).\n\n");
pdata.args.full_shots=1;
pdata.args.noshared=0;
+
}
QueryExtensions(pdata.dpy,
diff --git a/recordmydesktop/src/rmd_types.h b/recordmydesktop/src/rmd_types.h
index e09a52c..601cfa0 100644
--- a/recordmydesktop/src/rmd_types.h
+++ b/recordmydesktop/src/rmd_types.h
@@ -304,7 +304,6 @@ struct _ProgData {
//when drawing the dummy pointer
unsigned int periodtime,//time that a sound buffer lasts (microsecs)
frametime; //time that a frame lasts (microsecs)
- char *window_manager; //name of the window manager at program launch
Window shaped_w; //frame
int damage_event, //damage event base code
damage_error, //damage error base code
diff --git a/recordmydesktop/src/rmd_wm_is_compositing.c b/recordmydesktop/src/rmd_wm_is_compositing.c
new file mode 100644
index 0000000..e170835
--- /dev/null
+++ b/recordmydesktop/src/rmd_wm_is_compositing.c
@@ -0,0 +1,66 @@
+/******************************************************************************
+* recordMyDesktop *
+*******************************************************************************
+* *
+* Copyright (C) 2006,2007,2008 John Varouhakis *
+* *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the Free Software *
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+* *
+* *
+* *
+* For further information contact me at johnvarouhakis@gmail.com *
+******************************************************************************/
+
+#include "config.h"
+
+#include <X11/Xatom.h>
+
+#include "rmd_types.h"
+
+#include "rmd_wm_check.h"
+
+#include "rmd_wm_is_compositing.h"
+
+boolean rmdWMIsCompositing( Display *dpy, int screen ) {
+
+ Window win;
+ Atom atom;
+ char buf[32];
+ char *window_manager=rmdWMCheck( dpy,
+ RootWindow( dpy, screen ) );
+
+ //If the wm name is queried successfully the wm is compliant (source
+ //http://standards.freedesktop.org/wm-spec/1.4/ar01s03.html#id2568282 )
+ //in which case we will also free() the allcoated string.
+
+ if( window_manager == NULL )
+ return FALSE;
+ else
+ free( window_manager );
+
+
+ snprintf( buf, sizeof(buf), "_NET_WM_CM_S%d", screen);
+ atom = XInternAtom(dpy, buf, True);
+ if (atom == None) return FALSE;
+
+ win = XGetSelectionOwner(dpy, atom);
+
+ return win != None;
+
+
+
+}
+
diff --git a/recordmydesktop/src/rmd_wm_is_compositing.h b/recordmydesktop/src/rmd_wm_is_compositing.h
new file mode 100644
index 0000000..7f152ac
--- /dev/null
+++ b/recordmydesktop/src/rmd_wm_is_compositing.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+* recordMyDesktop *
+*******************************************************************************
+* *
+* Copyright (C) 2006,2007,2008 John Varouhakis *
+* *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with this program; if not, write to the Free Software *
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+* *
+* *
+* *
+* For further information contact me at johnvarouhakis@gmail.com *
+******************************************************************************/
+
+#ifndef RMD_WM_IS_COMPOSITING_H
+#define RMD_WM_IS_COMPOSITING_H 1
+
+#include "rmd_types.h"
+
+
+/**
+*Check if the window manager is compositing (duh!).
+*
+* \param dpy Connection to the server
+*
+* \param screen screen number/id that the window manager runs on
+*
+* \returns TRUE if compositing, false otherwise or when
+* the window manager doesn't support the required
+* freedesktop.org hints for the test to be done
+* succesfully.
+*/
+
+boolean rmdWMIsCompositing( Display *dpy, int screen) ;
+
+#endif
© All Rights Reserved