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)
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);
}
else
{
current_count +=
- handle_one_xevent (dpyinfo, xev, ¤t_finish,
+ handle_one_xevent (dpyinfo, xev, ¤t_finish,
current_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 ())
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)
{
#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
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;
f->win_gravity = NorthWestGravity;
}
x_calc_absolute_position (f);
-
+
BLOCK_INPUT;
x_wm_set_size_hint (f, (long) 0, 0);
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))
{
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.