Thu Sep 2 09:44:46 PDT 1999

(Raster)

added group menu (shit middle button on root) patch - nice :)
fixed some buffer overflow problems in the ipc.c code that cause segfaults.
fixed alert box form trying to run commands it cant find form rememberd states
on startup
fixed group null setting.
I flimmed.


SVN revision: 158
This commit is contained in:
Carsten Haitzler 1999-09-02 16:40:05 +00:00
parent c3120d2c14
commit 7e23d961d7
13 changed files with 330 additions and 152 deletions

View File

@ -1144,3 +1144,15 @@ Wed Sep 1 18:08:53 PDT 1999
(Raster)
fix minor problem introduced by fixing other shape bug.. :)
-------------------------------------------------------------------------------
Thu Sep 2 09:44:46 PDT 1999
(Raster)
added group menu (shit middle button on root) patch - nice :)
fixed some buffer overflow problems in the ipc.c code that cause segfaults.
fixed alert box form trying to run commands it cant find form rememberd states
on startup
fixed group null setting.
I flimmed.

View File

@ -2400,6 +2400,9 @@ void ShowMenuMasker(Menu * m);
void HideMenuMasker(void);
void RepackMenu(Menu * m);
void EmptyMenu(Menu * m);
Menu *CreateMenuFromGroups(char *name, MenuStyle * ms);
Menu *RefreshGroupMenu(Menu * m);
void ShowGroupMenu(void);
void SetNewAreaSize(int ax, int ay);
void GetCurrentArea(int *ax, int *ay);
@ -2803,6 +2806,7 @@ extern char just_flipped;
extern Menu *all_task_menu;
extern Menu *task_menu[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
extern Menu *desk_menu;
extern Menu *group_menu;
extern char no_overwrite;
extern Window external_pager_window;
extern char clickmenu;

View File

@ -536,6 +536,11 @@ spawnMenu(void *params)
AUDIO_PLAY("SOUND_MENU_SHOW");
ShowAllTaskMenu();
}
else if (!strcmp(s, "groupmenu"))
{
AUDIO_PLAY("SOUND_MENU_SHOW");
ShowGroupMenu();
}
else if (!strcmp(s, "named"))
{
m = FindItem(s2, 0, LIST_FINDBY_NAME, LIST_TYPE_MENU);
@ -615,86 +620,89 @@ execApplication(void *params)
execl(sh, sh, "-c", (char *)real_exec, NULL);
exit(0);
}
path = pathtofile(exe);
if (!path)
if (!mode.startup)
{
/* absolute path */
if (((char *)exe)[0] == '/')
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is because the file does not exist.\n",
(char *)exe);
/* relative path */
else
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is most probably because this program "
"is not in the\n"
"path for your shell which is %s. I suggest "
"you read "
"the manual\n"
"page for that shell and read up how to "
"change or add "
"to your\n"
"execution path.\n",
(char *)exe, sh);
}
else
/* it is a node on the filing sys */
{
/* it's a file */
if (isfile((char *)path))
path = pathtofile(exe);
if (!path)
{
/* can execute it */
if (canexec((char *)path))
/* absolute path */
if (((char *)exe)[0] == '/')
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"I am unsure as to why you could not "
"do this. "
"The file exists,\n"
"is a file, and you are allowed to "
"execute it. I "
"suggest you look\n"
"into this.\n",
(char *)path);
/* not executable file */
"This is because the file does not exist.\n",
(char *)exe);
/* relative path */
else
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is because the file exists, is a"
" file, but "
"you are unable\n"
"to execute it because you do not "
"have execute "
"access to this file.\n",
(char *)path);
"This is most probably because this program "
"is not in the\n"
"path for your shell which is %s. I suggest "
"you read "
"the manual\n"
"page for that shell and read up how to "
"change or add "
"to your\n"
"execution path.\n",
(char *)exe, sh);
}
/* it's not a file */
else
/* it is a node on the filing sys */
{
/* its a dir */
if (isdir((char *)path))
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is because the file is infact "
"a directory.\n",
(char *)path);
/* its not a file or a dir */
/* it's a file */
if (isfile((char *)path))
{
/* can execute it */
if (canexec((char *)path))
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"I am unsure as to why you could not "
"do this. "
"The file exists,\n"
"is a file, and you are allowed to "
"execute it. I "
"suggest you look\n"
"into this.\n",
(char *)path);
/* not executable file */
else
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is because the file exists, is a"
" file, but "
"you are unable\n"
"to execute it because you do not "
"have execute "
"access to this file.\n",
(char *)path);
}
/* it's not a file */
else
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is because the file is not a "
"regular file.\n",
(char *)path);
{
/* its a dir */
if (isdir((char *)path))
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is because the file is infact "
"a directory.\n",
(char *)path);
/* its not a file or a dir */
else
DialogAlertOK("There was an error running the program:\n"
"%s\n"
"This program could not be executed.\n"
"This is because the file is not a "
"regular file.\n",
(char *)path);
}
if (path)
Efree(path);
}
if (path)
Efree(path);
}
exit(100);
}

