Adding docking and fixing geometry parsing. - xzoom - A simple screen magnifier for X11.
       
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 986fe4832df4664dafc7fa7892bd070640ddf06e
 (DIR) parent 29cb8033f8cda420ff86769aa71d42af81b1b540
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Fri, 21 Oct 2011 11:17:57 +0200
       
       Adding docking and fixing geometry parsing.
       
       Diffstat:
         xzoom.c                             |      40 +++++++++++++++++++++++++++++--
       
       1 file changed, 38 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/xzoom.c b/xzoom.c
       @@ -59,6 +59,8 @@ Screen *scr;
        Window win;
        Atom wm_delete_window;
        Atom wm_protocols;
       +Atom wm_dock;
       +Atom wm_windowtype;
        Status status;
        
        GC gc;
       @@ -225,6 +227,7 @@ Usage(void) {
                        "-mag magnification [ magnification ]\n"
                        "-geometry geometry\n"
                        "-source geometry\n"
       +                "-dock\n"
                        "-x\n"
                        "-y\n"
                        "-xy\n\n"
       @@ -322,6 +325,9 @@ int
        main(int argc, char **argv) {
                XSetWindowAttributes xswa;
                XEvent event;
       +        XTextProperty str;
       +        XSizeHints *sizeh = NULL;
       +        XClassHint *ch;
                int buttonpressed = False;
                int unmapped = True;
                int scroll = 1;
       @@ -332,6 +338,7 @@ main(int argc, char **argv) {
                    dest_geom_mask = NoValue,
                    copy_from_src_mask;
                int xpos = 0, ypos = 0;
       +        int isdock = 0;
        
                atexit(destroy_images);
                progname = strrchr(argv[0], '/');
       @@ -441,6 +448,13 @@ main(int argc, char **argv) {
                                continue;
                        }
        
       +                if(!strcmp(argv[0], "-dock")) {
       +
       +                        isdock = 1;
       +
       +                        continue;
       +                }
       +
                        Usage();
                }
        
       @@ -499,10 +513,10 @@ main(int argc, char **argv) {
                if(dest_geom_mask & XNegative)
                        xpos += WidthOfScreen(scr);
        
       -        if(source_geom_mask & YNegative)
       +        if(dest_geom_mask & YNegative)
                        ypos += HeightOfScreen(scr);
        
       -        /* printf("=%dx%d+%d+%d\n", width[DST], height[DST], xpos, ypos); */
       +        printf("=%dx%d+%d+%d\n", width[DST], height[DST], xpos, ypos);
        
                xswa.event_mask = ButtonPressMask|ButtonReleaseMask|ButtonMotionMask;
                xswa.event_mask |= StructureNotifyMask;        /* resize etc.. */
       @@ -519,6 +533,28 @@ main(int argc, char **argv) {
                                PropModeReplace,
                                (unsigned char *)progname, strlen(progname));
        
       +        if(!isdock) {
       +                sizeh = XAllocSizeHints();
       +                sizeh->flags = PMaxSize | PMinSize;
       +                sizeh->min_width = sizeh->max_width = width[DST];
       +                sizeh->min_height = sizeh->max_height = height[DST];
       +        }
       +        XStringListToTextProperty(&progname, 1, &str);
       +        ch = XAllocClassHint();
       +        ch->res_class = progname;
       +        ch->res_name = progname;
       +
       +        XSetWMProperties(dpy, win, &str, &str, NULL, 0, sizeh, NULL, ch);
       +
       +        if(isdock) {
       +                wm_windowtype = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
       +                wm_dock = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
       +
       +                XChangeProperty(dpy, win, wm_windowtype, XA_ATOM, 32,
       +                                PropModeReplace, (unsigned char *)&wm_dock,
       +                                1);
       +        }
       +
                /*
                XChangeProperty(dpy, win, XA_WM_NAME, XA_STRING, 8,
                                PropModeReplace,