forked from aniani/vim
updated for version 7.0035
This commit is contained in:
28
src/gui.c
28
src/gui.c
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)//{{{
|
||||
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
|
||||
|
||||
@@ -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()
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user