swindow: only send one event for moveresize
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
16646c86ab
commit
3555e89c1c
|
@ -121,4 +121,33 @@ simplewindow_resize(simple_window_t *sw, unsigned int w, unsigned int h)
|
||||||
xcb_free_pixmap(sw->connection, d);
|
xcb_free_pixmap(sw->connection, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Move and resize a window in one call.
|
||||||
|
* \param sw The simple window to move and resize.
|
||||||
|
* \param x The new x coordinate.
|
||||||
|
* \param y The new y coordinate.
|
||||||
|
* \param w The new width.
|
||||||
|
* \param h The new height.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
simplewindow_moveresize(simple_window_t *sw, int x, int y,
|
||||||
|
unsigned int w, unsigned int h)
|
||||||
|
{
|
||||||
|
const uint32_t moveresize_win_vals[] = { x, y, w, h };
|
||||||
|
xcb_pixmap_t d;
|
||||||
|
xcb_screen_t *s = xcb_aux_get_screen(sw->connection, sw->phys_screen);
|
||||||
|
|
||||||
|
sw->geometry.x = x;
|
||||||
|
sw->geometry.y = y;
|
||||||
|
sw->geometry.width = w;
|
||||||
|
sw->geometry.height = h;
|
||||||
|
d = sw->pixmap;
|
||||||
|
sw->pixmap = xcb_generate_id(sw->connection);
|
||||||
|
xcb_create_pixmap(sw->connection, s->root_depth, sw->pixmap, s->root, w, h);
|
||||||
|
xcb_configure_window(sw->connection, sw->window,
|
||||||
|
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
|
||||||
|
| XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
|
||||||
|
moveresize_win_vals);
|
||||||
|
xcb_free_pixmap(sw->connection, d);
|
||||||
|
}
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
|
@ -62,21 +62,7 @@ simplewindow_delete(simple_window_t **sw)
|
||||||
|
|
||||||
void simplewindow_move(simple_window_t *, int, int);
|
void simplewindow_move(simple_window_t *, int, int);
|
||||||
void simplewindow_resize(simple_window_t *, unsigned int, unsigned int);
|
void simplewindow_resize(simple_window_t *, unsigned int, unsigned int);
|
||||||
|
void simplewindow_moveresize(simple_window_t *, int, int, unsigned int, unsigned int);
|
||||||
/** Move and resize a window in one call.
|
|
||||||
* \param sw The simple window to move and resize.
|
|
||||||
* \param x The new x coordinate.
|
|
||||||
* \param y The new y coordinate.
|
|
||||||
* \param w The new width.
|
|
||||||
* \param h The new height.
|
|
||||||
*/
|
|
||||||
static inline void
|
|
||||||
simplewindow_move_resize(simple_window_t *sw, int x, int y,
|
|
||||||
unsigned int w, unsigned int h)
|
|
||||||
{
|
|
||||||
simplewindow_move(sw, x, y);
|
|
||||||
simplewindow_resize(sw, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Refresh the window content by copying its pixmap data to its window.
|
/** Refresh the window content by copying its pixmap data to its window.
|
||||||
* \param sw The simple window to refresh.
|
* \param sw The simple window to refresh.
|
||||||
|
|
16
titlebar.c
16
titlebar.c
|
@ -168,7 +168,7 @@ titlebar_update_geometry_floating(client_t *c)
|
||||||
x_offset = (c->geometry.width - width) / 2;
|
x_offset = (c->geometry.width - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
c->geometry.x + x_offset,
|
c->geometry.x + x_offset,
|
||||||
c->geometry.y - c->titlebar->sw->geometry.height,
|
c->geometry.y - c->titlebar->sw->geometry.height,
|
||||||
width,
|
width,
|
||||||
|
@ -190,7 +190,7 @@ titlebar_update_geometry_floating(client_t *c)
|
||||||
x_offset = (c->geometry.width - width) / 2;
|
x_offset = (c->geometry.width - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
c->geometry.x + x_offset,
|
c->geometry.x + x_offset,
|
||||||
c->geometry.y + c->geometry.height + 2 * c->border,
|
c->geometry.y + c->geometry.height + 2 * c->border,
|
||||||
width,
|
width,
|
||||||
|
@ -212,7 +212,7 @@ titlebar_update_geometry_floating(client_t *c)
|
||||||
y_offset = (c->geometry.height - width) / 2;
|
y_offset = (c->geometry.height - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
c->geometry.x - c->titlebar->sw->geometry.width,
|
c->geometry.x - c->titlebar->sw->geometry.width,
|
||||||
c->geometry.y + y_offset,
|
c->geometry.y + y_offset,
|
||||||
c->titlebar->sw->geometry.width,
|
c->titlebar->sw->geometry.width,
|
||||||
|
@ -234,7 +234,7 @@ titlebar_update_geometry_floating(client_t *c)
|
||||||
y_offset = (c->geometry.height - width) / 2;
|
y_offset = (c->geometry.height - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
c->geometry.x + c->geometry.width + 2 * c->border,
|
c->geometry.x + c->geometry.width + 2 * c->border,
|
||||||
c->geometry.y + y_offset,
|
c->geometry.y + y_offset,
|
||||||
c->titlebar->sw->geometry.width,
|
c->titlebar->sw->geometry.width,
|
||||||
|
@ -277,7 +277,7 @@ titlebar_update_geometry(client_t *c, area_t geometry)
|
||||||
x_offset = (geometry.width - width) / 2;
|
x_offset = (geometry.width - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
geometry.x + x_offset,
|
geometry.x + x_offset,
|
||||||
geometry.y,
|
geometry.y,
|
||||||
width,
|
width,
|
||||||
|
@ -299,7 +299,7 @@ titlebar_update_geometry(client_t *c, area_t geometry)
|
||||||
x_offset = (geometry.width - width) / 2;
|
x_offset = (geometry.width - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
geometry.x + x_offset,
|
geometry.x + x_offset,
|
||||||
geometry.y + geometry.height
|
geometry.y + geometry.height
|
||||||
- c->titlebar->sw->geometry.height + 2 * c->border,
|
- c->titlebar->sw->geometry.height + 2 * c->border,
|
||||||
|
@ -322,7 +322,7 @@ titlebar_update_geometry(client_t *c, area_t geometry)
|
||||||
y_offset = (geometry.height - width) / 2;
|
y_offset = (geometry.height - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
geometry.x,
|
geometry.x,
|
||||||
geometry.y + y_offset,
|
geometry.y + y_offset,
|
||||||
c->titlebar->sw->geometry.width,
|
c->titlebar->sw->geometry.width,
|
||||||
|
@ -344,7 +344,7 @@ titlebar_update_geometry(client_t *c, area_t geometry)
|
||||||
y_offset = (geometry.height - width) / 2;
|
y_offset = (geometry.height - width) / 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
simplewindow_move_resize(c->titlebar->sw,
|
simplewindow_moveresize(c->titlebar->sw,
|
||||||
geometry.x + geometry.width
|
geometry.x + geometry.width
|
||||||
- c->titlebar->sw->geometry.width + 2 * c->border,
|
- c->titlebar->sw->geometry.width + 2 * c->border,
|
||||||
geometry.y + y_offset,
|
geometry.y + y_offset,
|
||||||
|
|
Loading…
Reference in New Issue