[vw7.7] Bugs in #resizeRectangle en #dragShape primitives

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[vw7.7] Bugs in #resizeRectangle en #dragShape primitives

Mark Plas

Hi,

 

I think there are two bugs with the resizeRectangle & dragShape primitives on Screen in VW7.7 on Vista (Haven't tried another OS). The first one has to do with multiple monitors, the 2nd one always occurs. [As a note: The first bug is quite important for us because more and more users are starting to use multiple displays].

 

+++ For the first bug:

 

I have configured two monitors with the 2nd monitor being to the left of the main monitor like you can see in this screenshot:

 

 

 

 

When I perform this:

 

                Rectangle fromUser: 100@100 phase: 0@0

 

and I try to draw a rectangle on the left monitor, the rectangle appears one 'grid cell' too much to the right. This problem doesn't occur on the main monitor where the rectangle more or less sticks to the mouse cursor.

 

I believe the reason for this lies in "NTANIM.C" in the alignToGrid macro:

 

#define alignToGrid(coord, gridPhase, gridSpacing, oldCoord)                                              

                /* assumptions: coord >= 0 && (gridSpacing == 0 ||                                                                    

                 * (gridSpacing > 0 && gridPhase >= 0 && gridPhase < gridSpacing))     

                 */                                                                                                                                                                                                                                                                    

                (((gridSpacing) > 0)                                                                                                                                                                                    

                 ? ((int)(((float)((coord) - (gridPhase)) / (gridSpacing)) + 0.5)   

                   * (gridSpacing) + (gridPhase))                                                                                                                                            

                 : (oldCoord))

 

 

The part in red indicates the problem. I think the "+0.5" part is meant to do a rounding of the floating point number, but this only works correctly for positive numbers. Because my 2nd monitor is on the left hand side, its coordinates are all negative. I think the 'round' function has to be used instead of the "+ 0.5".

 

For example, if you evaluate this with the existing macro:

 

alignToGrid(-1020, 0, 50, -1020)

 

then the result will be -950.

 

If on the other hand you would use the round function the result would be -1000 which is the wanted result here.

 

As mentioned at the beginning, this bug is becoming a problem for us because more and more of our users start using multiple displays and we rely on these primitives for some core functionality. Is there a fix available for this, or an acceptable workaround?

 

+++ For the 2nd bug:

 

On Vista (haven't tried another OS), if you do this:

 

 

Rectangle fromUser: 100@100 phase: 0@0.

 

and you hover with the mouse over icons on the desktop, then these icons get highlighted. As soon as you press down the mouse button to start drawing a rectangle, then you also start selecting a rectangular area on the desktop. Or if you would click on a desktop item and start resizing the rectangle, then you start dragging the item over the desktop.

 

It seems that the mouse events get propagated to the desktop during this operation which shouldn't be allowed.

 

Thanks in advance,

Mark


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vw7.7] Bugs in #resizeRectangle en #dragShape primitives

Andres Valloud-6
Thanks!
 
AR 60192: "alignToGrid macro rounds incorrectly"
AR 60193: "Rectangle fromUser:phase: selects desktop icons on Windows"

  
From: [hidden email] [mailto:[hidden email]] On Behalf Of Mark Plas
Sent: Tuesday, May 11, 2010 1:59 AM
To: vwnc NC
Subject: [vwnc] [vw7.7] Bugs in #resizeRectangle en #dragShape primitives

Hi,

 

I think there are two bugs with the resizeRectangle & dragShape primitives on Screen in VW7.7 on Vista (Haven't tried another OS). The first one has to do with multiple monitors, the 2nd one always occurs. [As a note: The first bug is quite important for us because more and more users are starting to use multiple displays].

 

+++ For the first bug:

 

I have configured two monitors with the 2nd monitor being to the left of the main monitor like you can see in this screenshot:

 

 

 

 

When I perform this:

 

                Rectangle fromUser: 100@100 phase: 0@0

 

and I try to draw a rectangle on the left monitor, the rectangle appears one 'grid cell' too much to the right. This problem doesn't occur on the main monitor where the rectangle more or less sticks to the mouse cursor.

 

I believe the reason for this lies in "NTANIM.C" in the alignToGrid macro:

 

#define alignToGrid(coord, gridPhase, gridSpacing, oldCoord)                                              

                /* assumptions: coord >= 0 && (gridSpacing == 0 ||                                                                    

                 * (gridSpacing > 0 && gridPhase >= 0 && gridPhase < gridSpacing))     

                 */                                                                                                                                                                                                                                                                    

                (((gridSpacing) > 0)                                                                                                                                                                                    

                 ? ((int)(((float)((coord) - (gridPhase)) / (gridSpacing)) + 0.5)   

                   * (gridSpacing) + (gridPhase))                                                                                                                                            

                 : (oldCoord))

 

 

The part in red indicates the problem. I think the "+0.5" part is meant to do a rounding of the floating point number, but this only works correctly for positive numbers. Because my 2nd monitor is on the left hand side, its coordinates are all negative. I think the 'round' function has to be used instead of the "+ 0.5".

 

For example, if you evaluate this with the existing macro:

 

alignToGrid(-1020, 0, 50, -1020)

 

then the result will be -950.

 

If on the other hand you would use the round function the result would be -1000 which is the wanted result here.

 

As mentioned at the beginning, this bug is becoming a problem for us because more and more of our users start using multiple displays and we rely on these primitives for some core functionality. Is there a fix available for this, or an acceptable workaround?

 

+++ For the 2nd bug:

 

On Vista (haven't tried another OS), if you do this:

 

 

Rectangle fromUser: 100@100 phase: 0@0.

 

and you hover with the mouse over icons on the desktop, then these icons get highlighted. As soon as you press down the mouse button to start drawing a rectangle, then you also start selecting a rectangular area on the desktop. Or if you would click on a desktop item and start resizing the rectangle, then you start dragging the item over the desktop.

 

It seems that the mouse events get propagated to the desktop during this operation which shouldn't be allowed.

 

Thanks in advance,

Mark


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc