Mouse x and y relative to current region?

I need to figure out where percentage wise the mouse is in a given region.

Right now I’m doing the following in a custom operator

  1. get region width (context.region.width)
  2. get mouse_x (event.mouse_x)
  3. do some math (100 / region_width) * mouse_x = percent_x

The problem is that mouse_x is not relative to the region the mouse so it screws up my math. Sooo, does anyone now how i can get the mouse position relative to the region its in?

Thanks in advance!

if this is in 2.5 there is a functoin to get the cursor location

dist_vec = scene.cursor_location

have you tried this instruction ?
it should give the coordiantes in blender units

happy 2.5

Thanks, but I think what your talking about just gives the location of the 3d cursor that you see in the 3d view. What I need is to get the mouse position and it must be able to get it in any type of window (properties, outliner, etc) not just the 3d view.

Basically I’m trying to create a customized version of the area_split function that will open a menu for horizontal or vertical splitting then split the window wherever the mouse is after you make the selection.