event: add partial redraw
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
669c023ca9
commit
24d6341c39
14
event.c
14
event.c
|
@ -495,25 +495,25 @@ event_handle_expose(void *data __attribute__ ((unused)),
|
|||
xcb_connection_t *connection __attribute__ ((unused)),
|
||||
xcb_expose_event_t *ev)
|
||||
{
|
||||
if(!ev->count)
|
||||
{
|
||||
int screen;
|
||||
client_t *c;
|
||||
|
||||
for(screen = 0; screen < globalconf.nscreen; screen++)
|
||||
for(int screen = 0; screen < globalconf.nscreen; screen++)
|
||||
for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
|
||||
{
|
||||
statusbar_t *statusbar = globalconf.screens[screen].statusbars.tab[i];
|
||||
if(statusbar->sw.window == ev->window)
|
||||
{
|
||||
simplewindow_refresh_pixmap(&statusbar->sw);
|
||||
simplewindow_refresh_pixmap_partial(&statusbar->sw,
|
||||
ev->x, ev->y,
|
||||
ev->width, ev->height);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if((c = client_getbytitlebarwin(ev->window)))
|
||||
simplewindow_refresh_pixmap(&c->titlebar->sw);
|
||||
}
|
||||
simplewindow_refresh_pixmap_partial(&c->titlebar->sw,
|
||||
ev->x, ev->y,
|
||||
ev->width, ev->height);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -236,12 +236,13 @@ simplewindow_moveresize(simple_window_t *sw, int x, int y, int w, int h)
|
|||
* \param sw The simple window to refresh.
|
||||
*/
|
||||
void
|
||||
simplewindow_refresh_pixmap(simple_window_t *sw)
|
||||
simplewindow_refresh_pixmap_partial(simple_window_t *sw,
|
||||
int16_t x, int16_t y,
|
||||
uint16_t w, uint16_t h)
|
||||
{
|
||||
xcb_copy_area(globalconf.connection, sw->pixmap,
|
||||
sw->window, sw->gc, 0, 0, 0, 0,
|
||||
sw->geometry.width,
|
||||
sw->geometry.height);
|
||||
sw->window, sw->gc, x, y, x, y,
|
||||
w, h);
|
||||
}
|
||||
|
||||
/** Set a simple window border width.
|
||||
|
|
12
swindow.h
12
swindow.h
|
@ -59,9 +59,19 @@ void simplewindow_wipe(simple_window_t *);
|
|||
void simplewindow_move(simple_window_t *, int, int);
|
||||
void simplewindow_resize(simple_window_t *, int, int);
|
||||
void simplewindow_moveresize(simple_window_t *, int, int, int, int);
|
||||
void simplewindow_refresh_pixmap(simple_window_t *);
|
||||
void simplewindow_refresh_pixmap_partial(simple_window_t *, int16_t, int16_t, uint16_t, uint16_t);
|
||||
void simplewindow_border_width_set(simple_window_t *, uint32_t);
|
||||
void simplewindow_border_color_set(simple_window_t *, const xcolor_t *);
|
||||
|
||||
/** Refresh the window content by copying its pixmap data to its window.
|
||||
* \param sw The simple window to refresh.
|
||||
*/
|
||||
static inline void
|
||||
simplewindow_refresh_pixmap(simple_window_t *sw)
|
||||
{
|
||||
simplewindow_refresh_pixmap_partial(sw, 0, 0, sw->geometry.width, sw->geometry.height);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
Loading…
Reference in New Issue