Ok, I feel cheap taking northwind87′s post http://orbitalstation.wordpress.com/2011/11/13/done-and-done-pt-2/ and using his valuable information to mess around with mouse controls, but here it is.
I also wanted to try hacking the same functions GetScreenX, GetScreenY, GetClientX, and GetClientY. I will admit I am doing it because at the moment I am lacking the knowledge to look anywhere else. I feel so helpless, but I will have to work with what I know, and I know that these function will let me play with the coordinates.
I tried to to multiply the values by 3 by changing “*aScreenX = GetScreenPoint().x*3;” to “*aScreenX = (GetScreenPoint().x)*3;”
The result is the following!

As expected, the menu shows up at different coordinates then where I right clicked. (which should be 3 times the x coordinate and 3 times the y coordinates)
While I was testing this bug, I was click happy because it was funny to see the menu show up somewhere else, I encountered an Error while playing with my middle mouse button just like northwind87 have reported.

I went to line 1279 of the nsMenuPopupFrame.cpp to investigate and found out that the error is happening (like the error message suggests) because
“
// at this point the anchor (anchorRect) is within the available screen
// area (screenRect) and the popup is known to be no larger than the screen.
// Next, check if there is enough space to show the popup at full size when
// positioned at screenPoint. If not, flip the popups to the opposite side
// of their anchor point, or resize them as necessary.
“
This error occurs in the function:
nsresult
nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, PRBool aIsMove)
So I guess when the right click menu pops up, it does not run this function, but when the mouse scroll picture needs to come up during middle mouse button usage, it runs the fucntion which checks the screen size and if popup can be created where it is being request to be created.
Does this mean someone should program a check for firefox that would check if the right click menu is trying to be displayed outside the screen limits?
I don’t think so. While I was thinking about this I realized why there was no error when right click menus were trying to display outside the screen.
It is because if you were trying to right click very close to the bottom right of the screen, and there is not enough width and height left over from your click point to the most left right point of the screen, you should not get an error, but a menu that is displayed as far left and bottom as possible. It is because of this that firefox will not get error when I change the coordinate reporting functions to report three times the coordinates because it is preprogrammed to show menu at far edge if the coordinate plus width of the menu is off the screen.
Also, This made me think that the check in SetPopUpPosition is redundant? since if the function is reporting the mouse coordinates properly, a user should be able to click off the screen. (Mouse coordinates would be always inside the screen) Only way a user would and should hit this error is if they were to mess around with the coordinate reporting fucntion like I did for this playing/hacking/testing session.
Anyways, I can not thank northwind87 enough for sharing how he played around with the reporting functions. I am going to reply to his thread to ask him how he ended up in that content/events/src/nsDOMMouseEvent.cpp file!