[Xfce4-commits] <ristretto:master> Set the motion-state to BOX-ZOOM even when not hovering over the image
Stephan Arts
noreply at xfce.org
Sun Dec 18 09:26:01 CET 2011
Updating branch refs/heads/master
to 0d1b0fb14f28eba61a2eb7d786cc1e88a43f2433 (commit)
from 97a169c4755d83c6ae626439d426cd7f994e2147 (commit)
commit 0d1b0fb14f28eba61a2eb7d786cc1e88a43f2433
Author: Stephan Arts <stephan at xfce.org>
Date: Sun Dec 18 09:22:43 2011 +0100
Set the motion-state to BOX-ZOOM even when not hovering over the image
Change the cursor only when the mouse is over the image, but allow
a selection to start from 'outside' the image and end outside the
image aswell.
src/image_viewer.c | 30 ++++++++++++++++++++++++++++--
1 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/image_viewer.c b/src/image_viewer.c
index 6a58052..3e77271 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -2127,6 +2127,25 @@ rstto_motion_notify_event (
widget->window,
NULL,
FALSE);
+
+ /* Only change the cursor when hovering over the image
+ */
+ if ( (event->x > viewer->priv->rendering.x_offset) &&
+ (event->y > viewer->priv->rendering.y_offset) &&
+ (event->y < (viewer->priv->rendering.y_offset + viewer->priv->rendering.height)) &&
+ (event->x < (viewer->priv->rendering.x_offset + viewer->priv->rendering.width)))
+ {
+ GdkCursor *cursor = gdk_cursor_new(GDK_UL_ANGLE);
+ gdk_window_set_cursor(widget->window, cursor);
+ gdk_cursor_unref(cursor);
+ }
+ else
+ {
+ /* Set back to default when moving over the
+ * background.
+ */
+ gdk_window_set_cursor(widget->window, NULL);
+ }
break;
default:
break;
@@ -2169,6 +2188,8 @@ rstto_button_press_event (
if (event->state & GDK_CONTROL_MASK)
{
+ /* Only change the cursor when hovering over the image
+ */
if ( (event->x > viewer->priv->rendering.x_offset) &&
(event->y > viewer->priv->rendering.y_offset) &&
(event->y < (viewer->priv->rendering.y_offset + viewer->priv->rendering.height)) &&
@@ -2177,9 +2198,14 @@ rstto_button_press_event (
GdkCursor *cursor = gdk_cursor_new(GDK_UL_ANGLE);
gdk_window_set_cursor(widget->window, cursor);
gdk_cursor_unref(cursor);
-
- rstto_image_viewer_set_motion_state (viewer, RSTTO_IMAGE_VIEWER_MOTION_STATE_BOX_ZOOM);
}
+
+ /* Set the zoom-state even if not hovering over the
+ * image, this allows for easier selection.
+ * Dragging from / to somewhere outside the image to
+ * make sure the border is selected too.
+ */
+ rstto_image_viewer_set_motion_state (viewer, RSTTO_IMAGE_VIEWER_MOTION_STATE_BOX_ZOOM);
}
}
return TRUE;
More information about the Xfce4-commits
mailing list