summaryrefslogtreecommitdiff
path: root/recordmydesktop/src
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-11-30 23:29:19 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2007-11-30 23:29:19 +0000
commitfeee5500811ad81003e9324c60ade31ce6701e19 (patch)
tree9820315373321290ae8875641876113126d5585d /recordmydesktop/src
parentc908820aaaf199ee4e7864ba48d337cc9141cea0 (diff)
doc/recordmydesktop.1: added documentation for --no-frame
include/rmdfunc.h: added frame related function prototypes include/rmdmacro.h: default(off) for --no-frame include/rmdtypes.h: added --no-frame(noframe) in args src/rmd_frame.c: create and move around the frame src/Makefile.am: added rmd_frame.c src/parseargs.c: parse --no-frame src/queryextensions.c: check for XShape, too(implicit, non-fatal) src/rmd_frame.c: init, move and draw funcs for the frame. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@445 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src')
-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
5 files changed, 199 insertions, 36 deletions
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