updated for version 7.0035
diff --git a/src/gui.c b/src/gui.c
index d77a146..ec3af28 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -4201,22 +4201,22 @@
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 32fb747..21d4a04 100644
--- a/src/gui_kde_x11.cc
+++ b/src/gui_kde_x11.cc
@@ -1303,19 +1303,13 @@
}//}}}
/*
- * 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)//{{{
+ void
+gui_mch_getmouse(int *x, int *y)//{{{
{
- return vmw->mapFromGlobal(QCursor::pos()).x();
-}//}}}
-
- int
-gui_mch_get_mouse_y(void)//{{{
-{
- 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 3b73339..b930852 100644
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -5672,27 +5672,16 @@
#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()
+void gui_mch_getmouse(int *x, int *y)
{
Point where;
GetMouse(&where);
- return (where.h);
-}
-
- int
-gui_mch_get_mouse_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 9223a40..fc96cc1 100644
--- a/src/gui_photon.c
+++ b/src/gui_photon.c
@@ -1896,29 +1896,18 @@
}
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 07cbc75..2c40514 100644
--- a/src/gui_riscos.c
+++ b/src/gui_riscos.c
@@ -3014,40 +3014,26 @@
}
/*
- * 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 cf07b26..e0b545c 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -3184,6 +3184,8 @@
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 @@
*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 77cc24d..33edfd3 100644
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -2411,33 +2411,18 @@
#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)
+ 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.x - rct.left);
-}
-
-/*
- * Get current y mouse coordinate in text window.
- * Return -1 when unknown.
- */
- int
-gui_mch_get_mouse_y(void)
-{
- 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 db091b5..1633b2a 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -3026,7 +3026,9 @@
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 d70a7b8..62889d2 100644
--- a/src/proto/gui_gtk_x11.pro
+++ b/src/proto/gui_gtk_x11.pro
@@ -57,8 +57,7 @@
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 cae8208..eb6a286 100644
--- a/src/proto/gui_kde_x11.pro
+++ b/src/proto/gui_kde_x11.pro
@@ -52,8 +52,7 @@
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 6f595e2..b5a4638 100644
--- a/src/proto/gui_mac.pro
+++ b/src/proto/gui_mac.pro
@@ -17,8 +17,7 @@
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 54a5659..af33ef5 100644
--- a/src/proto/gui_photon.pro
+++ b/src/proto/gui_photon.pro
@@ -23,8 +23,7 @@
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 f6b1b4a..1b07a00 100644
--- a/src/proto/gui_w16.pro
+++ b/src/proto/gui_w16.pro
@@ -39,8 +39,7 @@
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 a8c9793..8eca7f1 100644
--- a/src/proto/gui_w32.pro
+++ b/src/proto/gui_w32.pro
@@ -39,8 +39,7 @@
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));