screen: move screen_getbycoord()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
3a45831242
commit
b4d89eec6c
|
@ -38,6 +38,7 @@
|
|||
#include "dbus.h"
|
||||
#include "systray.h"
|
||||
#include "event.h"
|
||||
#include "screen.h"
|
||||
#include "common/version.h"
|
||||
#include "common/atoms.h"
|
||||
#include "config.h"
|
||||
|
@ -170,8 +171,7 @@ scan(void)
|
|||
*(geom_wins[i]), NULL)))
|
||||
continue;
|
||||
|
||||
screen = screen_get_bycoord(globalconf.screens_info, phys_screen,
|
||||
geom_r->x, geom_r->y);
|
||||
screen = screen_getbycoord(phys_screen, geom_r->x, geom_r->y);
|
||||
|
||||
client_manage(wins[i], geom_r, phys_screen, screen);
|
||||
|
||||
|
|
5
client.c
5
client.c
|
@ -420,7 +420,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
|||
|
||||
c = p_new(client_t, 1);
|
||||
|
||||
c->screen = screen_get_bycoord(globalconf.screens_info, screen, wgeom->x, wgeom->y);
|
||||
c->screen = screen_getbycoord(screen, wgeom->x, wgeom->y);
|
||||
|
||||
c->phys_screen = phys_screen;
|
||||
|
||||
|
@ -567,8 +567,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
|||
|| c->geometry.width != geometry.width
|
||||
|| c->geometry.height != geometry.height)))
|
||||
{
|
||||
new_screen =
|
||||
screen_get_bycoord(globalconf.screens_info, c->screen, geometry.x, geometry.y);
|
||||
new_screen = screen_getbycoord(c->screen, geometry.x, geometry.y);
|
||||
|
||||
c->geometry.x = values[0] = geometry.x;
|
||||
c->geometry.width = values[2] = geometry.width;
|
||||
|
|
|
@ -25,30 +25,6 @@
|
|||
#include "common/xscreen.h"
|
||||
#include "common/xutil.h"
|
||||
|
||||
/** Return the Xinerama screen number where the coordinates belongs to.
|
||||
* \param si The screens infos structure.
|
||||
* \param screen The logical screen number.
|
||||
* \param x X coordinate
|
||||
* \param y Y coordinate
|
||||
* \return Screen number or screen param if no match or no multi-head.
|
||||
*/
|
||||
int
|
||||
screen_get_bycoord(screens_info_t *si, int screen, int x, int y)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* don't waste our time */
|
||||
if(!si->xinerama_is_active)
|
||||
return screen;
|
||||
|
||||
for(i = 0; i < si->nscreen; i++)
|
||||
if((x < 0 || (x >= si->geometry[i].x && x < si->geometry[i].x + si->geometry[i].width))
|
||||
&& (y < 0 || (y >= si->geometry[i].y && y < si->geometry[i].y + si->geometry[i].height)))
|
||||
return i;
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
static inline area_t
|
||||
screen_xsitoarea(xcb_xinerama_screen_info_t si)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,6 @@ typedef struct
|
|||
area_t *geometry;
|
||||
} screens_info_t;
|
||||
|
||||
int screen_get_bycoord(screens_info_t *, int, int, int);
|
||||
void screensinfo_delete(screens_info_t **);
|
||||
screens_info_t * screensinfo_new(xcb_connection_t *);
|
||||
|
||||
|
|
4
event.c
4
event.c
|
@ -38,6 +38,7 @@
|
|||
#include "lua.h"
|
||||
#include "systray.h"
|
||||
#include "statusbar.h"
|
||||
#include "screen.h"
|
||||
#include "layouts/floating.h"
|
||||
#include "common/atoms.h"
|
||||
|
||||
|
@ -610,8 +611,7 @@ event_handle_maprequest(void *data __attribute__ ((unused)),
|
|||
|
||||
if(globalconf.screens_info->xinerama_is_active
|
||||
&& (qp_r = xcb_query_pointer_reply(connection, qp_c, NULL)))
|
||||
screen = screen_get_bycoord(globalconf.screens_info, screen,
|
||||
qp_r->root_x, qp_r->root_y);
|
||||
screen = screen_getbycoord(screen, qp_r->root_x, qp_r->root_y);
|
||||
else
|
||||
screen = phys_screen;
|
||||
|
||||
|
|
5
mouse.c
5
mouse.c
|
@ -540,8 +540,7 @@ mouse_client_move(client_t *c, int snap, bool infobox)
|
|||
client_t *target;
|
||||
|
||||
/* client moved to another screen? */
|
||||
newscreen = screen_get_bycoord(globalconf.screens_info, c->screen,
|
||||
mouse_x, mouse_y);
|
||||
newscreen = screen_getbycoord(c->screen, mouse_x, mouse_y);
|
||||
if(newscreen != c->screen)
|
||||
{
|
||||
screen_client_moveto(c, newscreen, true);
|
||||
|
@ -1188,7 +1187,7 @@ luaA_mouse_index(lua_State *L)
|
|||
if(!mouse_query_pointer_root(&screen, &mouse_x, &mouse_y, NULL))
|
||||
return 0;
|
||||
|
||||
i = screen_get_bycoord(globalconf.screens_info, screen, mouse_x, mouse_y);
|
||||
i = screen_getbycoord(screen, mouse_x, mouse_y);
|
||||
|
||||
lua_pushnumber(L, i + 1);
|
||||
break;
|
||||
|
|
24
screen.c
24
screen.c
|
@ -32,6 +32,30 @@
|
|||
|
||||
extern awesome_t globalconf;
|
||||
|
||||
/** Return the Xinerama screen number where the coordinates belongs to.
|
||||
* \param screen The logical screen number.
|
||||
* \param x X coordinate
|
||||
* \param y Y coordinate
|
||||
* \return Screen number or screen param if no match or no multi-head.
|
||||
*/
|
||||
int
|
||||
screen_getbycoord(int screen, int x, int y)
|
||||
{
|
||||
int i;
|
||||
screens_info_t *si = globalconf.screens_info;
|
||||
|
||||
/* don't waste our time */
|
||||
if(!si->xinerama_is_active)
|
||||
return screen;
|
||||
|
||||
for(i = 0; i < si->nscreen; i++)
|
||||
if((x < 0 || (x >= si->geometry[i].x && x < si->geometry[i].x + si->geometry[i].width))
|
||||
&& (y < 0 || (y >= si->geometry[i].y && y < si->geometry[i].y + si->geometry[i].height)))
|
||||
return i;
|
||||
|
||||
return screen;
|
||||
}
|
||||
|
||||
/** Get screens info.
|
||||
* \param screen Screen number.
|
||||
* \param statusbar Statusbar list to remove.
|
||||
|
|
Loading…
Reference in New Issue