Add pxr and pxd in px?. Initial PoC for mouse click support

This commit is contained in:
pancake 2015-05-27 23:46:03 +02:00
parent 4c84b3a2d5
commit d25c520a18
3 changed files with 38 additions and 3 deletions

View File

@ -6,6 +6,8 @@
#include <errno.h>
#endif
#define USE_CLICK 0
#define I r_cons_singleton()
#if 0
@ -156,10 +158,33 @@ R_API int r_cons_arrow_to_hjkl(int ch) {
case 'M': // Mouse events
ch = r_cons_readchar ();
/* Skip the x/y coordinates */
(void)r_cons_readchar();
(void)r_cons_readchar();
#if USE_CLICK
int x = r_cons_readchar() - 33;
int y = r_cons_readchar() - 33;
#else
(void) r_cons_readchar();
(void) r_cons_readchar();
#endif
#if USE_CLICK
if (ch==35) {
/* handle click */
#define CLICK_DEBUG 1
#if CLICK_DEBUG
r_cons_gotoxy (0,0);
r_cons_printf ("Click at %d %d\n", x, y);
r_cons_flush ();
#endif
RCons *cons = r_cons_singleton ();
if (cons->onclick) {
cons->onclick (cons->data, x, y);
}
r_cons_enable_mouse (R_FALSE);
(void)r_cons_readchar ();
ch = 0;
} else
#endif
if (ch==0x20) {
// click
// click - deprecated?
r_cons_enable_mouse (R_FALSE);
ch = 0;
//r_cons_enable_mouse (R_TRUE);

View File

@ -2402,6 +2402,7 @@ static int cmd_print(void *data, const char *input) {
"pxa", "", "show annotated hexdump",
"pxA", "", "show op analysis color map",
"pxb", "", "dump bits in hexdump form",
"pxd", "", "decimal (base 10) dump",
"pxe", "", "emoji hexdump! :)",
"pxf", "", "show hexdump of current function",
"pxh", "", "show hexadecimal half-words dump (16bit)",
@ -2410,6 +2411,7 @@ static int cmd_print(void *data, const char *input) {
"pxo", "", "show octal dump",
"pxq", "", "show hexadecimal quad-words dump (64bit)",
"pxQ", "", "same as above, but one per line",
"pxr", "", "show words with references to flags and code",
"pxs", "", "show hexadecimal in sparse mode",
"pxw", "", "show hexadecimal words dump (32bit)",
"pxW", "", "same as above, but one per line",

View File

@ -133,6 +133,13 @@ typedef struct r_cons_canvas_t {
} RConsCanvas;
typedef char *(*RConsEditorCallback)(void *core, const char *file, const char *str);
typedef int (*RConsClickCallback)(void *core, int x, int y);
#if 0
r_cons_click_begin();
r_cons_click_end();
r_cons_click_clear();
#endif
typedef struct r_cons_t {
RConsGrep grep;
@ -185,6 +192,7 @@ typedef struct r_cons_t {
struct r_line_t *line;
const char **vline;
int refcnt;
RConsClickCallback onclick;
} RCons;
// XXX THIS MUST BE A SINGLETON AND WRAPPED INTO RCons */