screen->windows[i] = screen->windows[i+1];
}
+CompositedWindow *reorder_window(CompositedScreen *screen, CompositedWindow *window, Window above)
+{
+ unsigned i, j;
+ CompositedWindow hold;
+
+ i = window-screen->windows;
+ if(above)
+ {
+ for(j=0; j<screen->nwindows; ++j)
+ if(screen->windows[j].window==above)
+ break;
+
+ if(j>=screen->nwindows || i==j+1)
+ return window;
+
+ if(j<i)
+ ++j;
+ }
+ else
+ j = 0;
+
+ hold = *window;
+ if(i<j)
+ {
+ for(; i<j; ++i)
+ screen->windows[i] = screen->windows[i+1];
+ }
+ else
+ {
+ for(; i>j; --i)
+ screen->windows[i] = screen->windows[i-1];
+ }
+ screen->windows[j] = hold;
+
+ return &screen->windows[j];
+}
+
CompositedScreen *find_screen_by_root(Compositor *compositor, Window root)
{
unsigned i;
mark_dirty(compositor, screen);
}
+void process_configure_event(Compositor *compositor, XConfigureEvent *event)
+{
+ CompositedScreen *screen = find_screen_by_root(compositor, event->event);
+ if(!screen)
+ return;
+
+ CompositedWindow *window = find_window(screen, event->window);
+ if(!window)
+ return;
+
+ window->x = event->x;
+ window->y = event->y;
+ if((unsigned)event->width!=window->width || (unsigned)event->height!=window->height || (unsigned)event->border_width!=window->border)
+ {
+ window->width = event->width;
+ window->height = event->height;
+ window->border = event->border_width;
+ create_window_pixmap(compositor, screen, window);
+ }
+ reorder_window(screen, window, event->above);
+
+ if(window->map_state==IsViewable)
+ mark_dirty(compositor, screen);
+}
+
void process_damage_event(Compositor *compositor, XDamageNotifyEvent *event)
{
CompositedScreen *screen = find_screen_by_window(compositor, event->drawable);
case ReparentNotify:
process_reparent_event(compositor, &event.xreparent);
break;
+ case ConfigureNotify:
+ process_configure_event(compositor, &event.xconfigure);
+ break;
default:
if(event.type==compositor->damage_event+XDamageNotify)
process_damage_event(compositor, (XDamageNotifyEvent *)&event);