Tetsuo Handa
from-****@I-lov*****
Thu Feb 9 12:25:54 JST 2012
shawn wrote: > I added click-to-select, and am trying to get ranges with ctrl-click > working. Notice-this makes it were to select text in the application you > have to use shift-click. > > What do people think? Thank you for the patch. If we want to allow use of mouse only for selecting a line, your patch is OK. Index: editpolicy.c =================================================================== --- editpolicy.c (revision 5828) +++ editpolicy.c (working copy) @@ -2270,6 +2270,20 @@ } /** + * ccs_click1 - Callback for clicking the left mouse button + * + * Returns nothing. + */ +static void ccs_click1(MEVENT mevent) +{ + struct ccs_screen *ptr = &ccs_screen[ccs_current_screen]; + if (mevent.y < CCS_HEADER_LINES) + return; + ptr->y = mevent.y - CCS_HEADER_LINES; + ccs_show_current(); +} + +/** * ccs_resize_window - Callback for resize event. * * Returns nothing. @@ -3221,6 +3235,7 @@ ptr->current = saved_cursor[ccs_current_screen].current; ptr->y = saved_cursor[ccs_current_screen].y; } + mousemask(ALL_MOUSE_EVENTS, NULL); start: if (ccs_current_screen == CCS_SCREEN_DOMAIN_LIST) { if (!ccs_domain_sort_type) { @@ -3280,6 +3295,14 @@ if (c == ERR) continue; /* Ignore invalid key. */ switch (c) { + case KEY_MOUSE: + { + MEVENT mevent; + if (getmouse(&mevent) == OK) + if (mevent.bstate & BUTTON1_CLICKED) + ccs_click1(mevent); + } + break; case KEY_RESIZE: ccs_resize_window(); ccs_show_list(); But people will surely ask for scrolling via mouse wheel if we allow use of mouse for selecting a line. Currently it is difficult to support mouse wheel without understanding terminal dependent behavior. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=230990 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=455585 I'm keeping the policy editor terminal/distribution independent as much as possible (e.g. not assigning function keys which may result in different scan codes on different terminals). If you want mouse support on the policy editor, you might be interested in GPET project ( http://sourceforge.jp/projects/gpet/ ).