diff options
| author | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-11-30 23:29:19 +0000 | 
|---|---|---|
| committer | iovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a> | 2007-11-30 23:29:19 +0000 | 
| commit | feee5500811ad81003e9324c60ade31ce6701e19 (patch) | |
| tree | 9820315373321290ae8875641876113126d5585d /recordmydesktop/src/rmd_frame.c | |
| parent | c908820aaaf199ee4e7864ba48d337cc9141cea0 (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/rmd_frame.c')
| -rw-r--r-- | recordmydesktop/src/rmd_frame.c | 152 | 
1 files changed, 152 insertions, 0 deletions
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; +} + + + + + + + +  | 
