mirror of
https://github.com/yshui/picom.git
synced 2025-04-07 17:44:04 -04:00
transition: fix fly-in/fly-out preset
fly-in only worked for left and up direction, and the offsets are a little bit wrong. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
904a111033
commit
383cde7512
2 changed files with 61 additions and 18 deletions
|
@ -118,7 +118,7 @@ fly-out = {
|
|||
curve = "cubic-bezier(0.05, 0, 0.69, -0.05)";
|
||||
duration = "placeholder0";
|
||||
start = 0;
|
||||
end = "(window-height + window-y) * placeholder2 + (window-width + window-x) * placeholder1";
|
||||
end = "window-height * placeholder2 + window-y * placeholder5 + window-width * placeholder1 + window-x * placeholder4";
|
||||
};
|
||||
offset-x = "v-timing * placeholder3";
|
||||
offset-y = "v-timing * (1 - placeholder3)";
|
||||
|
@ -133,9 +133,11 @@ fly-out = {
|
|||
};
|
||||
*placeholders = (
|
||||
(0, "duration"),
|
||||
(1, "direction", [0, 0, -1, 1]),
|
||||
(2, "direction", [-1, 1, 0, 0]),
|
||||
(3, "direction", [0, 0, 1, 1]),
|
||||
(1, "direction", [0, 0, -1, 1]), # left/right -> +1/-1 for X axis
|
||||
(2, "direction", [-1, 1, 0, 0]), # up/down -> +1/-1 for Y axis
|
||||
(3, "direction", [0, 0, 1, 1]), # X/Y axis switch
|
||||
(4, "direction", [0, 0, -1, 0]), # whether window X is added
|
||||
(5, "direction", [-1, 0, 0, 0]), # whether window Y is added
|
||||
);
|
||||
};
|
||||
fly-in = {
|
||||
|
@ -143,7 +145,7 @@ fly-in = {
|
|||
curve = "cubic-bezier(0.17, 0.67, 0.68, 1.03)";
|
||||
end = 0;
|
||||
duration = "placeholder0";
|
||||
start = "- window-height - window-y";
|
||||
start = "window-height * placeholder2 + window-y * placeholder5 + window-width * placeholder1 + window-x * placeholder4";
|
||||
};
|
||||
offset-x = "v-timing * placeholder3";
|
||||
offset-y = "v-timing * (1 - placeholder3)";
|
||||
|
@ -158,9 +160,11 @@ fly-in = {
|
|||
};
|
||||
*placeholders = (
|
||||
(0, "duration"),
|
||||
(1, "direction", [0, 0, -1, 1]),
|
||||
(2, "direction", [-1, 1, 0, 0]),
|
||||
(3, "direction", [0, 0, 1, 1]),
|
||||
(1, "direction", [0, 0, -1, 1]), # left/right -> +1/-1 for X axis
|
||||
(2, "direction", [-1, 1, 0, 0]), # up/down -> +1/-1 for Y axis
|
||||
(3, "direction", [0, 0, 1, 1]), # X/Y axis switch
|
||||
(4, "direction", [0, 0, -1, 0]), # whether window X is added
|
||||
(5, "direction", [-1, 0, 0, 0]), # whether window Y is added
|
||||
);
|
||||
};
|
||||
geometry-change = {
|
||||
|
|
|
@ -909,23 +909,27 @@ static struct script *script_template__fly_out(int *output_slots) {
|
|||
{.type = INST_STORE, .slot = 3},
|
||||
{.type = INST_LOAD, .slot = 2},
|
||||
{.type = INST_STORE, .slot = 4},
|
||||
{.type = INST_BRANCH_ONCE, .rel = 25},
|
||||
{.type = INST_BRANCH_ONCE, .rel = 29},
|
||||
{.type = INST_HALT},
|
||||
{.type = INST_IMM, .imm = 0x0p+0},
|
||||
{.type = INST_STORE_OVER_NAN, .slot = 10},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741824},
|
||||
{.type = INST_STORE, .slot = 12},
|
||||
{.type = INST_LOAD_CTX, .ctx = 24},
|
||||
{.type = INST_LOAD_CTX, .ctx = 8},
|
||||
{.type = INST_OP, .op = OP_ADD},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741832},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_LOAD_CTX, .ctx = 16},
|
||||
{.type = INST_LOAD_CTX, .ctx = 0},
|
||||
{.type = INST_LOAD_CTX, .ctx = 8},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741844},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_OP, .op = OP_ADD},
|
||||
{.type = INST_LOAD_CTX, .ctx = 16},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741828},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_OP, .op = OP_ADD},
|
||||
{.type = INST_LOAD_CTX, .ctx = 0},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741840},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_OP, .op = OP_ADD},
|
||||
{.type = INST_STORE, .slot = 11},
|
||||
{.type = INST_IMM, .imm = 0x1p+0},
|
||||
{.type = INST_STORE, .slot = 5},
|
||||
|
@ -933,7 +937,7 @@ static struct script *script_template__fly_out(int *output_slots) {
|
|||
{.type = INST_STORE, .slot = 6},
|
||||
{.type = INST_IMM, .imm = 0x1p+0},
|
||||
{.type = INST_STORE, .slot = 7},
|
||||
{.type = INST_BRANCH, .rel = -51},
|
||||
{.type = INST_BRANCH, .rel = -55},
|
||||
{.type = INST_IMM, .imm = 0x0p+0},
|
||||
{.type = INST_STORE, .slot = 9},
|
||||
{.type = INST_LOAD, .slot = 12},
|
||||
|
@ -1033,22 +1037,32 @@ static bool win_script_preset__fly_out(struct win_script *output, config_setting
|
|||
double placeholder1_direction;
|
||||
double placeholder2_direction;
|
||||
double placeholder3_direction;
|
||||
double placeholder4_direction;
|
||||
double placeholder5_direction;
|
||||
if (strcmp(knob_direction, "up") == 0) {
|
||||
placeholder1_direction = 0x0p+0;
|
||||
placeholder2_direction = -0x1p+0;
|
||||
placeholder3_direction = 0x0p+0;
|
||||
placeholder4_direction = 0x0p+0;
|
||||
placeholder5_direction = -0x1p+0;
|
||||
} else if (strcmp(knob_direction, "down") == 0) {
|
||||
placeholder1_direction = 0x0p+0;
|
||||
placeholder2_direction = 0x1p+0;
|
||||
placeholder3_direction = 0x0p+0;
|
||||
placeholder4_direction = 0x0p+0;
|
||||
placeholder5_direction = 0x0p+0;
|
||||
} else if (strcmp(knob_direction, "left") == 0) {
|
||||
placeholder1_direction = -0x1p+0;
|
||||
placeholder2_direction = 0x0p+0;
|
||||
placeholder3_direction = 0x1p+0;
|
||||
placeholder4_direction = -0x1p+0;
|
||||
placeholder5_direction = 0x0p+0;
|
||||
} else if (strcmp(knob_direction, "right") == 0) {
|
||||
placeholder1_direction = 0x1p+0;
|
||||
placeholder2_direction = 0x0p+0;
|
||||
placeholder3_direction = 0x1p+0;
|
||||
placeholder4_direction = 0x0p+0;
|
||||
placeholder5_direction = 0x0p+0;
|
||||
} else {
|
||||
log_error("Invalid choice \"%s\" for option \"direction\". Line %d.",
|
||||
knob_direction,
|
||||
|
@ -1064,6 +1078,8 @@ static bool win_script_preset__fly_out(struct win_script *output, config_setting
|
|||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = placeholder1_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 8, .value = placeholder2_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 12, .value = placeholder3_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 16, .value = placeholder4_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 20, .value = placeholder5_direction},
|
||||
};
|
||||
script_specialize(output->script, spec, ARR_SIZE(spec));
|
||||
return true;
|
||||
|
@ -1107,12 +1123,23 @@ static struct script *script_template__fly_in(int *output_slots) {
|
|||
{.type = INST_STORE, .slot = 3},
|
||||
{.type = INST_LOAD, .slot = 2},
|
||||
{.type = INST_STORE, .slot = 4},
|
||||
{.type = INST_BRANCH_ONCE, .rel = 16},
|
||||
{.type = INST_BRANCH_ONCE, .rel = 27},
|
||||
{.type = INST_HALT},
|
||||
{.type = INST_LOAD_CTX, .ctx = 24},
|
||||
{.type = INST_OP, .op = OP_NEG},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741832},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_LOAD_CTX, .ctx = 8},
|
||||
{.type = INST_OP, .op = OP_SUB},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741844},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_OP, .op = OP_ADD},
|
||||
{.type = INST_LOAD_CTX, .ctx = 16},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741828},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_OP, .op = OP_ADD},
|
||||
{.type = INST_LOAD_CTX, .ctx = 0},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741840},
|
||||
{.type = INST_OP, .op = OP_MUL},
|
||||
{.type = INST_OP, .op = OP_ADD},
|
||||
{.type = INST_STORE_OVER_NAN, .slot = 10},
|
||||
{.type = INST_LOAD_CTX, .ctx = 1073741824},
|
||||
{.type = INST_STORE, .slot = 11},
|
||||
|
@ -1122,7 +1149,7 @@ static struct script *script_template__fly_in(int *output_slots) {
|
|||
{.type = INST_STORE, .slot = 6},
|
||||
{.type = INST_IMM, .imm = 0x1p+0},
|
||||
{.type = INST_STORE, .slot = 7},
|
||||
{.type = INST_BRANCH, .rel = -42},
|
||||
{.type = INST_BRANCH, .rel = -53},
|
||||
{.type = INST_IMM, .imm = 0x0p+0},
|
||||
{.type = INST_STORE, .slot = 9},
|
||||
{.type = INST_LOAD, .slot = 11},
|
||||
|
@ -1222,22 +1249,32 @@ static bool win_script_preset__fly_in(struct win_script *output, config_setting_
|
|||
double placeholder1_direction;
|
||||
double placeholder2_direction;
|
||||
double placeholder3_direction;
|
||||
double placeholder4_direction;
|
||||
double placeholder5_direction;
|
||||
if (strcmp(knob_direction, "up") == 0) {
|
||||
placeholder1_direction = 0x0p+0;
|
||||
placeholder2_direction = -0x1p+0;
|
||||
placeholder3_direction = 0x0p+0;
|
||||
placeholder4_direction = 0x0p+0;
|
||||
placeholder5_direction = -0x1p+0;
|
||||
} else if (strcmp(knob_direction, "down") == 0) {
|
||||
placeholder1_direction = 0x0p+0;
|
||||
placeholder2_direction = 0x1p+0;
|
||||
placeholder3_direction = 0x0p+0;
|
||||
placeholder4_direction = 0x0p+0;
|
||||
placeholder5_direction = 0x0p+0;
|
||||
} else if (strcmp(knob_direction, "left") == 0) {
|
||||
placeholder1_direction = -0x1p+0;
|
||||
placeholder2_direction = 0x0p+0;
|
||||
placeholder3_direction = 0x1p+0;
|
||||
placeholder4_direction = -0x1p+0;
|
||||
placeholder5_direction = 0x0p+0;
|
||||
} else if (strcmp(knob_direction, "right") == 0) {
|
||||
placeholder1_direction = 0x1p+0;
|
||||
placeholder2_direction = 0x0p+0;
|
||||
placeholder3_direction = 0x1p+0;
|
||||
placeholder4_direction = 0x0p+0;
|
||||
placeholder5_direction = 0x0p+0;
|
||||
} else {
|
||||
log_error("Invalid choice \"%s\" for option \"direction\". Line %d.",
|
||||
knob_direction,
|
||||
|
@ -1253,6 +1290,8 @@ static bool win_script_preset__fly_in(struct win_script *output, config_setting_
|
|||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 4, .value = placeholder1_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 8, .value = placeholder2_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 12, .value = placeholder3_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 16, .value = placeholder4_direction},
|
||||
{.offset = SCRIPT_CTX_PLACEHOLDER_BASE + 20, .value = placeholder5_direction},
|
||||
};
|
||||
script_specialize(output->script, spec, ARR_SIZE(spec));
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue