use the action_from_string helper
This commit is contained in:
parent
68fdcde19b
commit
a6d5d8bcd8
1 changed files with 12 additions and 102 deletions
|
@ -82,110 +82,20 @@ static void addbinding()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a = action_from_string(action);
|
||||||
|
|
||||||
if (mact == MouseAction_Motion) {
|
if (mact == MouseAction_Motion) {
|
||||||
if (!g_ascii_strcasecmp(action, "move") &&
|
if (a && !(a->func == action_move || a->func == action_resize)) {
|
||||||
mact == MouseAction_Motion) {
|
action_free(a);
|
||||||
a = action_new(action_move);
|
a = NULL;
|
||||||
} else if (!g_ascii_strcasecmp(action, "resize") &&
|
|
||||||
mact == MouseAction_Motion) {
|
|
||||||
a = action_new(action_resize);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!g_ascii_strcasecmp(action, "focus")) {
|
|
||||||
a = action_new(action_focus);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "unfocus")) {
|
|
||||||
a = action_new(action_unfocus);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "iconify")) {
|
|
||||||
a = action_new(action_iconify);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "raise")) {
|
|
||||||
a = action_new(action_raise);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "lower")) {
|
|
||||||
a = action_new(action_lower);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "focusraise")) {
|
|
||||||
a = action_new(action_focusraise);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "close")) {
|
|
||||||
a = action_new(action_close);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "kill")) {
|
|
||||||
a = action_new(action_kill);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "shade")) {
|
|
||||||
a = action_new(action_shade);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "unshade")) {
|
|
||||||
a = action_new(action_unshade);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "toggleshade")) {
|
|
||||||
a = action_new(action_toggle_shade);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "toggleomnipresent")) {
|
|
||||||
a = action_new(action_toggle_omnipresent);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "maximizefull")) {
|
|
||||||
a = action_new(action_maximize_full);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "unmaximizefull")) {
|
|
||||||
a = action_new(action_unmaximize_full);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "togglemaximizefull")) {
|
|
||||||
a = action_new(action_toggle_maximize_full);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "maximizehorz")) {
|
|
||||||
a = action_new(action_maximize_horz);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "unmaximizehorz")) {
|
|
||||||
a = action_new(action_unmaximize_horz);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "togglemaximizehorz")) {
|
|
||||||
a = action_new(action_toggle_maximize_horz);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "maximizevert")) {
|
|
||||||
a = action_new(action_maximize_vert);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "unmaximizevert")) {
|
|
||||||
a = action_new(action_unmaximize_vert);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "togglemaximizevert")) {
|
|
||||||
a = action_new(action_toggle_maximize_vert);
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "sendtonextdesktop")) {
|
|
||||||
a = action_new(action_send_to_next_desktop);
|
|
||||||
a->data.sendtonextprev.wrap = FALSE;
|
|
||||||
a->data.sendtonextprev.follow = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "sendtonextdesktopwrap")) {
|
|
||||||
a = action_new(action_send_to_next_desktop);
|
|
||||||
a->data.sendtonextprev.wrap = TRUE;
|
|
||||||
a->data.sendtonextprev.follow = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "sendtopreviousdesktop")) {
|
|
||||||
a = action_new(action_send_to_previous_desktop);
|
|
||||||
a->data.sendtonextprev.wrap = FALSE;
|
|
||||||
a->data.sendtonextprev.follow = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "sendtopreviousdesktopwrap")) {
|
|
||||||
a = action_new(action_send_to_previous_desktop);
|
|
||||||
a->data.sendtonextprev.wrap = TRUE;
|
|
||||||
a->data.sendtonextprev.follow = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "nextdesktop")) {
|
|
||||||
a = action_new(action_next_desktop);
|
|
||||||
a->data.nextprevdesktop.wrap = FALSE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "nextdesktopwrap")) {
|
|
||||||
a = action_new(action_next_desktop);
|
|
||||||
a->data.nextprevdesktop.wrap = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "previousdesktop")) {
|
|
||||||
a = action_new(action_previous_desktop);
|
|
||||||
a->data.nextprevdesktop.wrap = FALSE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "previousdesktopwrap")) {
|
|
||||||
a = action_new(action_previous_desktop);
|
|
||||||
a->data.nextprevdesktop.wrap = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "nextdesktopcolumn")) {
|
|
||||||
a = action_new(action_next_desktop_column);
|
|
||||||
a->data.nextprevdesktop.wrap = FALSE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "nextdesktopcolumnwrap")) {
|
|
||||||
a = action_new(action_next_desktop_column);
|
|
||||||
a->data.nextprevdesktop.wrap = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "previousdesktopcolumn")) {
|
|
||||||
a = action_new(action_previous_desktop_column);
|
|
||||||
a->data.nextprevdesktop.wrap = FALSE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "previousdesktopcolumnwrap")) {
|
|
||||||
a = action_new(action_previous_desktop_column);
|
|
||||||
a->data.nextprevdesktop.wrap = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "nextdesktoprow")) {
|
|
||||||
a = action_new(action_next_desktop_row);
|
|
||||||
a->data.nextprevdesktop.wrap = FALSE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "nextdesktoprowwrap")) {
|
|
||||||
a = action_new(action_next_desktop_row);
|
|
||||||
a->data.nextprevdesktop.wrap = TRUE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "previousdesktoprow")) {
|
|
||||||
a = action_new(action_previous_desktop_row);
|
|
||||||
a->data.nextprevdesktop.wrap = FALSE;
|
|
||||||
} else if (!g_ascii_strcasecmp(action, "previousdesktoprowwrap")) {
|
|
||||||
a = action_new(action_previous_desktop_row);
|
|
||||||
a->data.nextprevdesktop.wrap = TRUE;
|
|
||||||
}
|
}
|
||||||
|
/* the below types cannot be used with !motion events, or at all with
|
||||||
|
mouse bindings */
|
||||||
|
} else if (a && (a->func == action_move || a->func == action_resize ||
|
||||||
|
a->func == action_move_relative ||
|
||||||
|
a->func == action_resize_relative)) {
|
||||||
|
action_free(a);
|
||||||
|
a = NULL;
|
||||||
}
|
}
|
||||||
if (a == NULL) {
|
if (a == NULL) {
|
||||||
g_warning("Invalid action '%s' in '%s' on line %d", action, path,
|
g_warning("Invalid action '%s' in '%s' on line %d", action, path,
|
||||||
|
|
Loading…
Reference in a new issue