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.
+8 −3
5 files changed
- M commands.c +1 −1
- M config.def.h +1 −0
- M nsxiv.1 +3 −0
- M nsxiv.h +2 −1
- M window.c +1 −1
| @@ -338,7 +338,7 @@ bool ci_drag(arg_t mode) | |||
| 338 | 338 | if ((int)(img.w * img.zoom) <= win.w && (int)(img.h * img.zoom) <= win.h) | |
| 339 | 339 | return false; | |
| 340 | 340 | ||
| 341 | − | win_set_cursor(&win, CURSOR_DRAG); | |
| 341 | + | win_set_cursor(&win, mode == DRAG_ABSOLUTE ? CURSOR_DRAG_ABSOLUTE : CURSOR_DRAG_RELATIVE); | |
| 342 | 342 | win_cursor_pos(&win, &x, &y); | |
| 343 | 343 | ox = x; | |
| 344 | 344 | oy = y; | |
| @@ -158,6 +158,7 @@ static const keymap_t keys[] = { | |||
| 158 | 158 | static const button_t buttons[] = { | |
| 159 | 159 | /* modifiers button function argument */ | |
| 160 | 160 | { 0, 1, i_cursor_navigate, None }, | |
| 161 | + | { ControlMask, 1, i_drag, DRAG_RELATIVE }, | |
| 161 | 162 | { 0, 2, i_drag, DRAG_ABSOLUTE }, | |
| 162 | 163 | { 0, 3, g_switch_mode, None }, | |
| 163 | 164 | { 0, 4, g_zoom, +1 }, | |
| @@ -390,6 +390,9 @@ Panning: | |||
| 390 | 390 | Pan the image according to the mouse cursor position in the window while | |
| 391 | 391 | keeping this button pressed down. | |
| 392 | 392 | .TP | |
| 393 | + | .B Ctrl-Button1 | |
| 394 | + | Pan the image relative to the mouse cursor. | |
| 395 | + | .TP | |
| 393 | 396 | Zooming: | |
| 394 | 397 | .TP | |
| 395 | 398 | .B ScrollUp | |
| @@ -99,7 +99,8 @@ typedef enum { | |||
| 99 | 99 | ||
| 100 | 100 | typedef enum { | |
| 101 | 101 | CURSOR_ARROW, | |
| 102 | − | CURSOR_DRAG, | |
| 102 | + | CURSOR_DRAG_ABSOLUTE, | |
| 103 | + | CURSOR_DRAG_RELATIVE, | |
| 103 | 104 | CURSOR_WATCH, | |
| 104 | 105 | CURSOR_LEFT, | |
| 105 | 106 | CURSOR_RIGHT, | |
| @@ -51,7 +51,7 @@ static struct { | |||
| 51 | 51 | int name; | |
| 52 | 52 | Cursor icon; | |
| 53 | 53 | } cursors[CURSOR_COUNT] = { | |
| 54 | − | { XC_left_ptr }, { XC_dotbox }, { XC_watch }, | |
| 54 | + | { XC_left_ptr }, { XC_dotbox }, { XC_fleur }, { XC_watch }, | |
| 55 | 55 | { XC_sb_left_arrow }, { XC_sb_right_arrow } | |
| 56 | 56 | }; | |
| 57 | 57 | ||