View File

@ -1036,7 +1036,6 @@ HandleProperty(XEvent * ev)
EWin *ewin;
char title[10240];
int desktop;
static Atom pga = 0;
EDBUG(5, "HandleProperty");
win = ev->xproperty.window;
@ -1069,13 +1068,6 @@ HandleProperty(XEvent * ev)
}
UngrabX();
}
else if (win == root.win)
{
if (!pga)
pga = XInternAtom(disp, "_GNOME_PAGER_ACTIVE", False);
if (ev->xproperty.atom == pga)
HandlePager();
}
EDBUG_RETURN_;
}
@ -1232,17 +1224,17 @@ HandleConfigureRequest(XEvent * ev)
w, h);
if (mode.mode == MODE_MOVE)
ICCCM_Configure(ewin);
{
char pshaped;
pshaped = ewin->client.shaped;
ICCCM_GetShapeInfo(ewin);
if (pshaped != ewin->client.shaped)
{
SyncBorderToEwin(ewin);
PropagateShapes(ewin->win);
}
}
{
char pshaped;
pshaped = ewin->client.shaped;
ICCCM_GetShapeInfo(ewin);
if (pshaped != ewin->client.shaped)
{
SyncBorderToEwin(ewin);
PropagateShapes(ewin->win);
}
}
ReZoom(ewin);
}
else
@ -1274,17 +1266,17 @@ HandleResizeRequest(XEvent * ev)
w = ev->xresizerequest.width;
h = ev->xresizerequest.height;
ResizeEwin(ewin, w, h);
{
char pshaped;
pshaped = ewin->client.shaped;
ICCCM_GetShapeInfo(ewin);
if (pshaped != ewin->client.shaped)
{
SyncBorderToEwin(ewin);
PropagateShapes(ewin->win);
}
}
{
char pshaped;
pshaped = ewin->client.shaped;
ICCCM_GetShapeInfo(ewin);
if (pshaped != ewin->client.shaped)
{
SyncBorderToEwin(ewin);
PropagateShapes(ewin->win);
}
}
ReZoom(ewin);
}
else

View File

@ -32,6 +32,7 @@ char just_flipped = 0;
Menu *all_task_menu = NULL;
Menu *task_menu[ENLIGHTENMENT_CONF_NUM_DESKTOPS];
Menu *desk_menu = NULL;
Menu *group_menu = NULL;
char no_overwrite = 0;
Window external_pager_window = 0;
char clickmenu = 0;

View File

@ -31,7 +31,8 @@ FreeGroup(Group * g)
if (g->members)
Efree(g->members);
Efree(g);
current_group = NULL;
if (g == current_group)
current_group = NULL;
}
}
@ -137,8 +138,6 @@ RemoveEwinFromGroup(EWin * ewin)
ewin->group->members = Erealloc(ewin->group->members, sizeof(EWin *) * ewin->group->num_members);
else
{
if (current_group == ewin->group)
current_group = NULL;
RemoveItem((char *)ewin->group, 0, LIST_FINDBY_POINTER, LIST_TYPE_GROUP);
FreeGroup(ewin->group);
}

View File

