summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-11-30 09:06:55 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-11-30 09:06:55 +0000
commit6dcbd633ef79bce5040a7bc6062f0895fe600456 (patch)
tree6673b741214c83a0d65e85c2ad76cc3d098192ea /recordmydesktop
parentb0bd03bd035d1a6b5f6d5a2021d39432d270fa6a (diff)
Makefile.am: added rmd_error.c
poll_events.c: moved away rmdErrorHandler recordmydesktop.c: call XSetErrorHandler rmd_error.c: new place for rmdErrorHandler(added handling for bad access on X_GrabKey) git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@443 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/src/Makefile.am3
-rw-r--r--recordmydesktop/src/poll_events.c15
-rw-r--r--recordmydesktop/src/recordmydesktop.c5
-rw-r--r--recordmydesktop/src/rmd_error.c60
4 files changed, 66 insertions, 17 deletions
diff --git a/recordmydesktop/src/Makefile.am b/recordmydesktop/src/Makefile.am
index 576cd97..e105669 100644
--- a/recordmydesktop/src/Makefile.am
+++ b/recordmydesktop/src/Makefile.am
@@ -31,7 +31,8 @@ recordmydesktop_SOURCES= recordmydesktop.c\
rmd_jack.c\
cleanup.c\
specsfile.c\
- shortcuts.c
+ shortcuts.c\
+ rmd_error.c
INCLUDES= $(all_includes) -I$(top_srcdir)/include
diff --git a/recordmydesktop/src/poll_events.c b/recordmydesktop/src/poll_events.c
index 497b593..e78587e 100644
--- a/recordmydesktop/src/poll_events.c
+++ b/recordmydesktop/src/poll_events.c
@@ -39,20 +39,6 @@
#include <rmdtypes.h>
#include <rmdmacro.h>
-int rmdErrorHandler( Display *dpy, XErrorEvent *e )
-{
- char error_desc[1024];
- XGetErrorText(dpy,e->error_code,error_desc,sizeof(error_desc));
- fprintf(stderr,"X Error: %s\n",error_desc);
- fflush(stderr);
- if((e->error_code==BadWindow)&&(e->request_code==X_GetWindowAttributes)){
- fprintf(stderr,"BadWindow on XGetWindowAttributes.\nIgnoring...\n");
- fflush(stderr);
- return 0;
- }
- else
- exit(1);
-}
void *PollEvents(ProgData *pdata){
Window root_return,
@@ -63,7 +49,6 @@ void *PollEvents(ProgData *pdata){
inserts=0;
XEvent event;
- XSetErrorHandler(rmdErrorHandler);
XSelectInput (pdata->dpy,pdata->specs.root, SubstructureNotifyMask);
diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c
index 56d821a..2401dd0 100644
--- a/recordmydesktop/src/recordmydesktop.c
+++ b/recordmydesktop/src/recordmydesktop.c
@@ -40,8 +40,10 @@ int main(int argc,char **argv){
if(ParseArgs(argc,argv,&pdata.args)){
exit(1);
}
- if(pdata.args.display!=NULL)
+ if(pdata.args.display!=NULL){
pdata.dpy = XOpenDisplay(pdata.args.display);
+ XSetErrorHandler(rmdErrorHandler);
+ }
else{
fprintf(stderr,"No display specified for connection!\n");
exit(8);
@@ -100,6 +102,7 @@ int main(int argc,char **argv){
if((exit_status=InitializeData(&pdata,&enc_data,&cache_data))==0){
+
if(!strcmp(pdata.args.pause_shortcut,
pdata.args.stop_shortcut)||
RegisterShortcut(pdata.dpy,
diff --git a/recordmydesktop/src/rmd_error.c b/recordmydesktop/src/rmd_error.c
new file mode 100644
index 0000000..926fb5d
--- /dev/null
+++ b/recordmydesktop/src/rmd_error.c
@@ -0,0 +1,60 @@
+/******************************************************************************
+* recordMyDesktop *
+*******************************************************************************
+* *
+* Copyright (C) 2006,2007 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 *
+******************************************************************************/
+
+
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <rmdfunc.h>
+
+int rmdErrorHandler( Display *dpy, XErrorEvent *e )
+{
+ char error_desc[1024];
+ XGetErrorText(dpy,e->error_code,error_desc,sizeof(error_desc));
+ fprintf(stderr,"X Error: %s\n",error_desc);
+ fflush(stderr);
+ if((e->error_code==BadWindow)&&(e->request_code==X_GetWindowAttributes)){
+ fprintf(stderr,"BadWindow on XGetWindowAttributes.\nIgnoring...\n");
+ fflush(stderr);
+ return 0;
+ }
+ else if((e->error_code==BadAccess)&&(e->request_code==X_GrabKey)){
+ fprintf(stderr,"Bad Access on XGrabKey.\n"
+ "Shortcut already assigned.\n");
+ fflush(stderr);
+ return 0;
+ }
+ else
+ exit(1);
+}
+
+
+
© All Rights Reserved