summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorQuentin Glidic <sardemff7+git@sardemff7.net>2017-05-30 12:13:25 +0200
committerQuentin Glidic <sardemff7+git@sardemff7.net>2017-05-30 13:45:17 +0200
commit685d4f0e13bee9a23c647e637e2f7194353be501 (patch)
tree43afb07a92fb5b8dbcdb6d90d1d9e2a1defb8c97 /source
parent30da7e587a2a1e90c4338af4d07e5bd3be77ecc3 (diff)
widget: Rely on find_mouse_target to send motion events
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Diffstat (limited to 'source')
-rw-r--r--source/view.c7
-rw-r--r--source/widgets/box.c19
-rw-r--r--source/widgets/container.c13
-rw-r--r--source/widgets/scrollbar.c2
-rw-r--r--source/widgets/widget.c4
5 files changed, 8 insertions, 37 deletions
diff --git a/source/view.c b/source/view.c
index 43f8bb0c..2fe21de8 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1410,8 +1410,11 @@ void rofi_view_itterrate ( RofiViewState *state, xcb_generic_event_t *event, xkb
xcb_motion_notify_event_t xme = *( (xcb_motion_notify_event_t *) event );
state->mouse.x = xme.event_x;
state->mouse.y = xme.event_y;
- if ( widget_motion_notify ( WIDGET ( state->main_window ), &xme ) ) {
- return;
+ if ( state->mouse.motion_target != NULL ) {
+ gint x = state->mouse.x;
+ gint y = state->mouse.y;
+ widget_xy_to_relative ( state->mouse.motion_target, &x, &y );
+ widget_motion_notify ( state->mouse.motion_target, x, y );
}
break;
}
diff --git a/source/widgets/box.c b/source/widgets/box.c
index 9c9ccb89..a2fc6a95 100644
--- a/source/widgets/box.c
+++ b/source/widgets/box.c
@@ -297,24 +297,6 @@ static widget *box_find_mouse_target ( widget *wid, WidgetType type, gint x, gin
return NULL;
}
-static gboolean box_motion_notify ( widget *wid, xcb_motion_notify_event_t *xme )
-{
- box *b = (box *) wid;
- for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
- widget * child = (widget *) iter->data;
- if ( !child->enabled ) {
- continue;
- }
- if ( widget_intersect ( child, xme->event_x, xme->event_y ) ) {
- xcb_motion_notify_event_t rel = *xme;
- rel.event_x -= child->x;
- rel.event_y -= child->y;
- return widget_motion_notify ( child, &rel );
- }
- }
- return FALSE;
-}
-
box * box_create ( const char *name, boxType type )
{
box *b = g_malloc0 ( sizeof ( box ) );
@@ -326,7 +308,6 @@ box * box_create ( const char *name, boxType type )
b->widget.resize = box_resize;
b->widget.update = box_update;
b->widget.find_mouse_target = box_find_mouse_target;
- b->widget.motion_notify = box_motion_notify;
b->widget.get_desired_height = box_get_desired_height;
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
diff --git a/source/widgets/container.c b/source/widgets/container.c
index 783f7ee4..6807ce15 100644
--- a/source/widgets/container.c
+++ b/source/widgets/container.c
@@ -100,18 +100,6 @@ static widget *container_find_mouse_target ( widget *wid, WidgetType type, gint
return widget_find_mouse_target ( b->child, type, x, y );
}
-static gboolean container_motion_notify ( widget *wid, xcb_motion_notify_event_t *xme )
-{
- container *b = (container *) wid;
- if ( widget_intersect ( b->child, xme->event_x, xme->event_y ) ) {
- xcb_motion_notify_event_t rel = *xme;
- rel.event_x -= b->child->x;
- rel.event_y -= b->child->y;
- return widget_motion_notify ( b->child, &rel );
- }
- return FALSE;
-}
-
container * container_create ( const char *name )
{
container *b = g_malloc0 ( sizeof ( container ) );
@@ -122,7 +110,6 @@ container * container_create ( const char *name )
b->widget.resize = container_resize;
b->widget.update = container_update;
b->widget.find_mouse_target = container_find_mouse_target;
- b->widget.motion_notify = container_motion_notify;
b->widget.get_desired_height = container_get_desired_height;
b->widget.enabled = rofi_theme_get_boolean ( WIDGET ( b ), "enabled", TRUE );
return b;
diff --git a/source/widgets/scrollbar.c b/source/widgets/scrollbar.c
index db4c1d17..b21066f7 100644
--- a/source/widgets/scrollbar.c
+++ b/source/widgets/scrollbar.c
@@ -83,7 +83,7 @@ static gboolean scrollbar_trigger_action ( widget *wid, MouseBindingMouseDefault
return FALSE;
}
-static gboolean scrollbar_motion_notify ( widget *wid, xcb_motion_notify_event_t *xme )
+static gboolean scrollbar_motion_notify ( widget *wid, G_GNUC_UNUSED gint x, gint y )
{
/* FIXME: scoll
scrollbar *sb = (scrollbar *) wid;
diff --git a/source/widgets/widget.c b/source/widgets/widget.c
index 2fd99863..b98ee45b 100644
--- a/source/widgets/widget.c
+++ b/source/widgets/widget.c
@@ -467,10 +467,10 @@ void widget_set_trigger_action_handler ( widget *wid, widget_trigger_action_cb c
wid->trigger_action_cb_data = cb_data;
}
-gboolean widget_motion_notify ( widget *wid, xcb_motion_notify_event_t *xme )
+gboolean widget_motion_notify ( widget *wid, gint x, gint y )
{
if ( wid && wid->motion_notify ) {
- wid->motion_notify ( wid, xme );
+ wid->motion_notify ( wid, x, y );
}
return FALSE;