summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/doc/recordmydesktop.18
-rw-r--r--recordmydesktop/include/rmdfunc.h66
-rw-r--r--recordmydesktop/include/rmdmacro.h1
-rw-r--r--recordmydesktop/include/rmdtypes.h1
-rw-r--r--recordmydesktop/src/Makefile.am3
-rw-r--r--recordmydesktop/src/get_frame.c63
-rw-r--r--recordmydesktop/src/parseargs.c3
-rw-r--r--recordmydesktop/src/queryextensions.c14
-rw-r--r--recordmydesktop/src/rmd_frame.c152
9 files changed, 274 insertions, 37 deletions
diff --git a/recordmydesktop/doc/recordmydesktop.1 b/recordmydesktop/doc/recordmydesktop.1
index 4965457..e8839e4 100644
--- a/recordmydesktop/doc/recordmydesktop.1
+++ b/recordmydesktop/doc/recordmydesktop.1
@@ -366,6 +366,14 @@ Misc Options:
.br
.TP
.B
+ \-\-no\-frame
+ Normally, around the recording area, there is drawn a frame to assist
+ the user in identifying what does and what doesn't get captured.
+ This frame will also follow around the mouse, when \-\-follow\-mouse
+ is used. If you do not wish this frame to appear, use this option.
+.br
+.TP
+.B
\-pause\-shortcut MOD+KEY
Shortcut that will be used for pausing or unpausing the recording.
MOD can be any combination of the following modifier keys:
diff --git a/recordmydesktop/include/rmdfunc.h b/recordmydesktop/include/rmdfunc.h
index b5bafd8..dad87dd 100644
--- a/recordmydesktop/include/rmdfunc.h
+++ b/recordmydesktop/include/rmdfunc.h
@@ -723,10 +723,74 @@ int RegisterShortcut(Display *dpy,
* otherwise.
*
*/
-
int rmdErrorHandler(Display *dpy,XErrorEvent *e);
+/*
+ * Create a frame that marks the recording area.
+ *
+ * \param dpy Connection to the X Server
+ *
+ * \param screen Recorded screen
+ *
+ * \param root Root window of the display
+ *
+ * \param x X pos of the recorded area
+ *
+ * \param y Y pos of the recorded area
+ *
+ * \param width Width of the recorded area
+ *
+ * \param height Height of the recorded area
+ *
+ * \returns The WindowID of the frame
+ *
+ */
+Window rmdFrameInit(Display *dpy,
+ int screen,
+ Window root,
+ int x,
+ int y,
+ int width,
+ int height);
+
+
+/*
+ * Move the frame (subtracts the borderwidth)
+ *
+ * \param dpy Connection to the X Server
+ *
+ * \param win WindowId of the frame
+ *
+ * \param x New X pos of the recorded area
+ *
+ * \param y New Y pos of the recorded area
+ *
+ */
+void rmdMoveFrame(Display *dpy,
+ Window win,
+ int x,
+ int y);
+
+/*
+ * Redraw the frame that marks the recording area.
+ *
+ * \param dpy Connection to the X Server
+ *
+ * \param screen Recorded screen
+ *
+ * \param win WindoID of the frame
+ *
+ * \param width Width of the recorded area
+ *
+ * \param height Height of the recorded area
+ *
+ */
+void rmdDrawFrame(Display *dpy,
+ int screen,
+ Window win,
+ int width,
+ int height);
#endif
diff --git a/recordmydesktop/include/rmdmacro.h b/recordmydesktop/include/rmdmacro.h
index d167675..3f3564c 100644
--- a/recordmydesktop/include/rmdmacro.h
+++ b/recordmydesktop/include/rmdmacro.h
@@ -207,6 +207,7 @@
(args)->use_jack=\
(args)->noshared=\
(args)->no_encode=\
+ (args)->noframe=\
(args)->jack_nports=0;\
(args)->jack_ringbuffer_secs=3.0;\
(args)->jack_port_names=NULL;\
diff --git a/recordmydesktop/include/rmdtypes.h b/recordmydesktop/include/rmdtypes.h
index 70e050c..b84a148 100644
--- a/recordmydesktop/include/rmdtypes.h
+++ b/recordmydesktop/include/rmdtypes.h
@@ -165,6 +165,7 @@ typedef struct _ProgArgs{
char *workdir; //directory to be used for cache files(default $HOME)
char *pause_shortcut; //pause/unpause shortcut sequence(Control+Alt+p)
char *stop_shortcut; //stop shortcut sequence(Control+Alt+s)
+ int noframe; //don't draw a frame around the recording area
int zerocompression; //image data are always flushed uncompressed
int overwrite; //overwite a previously existing file
//(do not add a .number postfix)
diff --git a/recordmydesktop/src/Makefile.am b/recordmydesktop/src/Makefile.am
index e105669..177cafe 100644
--- a/recordmydesktop/src/Makefile.am
+++ b/recordmydesktop/src/Makefile.am
@@ -32,7 +32,8 @@ recordmydesktop_SOURCES= recordmydesktop.c\
cleanup.c\
specsfile.c\
shortcuts.c\
- rmd_error.c
+ rmd_error.c\
+ rmd_frame.c
INCLUDES= $(all_includes) -I$(top_srcdir)/include
diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c
index 683e68e..b0f9383 100644
--- a/recordmydesktop/src/get_frame.c
+++ b/recordmydesktop/src/get_frame.c
@@ -27,11 +27,6 @@
#include <recordmydesktop.h>
-#ifdef USE_GLX_CAP
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glx.h>
-#endif
int FirstFrame(ProgData *pdata,XImage **image,XShmSegmentInfo *shminfo,
char **pxl_data){
@@ -139,7 +134,9 @@ void *GetFrame(ProgData *pdata){
unsigned int msk_ret;
WGeometry mouse_pos_abs,mouse_pos_rel,mouse_pos_temp;
BRWindow temp_brwin;
- Window root_ret,child_ret;
+ Window root_ret,
+ child_ret,
+ shaped_w=None; //Frame
XFixesCursorImage *xcim=NULL;
XImage *image=NULL,*image_back=NULL; //the image that holds
//the current full screenshot
@@ -150,20 +147,6 @@ void *GetFrame(ProgData *pdata){
-#ifdef USE_GLX_CAP
- XVisualInfo vinfo_return;
- XMatchVisualInfo(pdata->dpy,pdata->specs.screen,pdata->specs.depth,TrueColor,&vinfo_return );
- GLXContext ctx=glXCreateContext( pdata->dpy,
- &vinfo_return,
- NULL,
- True);
-// fprintf(stderr,"here %d",pdata->args.windowid);
- glXMakeCurrent( pdata->dpy,
- pdata->brwin.windowid,
- ctx);
-
- glReadBuffer(GL_FRONT);
-#endif
img_sel=d_buff=pdata->args.full_shots;
@@ -202,6 +185,15 @@ void *GetFrame(ProgData *pdata){
}
+ if(!pdata->args.noframe){
+ shaped_w=rmdFrameInit(pdata->dpy,
+ pdata->specs.screen,
+ pdata->specs.root,
+ pdata->brwin.rgeom.x,
+ pdata->brwin.rgeom.y,
+ pdata->brwin.rgeom.width,
+ pdata->brwin.rgeom.height);
+ }
mouse_pos_abs.x=mouse_pos_temp.x=0;
mouse_pos_abs.y=mouse_pos_temp.y=0;
@@ -276,6 +268,18 @@ void *GetFrame(ProgData *pdata){
((pdata->args.xfixes_cursor)?xcim->yhot:0),
pdata->specs.width,
pdata->specs.height);
+ if(!pdata->args.noframe){
+ rmdMoveFrame(pdata->dpy,
+ shaped_w,
+ temp_brwin.rgeom.x,
+ temp_brwin.rgeom.y);
+
+ rmdDrawFrame(pdata->dpy,
+ pdata->specs.screen,
+ shaped_w,
+ pdata->brwin.rgeom.width,
+ pdata->brwin.rgeom.height);
+ }
}
if(!pdata->args.full_shots){
@@ -306,20 +310,10 @@ void *GetFrame(ProgData *pdata){
((unsigned char*)image_back->data));
if(!pdata->args.noshared){
-#ifdef USE_GLX_CAP
- glReadPixels(0,
- 0,
- temp_brwin.rgeom.width,
- temp_brwin.rgeom.height,
- GL_RGBA,
- GL_UNSIGNED_BYTE,
- front_buff);
-#else
XShmGetImage(pdata->dpy,pdata->specs.root,
((!img_sel)?image:image_back),
(temp_brwin.rgeom.x),
(temp_brwin.rgeom.y),AllPlanes);
-#endif
}
if(pdata->args.noshared){
GetZPixmap( pdata->dpy,
@@ -429,9 +423,12 @@ void *GetFrame(ProgData *pdata){
pthread_mutex_unlock(&pdata->img_buff_ready_mutex);
capture_busy=0;
}
-#ifdef USE_GLX_CAP
- glXDestroyContext(pdata->dpy,ctx);
-#endif
+
+ if(!pdata->args.noframe){
+ XDestroyWindow(pdata->dpy,shaped_w);
+ }
+
+
pthread_mutex_lock(&pdata->img_buff_ready_mutex);
pthread_cond_broadcast(&pdata->image_buffer_ready);
pthread_mutex_unlock(&pdata->img_buff_ready_mutex);
diff --git a/recordmydesktop/src/parseargs.c b/recordmydesktop/src/parseargs.c
index 1ed0cc1..3bca909 100644
--- a/recordmydesktop/src/parseargs.c
+++ b/recordmydesktop/src/parseargs.c
@@ -524,6 +524,9 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){
else if(!strcmp(argv[i],"--full-shots")){
arg_return->full_shots=1;
}
+ else if(!strcmp(argv[i],"--no-frame")){
+ arg_return->noframe=1;
+ }
else if(!strcmp(argv[i],"--follow-mouse")){
arg_return->full_shots=1;
arg_return->follow_mouse=1;
diff --git a/recordmydesktop/src/queryextensions.c b/recordmydesktop/src/queryextensions.c
index 6a380c5..4fc7783 100644
--- a/recordmydesktop/src/queryextensions.c
+++ b/recordmydesktop/src/queryextensions.c
@@ -26,6 +26,7 @@
#include <recordmydesktop.h>
+#include <X11/extensions/shape.h>
void QueryExtensions(Display *dpy,
ProgArgs *args,
@@ -35,7 +36,9 @@ void QueryExtensions(Display *dpy,
int xf_event_basep,
xf_error_basep,
shm_event_base,
- shm_error_base;
+ shm_error_base,
+ shape_event_base,
+ shape_error_base;
if((!(args->full_shots))&&(!XDamageQueryExtension( dpy, damage_event, damage_error))){
fprintf(stderr,"XDamage extension not found!!!\n"
@@ -54,7 +57,6 @@ void QueryExtensions(Display *dpy,
"Try again using the --no-shared option\n");
exit(5);
}
-
if((args->xfixes_cursor)&&
(XFixesQueryExtension(dpy,&xf_event_basep,&xf_error_basep)==False)){
args->xfixes_cursor=0;
@@ -63,4 +65,12 @@ void QueryExtensions(Display *dpy,
" --no-cursor option.\n");
exit(6);
}
+ if((!args->noframe)&&
+ (!XShapeQueryExtension(dpy,&shape_event_base,&shape_error_base))){
+ fprintf(stderr,"XShape Not Found!!!\n"
+ "Frame won't be available.\n");
+
+ args->noframe=1;
+ }
+
}
diff --git a/recordmydesktop/src/rmd_frame.c b/recordmydesktop/src/rmd_frame.c
new file mode 100644
index 0000000..d49613c
--- /dev/null
+++ b/recordmydesktop/src/rmd_frame.c
@@ -0,0 +1,152 @@
+/******************************************************************************
+* 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 *
+******************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/shape.h>
+
+#define BORDER_WIDTH 6
+#define OUTLINE_WIDTH 1
+
+void rmdDrawFrame(Display *dpy,
+ int screen,
+ Window win,
+ int width,
+ int height){
+
+ GC gc;
+ XGCValues gcv;
+ XColor white, white_e,
+ black, black_e ;
+ unsigned long gcmask=GCForeground;
+
+ XAllocNamedColor(dpy,DefaultColormap(dpy, screen),"white", &white, &white_e);
+ XAllocNamedColor(dpy,DefaultColormap(dpy, screen),"black", &black, &black_e);
+
+ gcv.foreground = black.pixel;
+ gc = XCreateGC(dpy,win, gcmask,&gcv);
+ XFillRectangle(dpy,
+ win,
+ gc,
+ OUTLINE_WIDTH,
+ OUTLINE_WIDTH,
+ width+(BORDER_WIDTH-OUTLINE_WIDTH)*2,
+ height+(BORDER_WIDTH-OUTLINE_WIDTH)*2);
+ gcv.foreground = white.pixel;
+ XChangeGC(dpy,gc,gcmask,&gcv);
+ XFillRectangle(dpy,
+ win,
+ gc,
+ BORDER_WIDTH-OUTLINE_WIDTH,
+ BORDER_WIDTH-OUTLINE_WIDTH,
+ width+OUTLINE_WIDTH*2,
+ height+OUTLINE_WIDTH*2);
+
+ XFreeGC(dpy, gc);
+
+}
+
+
+void rmdMoveFrame(Display *dpy,
+ Window win,
+ int x,
+ int y){
+
+ XMoveWindow(dpy,
+ win,
+ x-BORDER_WIDTH,
+ y-BORDER_WIDTH);
+
+// XSync(pdata->dpy,False);
+
+}
+
+Window rmdFrameInit(Display *dpy,
+ int screen,
+ Window root,
+ int x,
+ int y,
+ int width,
+ int height){
+
+ XSetWindowAttributes attribs;
+ XColor white, white_e;
+ Window win;
+ unsigned long valuemask=CWBackPixmap|CWBackPixel|
+ CWSaveUnder|CWOverrideRedirect|CWColormap;
+
+ XAllocNamedColor(dpy,DefaultColormap(dpy, screen),"white", &white, &white_e);
+
+ attribs.background_pixmap=None;
+ attribs.background_pixel=white.pixel;
+ attribs.save_under=True;
+ attribs.override_redirect=True;
+ attribs.colormap=DefaultColormap(dpy,screen);
+
+ win = XCreateWindow(dpy,
+ root,
+ x-BORDER_WIDTH,
+ y-BORDER_WIDTH,
+ width+BORDER_WIDTH*2,
+ height+BORDER_WIDTH*2,
+ 0,
+ CopyFromParent,
+ InputOutput,
+ CopyFromParent,
+ valuemask,
+ &attribs);
+
+
+ XRectangle rect;
+ rect.x=rect.y=BORDER_WIDTH;
+ rect.width=width;
+ rect.height=height;
+
+ XShapeCombineRectangles(dpy,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeSubtract,
+ 0);
+
+ XMapWindow(dpy, win);
+
+ rmdDrawFrame(dpy,screen,win,width,height);
+
+ return win;
+}
+
+
+
+
+
+
+
+
© All Rights Reserved