mouse: don't pass parser data, useless

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-23 16:15:24 +02:00
parent 341f58b9f6
commit 100f62c4b9
1 changed files with 15 additions and 26 deletions

41
mouse.c
View File

@ -236,14 +236,12 @@ mouse_snap_to_corner(area_t a, int *x, int *y, corner_t corner)
/** Redraw the infobox. /** Redraw the infobox.
* \param ctx Draw context. * \param ctx Draw context.
* \param sw The simple window. * \param sw The simple window.
* \param pdata The draw parser data.
* \param geometry The geometry to use for the box. * \param geometry The geometry to use for the box.
* \param border The client border size. * \param border The client border size.
*/ */
static void static void
mouse_infobox_draw(draw_context_t *ctx, mouse_infobox_draw(draw_context_t *ctx,
simple_window_t *sw, simple_window_t *sw,
draw_parser_data_t *pdata,
area_t geometry, int border) area_t geometry, int border)
{ {
area_t draw_geometry = { 0, 0, ctx->width, ctx->height }; area_t draw_geometry = { 0, 0, ctx->width, ctx->height };
@ -252,7 +250,7 @@ mouse_infobox_draw(draw_context_t *ctx,
snprintf(size, sizeof(size), "<text align=\"center\"/>%dx%d+%d+%d", snprintf(size, sizeof(size), "<text align=\"center\"/>%dx%d+%d+%d",
geometry.width, geometry.height, geometry.x, geometry.y); geometry.width, geometry.height, geometry.x, geometry.y);
draw_rectangle(ctx, draw_geometry, 1.0, true, globalconf.colors.bg); draw_rectangle(ctx, draw_geometry, 1.0, true, globalconf.colors.bg);
draw_text(ctx, globalconf.font, draw_geometry, size, pdata); draw_text(ctx, globalconf.font, draw_geometry, size, NULL);
simplewindow_move(sw, simplewindow_move(sw,
geometry.x + ((2 * border + geometry.width) - sw->geometry.width) / 2, geometry.x + ((2 * border + geometry.width) - sw->geometry.width) / 2,
geometry.y + ((2 * border + geometry.height) - sw->geometry.height) / 2); geometry.y + ((2 * border + geometry.height) - sw->geometry.height) / 2);
@ -264,20 +262,22 @@ mouse_infobox_draw(draw_context_t *ctx,
* \param border Border size of the client. * \param border Border size of the client.
* \param geometry Client geometry. * \param geometry Client geometry.
* \param ctx Draw context to create. * \param ctx Draw context to create.
* \param pdata The draw parser data to fill.
* \return The simple window. * \return The simple window.
*/ */
static simple_window_t * static simple_window_t *
mouse_infobox_new(int phys_screen, int border, area_t geometry, mouse_infobox_new(int phys_screen, int border, area_t geometry,
draw_context_t **ctx, draw_parser_data_t *pdata) draw_context_t **ctx)
{ {
simple_window_t *sw; simple_window_t *sw;
area_t geom; area_t geom;
draw_parser_data_t pdata;
draw_parser_data_init(&pdata);
geom = draw_text_extents(globalconf.connection, geom = draw_text_extents(globalconf.connection,
globalconf.default_screen, globalconf.default_screen,
globalconf.font, globalconf.font,
"0000x0000+0000+0000", pdata); "0000x0000+0000+0000", &pdata);
geom.x = geometry.x + ((2 * border + geometry.width) - geom.width) / 2; geom.x = geometry.x + ((2 * border + geometry.width) - geom.width) / 2;
geom.y = geometry.y + ((2 * border + geometry.height) - geom.height) / 2; geom.y = geometry.y + ((2 * border + geometry.height) - geom.height) / 2;
@ -292,7 +292,9 @@ mouse_infobox_new(int phys_screen, int border, area_t geometry,
globalconf.colors.bg); globalconf.colors.bg);
xcb_map_window(globalconf.connection, sw->window); xcb_map_window(globalconf.connection, sw->window);
mouse_infobox_draw(*ctx, sw, pdata, geometry, border); mouse_infobox_draw(*ctx, sw, geometry, border);
draw_parser_data_wipe(&pdata);
return sw; return sw;
} }
@ -463,9 +465,7 @@ mouse_client_move(client_t *c, int snap, bool infobox)
draw_context_t *ctx; draw_context_t *ctx;
/* the root window */ /* the root window */
xcb_window_t root; xcb_window_t root;
draw_parser_data_t pdata;
draw_parser_data_init(&pdata);
layout = layout_get_current(c->screen); layout = layout_get_current(c->screen);
root = xutil_screen_get(globalconf.connection, c->phys_screen)->root; root = xutil_screen_get(globalconf.connection, c->phys_screen)->root;
@ -479,13 +479,12 @@ mouse_client_move(client_t *c, int snap, bool infobox)
if(infobox && (c->isfloating || layout == layout_floating)) if(infobox && (c->isfloating || layout == layout_floating))
{ {
sw = mouse_infobox_new(c->phys_screen, c->border, c->geometry, &ctx, &pdata); sw = mouse_infobox_new(c->phys_screen, c->border, c->geometry, &ctx);
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
} }
/* for each motion event */ /* for each motion event */
while(mouse_track_mouse_drag(&mouse_x, &mouse_y)) while(mouse_track_mouse_drag(&mouse_x, &mouse_y))
{
if(c->isfloating || layout == layout_floating) if(c->isfloating || layout == layout_floating)
{ {
area_t geometry; area_t geometry;
@ -504,7 +503,7 @@ mouse_client_move(client_t *c, int snap, bool infobox)
/* draw the infobox */ /* draw the infobox */
if(sw) if(sw)
{ {
mouse_infobox_draw(ctx, sw, &pdata, c->geometry, c->border); mouse_infobox_draw(ctx, sw, c->geometry, c->border);
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
} }
@ -539,7 +538,6 @@ mouse_client_move(client_t *c, int snap, bool infobox)
layout_refresh(); layout_refresh();
} }
} }
}
/* ungrab pointer */ /* ungrab pointer */
xcb_ungrab_pointer(globalconf.connection, XCB_CURRENT_TIME); xcb_ungrab_pointer(globalconf.connection, XCB_CURRENT_TIME);
@ -550,9 +548,6 @@ mouse_client_move(client_t *c, int snap, bool infobox)
draw_context_delete(&ctx); draw_context_delete(&ctx);
simplewindow_delete(&sw); simplewindow_delete(&sw);
} }
xcb_aux_sync(globalconf.connection);
draw_parser_data_wipe(&pdata);
} }
@ -574,9 +569,7 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox)
draw_context_t *ctx; draw_context_t *ctx;
size_t cursor = CurResize; size_t cursor = CurResize;
int top, bottom, left, right; int top, bottom, left, right;
draw_parser_data_t pdata;
draw_parser_data_init(&pdata);
screen = xutil_screen_get(globalconf.connection, c->phys_screen); screen = xutil_screen_get(globalconf.connection, c->phys_screen);
/* get current mouse position */ /* get current mouse position */
@ -621,7 +614,7 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox)
/* create the infobox */ /* create the infobox */
if(infobox) if(infobox)
{ {
sw = mouse_infobox_new(c->phys_screen, c->border, c->geometry, &ctx, &pdata); sw = mouse_infobox_new(c->phys_screen, c->border, c->geometry, &ctx);
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
} }
@ -695,7 +688,7 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox)
/* draw the infobox */ /* draw the infobox */
if(sw) if(sw)
mouse_infobox_draw(ctx, sw, &pdata, c->geometry, c->border); mouse_infobox_draw(ctx, sw, c->geometry, c->border);
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
} }
@ -709,7 +702,6 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox)
draw_context_delete(&ctx); draw_context_delete(&ctx);
simplewindow_delete(&sw); simplewindow_delete(&sw);
} }
draw_parser_data_wipe(&pdata);
} }
/** Resize the master column/row of a tiled layout /** Resize the master column/row of a tiled layout
@ -833,9 +825,7 @@ mouse_client_resize_magnified(client_t *c, bool infobox)
simple_window_t *sw = NULL; simple_window_t *sw = NULL;
draw_context_t *ctx; draw_context_t *ctx;
xcb_window_t root; xcb_window_t root;
draw_parser_data_t pdata;
draw_parser_data_init(&pdata);
tag = tags_get_current(c->screen)[0]; tag = tags_get_current(c->screen)[0];
root = xutil_screen_get(globalconf.connection, c->phys_screen)->root; root = xutil_screen_get(globalconf.connection, c->phys_screen)->root;
@ -880,7 +870,7 @@ mouse_client_resize_magnified(client_t *c, bool infobox)
/* create the infobox */ /* create the infobox */
if(infobox) if(infobox)
sw = mouse_infobox_new(c->phys_screen, c->border, c->geometry, &ctx, &pdata); sw = mouse_infobox_new(c->phys_screen, c->border, c->geometry, &ctx);
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
@ -912,7 +902,7 @@ mouse_client_resize_magnified(client_t *c, bool infobox)
/* draw the infobox */ /* draw the infobox */
if(sw) if(sw)
{ {
mouse_infobox_draw(ctx, sw, &pdata, c->geometry, c->border); mouse_infobox_draw(ctx, sw, c->geometry, c->border);
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
} }
} }
@ -926,7 +916,6 @@ mouse_client_resize_magnified(client_t *c, bool infobox)
draw_context_delete(&ctx); draw_context_delete(&ctx);
simplewindow_delete(&sw); simplewindow_delete(&sw);
} }
draw_parser_data_wipe(&pdata);
} }
/** Resize a client with the mouse. /** Resize a client with the mouse.