aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-10-10 14:06:17 +0400
committerDmitry Antipov2013-10-10 14:06:17 +0400
commit6bbe6da82dd61d050a773602f272dc4750291302 (patch)
tree533463c1ba5b80dbf2acac602f8c7a13fe18d666 /src
parent6c8413fce16569e3883b48e64cd5da2a37a209d6 (diff)
downloademacs-6bbe6da82dd61d050a773602f272dc4750291302.tar.gz
emacs-6bbe6da82dd61d050a773602f272dc4750291302.zip
* keyboard.c (last_event_timestamp): Remove. For X selection and
GTK popup menus, it may be obtained from per-frame X display info. (kbd_buffer_store_event_hold, kbd_buffer_get_event) (process_special_events): Adjust users. * keyboard.h (last_event_timestamp): Remove declaration. * xmenu.c (xmenu_show, create_and_show_popup_menu): Lost last arg. Use FRAME_DISPLAY_INFO (f)->last_user_time for gtk_menu_popup. * menu.h (xmenu_show): Adjust prototype. * menu.c (Fx_popup_menu): Adjust user. * xselect.c (x_own_selection, x_get_foreign_selection) (Fx_disown_selection_internal): Use dpyinfo->last_user_time.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/keyboard.c10
-rw-r--r--src/keyboard.h4
-rw-r--r--src/menu.c7
-rw-r--r--src/menu.h2
-rw-r--r--src/xmenu.c14
-rw-r--r--src/xselect.c6
7 files changed, 26 insertions, 31 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d5862485a76..bdf3a9fb09f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,19 @@
12013-10-10 Dmitry Antipov <dmantipov@yandex.ru> 12013-10-10 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 * keyboard.c (last_event_timestamp): Remove. For X selection and
4 GTK popup menus, it may be obtained from per-frame X display info.
5 (kbd_buffer_store_event_hold, kbd_buffer_get_event)
6 (process_special_events): Adjust users.
7 * keyboard.h (last_event_timestamp): Remove declaration.
8 * xmenu.c (xmenu_show, create_and_show_popup_menu): Lost last arg.
9 Use FRAME_DISPLAY_INFO (f)->last_user_time for gtk_menu_popup.
10 * menu.h (xmenu_show): Adjust prototype.
11 * menu.c (Fx_popup_menu): Adjust user.
12 * xselect.c (x_own_selection, x_get_foreign_selection)
13 (Fx_disown_selection_internal): Use dpyinfo->last_user_time.
14
152013-10-10 Dmitry Antipov <dmantipov@yandex.ru>
16
3 * keyboard.c (init_kboard): Now static. Add arg 17 * keyboard.c (init_kboard): Now static. Add arg
4 to denote window system. Adjust comment. 18 to denote window system. Adjust comment.
5 (init_keyboard): Adjust user. 19 (init_keyboard): Adjust user.
diff --git a/src/keyboard.c b/src/keyboard.c
index 9d0ce14ce6f..e0cd4d4fda0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -218,10 +218,6 @@ static ptrdiff_t last_point_position;
218 'volatile' here. */ 218 'volatile' here. */
219Lisp_Object internal_last_event_frame; 219Lisp_Object internal_last_event_frame;
220 220
221/* The timestamp of the last input event we received from the X server.
222 X Windows wants this for selection ownership. */
223Time last_event_timestamp;
224
225static Lisp_Object Qx_set_selection, Qhandle_switch_frame; 221static Lisp_Object Qx_set_selection, Qhandle_switch_frame;
226static Lisp_Object Qhandle_select_window; 222static Lisp_Object Qhandle_select_window;
227Lisp_Object QPRIMARY; 223Lisp_Object QPRIMARY;
@@ -3632,8 +3628,6 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3632 Vlast_event_frame = focus; 3628 Vlast_event_frame = focus;
3633 } 3629 }
3634 3630
3635 last_event_timestamp = event->timestamp;
3636
3637 handle_interrupt (0); 3631 handle_interrupt (0);
3638 return; 3632 return;
3639 } 3633 }
@@ -3938,8 +3932,6 @@ kbd_buffer_get_event (KBOARD **kbp,
3938 ? kbd_fetch_ptr 3932 ? kbd_fetch_ptr
3939 : kbd_buffer); 3933 : kbd_buffer);
3940 3934
3941 last_event_timestamp = event->timestamp;
3942
3943 *kbp = event_to_kboard (event); 3935 *kbp = event_to_kboard (event);
3944 if (*kbp == 0) 3936 if (*kbp == 0)
3945 *kbp = current_kboard; /* Better than returning null ptr? */ 3937 *kbp = current_kboard; /* Better than returning null ptr? */
@@ -4301,8 +4293,6 @@ process_special_events (void)
4301 else 4293 else
4302 kbd_fetch_ptr++; 4294 kbd_fetch_ptr++;
4303 4295
4304 /* X wants last_event_timestamp for selection ownership. */
4305 last_event_timestamp = copy.timestamp;
4306 input_pending = readable_events (0); 4296 input_pending = readable_events (0);
4307 x_handle_selection_event (&copy); 4297 x_handle_selection_event (&copy);
4308#else 4298#else
diff --git a/src/keyboard.h b/src/keyboard.h
index 26cb862e8a0..6f5593bdf65 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -496,10 +496,6 @@ extern Lisp_Object QCtoggle, QCradio;
496 speed up parse_modifiers. */ 496 speed up parse_modifiers. */
497extern Lisp_Object Qevent_symbol_element_mask; 497extern Lisp_Object Qevent_symbol_element_mask;
498 498
499/* The timestamp of the last input event we received from the X server.
500 X Windows wants this for selection ownership. */
501extern Time last_event_timestamp;
502
503extern int quit_char; 499extern int quit_char;
504 500
505extern unsigned int timers_run; 501extern unsigned int timers_run;
diff --git a/src/menu.c b/src/menu.c
index 9e135b56ce5..d87d495f96b 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1440,14 +1440,9 @@ no quit occurs and `x-popup-menu' returns nil. */)
1440 else 1440 else
1441#endif 1441#endif
1442#if (defined (HAVE_X_WINDOWS) || defined (MSDOS)) 1442#if (defined (HAVE_X_WINDOWS) || defined (MSDOS))
1443 /* Assume last_event_timestamp is the timestamp of the button event.
1444 Is this assumption ever violated? We can't use the timestamp
1445 stored within POSITION because there the top bits from the actual
1446 timestamp may be truncated away (Bug#4930). */
1447 if (FRAME_X_P (f) || FRAME_MSDOS_P (f)) 1443 if (FRAME_X_P (f) || FRAME_MSDOS_P (f))
1448 selection = xmenu_show (f, xpos, ypos, for_click, 1444 selection = xmenu_show (f, xpos, ypos, for_click,
1449 keymaps, title, &error_name, 1445 keymaps, title, &error_name);
1450 last_event_timestamp);
1451 else 1446 else
1452#endif 1447#endif
1453 if (FRAME_TERMCAP_P (f)) 1448 if (FRAME_TERMCAP_P (f))
diff --git a/src/menu.h b/src/menu.h
index c83f7431c45..17d66290647 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -50,7 +50,7 @@ extern Lisp_Object w32_menu_show (struct frame *, int, int, int, int,
50extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool, 50extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool,
51 Lisp_Object, const char **); 51 Lisp_Object, const char **);
52extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool, 52extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool,
53 Lisp_Object, const char **, Time); 53 Lisp_Object, const char **);
54extern Lisp_Object tty_menu_show (struct frame *, int, int, int, int, 54extern Lisp_Object tty_menu_show (struct frame *, int, int, int, int,
55 Lisp_Object, int, const char **); 55 Lisp_Object, int, const char **);
56extern ptrdiff_t menu_item_width (const unsigned char *); 56extern ptrdiff_t menu_item_width (const unsigned char *);
diff --git a/src/xmenu.c b/src/xmenu.c
index fe0e229ef20..d910100f77f 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1262,8 +1262,8 @@ pop_down_menu (void *arg)
1262 menu pops down. 1262 menu pops down.
1263 menu_item_selection will be set to the selection. */ 1263 menu_item_selection will be set to the selection. */
1264static void 1264static void
1265create_and_show_popup_menu (struct frame *f, widget_value *first_wv, int x, int y, 1265create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1266 bool for_click, Time timestamp) 1266 int x, int y, bool for_click)
1267{ 1267{
1268 int i; 1268 int i;
1269 GtkWidget *menu; 1269 GtkWidget *menu;
@@ -1314,7 +1314,7 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv, int x, int
1314 gtk_widget_show_all (menu); 1314 gtk_widget_show_all (menu);
1315 1315
1316 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 1316 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
1317 timestamp ? timestamp : gtk_get_current_event_time ()); 1317 FRAME_DISPLAY_INFO (f)->last_user_time);
1318 1318
1319 record_unwind_protect_ptr (pop_down_menu, menu); 1319 record_unwind_protect_ptr (pop_down_menu, menu);
1320 1320
@@ -1372,7 +1372,7 @@ pop_down_menu (Lisp_Object arg)
1372 menu_item_selection will be set to the selection. */ 1372 menu_item_selection will be set to the selection. */
1373static void 1373static void
1374create_and_show_popup_menu (struct frame *f, widget_value *first_wv, 1374create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1375 int x, int y, bool for_click, Time timestamp) 1375 int x, int y, bool for_click)
1376{ 1376{
1377 int i; 1377 int i;
1378 Arg av[2]; 1378 Arg av[2];
@@ -1451,7 +1451,7 @@ cleanup_widget_value_tree (void *arg)
1451 1451
1452Lisp_Object 1452Lisp_Object
1453xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, 1453xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
1454 Lisp_Object title, const char **error_name, Time timestamp) 1454 Lisp_Object title, const char **error_name)
1455{ 1455{
1456 int i; 1456 int i;
1457 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; 1457 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -1664,7 +1664,7 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
1664 record_unwind_protect_ptr (cleanup_widget_value_tree, first_wv); 1664 record_unwind_protect_ptr (cleanup_widget_value_tree, first_wv);
1665 1665
1666 /* Actually create and show the menu until popped down. */ 1666 /* Actually create and show the menu until popped down. */
1667 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp); 1667 create_and_show_popup_menu (f, first_wv, x, y, for_click);
1668 1668
1669 unbind_to (specpdl_count, Qnil); 1669 unbind_to (specpdl_count, Qnil);
1670 1670
@@ -2133,7 +2133,7 @@ pop_down_menu (Lisp_Object arg)
2133 2133
2134Lisp_Object 2134Lisp_Object
2135xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, 2135xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
2136 Lisp_Object title, const char **error_name, Time timestamp) 2136 Lisp_Object title, const char **error_name)
2137{ 2137{
2138 Window root; 2138 Window root;
2139 XMenu *menu; 2139 XMenu *menu;
diff --git a/src/xselect.c b/src/xselect.c
index 5eb263d8d0c..b4f4f9d43b6 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -320,7 +320,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
320 Window selecting_window = FRAME_X_WINDOW (f); 320 Window selecting_window = FRAME_X_WINDOW (f);
321 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 321 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
322 Display *display = dpyinfo->display; 322 Display *display = dpyinfo->display;
323 Time timestamp = last_event_timestamp; 323 Time timestamp = dpyinfo->last_user_time;
324 Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name); 324 Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name);
325 325
326 block_input (); 326 block_input ();
@@ -1188,7 +1188,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1188 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 1188 struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
1189 Display *display = dpyinfo->display; 1189 Display *display = dpyinfo->display;
1190 Window requestor_window = FRAME_X_WINDOW (f); 1190 Window requestor_window = FRAME_X_WINDOW (f);
1191 Time requestor_time = last_event_timestamp; 1191 Time requestor_time = dpyinfo->last_user_time;
1192 Atom target_property = dpyinfo->Xatom_EMACS_TMP; 1192 Atom target_property = dpyinfo->Xatom_EMACS_TMP;
1193 Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_symbol); 1193 Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_symbol);
1194 Atom type_atom = (CONSP (target_type) 1194 Atom type_atom = (CONSP (target_type)
@@ -2067,7 +2067,7 @@ On MS-DOS, all this does is return non-nil if we own the selection. */)
2067 2067
2068 block_input (); 2068 block_input ();
2069 if (NILP (time_object)) 2069 if (NILP (time_object))
2070 timestamp = last_event_timestamp; 2070 timestamp = dpyinfo->last_user_time;
2071 else 2071 else
2072 CONS_TO_INTEGER (time_object, Time, timestamp); 2072 CONS_TO_INTEGER (time_object, Time, timestamp);
2073 XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp); 2073 XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp);