mirror of
https://github.com/NickHu/sway
synced 2024-12-27 21:58:11 +01:00
Remove FSB_GAPS_INNER and FSB_GAPS_OUTER
This commit is contained in:
parent
394a5d36cb
commit
0c495eecde
5 changed files with 20 additions and 75 deletions
|
@ -166,12 +166,6 @@ enum edge_border_types {
|
||||||
E_BOTH /**< hide vertical and horizontal edge borders */
|
E_BOTH /**< hide vertical and horizontal edge borders */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum floating_scroll_behavior {
|
|
||||||
FSB_GAPS_OUTER, /**< Adjust outer gaps */
|
|
||||||
FSB_GAPS_INNER, /**< Adjust inner gaps */
|
|
||||||
FSB_CUSTOM /**< Perform a user-defined action */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration struct. The result of loading a config file.
|
* The configuration struct. The result of loading a config file.
|
||||||
*/
|
*/
|
||||||
|
@ -190,9 +184,8 @@ struct sway_config {
|
||||||
uint32_t floating_mod;
|
uint32_t floating_mod;
|
||||||
uint32_t dragging_key;
|
uint32_t dragging_key;
|
||||||
uint32_t resizing_key;
|
uint32_t resizing_key;
|
||||||
enum floating_scroll_behavior floating_scroll;
|
char *floating_scroll_up_cmd;
|
||||||
char *fsb_up;
|
char *floating_scroll_down_cmd;
|
||||||
char *fsb_down;
|
|
||||||
enum swayc_layouts default_orientation;
|
enum swayc_layouts default_orientation;
|
||||||
enum swayc_layouts default_layout;
|
enum swayc_layouts default_layout;
|
||||||
char *font;
|
char *font;
|
||||||
|
|
|
@ -711,34 +711,19 @@ static struct cmd_results *cmd_floating_scroll(int argc, char **argv) {
|
||||||
if ((error = checkarg(argc, "floating_scroll", EXPECTED_AT_LEAST, 1))) {
|
if ((error = checkarg(argc, "floating_scroll", EXPECTED_AT_LEAST, 1))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if (!strcasecmp("behavior", argv[0])) {
|
if (!strcasecmp("up", argv[0])) {
|
||||||
|
free(config->floating_scroll_up_cmd);
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
error = cmd_results_new(CMD_INVALID, "floating_scroll", "Insufficient parameters given");
|
config->floating_scroll_up_cmd = strdup("");
|
||||||
return error;
|
|
||||||
}
|
|
||||||
if (!strcasecmp("gaps_inner", argv[1])) {
|
|
||||||
config->floating_scroll = FSB_GAPS_INNER;
|
|
||||||
} else if (!strcasecmp("gaps_outer", argv[1])) {
|
|
||||||
config->floating_scroll = FSB_GAPS_OUTER;
|
|
||||||
} else if (!strcasecmp("custom", argv[1])) {
|
|
||||||
config->floating_scroll = FSB_CUSTOM;
|
|
||||||
} else {
|
} else {
|
||||||
error = cmd_results_new(CMD_INVALID, "floating_scroll", "Unknown behavior: '%s'", argv[1]);
|
config->floating_scroll_up_cmd = join_args(argv + 1, argc - 1);
|
||||||
return error;
|
|
||||||
}
|
|
||||||
} else if (!strcasecmp("up", argv[0])) {
|
|
||||||
free(config->fsb_up);
|
|
||||||
if (argc < 2) {
|
|
||||||
config->fsb_up = strdup("");
|
|
||||||
} else {
|
|
||||||
config->fsb_up = join_args(argv + 1, argc - 1);
|
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp("down", argv[0])) {
|
} else if (!strcasecmp("down", argv[0])) {
|
||||||
free(config->fsb_down);
|
free(config->floating_scroll_down_cmd);
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
config->fsb_down = strdup("");
|
config->floating_scroll_down_cmd = strdup("");
|
||||||
} else {
|
} else {
|
||||||
config->fsb_down = join_args(argv + 1, argc - 1);
|
config->floating_scroll_down_cmd = join_args(argv + 1, argc - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error = cmd_results_new(CMD_INVALID, "floating_scroll", "Unknown command: '%s'", argv[0]);
|
error = cmd_results_new(CMD_INVALID, "floating_scroll", "Unknown command: '%s'", argv[0]);
|
||||||
|
|
|
@ -131,8 +131,8 @@ void free_config(struct sway_config *config) {
|
||||||
list_free(config->active_bar_modifiers);
|
list_free(config->active_bar_modifiers);
|
||||||
free_flat_list(config->config_chain);
|
free_flat_list(config->config_chain);
|
||||||
free(config->font);
|
free(config->font);
|
||||||
free(config->fsb_up);
|
free(config->floating_scroll_up_cmd);
|
||||||
free(config->fsb_down);
|
free(config->floating_scroll_down_cmd);
|
||||||
free(config);
|
free(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +161,8 @@ static void config_defaults(struct sway_config *config) {
|
||||||
config->floating_mod = 0;
|
config->floating_mod = 0;
|
||||||
config->dragging_key = M_LEFT_CLICK;
|
config->dragging_key = M_LEFT_CLICK;
|
||||||
config->resizing_key = M_RIGHT_CLICK;
|
config->resizing_key = M_RIGHT_CLICK;
|
||||||
config->floating_scroll = FSB_GAPS_INNER;
|
config->floating_scroll_up_cmd = strdup("");
|
||||||
config->fsb_up = strdup("");
|
config->floating_scroll_down_cmd = strdup("");
|
||||||
config->fsb_down = strdup("");
|
|
||||||
config->default_layout = L_NONE;
|
config->default_layout = L_NONE;
|
||||||
config->default_orientation = L_NONE;
|
config->default_orientation = L_NONE;
|
||||||
config->font = strdup("monospace 10");
|
config->font = strdup("monospace 10");
|
||||||
|
|
|
@ -723,36 +723,11 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
|
||||||
bool handle_pointer_scroll(wlc_handle view, uint32_t time, const struct wlc_modifiers* modifiers,
|
bool handle_pointer_scroll(wlc_handle view, uint32_t time, const struct wlc_modifiers* modifiers,
|
||||||
uint8_t axis_bits, double _amount[2]) {
|
uint8_t axis_bits, double _amount[2]) {
|
||||||
if (!(modifiers->mods ^ config->floating_mod)) {
|
if (!(modifiers->mods ^ config->floating_mod)) {
|
||||||
switch (config->floating_scroll) {
|
int amount = (int)_amount[0];
|
||||||
case FSB_GAPS_INNER:
|
if (amount > 0) {
|
||||||
case FSB_GAPS_OUTER:
|
handle_command(config->floating_scroll_up_cmd);
|
||||||
{
|
} else if (amount < 0) {
|
||||||
int amount = (int)_amount[0];
|
handle_command(config->floating_scroll_down_cmd);
|
||||||
int i,j;
|
|
||||||
for (i = 0; i < root_container.children->length; ++i) {
|
|
||||||
swayc_t *op = root_container.children->items[i];
|
|
||||||
for (j = 0; j < op->children->length; ++j) {
|
|
||||||
swayc_t *ws = op->children->items[j];
|
|
||||||
if (config->floating_scroll == FSB_GAPS_INNER) {
|
|
||||||
container_map(ws, add_gaps, &amount);
|
|
||||||
} else {
|
|
||||||
ws->gaps += amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
arrange_windows(&root_container, -1, -1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FSB_CUSTOM:
|
|
||||||
{
|
|
||||||
int amount = (int)_amount[0];
|
|
||||||
if (amount > 0) {
|
|
||||||
handle_command(config->fsb_up);
|
|
||||||
} else if (amount < 0) {
|
|
||||||
handle_command(config->fsb_down);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EVENT_PASSTHROUGH;
|
return EVENT_PASSTHROUGH;
|
||||||
|
|
|
@ -156,17 +156,10 @@ or triggered at runtime.
|
||||||
enabled, left click is used for resizing and right click for dragging. The
|
enabled, left click is used for resizing and right click for dragging. The
|
||||||
mode paramenter is optional and defaults to _normal_ if it isn't defined.
|
mode paramenter is optional and defaults to _normal_ if it isn't defined.
|
||||||
|
|
||||||
**floating_scroll** behavior <gaps_inner|gaps_outer|custom>::
|
|
||||||
If set to _gaps_inner_, adjusts inner gaps of the windows on scrolling
|
|
||||||
while holding the floating modifier. If set to _gaps_outer_, adjusts
|
|
||||||
outer gaps. If set to _custom_, performs user-defined commands,
|
|
||||||
specified in *floating_scroll up|down*.
|
|
||||||
|
|
||||||
**floating_scroll** <up|down> [command]::
|
**floating_scroll** <up|down> [command]::
|
||||||
Sets the command to be executed on scrolling up and down
|
Sets the command to be executed on scrolling up and down
|
||||||
(respectively) while holding the floating modifier, when
|
(respectively) while holding the floating modifier. Resets the
|
||||||
*floating_scroll behavior* is set to _custom_. Resets the command,
|
command, when given no arguments.
|
||||||
when given none.
|
|
||||||
|
|
||||||
**focus_follows_mouse** <yes|no>::
|
**focus_follows_mouse** <yes|no>::
|
||||||
If set to _yes_, the currently focused view will change as you move your
|
If set to _yes_, the currently focused view will change as you move your
|
||||||
|
|
Loading…
Reference in a new issue