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 10, 2024
2 parents 6b0d33d + 240c269 commit 62bb3c3
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 95 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
# v12
# 12.2 (2024-Oct-10)

## Improvements

* fly-out/slide-out animation presets no longer cause jumps in window opacity

## Bug fixes

* Random delays before screen is updated (#1345 #1330)
* Fix building on 32-bit systems (#1346)
* Fix blank screen on 32-bit systems
* Fix fly-in/fly-out animation presets so they work with directions other than up and left

# v12.1 (2024-Sep-29)

## Bug fixes

* picom stops rendering correctly after monitor configuration changes (#1338, thanks to @Suyooo)

# v12 (2024-Sep-27)

## Bug fixes

Expand Down
19 changes: 12 additions & 7 deletions data/animation_presets.conf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ slide-out = {
crop-y = "window-y";
crop-width = "window-width";
crop-height = "window-height";
opacity = 1;
opacity = {
start = "window-raw-opacity-before";
end = "window-raw-opacity-before";
duration = "placeholder0";
};
blur-opacity = "opacity";
shadow-opacity = "opacity";
*knobs = {
Expand Down Expand Up @@ -124,9 +128,13 @@ fly-out = {
offset-y = "v-timing * (1 - placeholder3)";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
opacity = 1;
shadow-opacity = 1;
blur-opacity = 1;
opacity = {
start = "window-raw-opacity-before";
end = "window-raw-opacity-before";
duration = "placeholder0";
};
shadow-opacity = "opacity";
blur-opacity = "opacity";
*knobs = {
duration = 0.2;
direction = (0, ["up", "down", "left", "right"]);
Expand All @@ -151,9 +159,6 @@ fly-in = {
offset-y = "v-timing * (1 - placeholder3)";
shadow-offset-x = "offset-x";
shadow-offset-y = "offset-y";
opacity = 1;
shadow-opacity = 1;
blur-opacity = 1;
*knobs = {
duration = 0.2;
direction = (0, ["up", "down", "left", "right"]);
Expand Down
65 changes: 41 additions & 24 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1456,31 +1456,48 @@ static void unredirect(session_t *ps) {
static void handle_x_events(struct session *ps) {
bool wm_was_consistent = wm_is_consistent(ps->wm);

if (ps->vblank_scheduler) {
vblank_handle_x_events(ps->vblank_scheduler);
}
while (true) {
// Flush because if we go into sleep when there is still requests
// in the outgoing buffer, they will not be sent for an indefinite
// amount of time. Use XFlush here too, we might still use some
// Xlib functions because OpenGL.
//
// Also note, `xcb_flush`/`XFlush` may _read_ more events from the server
// (yes, this is ridiculous, I know). But since we are polling for events
// in a loop, this should be fine - if we read events here, they will be
// handled below; and if some requests is sent later in this loop, which
// means some events must have been received, we will loop once more and
// get here to flush them.
XFlush(ps->c.dpy);
xcb_flush(ps->c.c);

// We have to check for vblank events (i.e. special xcb events) and normal
// events in a loop. This is because both `xcb_poll_for_event` and
// `xcb_poll_for_special_event` will read data from the X connection and
// put it in a buffer. So whichever one we call last, say
// `xcb_poll_for_special_event`, will read data into the buffer that might
// contain events that `xcb_poll_for_event` should handle, and vice versa.
// This causes us to go into sleep with events in the buffer.
//
// We have to keep calling both of them until neither of them return any
// events.
bool has_events = false;
if (ps->vblank_scheduler) {
has_events = vblank_handle_x_events(ps->vblank_scheduler) ==
VBLANK_HANDLE_X_EVENTS_OK;
}

xcb_generic_event_t *ev;
while ((ev = x_poll_for_event(&ps->c))) {
has_events = true;
ev_handle(ps, (xcb_generic_event_t *)ev);
free(ev);
};

// Flush because if we go into sleep when there is still requests in the
// outgoing buffer, they will not be sent for an indefinite amount of
// time. Use XFlush here too, we might still use some Xlib functions
// because OpenGL.
//
// Also note, after we have flushed here, we won't flush again in this
// function before going into sleep. This is because `xcb_flush`/`XFlush`
// may _read_ more events from the server (yes, this is ridiculous, I
// know). And we can't have that, see the comments above this function.
//
// This means if functions called ev_handle need to send some events,
// they need to carefully make sure those events are flushed, one way or
// another.
XFlush(ps->c.dpy);
xcb_flush(ps->c.c);

xcb_generic_event_t *ev;
while ((ev = x_poll_for_event(&ps->c))) {
ev_handle(ps, (xcb_generic_event_t *)ev);
free(ev);
};
if (!has_events) {
break;
}
}
int err = xcb_connection_has_error(ps->c.c);
if (err) {
log_fatal("X11 server connection broke (error %d)", err);
Expand Down
Loading

0 comments on commit 62bb3c3

Please sign in to comment.