Steal documentation with tips on email clients
[wmaker-crm.git] / src / winmenu.c
blob8e657e606eb2f489a78bdd9c0fd1b08fc174ae8f
1 /* winmenu.c - command menu for windows
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "wconfig.h"
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <unistd.h>
27 #include <string.h>
29 #include <X11/Xlib.h>
30 #include <X11/Xutil.h>
32 #include "WindowMaker.h"
33 #include "actions.h"
34 #include "menu.h"
35 #include "funcs.h"
36 #include "window.h"
37 #include "client.h"
38 #include "application.h"
39 #include "keybind.h"
40 #include "framewin.h"
41 #include "workspace.h"
42 #include "winspector.h"
43 #include "dialog.h"
44 #include "stacking.h"
45 #include "icon.h"
46 #include "xinerama.h"
48 #define MC_MAXIMIZE 0
49 #define MC_MINIATURIZE 1
50 #define MC_SHADE 2
51 #define MC_HIDE 3
52 #define MC_MOVERESIZE 4
53 #define MC_SELECT 5
54 #define MC_DUMMY_MOVETO 6
55 #define MC_PROPERTIES 7
56 #define MC_OPTIONS 8
57 #define MC_SHORTCUT 8
59 #define MC_CLOSE 9
60 #define MC_KILL 10
62 #define WO_KEEP_ON_TOP 0
63 #define WO_KEEP_AT_BOTTOM 1
64 #define WO_OMNIPRESENT 2
65 #define WO_ENTRIES 3
67 /**** Global data ***/
68 extern Time LastTimestamp;
69 extern Atom _XA_WM_DELETE_WINDOW;
70 extern Atom _XA_GNUSTEP_WM_MINIATURIZE_WINDOW;
72 extern WShortKey wKeyBindings[WKBD_LAST];
74 extern WPreferences wPreferences;
76 static void updateOptionsMenu(WMenu * menu, WWindow * wwin);
78 static void execWindowOptionCommand(WMenu * menu, WMenuEntry * entry)
80 WWindow *wwin = (WWindow *) entry->clientdata;
82 switch (entry->order) {
83 case WO_KEEP_ON_TOP:
84 if (wwin->frame->core->stacking->window_level != WMFloatingLevel)
85 ChangeStackingLevel(wwin->frame->core, WMFloatingLevel);
86 else
87 ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
88 break;
90 case WO_KEEP_AT_BOTTOM:
91 if (wwin->frame->core->stacking->window_level != WMSunkenLevel)
92 ChangeStackingLevel(wwin->frame->core, WMSunkenLevel);
93 else
94 ChangeStackingLevel(wwin->frame->core, WMNormalLevel);
95 break;
97 case WO_OMNIPRESENT:
98 wWindowSetOmnipresent(wwin, !wwin->flags.omnipresent);
99 break;
103 static void execMenuCommand(WMenu * menu, WMenuEntry * entry)
105 WWindow *wwin = (WWindow *) entry->clientdata;
106 WApplication *wapp;
108 CloseWindowMenu(menu->frame->screen_ptr);
110 switch (entry->order) {
111 case MC_CLOSE:
112 /* send delete message */
113 wClientSendProtocol(wwin, _XA_WM_DELETE_WINDOW, LastTimestamp);
114 break;
116 case MC_KILL:
117 wretain(wwin);
118 if (wPreferences.dont_confirm_kill
119 || wMessageDialog(menu->frame->screen_ptr, _("Kill Application"),
121 ("This will kill the application.\nAny unsaved changes will be lost.\nPlease confirm."),
122 _("Yes"), _("No"), NULL) == WAPRDefault) {
123 if (!wwin->flags.destroyed)
124 wClientKill(wwin);
126 wrelease(wwin);
127 break;
129 case MC_MINIATURIZE:
130 if (wwin->flags.miniaturized) {
131 wDeiconifyWindow(wwin);
132 } else {
133 if (wwin->protocols.MINIATURIZE_WINDOW) {
134 wClientSendProtocol(wwin, _XA_GNUSTEP_WM_MINIATURIZE_WINDOW, LastTimestamp);
135 } else {
136 wIconifyWindow(wwin);
139 break;
141 case MC_MAXIMIZE:
142 if (wwin->flags.maximized)
143 wUnmaximizeWindow(wwin);
144 else
145 wMaximizeWindow(wwin, MAX_VERTICAL | MAX_HORIZONTAL);
146 break;
148 case MC_SHADE:
149 if (wwin->flags.shaded)
150 wUnshadeWindow(wwin);
151 else
152 wShadeWindow(wwin);
153 break;
155 case MC_SELECT:
156 if (!wwin->flags.miniaturized)
157 wSelectWindow(wwin, !wwin->flags.selected);
158 else
159 wIconSelect(wwin->icon);
160 break;
162 case MC_MOVERESIZE:
163 wKeyboardMoveResizeWindow(wwin);
164 break;
166 case MC_PROPERTIES:
167 wShowInspectorForWindow(wwin);
168 break;
170 case MC_HIDE:
171 wapp = wApplicationOf(wwin->main_window);
172 wHideApplication(wapp);
173 break;
177 static void switchWSCommand(WMenu * menu, WMenuEntry * entry)
179 WWindow *wwin = (WWindow *) entry->clientdata;
181 wSelectWindow(wwin, False);
182 wWindowChangeWorkspace(wwin, entry->order);
185 static void makeShortcutCommand(WMenu * menu, WMenuEntry * entry)
187 WWindow *wwin = (WWindow *) entry->clientdata;
188 WScreen *scr = wwin->screen_ptr;
189 int index = entry->order - WO_ENTRIES;
191 if (scr->shortcutWindows[index]) {
192 WMFreeArray(scr->shortcutWindows[index]);
193 scr->shortcutWindows[index] = NULL;
196 if (wwin->flags.selected && scr->selected_windows) {
197 scr->shortcutWindows[index] = WMDuplicateArray(scr->selected_windows);
198 /*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
199 WMInsertInArray(scr->shortcutWindows[index], 0, wwin); */
200 } else {
201 scr->shortcutWindows[index] = WMCreateArray(4);
202 WMAddToArray(scr->shortcutWindows[index], wwin);
205 wSelectWindow(wwin, !wwin->flags.selected);
206 XFlush(dpy);
207 wusleep(3000);
208 wSelectWindow(wwin, !wwin->flags.selected);
209 XFlush(dpy);
212 static void updateWorkspaceMenu(WMenu * menu)
214 WScreen *scr = menu->frame->screen_ptr;
215 char title[MAX_WORKSPACENAME_WIDTH + 1];
216 int i;
218 for (i = 0; i < scr->workspace_count; i++) {
219 if (i < menu->entry_no) {
220 if (strcmp(menu->entries[i]->text, scr->workspaces[i]->name) != 0) {
221 wfree(menu->entries[i]->text);
222 strncpy(title, scr->workspaces[i]->name, MAX_WORKSPACENAME_WIDTH);
223 title[MAX_WORKSPACENAME_WIDTH] = 0;
224 menu->entries[i]->text = wstrdup(title);
225 menu->flags.realized = 0;
227 } else {
228 strncpy(title, scr->workspaces[i]->name, MAX_WORKSPACENAME_WIDTH);
229 title[MAX_WORKSPACENAME_WIDTH] = 0;
231 wMenuAddCallback(menu, title, switchWSCommand, NULL);
233 menu->flags.realized = 0;
237 if (!menu->flags.realized)
238 wMenuRealize(menu);
241 static char *getShortcutString(WShortKey key)
243 char *tmp = NULL;
244 char *k = XKeysymToString(XKeycodeToKeysym(dpy, key.keycode, 0));
245 if (!k) return NULL;
247 char **m = wPreferences.modifier_labels;
248 if (key.modifier & ControlMask) tmp = wstrappend(tmp, m[1] ? m[1] : "Ctrl+");
249 if (key.modifier & ShiftMask) tmp = wstrappend(tmp, m[0] ? m[0] : "Shift+");
250 if (key.modifier & Mod1Mask) tmp = wstrappend(tmp, m[2] ? m[2] : "Mod1+");
251 if (key.modifier & Mod2Mask) tmp = wstrappend(tmp, m[3] ? m[3] : "Mod2+");
252 if (key.modifier & Mod3Mask) tmp = wstrappend(tmp, m[4] ? m[4] : "Mod3+");
253 if (key.modifier & Mod4Mask) tmp = wstrappend(tmp, m[5] ? m[5] : "Mod4+");
254 if (key.modifier & Mod5Mask) tmp = wstrappend(tmp, m[6] ? m[6] : "Mod5+");
255 tmp = wstrappend(tmp, k);
257 return tmp;
260 static void updateMakeShortcutMenu(WMenu * menu, WWindow * wwin)
262 WMenu *smenu = menu->cascades[menu->entries[MC_SHORTCUT]->cascade];
263 int i;
264 char *buffer;
265 int buflen;
266 KeyCode kcode;
268 if (!smenu)
269 return;
271 buflen = strlen(_("Set Shortcut")) + 16;
272 buffer = wmalloc(buflen);
274 for (i = WO_ENTRIES; i < smenu->entry_no; i++) {
275 char *tmp;
276 int shortcutNo = i - WO_ENTRIES;
277 WMenuEntry *entry = smenu->entries[i];
278 WMArray *shortSelWindows = wwin->screen_ptr->shortcutWindows[shortcutNo];
280 snprintf(buffer, buflen, "%s %i", _("Set Shortcut"), shortcutNo + 1);
282 if (!shortSelWindows) {
283 entry->flags.indicator_on = 0;
284 } else {
285 entry->flags.indicator_on = 1;
286 if (WMCountInArray(shortSelWindows, wwin))
287 entry->flags.indicator_type = MI_DIAMOND;
288 else
289 entry->flags.indicator_type = MI_CHECK;
292 if (strcmp(buffer, entry->text) != 0) {
293 wfree(entry->text);
294 entry->text = wstrdup(buffer);
295 smenu->flags.realized = 0;
298 kcode = wKeyBindings[WKBD_WINDOW1 + shortcutNo].keycode;
300 if (kcode) {
301 if ((tmp = getShortcutString(wKeyBindings[WKBD_WINDOW1 + shortcutNo]))
302 && (!entry->rtext || strcmp(tmp, entry->rtext) != 0)) {
303 if (entry->rtext)
304 wfree(entry->rtext);
305 entry->rtext = tmp;
306 smenu->flags.realized = 0;
308 wMenuSetEnabled(smenu, i, True);
309 } else {
310 wMenuSetEnabled(smenu, i, False);
311 if (entry->rtext) {
312 wfree(entry->rtext);
313 entry->rtext = NULL;
314 smenu->flags.realized = 0;
317 entry->clientdata = wwin;
319 wfree(buffer);
320 if (!smenu->flags.realized)
321 wMenuRealize(smenu);
324 static void updateOptionsMenu(WMenu * menu, WWindow * wwin)
326 WMenu *smenu = menu->cascades[menu->entries[MC_OPTIONS]->cascade];
328 /* keep on top check */
329 smenu->entries[WO_KEEP_ON_TOP]->clientdata = wwin;
330 smenu->entries[WO_KEEP_ON_TOP]->flags.indicator_on =
331 (wwin->frame->core->stacking->window_level == WMFloatingLevel) ? 1 : 0;
332 wMenuSetEnabled(smenu, WO_KEEP_ON_TOP, !wwin->flags.miniaturized);
334 /* keep at bottom check */
335 smenu->entries[WO_KEEP_AT_BOTTOM]->clientdata = wwin;
336 smenu->entries[WO_KEEP_AT_BOTTOM]->flags.indicator_on =
337 (wwin->frame->core->stacking->window_level == WMSunkenLevel) ? 1 : 0;
338 wMenuSetEnabled(smenu, WO_KEEP_AT_BOTTOM, !wwin->flags.miniaturized);
340 /* omnipresent check */
341 smenu->entries[WO_OMNIPRESENT]->clientdata = wwin;
342 smenu->entries[WO_OMNIPRESENT]->flags.indicator_on = IS_OMNIPRESENT(wwin);
344 smenu->flags.realized = 0;
345 wMenuRealize(smenu);
348 static WMenu *makeWorkspaceMenu(WScreen * scr)
350 WMenu *menu;
352 menu = wMenuCreate(scr, NULL, False);
353 if (!menu) {
354 wwarning(_("could not create submenu for window menu"));
355 return NULL;
358 updateWorkspaceMenu(menu);
360 return menu;
363 static WMenu *makeMakeShortcutMenu(WScreen * scr, WMenu * menu)
366 WMenu *menu;
368 int i;
370 menu = wMenuCreate(scr, NULL, False);
371 if (!menu) {
372 wwarning(_("could not create submenu for window menu"));
373 return NULL;
377 for (i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
378 WMenuEntry *entry;
379 entry = wMenuAddCallback(menu, "", makeShortcutCommand, NULL);
381 entry->flags.indicator = 1;
384 return menu;
387 static WMenu *makeOptionsMenu(WScreen * scr)
389 WMenu *menu;
390 WMenuEntry *entry;
392 menu = wMenuCreate(scr, NULL, False);
393 if (!menu) {
394 wwarning(_("could not create submenu for window menu"));
395 return NULL;
398 entry = wMenuAddCallback(menu, _("Keep on top"), execWindowOptionCommand, NULL);
399 entry->flags.indicator = 1;
400 entry->flags.indicator_type = MI_CHECK;
402 entry = wMenuAddCallback(menu, _("Keep at bottom"), execWindowOptionCommand, NULL);
403 entry->flags.indicator = 1;
404 entry->flags.indicator_type = MI_CHECK;
406 entry = wMenuAddCallback(menu, _("Omnipresent"), execWindowOptionCommand, NULL);
407 entry->flags.indicator = 1;
408 entry->flags.indicator_type = MI_CHECK;
410 return menu;
413 static WMenu *createWindowMenu(WScreen * scr)
415 WMenu *menu;
416 WMenuEntry *entry;
418 menu = wMenuCreate(scr, NULL, False);
420 * Warning: If you make some change that affects the order of the
421 * entries, you must update the command #defines in the top of
422 * this file.
424 entry = wMenuAddCallback(menu, _("Maximize"), execMenuCommand, NULL);
425 entry->rtext = getShortcutString(wKeyBindings[WKBD_MAXIMIZE]);
427 entry = wMenuAddCallback(menu, _("Miniaturize"), execMenuCommand, NULL);
428 entry->rtext = getShortcutString(wKeyBindings[WKBD_MINIATURIZE]);
430 entry = wMenuAddCallback(menu, _("Shade"), execMenuCommand, NULL);
431 entry->rtext = getShortcutString(wKeyBindings[WKBD_SHADE]);
433 entry = wMenuAddCallback(menu, _("Hide"), execMenuCommand, NULL);
434 entry->rtext = getShortcutString(wKeyBindings[WKBD_HIDE]);
436 entry = wMenuAddCallback(menu, _("Resize/Move"), execMenuCommand, NULL);
437 entry->rtext = getShortcutString(wKeyBindings[WKBD_MOVERESIZE]);
439 entry = wMenuAddCallback(menu, _("Select"), execMenuCommand, NULL);
440 entry->rtext = getShortcutString(wKeyBindings[WKBD_SELECT]);
442 entry = wMenuAddCallback(menu, _("Move To"), NULL, NULL);
443 scr->workspace_submenu = makeWorkspaceMenu(scr);
444 if (scr->workspace_submenu)
445 wMenuEntrySetCascade(menu, entry, scr->workspace_submenu);
447 entry = wMenuAddCallback(menu, _("Attributes..."), execMenuCommand, NULL);
449 entry = wMenuAddCallback(menu, _("Options"), NULL, NULL);
450 wMenuEntrySetCascade(menu, entry, makeMakeShortcutMenu(scr, makeOptionsMenu(scr)));
453 entry = wMenuAddCallback(menu, _("Select Shortcut"), NULL, NULL);
454 wMenuEntrySetCascade(menu, entry, makeMakeShortcutMenu(scr));
457 entry = wMenuAddCallback(menu, _("Close"), execMenuCommand, NULL);
458 entry->rtext = getShortcutString(wKeyBindings[WKBD_CLOSE]);
460 entry = wMenuAddCallback(menu, _("Kill"), execMenuCommand, NULL);
462 return menu;
465 void CloseWindowMenu(WScreen * scr)
467 if (scr->window_menu) {
468 if (scr->window_menu->flags.mapped)
469 wMenuUnmap(scr->window_menu);
471 if (scr->window_menu->entries[0]->clientdata) {
472 WWindow *wwin = (WWindow *) scr->window_menu->entries[0]->clientdata;
474 wwin->flags.menu_open_for_me = 0;
476 scr->window_menu->entries[0]->clientdata = NULL;
480 static void updateMenuForWindow(WMenu * menu, WWindow * wwin)
482 WApplication *wapp = wApplicationOf(wwin->main_window);
483 WScreen *scr = wwin->screen_ptr;
484 int i;
486 updateOptionsMenu(menu, wwin);
488 updateMakeShortcutMenu(menu, wwin);
490 wMenuSetEnabled(menu, MC_HIDE, wapp != NULL && !WFLAGP(wapp->main_window_desc, no_appicon));
492 wMenuSetEnabled(menu, MC_CLOSE, (wwin->protocols.DELETE_WINDOW && !WFLAGP(wwin, no_closable)));
494 if (wwin->flags.miniaturized) {
495 static char *text = NULL;
496 if (!text)
497 text = _("Deminiaturize");
499 menu->entries[MC_MINIATURIZE]->text = text;
500 } else {
501 static char *text = NULL;
502 if (!text)
503 text = _("Miniaturize");
505 menu->entries[MC_MINIATURIZE]->text = text;
508 wMenuSetEnabled(menu, MC_MINIATURIZE, !WFLAGP(wwin, no_miniaturizable));
510 if (wwin->flags.maximized) {
511 static char *text = NULL;
512 if (!text)
513 text = _("Unmaximize");
515 menu->entries[MC_MAXIMIZE]->text = text;
516 } else {
517 static char *text = NULL;
518 if (!text)
519 text = _("Maximize");
521 menu->entries[MC_MAXIMIZE]->text = text;
523 wMenuSetEnabled(menu, MC_MAXIMIZE, IS_RESIZABLE(wwin));
525 wMenuSetEnabled(menu, MC_MOVERESIZE, IS_RESIZABLE(wwin)
526 && !wwin->flags.miniaturized);
528 if (wwin->flags.shaded) {
529 static char *text = NULL;
530 if (!text)
531 text = _("Unshade");
533 menu->entries[MC_SHADE]->text = text;
534 } else {
535 static char *text = NULL;
536 if (!text)
537 text = _("Shade");
539 menu->entries[MC_SHADE]->text = text;
542 wMenuSetEnabled(menu, MC_SHADE, !WFLAGP(wwin, no_shadeable)
543 && !wwin->flags.miniaturized);
545 wMenuSetEnabled(menu, MC_DUMMY_MOVETO, !IS_OMNIPRESENT(wwin));
547 if (!wwin->flags.inspector_open) {
548 wMenuSetEnabled(menu, MC_PROPERTIES, True);
549 } else {
550 wMenuSetEnabled(menu, MC_PROPERTIES, False);
553 /* set the client data of the entries to the window */
554 for (i = 0; i < menu->entry_no; i++) {
555 menu->entries[i]->clientdata = wwin;
558 for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
559 scr->workspace_submenu->entries[i]->clientdata = wwin;
560 if (i == scr->current_workspace) {
561 wMenuSetEnabled(scr->workspace_submenu, i, False);
562 } else {
563 wMenuSetEnabled(scr->workspace_submenu, i, True);
567 menu->flags.realized = 0;
568 wMenuRealize(menu);
571 void OpenWindowMenu(WWindow * wwin, int x, int y, int keyboard)
573 WMenu *menu;
574 WScreen *scr = wwin->screen_ptr;
575 WMRect rect;
577 wwin->flags.menu_open_for_me = 1;
579 if (!scr->window_menu) {
580 scr->window_menu = createWindowMenu(scr);
582 /* hack to save some memory allocation/deallocation */
583 wfree(scr->window_menu->entries[MC_MINIATURIZE]->text);
584 wfree(scr->window_menu->entries[MC_MAXIMIZE]->text);
585 wfree(scr->window_menu->entries[MC_SHADE]->text);
586 } else {
587 updateWorkspaceMenu(scr->workspace_submenu);
590 menu = scr->window_menu;
591 if (menu->flags.mapped) {
592 wMenuUnmap(menu);
593 if (menu->entries[0]->clientdata == wwin) {
594 return;
598 updateMenuForWindow(menu, wwin);
600 x -= menu->frame->core->width / 2;
601 if (x + menu->frame->core->width > wwin->frame_x + wwin->frame->core->width)
602 x = wwin->frame_x + wwin->frame->core->width - menu->frame->core->width;
603 if (x < wwin->frame_x)
604 x = wwin->frame_x;
606 rect = wGetRectForHead(menu->frame->screen_ptr,
607 wGetHeadForPointerLocation(menu->frame->screen_ptr));
608 if (x < rect.pos.x - menu->frame->core->width / 2)
609 x = rect.pos.x - menu->frame->core->width / 2;
610 if (y < rect.pos.y)
611 y = rect.pos.y;
613 if (!wwin->flags.internal_window)
614 wMenuMapAt(menu, x, y, keyboard);
617 void OpenWindowMenu2(WWindow *wwin, int x, int y, int keyboard)
619 int i;
620 WMenu *menu;
621 WScreen *scr = wwin->screen_ptr;
622 WMRect rect;
624 wwin->flags.menu_open_for_me = 1;
626 if (!scr->window_menu) {
627 scr->window_menu = createWindowMenu(scr);
629 /* hack to save some memory allocation/deallocation */
630 wfree(scr->window_menu->entries[MC_MINIATURIZE]->text);
631 wfree(scr->window_menu->entries[MC_MAXIMIZE]->text);
632 wfree(scr->window_menu->entries[MC_SHADE]->text);
633 } else {
634 updateWorkspaceMenu(scr->workspace_submenu);
637 menu = scr->window_menu;
638 if (menu->flags.mapped) {
639 wMenuUnmap(menu);
640 if (menu->entries[0]->clientdata == wwin) {
641 return;
645 updateMenuForWindow(menu, wwin);
647 for (i = 0; i < scr->workspace_submenu->entry_no; i++) {
648 scr->workspace_submenu->entries[i]->clientdata = wwin;
649 wMenuSetEnabled(scr->workspace_submenu, i, True);
652 x -= menu->frame->core->width / 2;
654 rect = wGetRectForHead(menu->frame->screen_ptr,
655 wGetHeadForPointerLocation(menu->frame->screen_ptr));
656 if (x < rect.pos.x - menu->frame->core->width / 2)
657 x = rect.pos.x - menu->frame->core->width / 2;
658 if (y < rect.pos.y)
659 y = rect.pos.y;
661 if (!wwin->flags.internal_window)
662 wMenuMapAt(menu, x, y, keyboard);
665 void OpenMiniwindowMenu(WWindow * wwin, int x, int y)
667 WMenu *menu;
668 WScreen *scr = wwin->screen_ptr;
670 wwin->flags.menu_open_for_me = 1;
672 if (!scr->window_menu) {
673 scr->window_menu = createWindowMenu(scr);
675 /* hack to save some memory allocation/deallocation */
676 wfree(scr->window_menu->entries[MC_MINIATURIZE]->text);
677 wfree(scr->window_menu->entries[MC_MAXIMIZE]->text);
678 wfree(scr->window_menu->entries[MC_SHADE]->text);
679 } else {
680 updateWorkspaceMenu(scr->workspace_submenu);
683 menu = scr->window_menu;
684 if (menu->flags.mapped) {
685 wMenuUnmap(menu);
686 if (menu->entries[0]->clientdata == wwin) {
687 return;
691 updateMenuForWindow(menu, wwin);
693 x -= menu->frame->core->width / 2;
695 wMenuMapAt(menu, x, y, False);
698 void DestroyWindowMenu(WScreen *scr)
700 if (scr->window_menu) {
701 scr->window_menu->entries[MC_MINIATURIZE]->text = NULL;
702 scr->window_menu->entries[MC_MAXIMIZE]->text = NULL;
703 scr->window_menu->entries[MC_SHADE]->text = NULL;
704 wMenuDestroy(scr->window_menu, True);
705 scr->window_menu = NULL;