Skip to content

Commit

Permalink
Merge branch 'yshui:next' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
pijulius authored Oct 9, 2024
2 parents 9977760 + b631485 commit 6b0d33d
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 20 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ scrouthtv <lennivh24 at gmail.com>
Sebastien Waegeneire <sebastien at waegeneire.com>
Stefan Radziuk <stefan.radziuk19 at imperial.ac.uk>
Subhaditya Nath <sn03.general at gmail.com>
Suyooo <me at suyo.be>
Tasos Sahanidis <tasos at tasossah.com>
Thiago Kenji Okada <thiagokokada at gmail.com>
Tilman Sauerbeck <tilman at code-monkey.de>
Expand Down
20 changes: 12 additions & 8 deletions data/animation_presets.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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)";
Expand All @@ -133,17 +133,19 @@ 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 = {
v-timing = {
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)";
Expand All @@ -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 = {
Expand Down
20 changes: 18 additions & 2 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,8 @@ static void unredirect(session_t *ps) {
xcb_composite_unredirect_subwindows(ps->c.c, ps->c.screen_info->root,
session_redirection_mode(ps));
// Unmap overlay window
if (ps->overlay != XCB_NONE) {
if (ps->overlay != XCB_NONE &&
session_redirection_mode(ps) == XCB_COMPOSITE_REDIRECT_MANUAL) {
xcb_unmap_window(ps->c.c, ps->overlay);
}

Expand Down Expand Up @@ -2559,6 +2560,21 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
// We are here if we don't really function as a compositor, so we are not
// taking over the screen, and we don't need to register as a compositor

// We still need to know what the overlay window is, so we won't be
// confused when we get events for the overlay window. Since
// CompositeGetOverlayWindow also maps the overlay, we need to immediately
// release it.
auto get_overlay =
xcb_composite_get_overlay_window(ps->c.c, ps->c.screen_info->root);
XCB_AWAIT_VOID(xcb_composite_release_overlay_window, ps->c.c,
ps->c.screen_info->root);
auto overlay_reply =
xcb_composite_get_overlay_window_reply(ps->c.c, get_overlay, NULL);
if (overlay_reply) {
ps->overlay = overlay_reply->overlay_win;
free(overlay_reply);
}

// If we are in debug mode, we need to create a window for rendering if
// the backend supports presenting.

Expand Down Expand Up @@ -2674,7 +2690,7 @@ static void session_destroy(session_t *ps) {
#endif

// Release overlay window
if (ps->overlay) {
if (ps->overlay && session_redirection_mode(ps) == XCB_COMPOSITE_REDIRECT_MANUAL) {
xcb_composite_release_overlay_window(ps->c.c, ps->overlay);
ps->overlay = XCB_NONE;
}
Expand Down
59 changes: 49 additions & 10 deletions src/transition/generated/script_templates.c
Original file line number Diff line number Diff line change
Expand Up @@ -909,31 +909,35 @@ 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},
{.type = INST_IMM, .imm = 0x1p+0},
{.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},
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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},
Expand All @@ -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},
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 6b0d33d

Please sign in to comment.