[gtk+/multitouch: 24/27] gtk, pah: Use the touch area if available for the notification size.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multitouch: 24/27] gtk, pah: Use the touch area if available for the notification size.
- Date: Mon, 5 Dec 2011 01:18:08 +0000 (UTC)
commit b8dda4f5ce7260f750451c505f14688b1a1ac80a
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Nov 6 12:13:14 2011 +0100
gtk,pah: Use the touch area if available for the notification size.
On multitouch devices that are capable of returning the touch area,
use it to display the press-and-hold indicator at a reasonable size.
gtk/gtkwidget.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 86c0cfc..5e9a8f7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7251,11 +7251,26 @@ _gtk_widget_press_and_hold_check_start (GtkWidget *widget,
source_device = gdk_event_get_source_device ((GdkEvent *) event);
source = gdk_device_get_source (source_device);
- if (source == GDK_SOURCE_TOUCH)
+ if (source == GDK_SOURCE_TOUCH ||
+ source == GDK_SOURCE_MULTITOUCH)
{
- /* Have an indicator with 2.5cm of diameter */
- data->size = (25 * gdk_screen_get_width (screen)) /
- gdk_screen_get_width_mm (screen);
+ cairo_region_t *region;
+
+ region = gdk_event_get_touch_area ((GdkEvent *) event);
+
+ if (region)
+ {
+ cairo_rectangle_int_t rect;
+
+ cairo_region_get_extents (region, &rect);
+ data->size = MAX (rect.width, rect.height);
+ }
+ else
+ {
+ /* Have an indicator with 2.5cm of diameter */
+ data->size = (25 * gdk_screen_get_width (screen)) /
+ gdk_screen_get_width_mm (screen);
+ }
}
else
data->size = gdk_display_get_default_cursor_size (gtk_widget_get_display (widget));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]