Mercurial > emacs
annotate oldXMenu/Locate.c @ 71930:e631e867af4a
*** empty log message ***
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Mon, 17 Jul 2006 04:19:54 +0000 |
parents | e8a3fb527b77 |
children | ce127a46b1ca d04d8ccb3c41 c5406394f567 |
rev | line source |
---|---|
25858 | 1 #include "copyright.h" |
2 | |
3 /* Copyright Massachusetts Institute of Technology 1985 */ | |
68640
e8a3fb527b77
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65000
diff
changeset
|
4 /* Copyright (C) 2002, 2003, 2004, 2005, |
e8a3fb527b77
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
65000
diff
changeset
|
5 2006 Free Software Foundation, Inc. */ |
25858 | 6 |
7 /* | |
8 * XMenu: MIT Project Athena, X Window system menu package | |
9 * | |
10 * XMenuLocate - Return data necessary to position and locate | |
11 * a menu on the screen. | |
12 * | |
13 * Author: Tony Della Fera, DEC | |
14 * January 11, 1985 | |
15 * | |
16 */ | |
17 | |
18 #include "XMenuInt.h" | |
19 | |
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. */ | |
32 { | |
33 register XMPane *p_ptr; /* XMPane pointer. */ | |
34 register XMSelect *s_ptr; /* XMSelect pointer. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
25858
diff
changeset
|
35 |
25858 | 36 /* |
37 * Are the position arguments positive? | |
38 */ | |
39 if ((x_pos <= 0) || (y_pos <= 0)) { | |
40 _XMErrorCode = XME_ARG_BOUNDS; | |
41 return(XM_FAILURE); | |
42 } | |
43 | |
44 /* | |
45 * Find the right pane. | |
46 */ | |
47 p_ptr = _XMGetPanePtr(menu, p_num); | |
48 if (p_ptr == NULL) return(XM_FAILURE); | |
49 | |
50 /* | |
51 * Find the right selection. | |
52 */ | |
53 s_ptr = _XMGetSelectionPtr(p_ptr, s_num); | |
54 | |
55 /* | |
56 * Check to see that the menu's dependencies have been | |
57 * recomputed and are up to date. If not, do it now. | |
58 */ | |
59 if (menu->recompute) XMenuRecompute(display, menu); | |
60 | |
61 /* | |
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. | |
65 */ | |
66 _XMTransToOrigin(display, menu, p_ptr, s_ptr, x_pos, y_pos, ul_x, ul_y); | |
67 | |
68 /* | |
69 * Set remaining return argument values. | |
70 */ | |
71 *width = menu->width; | |
72 *height = menu->height; | |
73 | |
74 /* | |
75 * Return successfully. | |
76 */ | |
77 _XMErrorCode = XME_NO_ERROR; | |
78 return(XM_SUCCESS); | |
79 } | |
52401 | 80 |
81 /* arch-tag: 1ff94bab-cf67-4c92-bff4-dc0130153173 | |
82 (do not change this comment) */ |