aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2004-03-29 22:49:15 +0000
committerKim F. Storm2004-03-29 22:49:15 +0000
commit0666d82cff650efd44db9a61acd4fa38461395df (patch)
treecfc0f208c6e21f8af8eb84a9254be965094fd7fa
parent48a0bce4b5a6dd21cda6e5ee1ebfd87f7771c682 (diff)
downloademacs-0666d82cff650efd44db9a61acd4fa38461395df.tar.gz
emacs-0666d82cff650efd44db9a61acd4fa38461395df.zip
(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.
-rw-r--r--src/xterm.c56
1 files changed, 48 insertions, 8 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 2fadc156ff3..b08b03fba9c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -217,6 +217,17 @@ static String Xt_default_resources[] = {0};
217 217
218static int toolkit_scroll_bar_interaction; 218static int toolkit_scroll_bar_interaction;
219 219
220/* Non-zero means to not move point as a result of clicking on a
221 frame to focus it (when focus-follows-mouse is nil). */
222
223int x_mouse_click_focus_ignore_position;
224
225/* Non-zero timeout value means ignore next mouse click if it arrives
226 before that timeout elapses (i.e. as part of the same sequence of
227 events resulting from clicking on a frame to select it). */
228
229static unsigned long ignore_next_mouse_click_timeout;
230
220/* Mouse movement. 231/* Mouse movement.
221 232
222 Formerly, we used PointerMotionHintMask (in standard_event_mask) 233 Formerly, we used PointerMotionHintMask (in standard_event_mask)
@@ -747,13 +758,13 @@ x_draw_fringe_bitmap (w, row, p)
747 758
748 if (p->overlay_p) 759 if (p->overlay_p)
749 { 760 {
750 clipmask = XCreatePixmapFromBitmapData (display, 761 clipmask = XCreatePixmapFromBitmapData (display,
751 FRAME_X_DISPLAY_INFO (f)->root_window, 762 FRAME_X_DISPLAY_INFO (f)->root_window,
752 bits, p->wd, p->h, 763 bits, p->wd, p->h,
753 1, 0, 1); 764 1, 0, 1);
754 gcv.clip_mask = clipmask; 765 gcv.clip_mask = clipmask;
755 gcv.clip_x_origin = p->x; 766 gcv.clip_x_origin = p->x;
756 gcv.clip_y_origin = p->y; 767 gcv.clip_y_origin = p->y;
757 XChangeGC (display, gc, GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv); 768 XChangeGC (display, gc, GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv);
758 } 769 }
759 770
@@ -5725,7 +5736,7 @@ event_handler_gdk (gxev, ev, data)
5725 else 5736 else
5726 { 5737 {
5727 current_count += 5738 current_count +=
5728 handle_one_xevent (dpyinfo, xev, &current_finish, 5739 handle_one_xevent (dpyinfo, xev, &current_finish,
5729 current_hold_quit); 5740 current_hold_quit);
5730 } 5741 }
5731 } 5742 }
@@ -6167,6 +6178,8 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6167 6178
6168 case KeyPress: 6179 case KeyPress:
6169 6180
6181 ignore_next_mouse_click_timeout = 0;
6182
6170#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6183#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
6171 /* Dispatch KeyPress events when in menu. */ 6184 /* Dispatch KeyPress events when in menu. */
6172 if (popup_activated ()) 6185 if (popup_activated ())
@@ -6526,6 +6539,9 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6526 6539
6527 f = x_any_window_to_frame (dpyinfo, event.xcrossing.window); 6540 f = x_any_window_to_frame (dpyinfo, event.xcrossing.window);
6528 6541
6542 if (f && x_mouse_click_focus_ignore_position)
6543 ignore_next_mouse_click_timeout = event.xmotion.time + 200;
6544
6529#if 0 6545#if 0
6530 if (event.xcrossing.focus) 6546 if (event.xcrossing.focus)
6531 { 6547 {
@@ -6769,7 +6785,21 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6769#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6785#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
6770 if (! popup_activated ()) 6786 if (! popup_activated ())
6771#endif 6787#endif
6772 construct_mouse_click (&inev, &event, f); 6788 {
6789 if (ignore_next_mouse_click_timeout)
6790 {
6791 if (event.type == ButtonPress
6792 && (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0)
6793 {
6794 ignore_next_mouse_click_timeout = 0;
6795 construct_mouse_click (&inev, &event, f);
6796 }
6797 if (event.type == ButtonRelease)
6798 ignore_next_mouse_click_timeout = 0;
6799 }
6800 else
6801 construct_mouse_click (&inev, &event, f);
6802 }
6773 } 6803 }
6774 } 6804 }
6775 else 6805 else
@@ -6917,7 +6947,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6917 any_help_event_p = 1; 6947 any_help_event_p = 1;
6918 gen_help_event (help_echo_string, frame, help_echo_window, 6948 gen_help_event (help_echo_string, frame, help_echo_window,
6919 help_echo_object, help_echo_pos); 6949 help_echo_object, help_echo_pos);
6920 } 6950 }
6921 else 6951 else
6922 { 6952 {
6923 help_echo_string = Qnil; 6953 help_echo_string = Qnil;
@@ -8229,7 +8259,7 @@ x_set_offset (f, xoff, yoff, change_gravity)
8229 f->win_gravity = NorthWestGravity; 8259 f->win_gravity = NorthWestGravity;
8230 } 8260 }
8231 x_calc_absolute_position (f); 8261 x_calc_absolute_position (f);
8232 8262
8233 BLOCK_INPUT; 8263 BLOCK_INPUT;
8234 x_wm_set_size_hint (f, (long) 0, 0); 8264 x_wm_set_size_hint (f, (long) 0, 0);
8235 8265
@@ -10350,7 +10380,7 @@ x_term_init (display_name, xrm_option, resource_name)
10350 get_bits_and_offset (dpyinfo->visual->green_mask, 10380 get_bits_and_offset (dpyinfo->visual->green_mask,
10351 &dpyinfo->green_bits, &dpyinfo->green_offset); 10381 &dpyinfo->green_bits, &dpyinfo->green_offset);
10352 } 10382 }
10353 10383
10354 /* See if a private colormap is requested. */ 10384 /* See if a private colormap is requested. */
10355 if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen)) 10385 if (dpyinfo->visual == DefaultVisualOfScreen (dpyinfo->screen))
10356 { 10386 {
@@ -10824,6 +10854,16 @@ UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
10824to 4.1, set this to nil. */); 10854to 4.1, set this to nil. */);
10825 x_use_underline_position_properties = 1; 10855 x_use_underline_position_properties = 1;
10826 10856
10857 DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
10858 &x_mouse_click_focus_ignore_position,
10859 doc: /* Non-nil means that a mouse click to focus a frame does not move point.
10860This variable is only used when the window manager requires that you
10861click on a frame to select it (give it focus). In that case, a value
10862of nil, means that the selected window and cursor position changes to
10863reflect the mouse click position, while a non-nil value means that the
10864selected window or cursor position is preserved. */);
10865 x_mouse_click_focus_ignore_position = 0;
10866
10827 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 10867 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
10828 doc: /* What X toolkit scroll bars Emacs uses. 10868 doc: /* What X toolkit scroll bars Emacs uses.
10829A value of nil means Emacs doesn't use X toolkit scroll bars. 10869A value of nil means Emacs doesn't use X toolkit scroll bars.