Lines 79-84
static WMPropList *dPasteCommand = NULL;
Link Here
|
79 |
#ifdef XDND /* XXX was OFFIX */ |
79 |
#ifdef XDND /* XXX was OFFIX */ |
80 |
static WMPropList *dDropCommand = NULL; |
80 |
static WMPropList *dDropCommand = NULL; |
81 |
#endif |
81 |
#endif |
|
|
82 |
static WMPropList *dKeyboardShortcut = NULL; |
82 |
static WMPropList *dAutoLaunch, *dLock; |
83 |
static WMPropList *dAutoLaunch, *dLock; |
83 |
static WMPropList *dName, *dForced, *dBuggyApplication, *dYes, *dNo; |
84 |
static WMPropList *dName, *dForced, *dBuggyApplication, *dYes, *dNo; |
84 |
static WMPropList *dHost, *dDock, *dClip; |
85 |
static WMPropList *dHost, *dDock, *dClip; |
Lines 131-136
static void make_keys(void)
Link Here
|
131 |
#ifdef XDND |
132 |
#ifdef XDND |
132 |
dDropCommand = WMRetainPropList(WMCreatePLString("DropCommand")); |
133 |
dDropCommand = WMRetainPropList(WMCreatePLString("DropCommand")); |
133 |
#endif |
134 |
#endif |
|
|
135 |
dKeyboardShortcut = WMRetainPropList(WMCreatePLString("Shortcut")); |
134 |
dLock = WMRetainPropList(WMCreatePLString("Lock")); |
136 |
dLock = WMRetainPropList(WMCreatePLString("Lock")); |
135 |
dAutoLaunch = WMRetainPropList(WMCreatePLString("AutoLaunch")); |
137 |
dAutoLaunch = WMRetainPropList(WMCreatePLString("AutoLaunch")); |
136 |
dName = WMRetainPropList(WMCreatePLString("Name")); |
138 |
dName = WMRetainPropList(WMCreatePLString("Name")); |
Lines 1241-1246
static WMPropList *make_icon_state(WAppI
Link Here
|
1241 |
WMReleasePropList(command); |
1243 |
WMReleasePropList(command); |
1242 |
} |
1244 |
} |
1243 |
|
1245 |
|
|
|
1246 |
if (btn->keyboard_shortcut) { |
1247 |
command = WMCreatePLString(btn->keyboard_shortcut); |
1248 |
WMPutInPLDictionary(node, dKeyboardShortcut, command); |
1249 |
WMReleasePropList(command); |
1250 |
} |
1251 |
|
1244 |
if (btn->client_machine && btn->remote_start) { |
1252 |
if (btn->client_machine && btn->remote_start) { |
1245 |
host = WMCreatePLString(btn->client_machine); |
1253 |
host = WMCreatePLString(btn->client_machine); |
1246 |
WMPutInPLDictionary(node, dHost, host); |
1254 |
WMPutInPLDictionary(node, dHost, host); |
Lines 1435-1440
static WAppIcon *restore_icon_state(WScr
Link Here
|
1435 |
aicon->dnd_command = wstrdup(WMGetFromPLString(cmd)); |
1443 |
aicon->dnd_command = wstrdup(WMGetFromPLString(cmd)); |
1436 |
#endif |
1444 |
#endif |
1437 |
|
1445 |
|
|
|
1446 |
cmd = WMGetFromPLDictionary(info, dKeyboardShortcut); |
1447 |
if (cmd) { |
1448 |
if(addDockShortcut(WMGetFromPLString(cmd), aicon)) |
1449 |
aicon->keyboard_shortcut = wstrdup(WMGetFromPLString(cmd)); |
1450 |
} |
1451 |
|
1438 |
cmd = WMGetFromPLDictionary(info, dPasteCommand); |
1452 |
cmd = WMGetFromPLDictionary(info, dPasteCommand); |
1439 |
if (cmd) |
1453 |
if (cmd) |
1440 |
aicon->paste_command = wstrdup(WMGetFromPLString(cmd)); |
1454 |
aicon->paste_command = wstrdup(WMGetFromPLString(cmd)); |
Lines 1704-1709
WDock *wDockRestoreState(WScreen *scr, W
Link Here
|
1704 |
if (type == WM_DOCK) |
1718 |
if (type == WM_DOCK) |
1705 |
dock->icon_count = 0; |
1719 |
dock->icon_count = 0; |
1706 |
|
1720 |
|
|
|
1721 |
dock->screen_ptr->flags.dock_changed_shortcuts = 0; |
1722 |
|
1707 |
for (i = 0; i < count; i++) { |
1723 |
for (i = 0; i < count; i++) { |
1708 |
if (dock->icon_count >= dock->max_icons) { |
1724 |
if (dock->icon_count >= dock->max_icons) { |
1709 |
wwarning(_("there are too many icons stored in dock. Ignoring what doesn't fit")); |
1725 |
wwarning(_("there are too many icons stored in dock. Ignoring what doesn't fit")); |
Lines 1736-1741
WDock *wDockRestoreState(WScreen *scr, W
Link Here
|
1736 |
dock->icon_count++; |
1752 |
dock->icon_count++; |
1737 |
} |
1753 |
} |
1738 |
|
1754 |
|
|
|
1755 |
if(dock->screen_ptr->flags.dock_changed_shortcuts) |
1756 |
{ |
1757 |
rebind_key_grabs(dock->screen_ptr); |
1758 |
dock->screen_ptr->flags.dock_changed_shortcuts = 0; |
1759 |
} |
1760 |
|
1739 |
/* if the first icon is not defined, use the default */ |
1761 |
/* if the first icon is not defined, use the default */ |
1740 |
if (dock->icon_array[0] == NULL) { |
1762 |
if (dock->icon_array[0] == NULL) { |
1741 |
/* update default icon */ |
1763 |
/* update default icon */ |
Lines 4034-4036
int wClipMakeIconOmnipresent(WAppIcon *a
Link Here
|
4034 |
|
4056 |
|
4035 |
return status; |
4057 |
return status; |
4036 |
} |
4058 |
} |
|
|
4059 |
|
4060 |
Bool |
4061 |
addDockShortcut(char *shortcutDefinition, WAppIcon *icon) |
4062 |
{ |
4063 |
int modifier = 0; |
4064 |
KeyCode keycode; |
4065 |
KeySym ksym; |
4066 |
char *k; |
4067 |
char buf[128], *b; |
4068 |
|
4069 |
strcpy(buf, shortcutDefinition); |
4070 |
b = (char*)buf; |
4071 |
|
4072 |
/* get modifiers */ |
4073 |
while((k = strchr(b, '+'))!=NULL) { |
4074 |
int mod; |
4075 |
|
4076 |
*k = 0; |
4077 |
mod = wXModifierFromKey(b); |
4078 |
if(mod < 0) { |
4079 |
wwarning(_("invalid key modifier \"%s\""), b); |
4080 |
return False; |
4081 |
} |
4082 |
modifier |= mod; |
4083 |
|
4084 |
b = k+1; |
4085 |
} |
4086 |
|
4087 |
/* get key */ |
4088 |
ksym = XStringToKeysym(b); |
4089 |
|
4090 |
if (ksym==NoSymbol) { |
4091 |
wwarning(_("invalid kbd shortcut specification \"%s\""), shortcutDefinition); |
4092 |
return False; |
4093 |
} |
4094 |
|
4095 |
keycode = XKeysymToKeycode(dpy, ksym); |
4096 |
if (keycode==0) { |
4097 |
wwarning(_("invalid key in shortcut \"%s\""), shortcutDefinition); |
4098 |
return False; |
4099 |
} |
4100 |
icon->modifier = modifier; |
4101 |
icon->keycode = keycode; |
4102 |
if(icon->dock && icon->dock->screen_ptr) |
4103 |
icon->dock->screen_ptr->flags.dock_changed_shortcuts = 1; |
4104 |
return True; |
4105 |
} |
4106 |
|
4107 |
static Bool |
4108 |
wDockPerformShortcut(WDock *dock, XEvent *event) |
4109 |
{ |
4110 |
int i; |
4111 |
int modifiers; |
4112 |
int done = 0; |
4113 |
|
4114 |
if(!dock) return done; |
4115 |
modifiers = event->xkey.state & ValidModMask; |
4116 |
for(i=(dock->type==WM_DOCK ? 0 : 1); i<dock->max_icons; i++) { |
4117 |
WAppIcon *btn = dock->icon_array[i]; |
4118 |
|
4119 |
if(!btn || btn->attracted) |
4120 |
continue; |
4121 |
|
4122 |
if(btn->keycode==event->xkey.keycode && (btn->modifier==modifiers)) { |
4123 |
launchDockedApplication(btn, False); |
4124 |
done = True; |
4125 |
break; |
4126 |
} |
4127 |
|
4128 |
} |
4129 |
return done; |
4130 |
} |
4131 |
|
4132 |
Bool |
4133 |
wDockAndClipPerformShortcut(WScreen *scr, XEvent *event) |
4134 |
{ |
4135 |
int done = 0; |
4136 |
int i; |
4137 |
if(!(done = wDockPerformShortcut(scr->dock, event))) { |
4138 |
for(i=0; i < scr->workspace_count; i++) { |
4139 |
if(done = wDockPerformShortcut(scr->workspaces[i]->clip, event)) break; |
4140 |
} |
4141 |
} |
4142 |
return done; |
4143 |
} |
4144 |
|
4145 |
static void |
4146 |
wDockBindShortcuts(Window window, WDock* dock) |
4147 |
{ |
4148 |
int i; |
4149 |
if(!dock) return; |
4150 |
for(i=(dock->type==WM_DOCK ? 0 : 1); i<dock->max_icons; i++) { |
4151 |
WAppIcon *btn = dock->icon_array[i]; |
4152 |
|
4153 |
if(!btn || btn->attracted) |
4154 |
continue; |
4155 |
|
4156 |
if(btn->keyboard_shortcut) |
4157 |
{ |
4158 |
if(btn->keyboard_shortcut && btn->modifier!=AnyModifier) { |
4159 |
XGrabKey(dpy, btn->keycode, btn->modifier|LockMask, |
4160 |
window, True, GrabModeAsync, GrabModeAsync); |
4161 |
#ifdef NUMLOCK_HACK |
4162 |
wHackedGrabKey(btn->keycode, btn->modifier, |
4163 |
window, True, GrabModeAsync, GrabModeAsync); |
4164 |
#endif |
4165 |
} |
4166 |
XGrabKey(dpy, btn->keycode, btn->modifier, window, True, |
4167 |
GrabModeAsync, GrabModeAsync); |
4168 |
} |
4169 |
} |
4170 |
} |
4171 |
|
4172 |
void |
4173 |
wDockAndClipBindShortcuts(Window window, WScreen *scr) |
4174 |
{ |
4175 |
int i; |
4176 |
wDockBindShortcuts(window, scr->dock); |
4177 |
for(i=0; i < scr->workspace_count; i++ ) { |
4178 |
wDockBindShortcuts(window, scr->workspaces[i]->clip); |
4179 |
} |
4180 |
} |