Commit 0666d82c authored by Kim F. Storm's avatar Kim F. Storm

(x_mouse_click_focus_ignore_position): New var.

(syms_of_xterm): DEFVAR_BOOL it.
(ignore_next_mouse_click_timeout): New var.
(handle_one_xevent): Clear it on KeyPress, set it on EnterNotify.
Use it to filter mouse clicks following focus event.
parent 48a0bce4
......@@ -217,6 +217,17 @@ static String Xt_default_resources[] = {0};
static int toolkit_scroll_bar_interaction;
/* Non-zero means to not move point as a result of clicking on a
frame to focus it (when focus-follows-mouse is nil). */
int x_mouse_click_focus_ignore_position;
/* Non-zero timeout value means ignore next mouse click if it arrives
before that timeout elapses (i.e. as part of the same sequence of
events resulting from clicking on a frame to select it). */
static unsigned long ignore_next_mouse_click_timeout;
/* Mouse movement.
Formerly, we used PointerMotionHintMask (in standard_event_mask)
......@@ -747,13 +758,13 @@ x_draw_fringe_bitmap (w, row, p)
if (p->overlay_p)
{
clipmask = XCreatePixmapFromBitmapData (display,
clipmask = XCreatePixmapFromBitmapData (display,
FRAME_X_DISPLAY_INFO (f)->root_window,
bits, p->wd, p->h,
bits, p->wd, p->h,
1, 0, 1);
gcv.clip_mask = clipmask;
gcv.clip_x_origin = p->x;
gcv.clip_y_origin = p->y;
gcv.clip_y_origin = p->y;
XChangeGC (display, gc, GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv);
}
......@@ -5725,7 +5736,7 @@ event_handler_gdk (gxev, ev, data)
else
{
current_count +=
handle_one_xevent (dpyinfo, xev, &current_finish,
handle_one_xevent (dpyinfo, xev, &current_finish,
current_hold_quit);
}
}
......@@ -6167,6 +6178,8 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
case KeyPress:
ignore_next_mouse_click_timeout = 0;
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
/* Dispatch KeyPress events when in menu. */
if (popup_activated ())
......@@ -6526,6 +6539,9 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
f = x_any_window_to_frame (dpyinfo, event.xcrossing.window);
if (f && x_mouse_click_focus_ignore_position)
ignore_next_mouse_click_timeout = event.xmotion.time + 200;
#if 0
if (event.xcrossing.focus)
{
......@@ -6769,7 +6785,21 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
if (! popup_activated ())
#endif
construct_mouse_click (&inev, &event, f);
{
if (ignore_next_mouse_click_timeout)
{
if (event.type == ButtonPress
&& (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0)
{
ignore_next_mouse_click_timeout = 0;
construct_mouse_click (&inev, &event, f);
}
if (event.type == ButtonRelease)
ignore_next_mouse_click_timeout = 0;
}
else
construct_mouse_click (&inev, &event, f);
}
}
}
else
......@@ -6917,7 +6947,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
any_help_event_p = 1;
gen_help_event (help_echo_string, frame, help_echo_window,
help_echo_object, help_echo_pos);
}
}
else
{
help_echo_string = Qnil;
......@@ -8229,7 +8259,7 @@ x_set_offset (f, xoff, yoff, change_gravity)
f->win_gravity = NorthWestGravity;
}
x_calc_absolute_position (f);
BLOCK_INPUT;
x_wm_set_size_hint (f, (long) 0, 0);
......@@ -10350,7 +10380,7 @@ x_term_init (display_name, xrm_option, resource_name)
get_bits_and_offset (dpyinfo->visual->green_mask,
&dpyinfo->green_bits, &dpyinfo->green_offset);
}
/* See if a private colormap is requested. */
if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen))
{
......@@ -10824,6 +10854,16 @@ UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
to 4.1, set this to nil. */);
x_use_underline_position_properties = 1;
DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
&x_mouse_click_focus_ignore_position,
doc: /* Non-nil means that a mouse click to focus a frame does not move point.
This variable is only used when the window manager requires that you
click on a frame to select it (give it focus). In that case, a value
of nil, means that the selected window and cursor position changes to
reflect the mouse click position, while a non-nil value means that the
selected window or cursor position is preserved. */);
x_mouse_click_focus_ignore_position = 0;
DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
doc: /* What X toolkit scroll bars Emacs uses.
A value of nil means Emacs doesn't use X toolkit scroll bars.
......
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