diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui.c | 28 | ||||
-rw-r--r-- | src/gui_kde_x11.cc | 16 | ||||
-rw-r--r-- | src/gui_mac.c | 19 | ||||
-rw-r--r-- | src/gui_photon.c | 21 | ||||
-rw-r--r-- | src/gui_riscos.c | 30 | ||||
-rw-r--r-- | src/gui_w32.c | 7 | ||||
-rw-r--r-- | src/gui_w48.c | 25 | ||||
-rw-r--r-- | src/misc2.c | 4 | ||||
-rw-r--r-- | src/proto/gui_gtk_x11.pro | 3 | ||||
-rw-r--r-- | src/proto/gui_kde_x11.pro | 3 | ||||
-rw-r--r-- | src/proto/gui_mac.pro | 3 | ||||
-rw-r--r-- | src/proto/gui_photon.pro | 3 | ||||
-rw-r--r-- | src/proto/gui_w16.pro | 3 | ||||
-rw-r--r-- | src/proto/gui_w32.pro | 3 |
14 files changed, 55 insertions, 113 deletions
@@ -4201,22 +4201,22 @@ gui_mouse_correct() win_T *wp = NULL; need_mouse_correct = FALSE; - if (gui.in_use && p_mousef) + + if (!(gui.in_use && p_mousef)) + return; + + gui_mch_getmouse(&x, &y); + /* Don't move the mouse when it's left or right of the Vim window */ + if (x < 0 || x > Columns * gui.char_width) + return; + if (y >= 0) + wp = xy2win(x, y); + if (wp != curwin && wp != NULL) /* If in other than current window */ { - x = gui_mch_get_mouse_x(); - /* Don't move the mouse when it's left or right of the Vim window */ - if (x < 0 || x > Columns * gui.char_width) - return; - y = gui_mch_get_mouse_y(); - if (y >= 0) - wp = xy2win(x, y); - if (wp != curwin && wp != NULL) /* If in other than current window */ - { - validate_cline_row(); - gui_mch_setmouse((int)W_ENDCOL(curwin) * gui.char_width - 3, - (W_WINROW(curwin) + curwin->w_wrow) * gui.char_height + validate_cline_row(); + gui_mch_setmouse((int)W_ENDCOL(curwin) * gui.char_width - 3, + (W_WINROW(curwin) + curwin->w_wrow) * gui.char_height + (gui.char_height) / 2); - } } } diff --git a/src/gui_kde_x11.cc b/src/gui_kde_x11.cc index 32fb747a5..21d4a041d 100644 --- a/src/gui_kde_x11.cc +++ b/src/gui_kde_x11.cc @@ -1303,19 +1303,13 @@ gui_mch_get_rgb(guicolor_T pixel)//{{{ }//}}} /* - * Get current y mouse coordinate in text window. - * Return -1 when unknown. + * Get current mouse coordinates in text window. */ - int -gui_mch_get_mouse_x(void)//{{{ -{ - return vmw->mapFromGlobal(QCursor::pos()).x(); -}//}}} - - int -gui_mch_get_mouse_y(void)//{{{ + void +gui_mch_getmouse(int *x, int *y)//{{{ { - return vmw->mapFromGlobal(QCursor::pos()).y(); + *x = vmw->mapFromGlobal(QCursor::pos()).x(); + *y = vmw->mapFromGlobal(QCursor::pos()).y(); }//}}} void diff --git a/src/gui_mac.c b/src/gui_mac.c index 3b73339df..b930852a4 100644 --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -5672,27 +5672,16 @@ display_errors() #endif /* - * Get current y mouse coordinate in text window. - * Return -1 when unknown. + * Get current mouse coordinates in text window. */ - int -gui_mch_get_mouse_x() -{ - Point where; - - GetMouse(&where); - - return (where.h); -} - - int -gui_mch_get_mouse_y() +void gui_mch_getmouse(int *x, int *y) { Point where; GetMouse(&where); - return (where.v); + *x = where.h; + *y = where.v; } void diff --git a/src/gui_photon.c b/src/gui_photon.c index 9223a40ec..fc96cc187 100644 --- a/src/gui_photon.c +++ b/src/gui_photon.c @@ -1896,29 +1896,18 @@ gui_mch_mousehide(int hide) } int -gui_mch_get_mouse_x(void) +gui_mch_getmouse(int *x, int *y) { PhCursorInfo_t info; - short x, y; + short ix, iy; /* FIXME: does this return the correct position, * with respect to the border? */ PhQueryCursor( PhInputGroup( NULL ), &info ); - PtGetAbsPosition( gui.vimTextArea , &x, &y ); + PtGetAbsPosition( gui.vimTextArea , &ix, &iy ); - return( info.pos.x - x ); -} - - int -gui_mch_get_mouse_y(void) -{ - PhCursorInfo_t info; - short x, y; - - PhQueryCursor( PhInputGroup( NULL ), &info ); - PtGetAbsPosition( gui.vimTextArea , &x, &y ); - /* TODO: Add border offset? */ - return( info.pos.y - y ); + *x = info.pos.x - ix; + *y = info.pos.y - iy; } void diff --git a/src/gui_riscos.c b/src/gui_riscos.c index 07cbc7543..2c40514fd 100644 --- a/src/gui_riscos.c +++ b/src/gui_riscos.c @@ -3014,40 +3014,26 @@ gui_mch_set_scrollbar_colors(scrollbar_T *sb) } /* - * Get current x mouse coordinate in text window. + * Get current mouse coordinates in text window. * Note: (0,0) is the bottom left corner, positive y is UP. - * Return -1 when unknown. */ - int -gui_mch_get_mouse_x() + void +gui_mch_getmouse(x, y) + int *x; + int *y; { int left; - int block[10]; - - block[0] = gui.window_handle; - swi(Wimp_GetWindowState, 0, block); - left = block[1]; - - swi(Wimp_GetPointerInfo, 0, block); - return block[0] - left; -} - -/* - * Get current y mouse coordinate in text window. - * Return -1 when unknown. - */ - int -gui_mch_get_mouse_y() -{ int top; int block[10]; block[0] = gui.window_handle; swi(Wimp_GetWindowState, 0, block); + left = block[1]; top = block[4]; swi(Wimp_GetPointerInfo, 0, block); - return top - block[1]; + *x = block[0] - left; + *y = top - block[1]; } /* MouseTo(x, y) */ diff --git a/src/gui_w32.c b/src/gui_w32.c index cf07b2632..e0b545cf3 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -3184,6 +3184,8 @@ gui_mch_tearoff( int nameLen; int padding0, padding1, padding2 = 0; int sepPadding=0; + int x; + int y; #ifdef USE_SYSMENU_FONT LOGFONT lfSysmenu; int use_lfSysmenu = FALSE; @@ -3304,12 +3306,13 @@ gui_mch_tearoff( *p++ = HIWORD(lExtendedStyle); pnumitems = p; /* save where the number of items must be stored */ *p++ = 0; // NumberOfItems(will change later) + gui_mch_getmouse(&x, &y); if (initX == 0xffffL) - *p++ = PixelToDialogX(gui_mch_get_mouse_x()); // x + *p++ = PixelToDialogX(x); // x else *p++ = PixelToDialogX(initX); // x if (initY == 0xffffL) - *p++ = PixelToDialogY(gui_mch_get_mouse_y()); // y + *p++ = PixelToDialogY(y); // y else *p++ = PixelToDialogY(initY); // y *p++ = PixelToDialogX(dlgwidth); // cx diff --git a/src/gui_w48.c b/src/gui_w48.c index 77cc24dbe..33edfd3af 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -2411,33 +2411,18 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb) #endif /* - * Get current x mouse coordinate in text window. - * Return -1 when unknown. + * Get current mouse coordinates in text window. */ - int -gui_mch_get_mouse_x(void) -{ - RECT rct; - POINT mp; - - (void)GetWindowRect(s_textArea, &rct); - (void)GetCursorPos((LPPOINT)&mp); - return (int)(mp.x - rct.left); -} - -/* - * Get current y mouse coordinate in text window. - * Return -1 when unknown. - */ - int -gui_mch_get_mouse_y(void) + void +gui_mch_get_mouse_(int *x, int *y) { RECT rct; POINT mp; (void)GetWindowRect(s_textArea, &rct); (void)GetCursorPos((LPPOINT)&mp); - return (int)(mp.y - rct.top); + *x = (int)(mp.x - rct.left); + *y = (int)(mp.y - rct.top); } /* diff --git a/src/misc2.c b/src/misc2.c index db091b5bc..1633b2ae3 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -3026,7 +3026,9 @@ get_shape_idx(mouse) if (mouse && (State == HITRETURN || State == ASKMORE)) { # ifdef FEAT_GUI - if (Y_2_ROW(gui_mch_get_mouse_y()) == Rows - 1) + int x, y; + gui_mch_getmouse(&x, &y); + if (Y_2_ROW(y) == Rows - 1) return SHAPE_IDX_MOREL; # endif return SHAPE_IDX_MORE; diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro index d70a7b8ac..62889d258 100644 --- a/src/proto/gui_gtk_x11.pro +++ b/src/proto/gui_gtk_x11.pro @@ -57,8 +57,7 @@ void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); void gui_mch_draw_menubar __ARGS((void)); void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -int gui_mch_get_mouse_x __ARGS((void)); -int gui_mch_get_mouse_y __ARGS((void)); +void gui_mch_getmouse __ARGS((int *x, int *y)); void gui_mch_setmouse __ARGS((int x, int y)); void gui_mch_mousehide __ARGS((int hide)); void mch_set_mouse_shape __ARGS((int shape)); diff --git a/src/proto/gui_kde_x11.pro b/src/proto/gui_kde_x11.pro index cae8208fa..eb6a286ce 100644 --- a/src/proto/gui_kde_x11.pro +++ b/src/proto/gui_kde_x11.pro @@ -52,8 +52,7 @@ void gui_mch_menu_hidden __ARGS((vimmenu_T *menu, int hidden)); void gui_mch_draw_menubar __ARGS((void)); void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); -int gui_mch_get_mouse_x __ARGS((void)); -int gui_mch_get_mouse_y __ARGS((void)); +void gui_mch_getmouse __ARGS((int *x, int *y)); void gui_mch_setmouse __ARGS((int x, int y)); void gui_mch_mousehide __ARGS((int hide)); void mch_set_mouse_shape __ARGS((int shape)); diff --git a/src/proto/gui_mac.pro b/src/proto/gui_mac.pro index 6f595e2bd..b5a4638d1 100644 --- a/src/proto/gui_mac.pro +++ b/src/proto/gui_mac.pro @@ -17,8 +17,7 @@ short gui_mch_get_mac_menu_item_index __ARGS((vimmenu_T *menu, vimmenu_T *parent void gui_mch_set_blinking __ARGS((long wait, long on, long off)); void gui_mch_stop_blink __ARGS((void)); void gui_mch_start_blink __ARGS((void)); -int gui_mch_get_mouse_x __ARGS((void)); -int gui_mch_get_mouse_y __ARGS((void)); +void gui_mch_getmouse __ARGS((int *x, int *y)); void gui_mch_setmouse __ARGS((int x, int y)); void gui_mch_prepare __ARGS((int *argc, char **argv)); int gui_mch_init_check __ARGS((void)); diff --git a/src/proto/gui_photon.pro b/src/proto/gui_photon.pro index 54a565913..af33ef5ce 100644 --- a/src/proto/gui_photon.pro +++ b/src/proto/gui_photon.pro @@ -23,8 +23,7 @@ void gui_mch_enable_scrollbar __ARGS((scrollbar_T *sb, int flag)); void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); void mch_set_mouse_shape __ARGS((int shape)); void gui_mch_mousehide __ARGS((int hide)); -int gui_mch_get_mouse_x __ARGS((void)); -int gui_mch_get_mouse_y __ARGS((void)); +void gui_mch_getmouse __ARGS((int *x, int *y)); void gui_mch_setmouse __ARGS((int x, int y)); long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); void gui_mch_new_colors __ARGS((void)); diff --git a/src/proto/gui_w16.pro b/src/proto/gui_w16.pro index f6b1b4a3f..1b07a00e8 100644 --- a/src/proto/gui_w16.pro +++ b/src/proto/gui_w16.pro @@ -39,8 +39,7 @@ void gui_mch_find_dialog __ARGS((exarg_T *eap)); void gui_mch_replace_dialog __ARGS((exarg_T *eap)); void gui_mch_mousehide __ARGS((int hide)); void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -int gui_mch_get_mouse_x __ARGS((void)); -int gui_mch_get_mouse_y __ARGS((void)); +void gui_mch_getmouse __ARGS((int *x, int *y)); void gui_mch_setmouse __ARGS((int x, int y)); void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); void gui_mch_flash __ARGS((int msec)); diff --git a/src/proto/gui_w32.pro b/src/proto/gui_w32.pro index a8c97931d..8eca7f106 100644 --- a/src/proto/gui_w32.pro +++ b/src/proto/gui_w32.pro @@ -39,8 +39,7 @@ void gui_mch_find_dialog __ARGS((exarg_T *eap)); void gui_mch_replace_dialog __ARGS((exarg_T *eap)); void gui_mch_mousehide __ARGS((int hide)); void gui_mch_destroy_scrollbar __ARGS((scrollbar_T *sb)); -int gui_mch_get_mouse_x __ARGS((void)); -int gui_mch_get_mouse_y __ARGS((void)); +void gui_mch_getmouse __ARGS((int *x, int *y)); void gui_mch_setmouse __ARGS((int x, int y)); void gui_mch_get_screen_dimensions __ARGS((int *screen_w, int *screen_h)); void gui_mch_flash __ARGS((int msec)); |