}
static GdkDevice *
-find_suitable_pointer (struct frame *f)
+find_suitable_pointer (struct frame *f, bool need_smooth)
{
GdkSeat *seat = gdk_display_get_default_seat
(gtk_widget_get_display (FRAME_GTK_WIDGET (f)));
+ GList *devices, *tem;
+ GdkDevice *device;
if (!seat)
return NULL;
- return gdk_seat_get_pointer (seat);
+ devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL_POINTING);
+ device = NULL;
+ tem = NULL;
+
+ if (need_smooth)
+ {
+ for (tem = devices; tem; tem = tem->next)
+ {
+ device = GDK_DEVICE (tem->data);
+
+ if (gdk_device_get_source (device) == GDK_SOURCE_TOUCHPAD)
+ break;
+ }
+ }
+
+ g_list_free (devices);
+
+ return !tem ? gdk_seat_get_pointer (seat) : device;
}
static GdkDevice *
xg_event->button.button = button;
xg_event->button.state = modifier_state;
xg_event->button.time = time;
- xg_event->button.device = find_suitable_pointer (view->frame);
+ xg_event->button.device = find_suitable_pointer (view->frame, false);
gtk_main_do_event (xg_event);
gdk_event_free (xg_event);
xg_event->crossing.detail = GDK_NOTIFY_ANCESTOR;
xg_event->crossing.mode = GDK_CROSSING_UNGRAB;
xg_event->crossing.window = g_object_ref (target_window);
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (view->frame, false));
gtk_main_do_event (xg_event);
gdk_event_free (xg_event);
xg_event->crossing.mode = GDK_CROSSING_UNGRAB;
xg_event->crossing.window = g_object_ref (toplevel);
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (view->frame, false));
gtk_main_do_event (xg_event);
gdk_event_free (xg_event);
}
else
xg_event->scroll.direction = GDK_SCROLL_RIGHT;
- xg_event->scroll.device = find_suitable_pointer (view->frame);
+ xg_event->scroll.device = find_suitable_pointer (view->frame,
+ false);
xg_event->scroll.x = x;
xg_event->scroll.x_root = x;
xg_event->motion.y_root = root_y;
xg_event->motion.time = time;
xg_event->motion.state = state;
- xg_event->motion.device = find_suitable_pointer (view->frame);
+ xg_event->motion.device = find_suitable_pointer (view->frame, false);
g_object_ref (xg_event->any.window);
xg_event->scroll.state = state;
xg_event->scroll.delta_x = dx;
xg_event->scroll.delta_y = dy;
- xg_event->scroll.device = find_suitable_pointer (view->frame);
+ xg_event->scroll.device = find_suitable_pointer (view->frame, true);
xg_event->scroll.is_stop = stop_p;
g_object_ref (xg_event->any.window);
break;
}
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event, find_suitable_pointer (view->frame, false));
g_object_ref (xg_event->any.window);
gtk_main_do_event (xg_event);
{
xg_event = gdk_event_new (type);
- gdk_event_set_device (xg_event, find_suitable_pointer (xv->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (xv->frame, false));
window_coords_from_toplevel (tem, toplevel, x, y, &cx, &cy);
xg_event->crossing.x = cx;
xg_event->crossing.y = cy;
tem = it->data;
xg_event = gdk_event_new (type);
- gdk_event_set_device (xg_event, find_suitable_pointer (xv->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (xv->frame, false));
window_coords_from_toplevel (tem, toplevel, x, y, &cx, &cy);
xg_event->crossing.x = cx;
xg_event->crossing.y = cy;
xg_event->crossing.detail = GDK_NOTIFY_ANCESTOR;
xg_event->crossing.mode = exit_crossing;
xg_event->crossing.window = g_object_ref (view->last_crossing_window);
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (view->frame, false));
gtk_main_do_event (xg_event);
gdk_event_free (xg_event);
exit_crossing);
xg_event = gdk_event_new (GDK_LEAVE_NOTIFY);
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (view->frame, false));
window_coords_from_toplevel (last_crossing, toplevel,
x, y, &cx, &cy);
xg_event->crossing.x = cx;
entry_crossing);
xg_event = gdk_event_new (GDK_ENTER_NOTIFY);
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (view->frame, false));
window_coords_from_toplevel (current_window, toplevel,
x, y, &cx, &cy);
xg_event->crossing.x = cx;
xg_event->motion.y_root = event->xmotion.y_root;
xg_event->motion.time = event->xmotion.time;
xg_event->motion.state = event->xmotion.state;
- xg_event->motion.device = find_suitable_pointer (view->frame);
+ xg_event->motion.device
+ = find_suitable_pointer (view->frame, false);
}
else
{
return;
}
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (view->frame, false));
}
#endif
else
xg_event->crossing.x_root = event->xcrossing.x_root;
xg_event->crossing.y_root = event->xcrossing.y_root;
xg_event->crossing.focus = event->xcrossing.focus;
- gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+ gdk_event_set_device (xg_event,
+ find_suitable_pointer (view->frame, false));
}
gtk_main_do_event (xg_event);
if (FRAME_WINDOW_P (SELECTED_FRAME ()))
gdk_event_set_device (focus_event,
- find_suitable_pointer (SELECTED_FRAME ()));
+ find_suitable_pointer (SELECTED_FRAME (),
+ false));
g_object_ref (wnd);