Commit cdb05999 authored by deuce's avatar deuce
Browse files

Text input mouse clicks MUST be on the same line as the input.

Add new input option K_MOUSEEXIT
parent e8035572
......@@ -217,6 +217,9 @@
#define K_DECIMAL (1L<<13) /* Allow floating point numbers only */
#define K_DEUCEEXIT (1L<<14) /* Return whenever Deuce wants to exit */
/* Returns on up/down/F2 */
#define K_MOUSEEXIT (1L<<15) /* Returns when mouse is clicked outside of */
/* Input area (NOT outside of window!) */
/* And ungets the mouse event. */
#define HELPBUF_SIZE 4000
......
......@@ -1754,6 +1754,15 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
f=inkey();
if(f==CIO_KEY_MOUSE) {
if((f=uifc_getmouse(&mevnt))==0) {
if((mevnt.starty != top
|| (mevnt.startx > left+width
|| mevnt.startx < left))
&& mevnt.event==CIOLIB_BUTTON_1_CLICK) {
if(lastkey)
*lastkey=CIO_KEY_MOUSE;
ungetmouse(&mevnt);
return(j);
}
if(mevnt.startx>=left
&& mevnt.startx<=left+width
&& mevnt.event==CIOLIB_BUTTON_1_CLICK) {
......@@ -1761,7 +1770,8 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
if(i>j)
i=j;
}
if(mevnt.startx>=left
if(mevnt.starty == top
&& mevnt.startx>=left
&& mevnt.startx<=left+width
&& (mevnt.event==CIOLIB_BUTTON_2_CLICK
|| mevnt.event==CIOLIB_BUTTON_3_CLICK)) {
......@@ -1818,14 +1828,16 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int
}
if(ch==CIO_KEY_MOUSE) {
if((ch=uifc_getmouse(&mevnt))==0) {
if(mevnt.startx>=left
if(mevnt.starty == top
&& mevnt.startx>=left
&& mevnt.startx<=left+width
&& mevnt.event==CIOLIB_BUTTON_1_CLICK) {
i=mevnt.startx-left+soffset;
if(i>j)
i=j;
}
if(mevnt.startx>=left
if(mevnt.starty == top
&& mevnt.startx>=left
&& mevnt.startx<=left+width
&& (mevnt.event==CIOLIB_BUTTON_2_CLICK
|| mevnt.event==CIOLIB_BUTTON_3_CLICK)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment