From 3b2f6329a92feb576d0841c73f5f0232416bfb8b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 16 Aug 2010 14:25:12 +0200 Subject: [PATCH] Remove an unneeded argument to screen_getbycoord() Signed-off-by: Uli Schlachter --- mouse.c | 16 ++++++---------- objects/client.c | 5 ++--- objects/wibox.c | 4 ++-- screen.c | 5 +++-- screen.h | 2 +- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/mouse.c b/mouse.c index bd8720649..e25a6e3de 100644 --- a/mouse.c +++ b/mouse.c @@ -61,7 +61,6 @@ mouse_query_pointer(xcb_window_t window, int16_t *x, int16_t *y, xcb_window_t *c } /** Get the pointer position on the screen. - * \param s This will be set to the screen the mouse is on. * \param x This will be set to the Pointer-x-coordinate relative to window. * \param y This will be set to the Pointer-y-coordinate relative to window. * \param child This will be set to the window under the pointer. @@ -69,13 +68,12 @@ mouse_query_pointer(xcb_window_t window, int16_t *x, int16_t *y, xcb_window_t *c * \return True on success, false if an error occurred. */ static bool -mouse_query_pointer_root(screen_t **s, int16_t *x, int16_t *y, xcb_window_t *child, uint16_t *mask) +mouse_query_pointer_root(int16_t *x, int16_t *y, xcb_window_t *child, uint16_t *mask) { xcb_window_t root = globalconf.screen->root; if(mouse_query_pointer(root, x, y, child, mask)) { - *s = &globalconf.screens.tab[0]; return true; } return false; @@ -111,10 +109,10 @@ luaA_mouse_index(lua_State *L) switch(a_tokenize(attr, len)) { case A_TK_SCREEN: - if(!mouse_query_pointer_root(&screen, &mouse_x, &mouse_y, NULL, NULL)) + if(!mouse_query_pointer_root(&mouse_x, &mouse_y, NULL, NULL)) return 0; - screen = screen_getbycoord(screen, mouse_x, mouse_y); + screen = screen_getbycoord(mouse_x, mouse_y); lua_pushnumber(L, screen_array_indexof(&globalconf.screens, screen) + 1); break; @@ -196,14 +194,13 @@ luaA_mouse_coords(lua_State *L) uint16_t mask; int x, y; int16_t mouse_x, mouse_y; - screen_t *screen; if(lua_gettop(L) >= 1) { luaA_checktable(L, 1); bool ignore_enter_notify = (lua_gettop(L) == 2 && luaA_checkboolean(L, 2)); - if(!mouse_query_pointer_root(&screen, &mouse_x, &mouse_y, NULL, &mask)) + if(!mouse_query_pointer_root(&mouse_x, &mouse_y, NULL, &mask)) return 0; x = luaA_getopt_number(L, 1, "x", mouse_x); @@ -220,7 +217,7 @@ luaA_mouse_coords(lua_State *L) lua_pop(L, 1); } - if(!mouse_query_pointer_root(&screen, &mouse_x, &mouse_y, NULL, &mask)) + if(!mouse_query_pointer_root(&mouse_x, &mouse_y, NULL, &mask)) return 0; return luaA_mouse_pushstatus(L, mouse_x, mouse_y, mask); @@ -235,11 +232,10 @@ luaA_mouse_coords(lua_State *L) static int luaA_mouse_object_under_pointer(lua_State *L) { - screen_t *screen; int16_t mouse_x, mouse_y; xcb_window_t child; - if(!mouse_query_pointer_root(&screen, &mouse_x, &mouse_y, &child, NULL)) + if(!mouse_query_pointer_root(&mouse_x, &mouse_y, &child, NULL)) return 0; wibox_t *wibox; diff --git a/objects/client.c b/objects/client.c index 6ab249c0f..803702db3 100644 --- a/objects/client.c +++ b/objects/client.c @@ -539,7 +539,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, bool startup) client_array_push(&globalconf.clients, luaA_object_ref(globalconf.L, -1)); /* Set the right screen */ - screen_client_moveto(c, screen_getbycoord(&globalconf.screens.tab[0], wgeom->x, wgeom->y), false); + screen_client_moveto(c, screen_getbycoord(wgeom->x, wgeom->y), false); /* Store initial geometry and emits signals so we inform that geometry have * been set. */ @@ -750,8 +750,7 @@ client_resize(client_t *c, area_t geometry, bool hints) || c->geometry.height != geometry.height) { bool send_notice = false; - screen_t *new_screen = screen_getbycoord(c->screen, - geometry.x, geometry.y); + screen_t *new_screen = screen_getbycoord(geometry.x, geometry.y); if(c->geometry.width == geometry.width && c->geometry.height == geometry.height) diff --git a/objects/wibox.c b/objects/wibox.c index bc80ab8c0..ea1e47e58 100644 --- a/objects/wibox.c +++ b/objects/wibox.c @@ -322,7 +322,7 @@ wibox_moveresize(lua_State *L, int udx, area_t geometry) /* Deactivate BMA */ client_restore_enterleave_events(); - w->screen = screen_getbycoord(w->screen, w->geometry.x, w->geometry.y); + w->screen = screen_getbycoord(w->geometry.x, w->geometry.y); if(mask_vals & XCB_CONFIG_WINDOW_X) luaA_object_emit_signal(L, udx, "property::x", 0); @@ -710,7 +710,7 @@ wibox_attach(lua_State *L, int udx, screen_t *s) /* Check that the wibox coordinates matches the screen. */ screen_t *cscreen = - screen_getbycoord(wibox->screen, wibox->geometry.x, wibox->geometry.y); + screen_getbycoord(wibox->geometry.x, wibox->geometry.y); /* If it does not match, move it to the screen coordinates */ if(cscreen != wibox->screen) diff --git a/screen.c b/screen.c index d8612d1ee..1cd01db22 100644 --- a/screen.c +++ b/screen.c @@ -245,14 +245,15 @@ screen_scan(void) * \return Screen pointer or screen param if no match or no multi-head. */ screen_t * -screen_getbycoord(screen_t *screen, int x, int y) +screen_getbycoord(int x, int y) { foreach(s, globalconf.screens) if((x < 0 || (x >= s->geometry.x && x < s->geometry.x + s->geometry.width)) && (y < 0 || (y >= s->geometry.y && y < s->geometry.y + s->geometry.height))) return s; - return screen; + /* No screen found, let's be creative. */ + return &globalconf.screens.tab[0]; } /** Get screens info. diff --git a/screen.h b/screen.h index 81614cbbc..5d4e19e2a 100644 --- a/screen.h +++ b/screen.h @@ -49,7 +49,7 @@ ARRAY_FUNCS(screen_t, screen, DO_NOTHING) void screen_emit_signal(lua_State *, screen_t *, const char *, int); void screen_scan(void); -screen_t *screen_getbycoord(screen_t *, int, int); +screen_t *screen_getbycoord(int, int); area_t screen_area_get(screen_t *, bool); area_t display_area_get(void); void screen_client_moveto(client_t *, screen_t *, bool);