From 100f62c4b97f41512d71fe60c09fbc37c1d3d63e Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 23 Jun 2008 16:15:24 +0200 Subject: [PATCH] mouse: don't pass parser data, useless Signed-off-by: Julien Danjou --- mouse.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/mouse.c b/mouse.c index 87943946..ae2188e6 100644 --- a/mouse.c +++ b/mouse.c @@ -236,14 +236,12 @@ mouse_snap_to_corner(area_t a, int *x, int *y, corner_t corner) /** Redraw the infobox. * \param ctx Draw context. * \param sw The simple window. - * \param pdata The draw parser data. * \param geometry The geometry to use for the box. * \param border The client border size. */ static void mouse_infobox_draw(draw_context_t *ctx, simple_window_t *sw, - draw_parser_data_t *pdata, area_t geometry, int border) { 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), "%dx%d+%d+%d", geometry.width, geometry.height, geometry.x, geometry.y); 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, geometry.x + ((2 * border + geometry.width) - sw->geometry.width) / 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 geometry Client geometry. * \param ctx Draw context to create. - * \param pdata The draw parser data to fill. * \return The simple window. */ static simple_window_t * 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; area_t geom; + draw_parser_data_t pdata; + + draw_parser_data_init(&pdata); geom = draw_text_extents(globalconf.connection, globalconf.default_screen, globalconf.font, - "0000x0000+0000+0000", pdata); + "0000x0000+0000+0000", &pdata); geom.x = geometry.x + ((2 * border + geometry.width) - geom.width) / 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); 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; } @@ -463,9 +465,7 @@ mouse_client_move(client_t *c, int snap, bool infobox) draw_context_t *ctx; /* the root window */ xcb_window_t root; - draw_parser_data_t pdata; - draw_parser_data_init(&pdata); layout = layout_get_current(c->screen); 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)) { - 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); } /* for each motion event */ while(mouse_track_mouse_drag(&mouse_x, &mouse_y)) - { if(c->isfloating || layout == layout_floating) { area_t geometry; @@ -504,7 +503,7 @@ mouse_client_move(client_t *c, int snap, bool infobox) /* draw the infobox */ 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); } @@ -539,7 +538,6 @@ mouse_client_move(client_t *c, int snap, bool infobox) layout_refresh(); } } - } /* ungrab pointer */ 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); 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; size_t cursor = CurResize; int top, bottom, left, right; - draw_parser_data_t pdata; - draw_parser_data_init(&pdata); screen = xutil_screen_get(globalconf.connection, c->phys_screen); /* get current mouse position */ @@ -621,7 +614,7 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox) /* create the 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); } @@ -695,7 +688,7 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox) /* draw the infobox */ 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); } @@ -709,7 +702,6 @@ mouse_client_resize_floating(client_t *c, corner_t corner, bool infobox) draw_context_delete(&ctx); simplewindow_delete(&sw); } - draw_parser_data_wipe(&pdata); } /** 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; draw_context_t *ctx; xcb_window_t root; - draw_parser_data_t pdata; - draw_parser_data_init(&pdata); tag = tags_get_current(c->screen)[0]; 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 */ 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); @@ -912,7 +902,7 @@ mouse_client_resize_magnified(client_t *c, bool infobox) /* draw the infobox */ 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); } } @@ -926,7 +916,6 @@ mouse_client_resize_magnified(client_t *c, bool infobox) draw_context_delete(&ctx); simplewindow_delete(&sw); } - draw_parser_data_wipe(&pdata); } /** Resize a client with the mouse.