diff options
| author | Dmitry Antipov | 2013-10-10 14:06:17 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-10-10 14:06:17 +0400 |
| commit | 6bbe6da82dd61d050a773602f272dc4750291302 (patch) | |
| tree | 533463c1ba5b80dbf2acac602f8c7a13fe18d666 /src | |
| parent | 6c8413fce16569e3883b48e64cd5da2a37a209d6 (diff) | |
| download | emacs-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/ChangeLog | 14 | ||||
| -rw-r--r-- | src/keyboard.c | 10 | ||||
| -rw-r--r-- | src/keyboard.h | 4 | ||||
| -rw-r--r-- | src/menu.c | 7 | ||||
| -rw-r--r-- | src/menu.h | 2 | ||||
| -rw-r--r-- | src/xmenu.c | 14 | ||||
| -rw-r--r-- | src/xselect.c | 6 |
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 @@ | |||
| 1 | 2013-10-10 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2013-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 | |||
| 15 | 2013-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. */ |
| 219 | Lisp_Object internal_last_event_frame; | 219 | Lisp_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. */ | ||
| 223 | Time last_event_timestamp; | ||
| 224 | |||
| 225 | static Lisp_Object Qx_set_selection, Qhandle_switch_frame; | 221 | static Lisp_Object Qx_set_selection, Qhandle_switch_frame; |
| 226 | static Lisp_Object Qhandle_select_window; | 222 | static Lisp_Object Qhandle_select_window; |
| 227 | Lisp_Object QPRIMARY; | 223 | Lisp_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 (©); | 4297 | x_handle_selection_event (©); |
| 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. */ |
| 497 | extern Lisp_Object Qevent_symbol_element_mask; | 497 | extern 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. */ | ||
| 501 | extern Time last_event_timestamp; | ||
| 502 | |||
| 503 | extern int quit_char; | 499 | extern int quit_char; |
| 504 | 500 | ||
| 505 | extern unsigned int timers_run; | 501 | extern 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, | |||
| 50 | extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool, | 50 | extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool, |
| 51 | Lisp_Object, const char **); | 51 | Lisp_Object, const char **); |
| 52 | extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool, | 52 | extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool, |
| 53 | Lisp_Object, const char **, Time); | 53 | Lisp_Object, const char **); |
| 54 | extern Lisp_Object tty_menu_show (struct frame *, int, int, int, int, | 54 | extern Lisp_Object tty_menu_show (struct frame *, int, int, int, int, |
| 55 | Lisp_Object, int, const char **); | 55 | Lisp_Object, int, const char **); |
| 56 | extern ptrdiff_t menu_item_width (const unsigned char *); | 56 | extern 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. */ |
| 1264 | static void | 1264 | static void |
| 1265 | create_and_show_popup_menu (struct frame *f, widget_value *first_wv, int x, int y, | 1265 | create_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. */ |
| 1373 | static void | 1373 | static void |
| 1374 | create_and_show_popup_menu (struct frame *f, widget_value *first_wv, | 1374 | create_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 | ||
| 1452 | Lisp_Object | 1452 | Lisp_Object |
| 1453 | xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | 1453 | xmenu_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 | ||
| 2134 | Lisp_Object | 2134 | Lisp_Object |
| 2135 | xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | 2135 | xmenu_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); |