Krolyxon
Commit 5775457

Branches

Refs →

nsxiv5775457

Add default key-binding for DRAG_RELATIVE (#117)

Ctrl-Button1 now has a relative drag using the XC_fleur cursor.
XC_fleur is normally the cursor for "size all" action, which has 4
arrows pointing to 4 directions.
Author
LuXu
Date
2021-10-27 11:00 +0800
Committer
NRK · 2021-10-27 09:02 +0600
Parent
1f01c67
Commit
57754572bc20769575b888565dc192c9d6e14f05

+8 −3

5 files changed

  1. M commands.c +1 −1
  2. M config.def.h +1 −0
  3. M nsxiv.1 +3 −0
  4. M nsxiv.h +2 −1
  5. M window.c +1 −1
M commands.c View
@@ -338,7 +338,7 @@ bool ci_drag(arg_t mode)
338338 if ((int)(img.w * img.zoom) <= win.w && (int)(img.h * img.zoom) <= win.h)
339339 return false;
340340
341− win_set_cursor(&win, CURSOR_DRAG);
341+ win_set_cursor(&win, mode == DRAG_ABSOLUTE ? CURSOR_DRAG_ABSOLUTE : CURSOR_DRAG_RELATIVE);
342342 win_cursor_pos(&win, &x, &y);
343343 ox = x;
344344 oy = y;
M config.def.h View
@@ -158,6 +158,7 @@ static const keymap_t keys[] = {
158158 static const button_t buttons[] = {
159159 /* modifiers button function argument */
160160 { 0, 1, i_cursor_navigate, None },
161+ { ControlMask, 1, i_drag, DRAG_RELATIVE },
161162 { 0, 2, i_drag, DRAG_ABSOLUTE },
162163 { 0, 3, g_switch_mode, None },
163164 { 0, 4, g_zoom, +1 },
M nsxiv.1 View
@@ -390,6 +390,9 @@ Panning:
390390 Pan the image according to the mouse cursor position in the window while
391391 keeping this button pressed down.
392392 .TP
393+.B Ctrl-Button1
394+Pan the image relative to the mouse cursor.
395+.TP
393396 Zooming:
394397 .TP
395398 .B ScrollUp
M nsxiv.h View
@@ -99,7 +99,8 @@ typedef enum {
9999
100100 typedef enum {
101101 CURSOR_ARROW,
102− CURSOR_DRAG,
102+ CURSOR_DRAG_ABSOLUTE,
103+ CURSOR_DRAG_RELATIVE,
103104 CURSOR_WATCH,
104105 CURSOR_LEFT,
105106 CURSOR_RIGHT,
M window.c View
@@ -51,7 +51,7 @@ static struct {
5151 int name;
5252 Cursor icon;
5353 } cursors[CURSOR_COUNT] = {
54− { XC_left_ptr }, { XC_dotbox }, { XC_watch },
54+ { XC_left_ptr }, { XC_dotbox }, { XC_fleur }, { XC_watch },
5555 { XC_sb_left_arrow }, { XC_sb_right_arrow }
5656 };
5757