screen: remove index field
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
41eb19f76f
commit
4a34693bfb
2
client.c
2
client.c
|
@ -1907,7 +1907,7 @@ luaA_client_index(lua_State *L)
|
|||
lua_pushstring(L, c->icon_name);
|
||||
break;
|
||||
case A_TK_SCREEN:
|
||||
lua_pushnumber(L, 1 + c->screen->index);
|
||||
lua_pushnumber(L, 1 + screen_array_indexof(&globalconf.screens, c->screen));
|
||||
break;
|
||||
case A_TK_HIDE:
|
||||
lua_pushboolean(L, c->ishidden);
|
||||
|
|
2
layout.c
2
layout.c
|
@ -77,7 +77,7 @@ arrange(screen_t *screen)
|
|||
/* call hook */
|
||||
if(globalconf.hooks.arrange != LUA_REFNIL)
|
||||
{
|
||||
lua_pushnumber(globalconf.L, screen->index + 1);
|
||||
lua_pushnumber(globalconf.L, screen_array_indexof(&globalconf.screens, screen) + 1);
|
||||
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 1, 0);
|
||||
}
|
||||
|
||||
|
|
5
mouse.c
5
mouse.c
|
@ -340,7 +340,7 @@ luaA_mouse_index(lua_State *L)
|
|||
|
||||
screen = screen_getbycoord(screen, mouse_x, mouse_y);
|
||||
|
||||
lua_pushnumber(L, screen->index + 1);
|
||||
lua_pushnumber(L, screen_array_indexof(&globalconf.screens, screen) + 1);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -442,7 +442,8 @@ luaA_mouse_coords(lua_State *L)
|
|||
x = luaA_getopt_number(L, 1, "x", mouse_x);
|
||||
y = luaA_getopt_number(L, 1, "y", mouse_y);
|
||||
|
||||
root = xutil_screen_get(globalconf.connection, screen->index)->root;
|
||||
root = xutil_screen_get(globalconf.connection,
|
||||
screen_array_indexof(&globalconf.screens, screen))->root;
|
||||
mouse_warp_pointer(root, x, y);
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
|
9
screen.c
9
screen.c
|
@ -83,16 +83,16 @@ screen_scan(void)
|
|||
/* we already have a screen for this area, just check if
|
||||
* it's not bigger and drop it */
|
||||
drop = true;
|
||||
int i = screen_array_indexof(&globalconf.screens, screen_to_test);
|
||||
screen_to_test->geometry.width =
|
||||
MAX(xsi[screen].width, xsi[screen_to_test->index].width);
|
||||
MAX(xsi[screen].width, xsi[i].width);
|
||||
screen_to_test->geometry.height =
|
||||
MAX(xsi[screen].height, xsi[screen_to_test->index].height);
|
||||
MAX(xsi[screen].height, xsi[i].height);
|
||||
}
|
||||
if(!drop)
|
||||
{
|
||||
screen_t s;
|
||||
p_clear(&s, 1);
|
||||
s.index = screen;
|
||||
s.geometry = screen_xsitoarea(xsi[screen]);
|
||||
screen_array_append(&globalconf.screens, s);
|
||||
}
|
||||
|
@ -109,7 +109,6 @@ screen_scan(void)
|
|||
xcb_screen_t *xcb_screen = xutil_screen_get(globalconf.connection, screen);
|
||||
screen_t s;
|
||||
p_clear(&s, 1);
|
||||
s.index = screen;
|
||||
s.geometry.x = 0;
|
||||
s.geometry.y = 0;
|
||||
s.geometry.width = xcb_screen->width_in_pixels;
|
||||
|
@ -504,7 +503,7 @@ luaA_screen_padding(lua_State *L)
|
|||
foreach(w, s->wiboxes)
|
||||
wibox_position_update(*w);
|
||||
|
||||
ewmh_update_workarea(screen_virttophys(s->index));
|
||||
ewmh_update_workarea(screen_virttophys(screen_array_indexof(&globalconf.screens, s)));
|
||||
}
|
||||
return luaA_pushpadding(L, &s->padding);
|
||||
}
|
||||
|
|
2
screen.h
2
screen.h
|
@ -26,8 +26,6 @@
|
|||
|
||||
struct a_screen
|
||||
{
|
||||
/** Screen index */
|
||||
int index;
|
||||
/** Screen geometry */
|
||||
area_t geometry;
|
||||
/** true if we need to arrange() */
|
||||
|
|
15
tag.c
15
tag.c
|
@ -54,7 +54,8 @@ static void
|
|||
tag_view(tag_t *tag, bool view)
|
||||
{
|
||||
tag->selected = view;
|
||||
ewmh_update_net_current_desktop(screen_virttophys(tag->screen->index));
|
||||
ewmh_update_net_current_desktop(screen_virttophys(screen_array_indexof(&globalconf.screens,
|
||||
tag->screen)));
|
||||
tag->screen->need_arrange = true;
|
||||
}
|
||||
|
||||
|
@ -64,7 +65,8 @@ tag_view(tag_t *tag, bool view)
|
|||
void
|
||||
tag_append_to_screen(screen_t *s)
|
||||
{
|
||||
int phys_screen = screen_virttophys(s->index);
|
||||
int screen_index = screen_array_indexof(&globalconf.screens, s);
|
||||
int phys_screen = screen_virttophys(screen_index);
|
||||
tag_t *tag = tag_ref(globalconf.L);
|
||||
|
||||
tag->screen = s;
|
||||
|
@ -76,7 +78,7 @@ tag_append_to_screen(screen_t *s)
|
|||
/* call hook */
|
||||
if(globalconf.hooks.tags != LUA_REFNIL)
|
||||
{
|
||||
lua_pushnumber(globalconf.L, s->index + 1);
|
||||
lua_pushnumber(globalconf.L, screen_index + 1);
|
||||
tag_push(globalconf.L, tag);
|
||||
lua_pushliteral(globalconf.L, "add");
|
||||
luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0);
|
||||
|
@ -89,7 +91,8 @@ tag_append_to_screen(screen_t *s)
|
|||
static void
|
||||
tag_remove_from_screen(tag_t *tag)
|
||||
{
|
||||
int phys_screen = screen_virttophys(tag->screen->index);
|
||||
int screen_index = screen_array_indexof(&globalconf.screens, tag->screen);
|
||||
int phys_screen = screen_virttophys(screen_index);
|
||||
tag_array_t *tags = &tag->screen->tags;
|
||||
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
|
@ -105,7 +108,7 @@ tag_remove_from_screen(tag_t *tag)
|
|||
/* call hook */
|
||||
if(globalconf.hooks.tags != LUA_REFNIL)
|
||||
{
|
||||
lua_pushnumber(globalconf.L, tag->screen->index + 1);
|
||||
lua_pushnumber(globalconf.L, screen_index + 1);
|
||||
tag_push(globalconf.L, tag);
|
||||
lua_pushliteral(globalconf.L, "remove");
|
||||
luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0);
|
||||
|
@ -311,7 +314,7 @@ luaA_tag_index(lua_State *L)
|
|||
case A_TK_SCREEN:
|
||||
if(!tag->screen)
|
||||
return 0;
|
||||
lua_pushnumber(L, tag->screen->index + 1);
|
||||
lua_pushnumber(L, screen_array_indexof(&globalconf.screens, tag->screen) + 1);
|
||||
break;
|
||||
case A_TK_SELECTED:
|
||||
lua_pushboolean(L, tag->selected);
|
||||
|
|
10
wibox.c
10
wibox.c
|
@ -131,7 +131,7 @@ wibox_setposition(wibox_t *wibox, position_t p)
|
|||
foreach(w, wibox->screen->wiboxes)
|
||||
wibox_position_update(*w);
|
||||
|
||||
ewmh_update_workarea(screen_virttophys(wibox->screen->index));
|
||||
ewmh_update_workarea(screen_virttophys(screen_array_indexof(&globalconf.screens, wibox->screen)));
|
||||
|
||||
wibox_need_update(wibox);
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ wibox_detach(wibox_t *wibox)
|
|||
static void
|
||||
wibox_attach(screen_t *s)
|
||||
{
|
||||
int phys_screen = screen_virttophys(s->index);
|
||||
int phys_screen = screen_virttophys(screen_array_indexof(&globalconf.screens, s));
|
||||
|
||||
wibox_t *wibox = wibox_ref(globalconf.L);
|
||||
|
||||
|
@ -688,7 +688,7 @@ wibox_attach(screen_t *s)
|
|||
foreach(w, s->wiboxes)
|
||||
wibox_position_update(*w);
|
||||
|
||||
ewmh_update_workarea(screen_virttophys(s->index));
|
||||
ewmh_update_workarea(phys_screen);
|
||||
|
||||
if(wibox->isvisible)
|
||||
wibox_map(wibox);
|
||||
|
@ -869,7 +869,7 @@ luaA_wibox_index(lua_State *L)
|
|||
case A_TK_SCREEN:
|
||||
if(!wibox->screen)
|
||||
return 0;
|
||||
lua_pushnumber(L, wibox->screen->index + 1);
|
||||
lua_pushnumber(L, screen_array_indexof(&globalconf.screens, wibox->screen) + 1);
|
||||
break;
|
||||
case A_TK_BORDER_WIDTH:
|
||||
lua_pushnumber(L, wibox->sw.border.width);
|
||||
|
@ -1067,7 +1067,7 @@ luaA_wibox_newindex(lua_State *L)
|
|||
{
|
||||
int screen = luaL_checknumber(L, 3) - 1;
|
||||
luaA_checkscreen(screen);
|
||||
if(!wibox->screen || screen != wibox->screen->index)
|
||||
if(!wibox->screen || screen != screen_array_indexof(&globalconf.screens, wibox->screen))
|
||||
{
|
||||
titlebar_client_detach(client_getbytitlebar(wibox));
|
||||
lua_pushvalue(L, 1);
|
||||
|
|
|
@ -34,7 +34,7 @@ static area_t
|
|||
systray_geometry(widget_t *widget, screen_t *screen, int height, int width)
|
||||
{
|
||||
area_t geometry;
|
||||
int phys_screen = screen_virttophys(screen->index), n = 0;
|
||||
int phys_screen = screen_virttophys(screen_array_indexof(&globalconf.screens, screen)), n = 0;
|
||||
|
||||
geometry.height = height;
|
||||
|
||||
|
|
Loading…
Reference in New Issue