--- tkMenu.c.old	2005-02-26 15:09:57.000000000 +0100
+++ tkMenu.c	2005-02-26 15:20:05.000000000 +0100
@@ -316,13 +316,13 @@
 static CONST char *menuOptions[] = {
     "activate", "add", "cget", "clone", "configure", "delete", "entrycget",
     "entryconfigure", "index", "insert", "invoke", "post", "postcascade",
-    "type", "unpost", "yposition", (char *) NULL
+    "type", "unpost", "xposition", "yposition", (char *) NULL
 };
 enum options {
     MENU_ACTIVATE, MENU_ADD, MENU_CGET, MENU_CLONE, MENU_CONFIGURE,
     MENU_DELETE, MENU_ENTRYCGET, MENU_ENTRYCONFIGURE, MENU_INDEX,
     MENU_INSERT, MENU_INVOKE, MENU_POST, MENU_POSTCASCADE, MENU_TYPE,
-    MENU_UNPOST, MENU_YPOSITION
+    MENU_UNPOST, MENU_XPOSITION, MENU_YPOSITION
 };
 
 /*
@@ -347,6 +347,8 @@
 static int		GetIndexFromCoords
 			    _ANSI_ARGS_((Tcl_Interp *interp, TkMenu *menuPtr,
 			    char *string, int *indexPtr));
+static int		MenuDoXPosition _ANSI_ARGS_((Tcl_Interp *interp,
+			    TkMenu *menuPtr, Tcl_Obj *objPtr));
 static int		MenuDoYPosition _ANSI_ARGS_((Tcl_Interp *interp,
 			    TkMenu *menuPtr, Tcl_Obj *objPtr));
 static int		MenuAddOrInsert _ANSI_ARGS_((Tcl_Interp *interp,
@@ -1031,6 +1033,13 @@
 	    Tk_UnmapWindow(menuPtr->tkwin);
 	    result = TkPostSubmenu(interp, menuPtr, (TkMenuEntry *) NULL);
 	    break;
+	case MENU_XPOSITION:
+	    if (objc != 3) {
+		Tcl_WrongNumArgs(interp, 1, objv, "xposition index");
+		goto error;
+	    }
+	    result = MenuDoXPosition(interp, menuPtr, objv[2]);
+	    break;
 	case MENU_YPOSITION:
 	    if (objc != 3) {
 		Tcl_WrongNumArgs(interp, 1, objv, "yposition index");
@@ -2881,6 +2890,47 @@
 /*
  *----------------------------------------------------------------------
  *
+ * MenuDoXPosition --
+ *
+ *	Given arguments from an option command line, returns the X position.
+ *
+ * Results:
+ *	Returns TCL_OK or TCL_Error
+ *
+ * Side effects:
+ *	xPosition is set to the X-position of the menu entry.
+ *
+ *----------------------------------------------------------------------
+ */
+    
+static int
+MenuDoXPosition(interp, menuPtr, objPtr)
+    Tcl_Interp *interp;
+    TkMenu *menuPtr;
+    Tcl_Obj *objPtr;
+{
+    int index;
+    
+    TkRecomputeMenu(menuPtr);
+    if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
+    	goto error;
+    }
+    Tcl_ResetResult(interp);
+    if (index < 0) {
+	Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+    } else {
+	Tcl_SetObjResult(interp, Tcl_NewIntObj(menuPtr->entries[index]->x));
+    }
+
+    return TCL_OK;
+    
+error:
+    return TCL_ERROR;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
  * MenuDoYPosition --
  *
  *	Given arguments from an option command line, returns the Y position.
