Remove an unneeded argument to screen_getbycoord()
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
6b2e4352bb
commit
3b2f6329a9
16
mouse.c
16
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.
|
/** 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 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 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.
|
* \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.
|
* \return True on success, false if an error occurred.
|
||||||
*/
|
*/
|
||||||
static bool
|
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;
|
xcb_window_t root = globalconf.screen->root;
|
||||||
|
|
||||||
if(mouse_query_pointer(root, x, y, child, mask))
|
if(mouse_query_pointer(root, x, y, child, mask))
|
||||||
{
|
{
|
||||||
*s = &globalconf.screens.tab[0];
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -111,10 +109,10 @@ luaA_mouse_index(lua_State *L)
|
||||||
switch(a_tokenize(attr, len))
|
switch(a_tokenize(attr, len))
|
||||||
{
|
{
|
||||||
case A_TK_SCREEN:
|
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;
|
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);
|
lua_pushnumber(L, screen_array_indexof(&globalconf.screens, screen) + 1);
|
||||||
break;
|
break;
|
||||||
|
@ -196,14 +194,13 @@ luaA_mouse_coords(lua_State *L)
|
||||||
uint16_t mask;
|
uint16_t mask;
|
||||||
int x, y;
|
int x, y;
|
||||||
int16_t mouse_x, mouse_y;
|
int16_t mouse_x, mouse_y;
|
||||||
screen_t *screen;
|
|
||||||
|
|
||||||
if(lua_gettop(L) >= 1)
|
if(lua_gettop(L) >= 1)
|
||||||
{
|
{
|
||||||
luaA_checktable(L, 1);
|
luaA_checktable(L, 1);
|
||||||
bool ignore_enter_notify = (lua_gettop(L) == 2 && luaA_checkboolean(L, 2));
|
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;
|
return 0;
|
||||||
|
|
||||||
x = luaA_getopt_number(L, 1, "x", mouse_x);
|
x = luaA_getopt_number(L, 1, "x", mouse_x);
|
||||||
|
@ -220,7 +217,7 @@ luaA_mouse_coords(lua_State *L)
|
||||||
lua_pop(L, 1);
|
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 0;
|
||||||
|
|
||||||
return luaA_mouse_pushstatus(L, mouse_x, mouse_y, mask);
|
return luaA_mouse_pushstatus(L, mouse_x, mouse_y, mask);
|
||||||
|
@ -235,11 +232,10 @@ luaA_mouse_coords(lua_State *L)
|
||||||
static int
|
static int
|
||||||
luaA_mouse_object_under_pointer(lua_State *L)
|
luaA_mouse_object_under_pointer(lua_State *L)
|
||||||
{
|
{
|
||||||
screen_t *screen;
|
|
||||||
int16_t mouse_x, mouse_y;
|
int16_t mouse_x, mouse_y;
|
||||||
xcb_window_t child;
|
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;
|
return 0;
|
||||||
|
|
||||||
wibox_t *wibox;
|
wibox_t *wibox;
|
||||||
|
|
|
@ -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));
|
client_array_push(&globalconf.clients, luaA_object_ref(globalconf.L, -1));
|
||||||
|
|
||||||
/* Set the right screen */
|
/* 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
|
/* Store initial geometry and emits signals so we inform that geometry have
|
||||||
* been set. */
|
* been set. */
|
||||||
|
@ -750,8 +750,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
||||||
|| c->geometry.height != geometry.height)
|
|| c->geometry.height != geometry.height)
|
||||||
{
|
{
|
||||||
bool send_notice = false;
|
bool send_notice = false;
|
||||||
screen_t *new_screen = screen_getbycoord(c->screen,
|
screen_t *new_screen = screen_getbycoord(geometry.x, geometry.y);
|
||||||
geometry.x, geometry.y);
|
|
||||||
|
|
||||||
if(c->geometry.width == geometry.width
|
if(c->geometry.width == geometry.width
|
||||||
&& c->geometry.height == geometry.height)
|
&& c->geometry.height == geometry.height)
|
||||||
|
|
|
@ -322,7 +322,7 @@ wibox_moveresize(lua_State *L, int udx, area_t geometry)
|
||||||
/* Deactivate BMA */
|
/* Deactivate BMA */
|
||||||
client_restore_enterleave_events();
|
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)
|
if(mask_vals & XCB_CONFIG_WINDOW_X)
|
||||||
luaA_object_emit_signal(L, udx, "property::x", 0);
|
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. */
|
/* Check that the wibox coordinates matches the screen. */
|
||||||
screen_t *cscreen =
|
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 it does not match, move it to the screen coordinates */
|
||||||
if(cscreen != wibox->screen)
|
if(cscreen != wibox->screen)
|
||||||
|
|
5
screen.c
5
screen.c
|
@ -245,14 +245,15 @@ screen_scan(void)
|
||||||
* \return Screen pointer or screen param if no match or no multi-head.
|
* \return Screen pointer or screen param if no match or no multi-head.
|
||||||
*/
|
*/
|
||||||
screen_t *
|
screen_t *
|
||||||
screen_getbycoord(screen_t *screen, int x, int y)
|
screen_getbycoord(int x, int y)
|
||||||
{
|
{
|
||||||
foreach(s, globalconf.screens)
|
foreach(s, globalconf.screens)
|
||||||
if((x < 0 || (x >= s->geometry.x && x < s->geometry.x + s->geometry.width))
|
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)))
|
&& (y < 0 || (y >= s->geometry.y && y < s->geometry.y + s->geometry.height)))
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
return screen;
|
/* No screen found, let's be creative. */
|
||||||
|
return &globalconf.screens.tab[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get screens info.
|
/** Get screens info.
|
||||||
|
|
2
screen.h
2
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_emit_signal(lua_State *, screen_t *, const char *, int);
|
||||||
void screen_scan(void);
|
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 screen_area_get(screen_t *, bool);
|
||||||
area_t display_area_get(void);
|
area_t display_area_get(void);
|
||||||
void screen_client_moveto(client_t *, screen_t *, bool);
|
void screen_client_moveto(client_t *, screen_t *, bool);
|
||||||
|
|
Loading…
Reference in New Issue