aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-10-22 17:00:42 +0200
committerThomas White <taw@physics.org>2017-10-22 17:00:42 +0200
commita1f50778ecf8a10d04a69c7fff4cab57c5358da6 (patch)
treea84674a62ca46bee4dbb8fe7f4e8e91f84d112b7 /src
parentc0215df481e5f700bca5d4fa27ed19de8dd87b8e (diff)
Hold shift to create, resize or move
Diffstat (limited to 'src')
-rw-r--r--src/sc_editor.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 7af97a9..5845326 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -1086,9 +1086,11 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
enum corner c;
gdouble x, y;
struct frame *clicked;
+ int shift;
x = event->x - e->border_offs_x;
y = event->y - e->border_offs_y + e->scroll_pos;
+ shift = event->state & GDK_SHIFT_MASK;
if ( within_frame(e->selection, x, y) ) {
clicked = e->selection;
@@ -1096,8 +1098,8 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
clicked = find_frame_at_position(e->top, x, y);
}
- /* If the user clicked the currently selected frame, position cursor
- * or possibly prepare for resize */
+ /* Clicked within the currently selected frame
+ * -> resize, move or select text */
if ( (e->selection != NULL) && (clicked == e->selection) ) {
struct frame *fr;
@@ -1106,7 +1108,7 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
/* Within the resizing region? */
c = which_corner(x, y, fr);
- if ( (c != CORNER_NONE) && (fr->resizable) ) {
+ if ( (c != CORNER_NONE) && fr->resizable && shift ) {
e->drag_reason = DRAG_REASON_RESIZE;
e->drag_corner = c;
@@ -1137,7 +1139,7 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
check_callback_click(e->cursor_frame, e->cursor_para);
}
- if ( fr->resizable ) {
+ if ( fr->resizable && shift ) {
e->drag_status = DRAG_STATUS_COULD_DRAG;
e->drag_reason = DRAG_REASON_MOVE;
} else {
@@ -1152,13 +1154,16 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
} else if ( (clicked == NULL)
|| ( !e->top_editable && (clicked == e->top) ) )
{
- /* Clicked no object. Deselect old object and set up for
- * (maybe) creating a new one. */
+ /* Clicked no object. Deselect old object.
+ * If shift held, set up for creating a new one. */
e->selection = NULL;
- e->start_corner_x = event->x - e->border_offs_x;
- e->start_corner_y = event->y - e->border_offs_y;
- e->drag_status = DRAG_STATUS_COULD_DRAG;
- e->drag_reason = DRAG_REASON_CREATE;
+
+ if ( shift ) {
+ e->start_corner_x = event->x - e->border_offs_x;
+ e->start_corner_y = event->y - e->border_offs_y;
+ e->drag_status = DRAG_STATUS_COULD_DRAG;
+ e->drag_reason = DRAG_REASON_CREATE;
+ }
} else {