38#include "functions_defs.h"
82#define ENTRY_SPACING 4
103 MenuRoot *menu,
char *win_name,
char *action)
121 ?
"key symbol not found"
122 :
"key code not found");
128 if(
tmp->keysym == keysym &&
137 tmp->next =
Scr->FuncKeyRoot.next;
138 Scr->FuncKeyRoot.next =
tmp;
142 tmp->keysym = keysym;
143 tmp->keycode = keycode;
148 tmp->win_name = win_name;
149 tmp->action = action;
195 tmp->next =
Scr->FuncButtonRoot.next;
196 Scr->FuncButtonRoot.next =
tmp;
227#define SETDEF(btn, ctx, func) AddFuncButton(btn, ctx, 0, func, NULL, NULL)
244 if(
Scr->use3Dmenus) {
275 mr->width - 2 *
Scr->MenuShadowDepth,
Scr->EntryHeight, 1,
276 mi->highlight,
off,
true,
false);
277 FB(
mi->highlight.fore,
mi->highlight.back);
286 mr->width - 2 *
Scr->MenuShadowDepth,
Scr->EntryHeight);
287 FB(
mi->normal.fore,
mi->normal.back);
294 mi->item,
mi->strlen);
296 FB(
Scr->MenuC.shadd,
Scr->MenuC.shadc);
298 Scr->MenuShadowDepth,
300 mr->width -
Scr->MenuShadowDepth,
302 FB(
Scr->MenuC.shadc,
Scr->MenuC.shadd);
304 Scr->MenuShadowDepth,
306 mr->width -
Scr->MenuShadowDepth,
317 x =
mr->width -
Scr->pullW -
Scr->MenuShadowDepth - 2;
324 mr->width - 2 *
Scr->MenuShadowDepth,
Scr->EntryHeight, 1,
325 mi->normal,
off,
true,
false);
326 FB(
mi->normal.fore,
mi->normal.back);
354 mr->width,
Scr->EntryHeight);
355 FB(
mi->highlight.fore,
mi->highlight.back);
366 mr->width,
Scr->EntryHeight);
368 FB(
mi->normal.fore,
mi->normal.back);
385 &
Scr->pullW, &
Scr->pullH);
387 x =
mr->width -
Scr->pullW - 5;
400 mr->width,
Scr->EntryHeight);
408 y = ((
mi->item_num + 1) *
Scr->EntryHeight) - 1;
412 FB(
mi->normal.fore,
mi->normal.back);
423 if(
Scr->use3Dmenus) {
425 Scr->MenuShadowDepth,
Scr->MenuC,
off,
false,
false);
434 (
e->xexpose.y +
e->xexpose.height) >=
y_offset) {
448 if(!
Scr->Workspaces) {
456 for(wlist =
Scr->workSpaceMgr.workSpaceList; wlist !=
NULL;
457 wlist = wlist->
next) {
463 for(wlist =
Scr->workSpaceMgr.workSpaceList; wlist !=
NULL;
464 wlist = wlist->
next) {
471 for(wlist =
Scr->workSpaceMgr.workSpaceList; wlist !=
NULL;
472 wlist = wlist->
next) {
476 Scr->Workspaces->pinned =
false;
641#define UNUSED_PIXEL ((unsigned long) (~0))
657 tmp->real_menu =
false;
669 Scr->LastMenu->next =
tmp;
733 MenuRoot *sub,
int func,
char *fore,
char *back)
742 fprintf(
stderr,
"adding menu item=\"%s\", action=%s, sub=%d, f=%d\n",
743 item, action, sub, func);
759 if((menu ==
Scr->Workspaces) ||
760 (menu ==
Scr->Windows) ||
761 (menu ==
Scr->Icons) ||
762 (menu ==
Scr->AllWindows) ||
765 (menu ==
Scr->AllIcons) ||
768 (menu ==
Scr->Keys) ||
769 (menu ==
Scr->Visible)) {
773 else if(*item ==
'*') {
783 tmp->action = action;
788 tmp->separated =
false;
790 if(!
Scr->HaveFonts) {
808 if(width > menu->
width) {
812 tmp->user_colors =
false;
817 Scr->FirstTime =
true;
820 if(
Scr->use3Dmenus && !
Scr->BeNiceToColormap) {
824 tmp->user_colors =
true;
841 if(
mr->real_menu ==
false) {
866 Scr->EntryHeight =
Scr->MenuFont.height + 4;
872 if(
mr->pull ==
true) {
873 mr->width += 16 + 10;
875 width =
mr->width + 10;
890 mr->height =
mr->items *
Scr->EntryHeight;
892 if(
Scr->use3Dmenus) {
893 mr->width += 2 *
Scr->MenuShadowDepth;
894 mr->height += 2 *
Scr->MenuShadowDepth;
896 if(
Scr->Shadow && !
mr->pinned) {
934 if(
Scr->SaveUnder && !
mr->pinned) {
938 if(
Scr->BackingStore) {
965 5 * ((
int)
xcol.red / 6),
966 5 * ((
int)
xcol.green / 6),
967 5 * ((
int)
xcol.blue / 6));
969 Scr->FirstTime =
true;
983 5 * ((
int)
xcol.red / 6),
984 5 * ((
int)
xcol.green / 6),
985 5 * ((
int)
xcol.blue / 6));
987 Scr->FirstTime =
true;
991 if(
Scr->use3Dmenus && !
Scr->BeNiceToColormap) {
997 if(!
tmp->user_colors) {
999 tmp->normal.fore =
Scr->MenuC.fore;
1000 tmp->normal.back =
Scr->MenuC.back;
1003 tmp->normal.fore =
Scr->MenuTitleC.fore;
1004 tmp->normal.back =
Scr->MenuTitleC.back;
1009 tmp->highlight.fore =
mr->highlight.fore;
1010 tmp->highlight.back =
mr->highlight.back;
1013 tmp->highlight.fore =
tmp->normal.back;
1014 tmp->highlight.back =
tmp->normal.fore;
1016 if(
Scr->use3Dmenus && !
Scr->BeNiceToColormap) {
1035 if(
start->user_colors) {
1045 if(
end->user_colors) {
1056 f1.pixel =
start->normal.fore;
1058 f2.pixel =
end->normal.fore;
1061 b1.pixel =
start->normal.back;
1063 b2.pixel =
end->normal.back;
1101 cur->highlight.back =
cur->normal.fore =
f3.pixel;
1102 cur->highlight.fore =
cur->normal.back =
b3.pixel;
1103 cur->user_colors =
true;
1143 if((menu ==
Scr->Windows) ||
1144 (menu ==
Scr->Icons) ||
1145 (menu ==
Scr->AllWindows) ||
1147 (menu ==
Scr->AllIcons) ||
1149 (menu ==
Scr->Visible)) {
1158 all = (menu ==
Scr->AllWindows);
1171 if(menu ==
Scr->Windows) {
1174 else if(menu ==
Scr->Icons) {
1177 else if(menu ==
Scr->Visible) {
1180 else if(menu ==
Scr->AllIcons) {
1191 for(
ws =
Scr->workSpaceMgr.workSpaceList;
ws !=
NULL;
ws =
ws->next) {
1197 if(!
Scr->currentvs) {
1201 ws =
Scr->currentvs->wsw->currentwspc;
1207 if(
tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win) {
1245 if(
tmp_win ==
Scr->workSpaceMgr.occupyWindow->twm_win) {
1248 if(
Scr->ShortAllWindowsMenus &&
1252 if(
Scr->ShortAllWindowsMenus &&
tmp_win->isiconmgr) {
1275 if(
Scr->CaseSensitive) {
1306 if(menu ==
Scr->Keys) {
1387 y -= (
Scr->EntryHeight / 2);
1421 const int xl =
x + (menu->
width / 2);
1422 const int yt =
y + (
Scr->EntryHeight / 2);
1530 for(item = menu->
first; item;) {
1567 ev.xbutton.x_root -=
Scr->rootx;
1568 ev.xbutton.y_root -=
Scr->rooty;
1569 switch(
ev.xany.type) {
1585 ev.xbutton.x_root -=
Scr->rootx;
1586 ev.xbutton.y_root -=
Scr->rooty;
1591 if(
Scr->DontMoveOff) {
1631 unsigned int w, h,
bw,
d;
1633 for(i = 0, item = menu->
first; item != menu->
last; item = item->
next) {
1643 yt =
y + (i + 0.5) *
Scr->EntryHeight;
1661#define MSLEN (2 + 2 + 5 * 3 + 5 * 3)
1669#define DO(mask, str) do { \
1670 if(key->mods & mask##Mask) { \
1671 const int tslen = sizeof(str) - 1; \
1672 if((modStrCur - modStr + tslen) >= MSLEN) { \
1673 fprintf(stderr, "BUG: No space to add '%s' " \
1674 "in %s()\n", str, __func__); \
1677 strcpy(modStrCur, str); \
1678 modStrCur += tslen; \
1705#define Over1Mask (1<<30)
1708#define OverAllMask (1<<31)
1709 DO(
OverAll,
"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
void UninstallRootColormap(void)
void InstallRootColormap(void)
#define FB(fix_fore, fix_back)
void Draw3DBorder(Window w, int x, int y, int width, int height, int bw, ColorPair cp, ButtonState state, bool fill, bool forcebw)
Pixmap Create3DMenuIcon(unsigned int height, unsigned int *widthp, unsigned int *heightp, ColorPair cp)
Pixmap CreateMenuIcon(int height, unsigned int *widthp, unsigned int *heightp)
void * LookInList(name_list *list_head, const char *name, XClassHint *class)
Info and control for every X Window we take over.
void GetColor(int kind, Pixel *what, const char *name)
Get info from the server about a given color.
void GetShadeColors(ColorPair *cp)
Try and create a 'shaded' version of a color for prettier UI.
void CreateFonts(ScreenInfo *scr)
Load up our various defined fonts.
bool ConstrainByLayout(RLayout *layout, int move_off_res, int *left, int width, int *top, int height)
void ConstrainByBorders1(int *left, int width, int *top, int height)