Stricter file handling when following Read statements (fvwm-convert-2.6).
[fvwm.git] / fvwm / menugeometry.c
blob9210aa76451911b65cda879fe14b53e7f9c04c27
1 /* -*-c-*- */
2 /* This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 /* ---------------------------- included header files ---------------------- */
19 #include "config.h"
21 #include <stdio.h>
23 #include <X11/keysym.h>
25 #include "fvwm.h"
26 #include "externs.h"
27 #include "execcontext.h"
28 #include "misc.h"
29 #include "screen.h"
30 #include "menudim.h"
31 #include "menuroot.h"
32 #include "menuparameters.h"
33 #include "menugeometry.h"
35 /* ---------------------------- local definitions -------------------------- */
37 /* ---------------------------- local macros ------------------------------- */
39 /* ---------------------------- imports ------------------------------------ */
41 /* ---------------------------- included code files ------------------------ */
43 /* ---------------------------- local types -------------------------------- */
45 /* ---------------------------- forward declarations ----------------------- */
47 /* ---------------------------- local variables ---------------------------- */
49 /* ---------------------------- exported variables (globals) --------------- */
51 /* ---------------------------- local functions ---------------------------- */
53 /* ---------------------------- interface functions ------------------------ */
55 Bool menu_get_geometry(
56 struct MenuRoot *mr, Window *root_return, int *x_return, int *y_return,
57 int *width_return, int *height_return, int *border_width_return,
58 int *depth_return)
60 Status rc;
61 Bool brc;
62 int root_x;
63 int root_y;
65 rc = XGetGeometry(
66 dpy, MR_WINDOW(mr), root_return, x_return, y_return,
67 (unsigned int*)width_return, (unsigned int*)height_return,
68 (unsigned int*)border_width_return,
69 (unsigned int*)depth_return);
70 if (rc == 0)
72 return False;
74 if (!MR_IS_TEAR_OFF_MENU(mr))
76 return True;
78 brc = XTranslateCoordinates(
79 dpy, MR_WINDOW(mr), Scr.Root, *x_return, *y_return, &root_x,
80 &root_y, &JunkChild);
81 if (brc == True)
83 *x_return = root_x;
84 *y_return = root_y;
86 else
88 *x_return = 0;
89 *y_return = 0;
92 return brc;
95 Bool menu_get_outer_geometry(
96 struct MenuRoot *mr, struct MenuParameters *pmp, Window *root_return,
97 int *x_return, int *y_return, int *width_return, int *height_return,
98 int *border_width_return, int *depth_return)
100 if (MR_IS_TEAR_OFF_MENU(mr))
102 return XGetGeometry(
103 dpy,
104 FW_W_FRAME(pmp->tear_off_root_menu_window),
105 root_return,x_return,y_return,
106 (unsigned int*)width_return,
107 (unsigned int*)height_return,
108 (unsigned int*)border_width_return,
109 (unsigned int*)depth_return);
111 else
113 return menu_get_geometry(
114 mr,root_return,x_return,y_return,
115 width_return, height_return, border_width_return,
116 depth_return);