1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

Misc: Small adjustments

- Minor change of code in configure_win() for a slight performance boost
  in some cases.

- Discovered there are a lot of X errors that I basically cannot fix, caused by
  the asynchronous nature of Xlib...

- Correct the position of the timestamps in DEBUG_REPAINT. This might
  have negative effects for debugging X errors, though.
This commit is contained in:
Richard Grenville 2012-10-30 18:11:30 +08:00
parent 853d20ef56
commit 56e181309e

View file

@ -1261,6 +1261,9 @@ border_size(Display *dpy, win *w) {
border = XFixesCreateRegionFromWindow( border = XFixesCreateRegionFromWindow(
dpy, w->id, WindowRegionBounding); dpy, w->id, WindowRegionBounding);
if (!border)
return None;
/* translate this */ /* translate this */
XFixesTranslateRegion(dpy, border, XFixesTranslateRegion(dpy, border,
w->a.x + w->a.border_width, w->a.x + w->a.border_width,
@ -1607,10 +1610,6 @@ paint_all(Display *dpy, XserverRegion region, win *t) {
root_width, root_height); root_width, root_height);
#endif #endif
#ifdef DEBUG_REPAINT
printf("paint:");
#endif
if (t && t->reg_ignore) { if (t && t->reg_ignore) {
// Calculate the region upon which the root window is to be painted // Calculate the region upon which the root window is to be painted
// based on the ignore region of the lowest window, if available // based on the ignore region of the lowest window, if available
@ -1631,10 +1630,6 @@ paint_all(Display *dpy, XserverRegion region, win *t) {
reg_tmp2 = XFixesCreateRegion(dpy, NULL, 0); reg_tmp2 = XFixesCreateRegion(dpy, NULL, 0);
for (w = t; w; w = w->prev_trans) { for (w = t; w; w = w->prev_trans) {
#ifdef DEBUG_REPAINT
printf(" %#010lx", w->id);
#endif
// Painting shadow // Painting shadow
if (w->shadow) { if (w->shadow) {
// Shadow is to be painted based on the ignore region of current // Shadow is to be painted based on the ignore region of current
@ -1694,10 +1689,6 @@ paint_all(Display *dpy, XserverRegion region, win *t) {
check_fade_fin(dpy, w); check_fade_fin(dpy, w);
} }
#ifdef DEBUG_REPAINT
printf("\n");
#endif
// Free up all temporary regions // Free up all temporary regions
XFixesDestroyRegion(dpy, region); XFixesDestroyRegion(dpy, region);
XFixesDestroyRegion(dpy, reg_tmp); XFixesDestroyRegion(dpy, reg_tmp);
@ -1730,16 +1721,18 @@ paint_all(Display *dpy, XserverRegion region, win *t) {
XFlush(dpy); XFlush(dpy);
#ifdef DEBUG_REPAINT #ifdef DEBUG_REPAINT
// It prints the timestamp in the wrong line, but...
print_timestamp(); print_timestamp();
struct timespec now = get_time_timespec(); struct timespec now = get_time_timespec();
struct timespec diff = { 0 }; struct timespec diff = { 0 };
timespec_subtract(&diff, &now, &last_paint); timespec_subtract(&diff, &now, &last_paint);
printf("[ %5ld:%09ld ] ", diff.tv_sec, diff.tv_nsec); printf("[ %5ld:%09ld ] ", diff.tv_sec, diff.tv_nsec);
last_paint = now; last_paint = now;
printf("paint:");
for (w = t; w; w = w->prev_trans)
printf(" %#010lx", w->id);
putchar('\n');
fflush(stdout); fflush(stdout);
#endif #endif
} }
static void static void
@ -2403,10 +2396,6 @@ restack_win(Display *dpy, win *w, Window new_above) {
static void static void
configure_win(Display *dpy, XConfigureEvent *ce) { configure_win(Display *dpy, XConfigureEvent *ce) {
win *w = find_win(dpy, ce->window);
XserverRegion damage = None;
if (!w) {
if (ce->window == root) { if (ce->window == root) {
if (tgt_buffer) { if (tgt_buffer) {
XRenderFreePicture(dpy, tgt_buffer); XRenderFreePicture(dpy, tgt_buffer);
@ -2414,10 +2403,16 @@ configure_win(Display *dpy, XConfigureEvent *ce) {
} }
root_width = ce->width; root_width = ce->width;
root_height = ce->height; root_height = ce->height;
}
return; return;
} }
win *w = find_win(dpy, ce->window);
XserverRegion damage = None;
if (!w)
return;
if (w->a.map_state == IsUnmapped) { if (w->a.map_state == IsUnmapped) {
/* save the configure event for when the window maps */ /* save the configure event for when the window maps */
w->need_configure = True; w->need_configure = True;