summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2008-11-15 16:28:36 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2008-11-15 16:28:36 +0000
commitf54124e18ec18c7a97db7221e2a2ba23313e5ff4 (patch)
treedd9e09f09169eae937ac22c15894c47b5fba8745
parente8464a74616b7ccd1269d09a0be4bb9244b05ea8 (diff)
src/rmd_wm_is_compositing.[ch], src/rmd.c, src/rmd_types.h, src/Makefile.am :
Added rmdWMIsCompositing method which is used to determine if the window manager is compositing and thus if it will be recorded in --full-shots mode. This method replaces the name check that was previously used, but rmdWMCheck hasn't been removed as it is also a proper method of identifying compliance with the freedesktop.org standards, which is a neccessary step before determining whether a window manager is compositing. This method is still not perfect as non-3d compositing WM's will trigger full-shots, without neccessarily needing it, but the only penalty for this mistake will be increased CPU usage while previously, non-identification of compositing WM as such could lead in distorted/unusable videos (e.g. KWin when used in 3d compositing mode). git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@568 f606c939-3180-4ac9-a4b8-4b8779d57d0a
-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