Main index > Usage problems > adesklet can't get to the bottom of the screen [SOLVED]

By man1ed (Core Contributor), on Sun Mar 13 03:46:47 2005: adesklet can't get to the bottom of the screen [SOLVED].

It seems that by using the interactive "move" command, I can get an adesklet to within 1 pixel of the bottom of the screen, but I can't get it flush against the bottom. The same problem exists moving it to the far right. However, there is no problem moving it to the top of the screen or the left. Is this a known issue? Manually modifying ~/.adesklets is a workaround, but this seems like a bug. I wrote a patch to correct it, included below. I'd be happy to discuss its pros and cons.

Code:


--- adesklets-0.4.5/src/xwindow.c.orig  2005-03-11 23:06:11.000000000 -0800
+++ adesklets-0.4.5/src/xwindow.c       2005-03-11 23:06:11.000000000 -0800
@@ -414,7 +414,7 @@
                      root, cursor, 0)==GrabSuccess) {
        /* Draw initial rectangle */
        XDrawRectangle(display,root,gc,
-                      attr.x,attr.y,attr.width,attr.height);
+                      attr.x,attr.y,attr.width-1,attr.height-1);
        dummy=0;
        do {
          XWindowEvent(display,root,
@@ -431,7 +431,7 @@
            if(dummy) {
              /* Erase final rectangle */
              XDrawRectangle(display,root,gc,
-                            old_x,old_y,attr.width,attr.height);
+                            old_x,old_y,attr.width-1,attr.height-1);
              result=1;
            }
            break;
@@ -440,17 +440,17 @@
            x=attr.x+(ev.xmotion.x-grab_x);
            y=attr.y+(ev.xmotion.y-grab_y);
            /* Rectifies it */
-           x=((x+attr.width)<screen_width)?x:screen_width-attr.width-1;
-           y=((y+attr.height)<screen_height)?y:screen_height-attr.height-1;
+           x=((x+attr.width)<screen_width)?x:screen_width-attr.width;
+           y=((y+attr.height)<screen_height)?y:screen_height-attr.height;
            x=(x>0)?x:0;
            y=(y>0)?y:0;
            /* Draw rectangles: we use a GCxor function for
             not having to remember background data. */
            if (x!=old_x || y!=old_y) {
              XDrawRectangle(display,root,gc,
-                            old_x,old_y,attr.width,attr.height);
+                            old_x,old_y,attr.width-1,attr.height-1);
              XDrawRectangle(display,root,gc,
-                            x,y,attr.width,attr.height);
+                            x,y,attr.width-1,attr.height-1);
            }
            /* Save coordinates */
            old_x=x; old_y=y;

By syfou (Core Developer & Desklet Author), on Sun Mar 13 12:20:31 2005, last edited on Mon Mar 14 01:09:53 2005.

How weird... I looked and looked, and I just cannot apply your patch, either against my present tree or a freshly extracted adesklets 0.4.5. At the same time, I do not see anything wrong with it.

Here is my output, always the same:

Code:


/home/sylvain/adesklets/src/xwindow.c 1.2: 755 lines
Get file /home/sylvain/adesklets/src/xwindow.c from SCCS with lock? [y] 
/home/sylvain/adesklets/src/xwindow.c 1.2 -> 1.3: 755 lines
patching file /home/sylvain/adesklets/src/xwindow.c
Hunk #1 FAILED at 414.
Hunk #2 FAILED at 431.
Hunk #3 FAILED at 440.
3 out of 3 hunks FAILED -- saving rejects to file /home/sylvain/adesklets/src/xwindow.c.rej

By man1ed (Core Contributor), on Sun Mar 13 13:20:34 2005.

It seems like it is trying to patch the right file. Is it possible that your patch version does not support the "unfied" format? I could send a context or traditional diff. Or you could just apply it by hand, it is just adding and removing a few "-1"s.

By syfou (Core Developer & Desklet Author), on Sun Mar 13 13:42:23 2005, last edited on Mon Mar 14 01:11:04 2005.

I used Larry Wall's GNU patch version 2.5.9. It supports unified, context, traditional as well as ed scripts-style patches... I just do not get this, because I do not see anything wrong with your diff, and it do fit with up-to-date xwindow.c file.

I am such a sloppy typist, I would have liked using your submission directly... You could as well have used the make devpatch target for base source directory: it does the same job, with more boundary control for cross platform support.

But do not bother, I will look at it by hand. I will give you some feedback in a few hours.

By syfou (Core Developer & Desklet Author), on Mon Mar 14 00:59:10 2005.

Your provided corrections were included in adesklets - you can check it right away in the public BitKeeper repository. Let me know I you notice in the future any corner cases related to this I would have missed...

Thanks for having made this routine "pixel-perfect". ;-)

[P.-S. By the way, since you provided an accepted patch, you now gained the special rank of [b:d250d51077]Core contributor on the forum. 8) Your efforts were much appreciated.


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.