From 0ca7a0fd7178bcde0ffbd8f348c97bde2fc75fe9 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 10 May 2009 16:17:39 +0200 Subject: [PATCH] widget: use orientation rather than position Signed-off-by: Julien Danjou --- event.c | 6 +++--- mouse.c | 2 +- widget.c | 10 +++++----- widget.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/event.c b/event.c index de7426927..d9f84a271 100644 --- a/event.c +++ b/event.c @@ -156,7 +156,7 @@ event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_e event_button_callback(ev, &wibox->buttons, 1, NULL); /* then try to match a widget binding */ - widget_t *w = widget_getbycoords(wibox->position, &wibox->widgets, + widget_t *w = widget_getbycoords(wibox->sw.orientation, &wibox->widgets, wibox->sw.geometry.width, wibox->sw.geometry.height, &ev->event_x, &ev->event_y); @@ -400,7 +400,7 @@ event_handle_motionnotify(void *data __attribute__ ((unused)), if((wibox = wibox_getbywin(ev->event))) { - widget_t *w = widget_getbycoords(wibox->position, &wibox->widgets, + widget_t *w = widget_getbycoords(wibox->sw.orientation, &wibox->widgets, wibox->sw.geometry.width, wibox->sw.geometry.height, &ev->event_x, &ev->event_y); @@ -472,7 +472,7 @@ event_handle_enternotify(void *data __attribute__ ((unused)), if((wibox = wibox_getbywin(ev->event))) { - widget_t *w = widget_getbycoords(wibox->position, &wibox->widgets, + widget_t *w = widget_getbycoords(wibox->sw.orientation, &wibox->widgets, wibox->sw.geometry.width, wibox->sw.geometry.height, &ev->event_x, &ev->event_y); diff --git a/mouse.c b/mouse.c index c95979d0f..065053916 100644 --- a/mouse.c +++ b/mouse.c @@ -257,7 +257,7 @@ luaA_mouse_object_under_pointer(lua_State *L) int16_t x = mouse_x - wibox->sw.geometry.x; int16_t y = mouse_y - wibox->sw.geometry.y; - widget_t *widget = widget_getbycoords(wibox->position, &wibox->widgets, + widget_t *widget = widget_getbycoords(wibox->sw.orientation, &wibox->widgets, wibox->sw.geometry.width, wibox->sw.geometry.height, &x, &y); diff --git a/widget.c b/widget.c index e48bfe28c..a47671350 100644 --- a/widget.c +++ b/widget.c @@ -63,7 +63,7 @@ widget_node_delete(widget_node_t *node) } /** Get a widget node from a wibox by coords. - * \param Container position. + * \param orientation Wibox orientation. * \param widgets The widget list. * \param width The container width. * \param height The container height. @@ -72,20 +72,20 @@ widget_node_delete(widget_node_t *node) * \return A widget. */ widget_t * -widget_getbycoords(position_t position, widget_node_array_t *widgets, +widget_getbycoords(orientation_t orientation, widget_node_array_t *widgets, int width, int height, int16_t *x, int16_t *y) { int tmp; /* Need to transform coordinates like it was top/bottom */ - switch(position) + switch(orientation) { - case Right: + case South: tmp = *y; *y = width - *x; *x = tmp; break; - case Left: + case North: tmp = *y; *y = *x; *x = height - tmp; diff --git a/widget.h b/widget.h index 97c792e86..1d8204c42 100644 --- a/widget.h +++ b/widget.h @@ -69,7 +69,7 @@ struct widget_node_t area_t geometry; }; -widget_t *widget_getbycoords(position_t, widget_node_array_t *, int, int, int16_t *, int16_t *); +widget_t *widget_getbycoords(orientation_t, widget_node_array_t *, int, int, int16_t *, int16_t *); void widget_render(wibox_t *); void luaA_table2widgets(lua_State *, widget_node_array_t *);