@ -152,30 +152,6 @@ ShowIcons(void)
void
HandlePager(void)
{
Window *w1, *w2;
int size;
static Atom pga = 0;
if (!pga)
pga = XInternAtom(disp, "_GNOME_PAGER_ACTIVE", False);
external_pager_window = 0;
w1 = (Window *) AtomGet(root.win, pga, XA_WINDOW, &size);
if (w1)
{
if (WinExists(*w1))
{
w2 = (Window *) AtomGet(*w1, pga, XA_WINDOW, &size);
if (w2)
{
XSelectInput(disp, *w2, StructureNotifyMask |
SubstructureNotifyMask);
external_pager_window = *w2;
HideIcons();
Efree(w2);
}
}
Efree(w1);
}
}
Iconbox *

113
src/ipc.c
View File

@ -963,7 +963,6 @@ IPC_Background(char *params, Client * c)
else
{
/* delete background */
bg = (Background *) FindItem(name, 0, LIST_FINDBY_NAME, LIST_TYPE_BACKGROUND);
if (bg)
@ -983,23 +982,35 @@ IPC_Background(char *params, Client * c)
else
{
/* show all backgrounds */
Background **lst;
char buf2[FILEPATH_LEN_MAX];
char *buf3 = NULL;
int num, i;
buf2[0] = 0;
lst = (Background **) ListItemType(&num, LIST_TYPE_BACKGROUND);
for (i = 0; i < num; i++)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
strcat(buf, buf2);
}
if (lst)
Efree(lst);
{
for (i = 0; i < num; i++)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf3)
buf3 = realloc(buf3, strlen(buf3) + strlen(buf2) + 1);
else
{
buf3 = malloc(strlen(buf2) + 1);
buf3[0] = 0;
}
strcat(buf3, buf2);
}
if (buf3)
{
CommsSend(c, buf3);
Efree(buf3);
}
Efree(lst);
}
}
if (buf[0])
@ -1558,12 +1569,10 @@ void
IPC_ListClassMembers(char *params, Client * c)
{
char buf[FILEPATH_LEN_MAX];
char *buf = NULL;
char buf2[FILEPATH_LEN_MAX];
int num, i;
buf[0] = 0;
if (params)
{
if (!strcmp(params, "backgrounds"))
@ -1576,6 +1585,13 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
@ -1590,6 +1606,13 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
@ -1604,6 +1627,13 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
@ -1618,6 +1648,13 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
@ -1632,6 +1669,13 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
@ -1646,6 +1690,13 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
@ -1660,6 +1711,13 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
@ -1674,26 +1732,29 @@ IPC_ListClassMembers(char *params, Client * c)
{
buf2[0] = 0;
Esnprintf(buf2, sizeof(buf2), "%s\n", lst[i]->name);
if (buf)
buf = realloc(buf, strlen(buf) + strlen(buf2) + 1);
else
{
buf = malloc(strlen(buf2) + 1);
buf[0] = 0;
}
strcat(buf, buf2);
}
if (lst)
Efree(lst);
}
else
{
Esnprintf(buf, sizeof(buf), "Error: unknown class selected\n");
}
CommsSend(c, "Error: unknown class selected\n");
}
else
CommsSend(c, "Error: no class selected\n");
if (buf)
{
Esnprintf(buf, sizeof(buf), "Error: no class selected\n");
CommsSend(c, buf);
Efree(buf);
}
if (buf[0])
CommsSend(c, buf);
return;
}
void
@ -1709,9 +1770,7 @@ IPC_DialogOK(char *params, Client * c)
DIALOG_OK("Message", params);
}
else
{
Esnprintf(buf, sizeof(buf), "Error: No text for dialog specified\n");
}
Esnprintf(buf, sizeof(buf), "Error: No text for dialog specified\n");
if (buf[0])
CommsSend(c, buf);
@ -4422,7 +4481,7 @@ IPC_ReloadMenus(char *params, Client * c)
for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++)
if (m == task_menu[i])
not_task = 0;
if ((m != desk_menu) && not_task)
if ((m != desk_menu) && (m != group_menu) && not_task)
DestroyMenu(m);
}

View File

@ -234,8 +234,6 @@ main(int argc, char **argv)
if (!init_win_ext)
SpawnSnappedCmds();
desks.current = 0;
/* test the gnome pager stuff */
HandlePager();
/* Set up the internal pagers */
IB_Setup();
if (mode.show_pagers)

View File

