1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-29 11:35:47 +01:00

menu commands that have a = in it, executed with SHEXEC

This commit is contained in:
kojima
2000-09-21 14:22:59 +00:00
parent 7e3f885aa4
commit 6760c39881

View File

@@ -108,6 +108,7 @@ typedef struct _Panel {
Bool capturing; Bool capturing;
/* about the currently selected item */ /* about the currently selected item */
WEditMenuItem *currentItem; WEditMenuItem *currentItem;
InfoType currentType; InfoType currentType;
@@ -570,9 +571,9 @@ createPanel(_Panel *p)
WMSetScrollViewContentView(sview, WMWidgetView(pad)); WMSetScrollViewContentView(sview, WMWidgetView(pad));
/* data = putNewItem(panel, pad, ExternalInfo, _("Debian Menu")); data = putNewItem(panel, pad, ExternalInfo, _("Debian Menu"));
data->param.pipe.command = "/etc/X11/WindowMaker/menu.hook"; data->param.pipe.command = "/etc/X11/WindowMaker/menu.hook";
*/
data = putNewItem(panel, pad, PipeInfo, _("RedHat Menu")); data = putNewItem(panel, pad, PipeInfo, _("RedHat Menu"));
data->param.pipe.command = "wmconfig --output wmaker"; data->param.pipe.command = "wmconfig --output wmaker";
@@ -851,7 +852,7 @@ createPanel(_Panel *p)
" - drag items in menu to change their position\n" " - drag items in menu to change their position\n"
" - double click in a menu item to change the label\n" " - double click in a menu item to change the label\n"
" - click on a menu item to change related information")); " - click on a menu item to change related information"));
WMMapWidget(label);
WMRealizeWidget(panel->frame); WMRealizeWidget(panel->frame);
WMMapSubwidgets(panel->frame); WMMapSubwidgets(panel->frame);
@@ -871,8 +872,7 @@ createPanel(_Panel *p)
panel->sections[ExecInfo][1] = panel->shortF; panel->sections[ExecInfo][1] = panel->shortF;
panel->sections[CommandInfo][0] = panel->icommandL; panel->sections[CommandInfo][0] = panel->icommandL;
panel->sections[CommandInfo][1] = label; panel->sections[CommandInfo][1] = panel->shortF;
panel->sections[CommandInfo][2] = panel->shortF;
panel->sections[ExternalInfo][0] = panel->pathF; panel->sections[ExternalInfo][0] = panel->pathF;
@@ -884,6 +884,22 @@ createPanel(_Panel *p)
panel->currentType = NoInfo; panel->currentType = NoInfo;
showData(panel); showData(panel);
{
WMPoint pos;
pos = WMGetViewScreenPosition(WMWidgetView(panel->frame));
if (pos.x < 200) {
pos.x += FRAME_WIDTH + 20;
} else {
pos.x = 10;
}
pos.y = WMAX(pos.y - 100, 0);
WEditMenuShowAt(panel->menu, pos.x, pos.y);
}
} }
@@ -1129,7 +1145,6 @@ changeInfoType(_Panel *panel, char *title, InfoType type)
WMUnmapWidget(panel->quickB); WMUnmapWidget(panel->quickB);
w = panel->sections[type]; w = panel->sections[type];
while (*w) { while (*w) {
@@ -1477,7 +1492,6 @@ static void
buildMenuFromPL(_Panel *panel, proplist_t pl) buildMenuFromPL(_Panel *panel, proplist_t pl)
{ {
panel->menu = buildSubmenu(panel, pl); panel->menu = buildSubmenu(panel, pl);
WMMapWidget(panel->menu);
} }
@@ -1607,7 +1621,7 @@ processData(char *title, ItemData *data)
switch (data->type) { switch (data->type) {
case ExecInfo: case ExecInfo:
#if 1 #if 1
if (strpbrk(data->param.exec.command, "&$*|><?`")) { if (strpbrk(data->param.exec.command, "&$*|><?`=")) {
s1 = "SHEXEC"; s1 = "SHEXEC";
} else { } else {
s1 = "EXEC"; s1 = "EXEC";
@@ -1640,15 +1654,17 @@ processData(char *title, ItemData *data)
switch (i) { switch (i) {
case 3: case 3:
case 4: case 4:
if (data->param.command.parameter) if (data->param.command.parameter) {
PLAppendArrayElement(item, PLAppendArrayElement(item,
PLMakeString(data->param.command.parameter)); PLMakeString(data->param.command.parameter));
}
break; break;
case 7: /* restart */ case 6: /* restart */
if (data->param.command.parameter) if (data->param.command.parameter) {
PLAppendArrayElement(item, PLAppendArrayElement(item,
PLMakeString(data->param.command.parameter)); PLMakeString(data->param.command.parameter));
}
break; break;
} }
@@ -1768,6 +1784,23 @@ storeData(_Panel *panel)
} }
static void
showMenus(_Panel *panel)
{
WEditMenuUnhide(panel->menu);
}
static void
hideMenus(_Panel *panel)
{
WEditMenuHide(panel->menu);
}
Panel* Panel*
InitMenu(WMScreen *scr, WMWindow *win) InitMenu(WMScreen *scr, WMWindow *win)
{ {
@@ -1784,6 +1817,9 @@ InitMenu(WMScreen *scr, WMWindow *win)
panel->callbacks.createWidgets = createPanel; panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData; panel->callbacks.updateDomain = storeData;
panel->callbacks.showPanel = showMenus;
panel->callbacks.hidePanel = hideMenus;
AddSection(panel, ICON_FILE); AddSection(panel, ICON_FILE);