From fae7e5bb8a28ab23bf6a41996c843399c703c8e9 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 8 Jan 2009 11:01:06 +0100 Subject: [PATCH] wibox: check coordinates and screen attributes match Signed-off-by: Julien Danjou --- wibox.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wibox.c b/wibox.c index 87e24333..79c32c8e 100644 --- a/wibox.c +++ b/wibox.c @@ -24,6 +24,7 @@ #include "titlebar.h" #include "client.h" #include "ewmh.h" +#include "screen.h" #include "common/xcursor.h" extern awesome_t globalconf; @@ -36,7 +37,10 @@ static void wibox_move(wibox_t *wibox, int16_t x, int16_t y) { if(wibox->sw.window) + { simplewindow_move(&wibox->sw, x, y); + wibox->screen = screen_getbycoord(wibox->screen, x, y); + } else { wibox->sw.geometry.x = x; @@ -615,8 +619,16 @@ wibox_attach(wibox_t *wibox, screen_t *s) wibox_detach(wibox); + /* Set the wibox screen */ wibox->screen = s->index; + /* Check that the wibox coordinates matches the screen. */ + int cscreen = screen_getbycoord(wibox->screen, wibox->sw.geometry.x, wibox->sw.geometry.y); + + /* If it does not match, move it to the screen coordinates */ + if(cscreen != wibox->screen) + wibox_move(wibox, s->geometry.x, s->geometry.y); + wibox_array_append(&s->wiboxes, wibox_ref(&wibox)); /* compute x/y/width/height if not set */ @@ -711,6 +723,8 @@ luaA_wibox_new(lua_State *L) /* recompute position */ wibox_position_update(w); + w->sw.geometry.x = luaA_getopt_number(L, 2, "x", 0); + w->sw.geometry.y = luaA_getopt_number(L, 2, "y", 0); w->sw.geometry.width = luaA_getopt_number(L, 2, "width", 0); w->sw.geometry.height = luaA_getopt_number(L, 2, "height", 0); -- 2.11.4.GIT