@ -2,6 +2,7 @@
static MenuStyle *task_menu_style = NULL;
static MenuStyle *desk_menu_style = NULL;
static MenuStyle *group_menu_style = NULL;
static void FileMenuUpdate(int val, void *data);
static void FillFlatFileMenu(Menu * m, MenuStyle * ms, char *name, char *file, Menu * parent);
@ -1877,3 +1878,125 @@ HideMenuMasker(void)
EDestroyWindow(disp, mode.menu_cover_win);
mode.menu_cover_win = 0;
}
Menu *
CreateMenuFromGroups(char *name, MenuStyle * ms)
{
Menu *m, *mm;
Group **lst;
int i, j, num;
char s[256];
MenuItem *mi;
EDBUG(5, "CreateMenuFromEWins");
m = CreateMenu();
m->name = duplicate(name);
m->style = ms;
lst = (Group **) ListItemType(&num, LIST_TYPE_GROUP);
if (lst)
{
for (i = 0; i < num; i++)
{
mm = CreateMenu();
mm->name = duplicate("__SUBMENUGROUP_E");
mm->style = ms;
Esnprintf(s, sizeof(s), "%i", lst[i]->members[0]->client.win);
mi = CreateMenuItem("Show/Hide this group", NULL, ACTION_SHOW_HIDE_GROUP, s, NULL);
AddItemToMenu(mm, mi);
mi = CreateMenuItem("Iconify this group", NULL, ACTION_ICONIFY, s, NULL);
AddItemToMenu(mm, mi);
for (j = 0; j < lst[i]->num_members; j++)
{
Esnprintf(s, sizeof(s), "%i", lst[i]->members[j]->client.win);
mi = CreateMenuItem(lst[i]->members[j]->client.title, NULL, ACTION_FOCUS_SET, s, NULL);
AddItemToMenu(mm, mi);
}
mm->parent = m;
Esnprintf(s, sizeof(s), "Group %i", i);
mi = CreateMenuItem(s, NULL, 0, NULL, mm);
AddItemToMenu(m, mi);
}
Efree(lst);
}
EDBUG_RETURN(m);
}
Menu *
RefreshGroupMenu(Menu * m)
{
char was = 0;
int lx = 0, ly = 0;
EWin *ewin;
EDBUG(5, "RefreshGroupMenu");
if (m)
{
ewin = FindEwinByMenu(m);
if ((m->win) && (ewin))
{
lx = ewin->x;
ly = ewin->y;
was = 1;
}
DestroyMenu(m);
}
m = NULL;
if (!group_menu_style)
{
EDBUG_RETURN(NULL);
}
m = CreateMenuFromGroups("MENU", group_menu_style);
if ((was) && (m))
{
ShowMenu(m, 1);
ewin = FindEwinByMenu(m);
if (ewin)
{
MoveEwin(ewin, lx, ly);
ShowEwin(ewin);
}
mode.cur_menu[0] = m;
mode.cur_menu_depth = 1;
ShowMenuMasker(m);
}
EDBUG_RETURN(m);
}
void
ShowGroupMenu(void)
{
static MenuStyle *ms = NULL;
static Menu *m = NULL;
EDBUG(5, "ShowGroupMenu");
XUngrabPointer(disp, CurrentTime);
if (!group_menu_style)
{
ms = FindItem("GROUP_MENU", 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
if (!ms)
ms = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_MENU_STYLE);
if (!ms)
EDBUG_RETURN_;
}
group_menu_style = ms;
mode.cur_menu_mode = 1;
m = NULL;
m = RefreshGroupMenu(group_menu);
group_menu = m;
if (m)
{
if (!FindEwinByMenu(m))
ShowMenu(m, 0);
mode.cur_menu[0] = m;
mode.cur_menu_depth = 1;
ShowMenuMasker(m);
}
else
{
mode.cur_menu[0] = NULL;
mode.cur_menu_depth = 0;
HideMenuMasker();
}
EDBUG_RETURN_;
}

View File

@ -1,3 +1,4 @@
#include "E.h"
void EdgeTimeout(int val, void *data);

View File

@ -75,6 +75,11 @@ __ACLASS __BGN
__BUTTON 5
__ALLOW_ANY_MODIFIER_KEYS __ON
__ACTION __A_DESKTOP_NEXT
__NEXT_ACTION
__EVENT __MOUSE_PRESS
__BUTTON 2
__MODIFIER_KEY __SHIFT
__ACTION __A_SHOW_MENU "groupmenu"
__END