Fix spurious open-paren-in-column-0 in a comment.
[emacs.git] / oldXMenu / Locate.c
blob156d75762b14831dd35c3d3765c5167c6553f1bb
1 #include "copyright.h"
3 /* Copyright Massachusetts Institute of Technology 1985 */
4 /* Copyright (C) 2001, 2002, 2003, 2004, 2005,
5 2006 Free Software Foundation, Inc. */
7 /*
8 * XMenu: MIT Project Athena, X Window system menu package
10 * XMenuLocate - Return data necessary to position and locate
11 * a menu on the screen.
13 * Author: Tony Della Fera, DEC
14 * January 11, 1985
18 #include "XMenuInt.h"
20 int
21 XMenuLocate(display, menu, p_num, s_num, x_pos, y_pos, ul_x, ul_y, width, height)
22 register Display *display; /* Previously opened display. */
23 register XMenu *menu; /* Menu object being located. */
24 int p_num; /* Active pane number. */
25 int s_num; /* Active selection number. */
26 int x_pos; /* X coordinate of mouse active position. */
27 int y_pos; /* Y coordinate of mouse active position. */
28 int *ul_x; /* Returned upper left menu X coordinate. */
29 int *ul_y; /* Returned upper left menu Y coordinate. */
30 int *width; /* Returned menu width. */
31 int *height; /* Returned menu height. */
33 register XMPane *p_ptr; /* XMPane pointer. */
34 register XMSelect *s_ptr; /* XMSelect pointer. */
37 * Are the position arguments positive?
39 if ((x_pos <= 0) || (y_pos <= 0)) {
40 _XMErrorCode = XME_ARG_BOUNDS;
41 return(XM_FAILURE);
45 * Find the right pane.
47 p_ptr = _XMGetPanePtr(menu, p_num);
48 if (p_ptr == NULL) return(XM_FAILURE);
51 * Find the right selection.
53 s_ptr = _XMGetSelectionPtr(p_ptr, s_num);
56 * Check to see that the menu's dependencies have been
57 * recomputed and are up to date. If not, do it now.
59 if (menu->recompute) XMenuRecompute(display, menu);
62 * Compute the new menu origin such that the active point lies
63 * in the center of the desired active pane and selection.
64 * This sets the values of ul_x and ul_y.
66 _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, ul_x, ul_y);
69 * Set remaining return argument values.
71 *width = menu->width;
72 *height = menu->height;
75 * Return successfully.
77 _XMErrorCode = XME_NO_ERROR;
78 return(XM_SUCCESS);
81 /* arch-tag: 1ff94bab-cf67-4c92-bff4-dc0130153173
82 (do not change this comment) */