diff options
| author | Paul Eggert | 2011-05-15 10:17:44 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-05-15 10:17:44 -0700 |
| commit | 067a69a2d38db30190997dc48dbf82988ffa3583 (patch) | |
| tree | f8ce54ac9c65d32d1349cb449485ed0ba1833d57 | |
| parent | 5e9e35cd1dd6e4fb47c6720991581508b89f87f7 (diff) | |
| parent | 9fbd68410f1680b5b9bc2d56c239183ea13c7d58 (diff) | |
| download | emacs-067a69a2d38db30190997dc48dbf82988ffa3583.tar.gz emacs-067a69a2d38db30190997dc48dbf82988ffa3583.zip | |
Merge: user-interface timestamps and other int overflow patches.
| -rw-r--r-- | src/ChangeLog | 76 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/fns.c | 12 | ||||
| -rw-r--r-- | src/frame.c | 4 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/image.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 22 | ||||
| -rw-r--r-- | src/keyboard.h | 4 | ||||
| -rw-r--r-- | src/lisp.h | 4 | ||||
| -rw-r--r-- | src/menu.c | 6 | ||||
| -rw-r--r-- | src/menu.h | 5 | ||||
| -rw-r--r-- | src/msdos.c | 2 | ||||
| -rw-r--r-- | src/nsterm.m | 6 | ||||
| -rw-r--r-- | src/systime.h | 6 | ||||
| -rw-r--r-- | src/term.c | 7 | ||||
| -rw-r--r-- | src/termhooks.h | 6 | ||||
| -rw-r--r-- | src/w32gui.h | 4 | ||||
| -rw-r--r-- | src/w32inevt.c | 5 | ||||
| -rw-r--r-- | src/window.c | 5 | ||||
| -rw-r--r-- | src/xmenu.c | 24 | ||||
| -rw-r--r-- | src/xselect.c | 6 | ||||
| -rw-r--r-- | src/xterm.c | 46 | ||||
| -rw-r--r-- | src/xterm.h | 3 |
23 files changed, 172 insertions, 87 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ceb45afebc5..89c58eeb5a4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,79 @@ | |||
| 1 | 2011-05-15 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fixups, following up to the user-interface timestamp change. | ||
| 4 | * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time | ||
| 5 | for UI timestamps, instead of unsigned long. | ||
| 6 | * msdos.c (mouse_get_pos): Likewise. | ||
| 7 | * w32inevt.c (movement_time, w32_console_mouse_position): Likewise. | ||
| 8 | * w32gui.h (Time): Define by including "systime.h" rather than by | ||
| 9 | declaring it ourselves. (Bug#8664) | ||
| 10 | |||
| 11 | * dispextern.h (struct image): Don't assume time_t <= unsigned long. | ||
| 12 | * image.c (clear_image_cache): Likewise. | ||
| 13 | |||
| 14 | * term.c (term_mouse_position): Don't assume time_t wraparound. | ||
| 15 | |||
| 16 | Be more systematic about user-interface timestamps. | ||
| 17 | Before, the code sometimes used 'Time', sometimes 'unsigned long', | ||
| 18 | and sometimes 'EMACS_UINT', to represent these timestamps. This | ||
| 19 | change causes it to use 'Time' uniformly, as that's what X uses. | ||
| 20 | This makes the code easier to follow, and makes it easier to catch | ||
| 21 | integer overflow bugs such as Bug#8664. | ||
| 22 | * frame.c (Fmouse_position, Fmouse_pixel_position): | ||
| 23 | Use Time, not unsigned long, for user-interface timestamps. | ||
| 24 | * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise. | ||
| 25 | (button_down_time, make_lispy_position, make_lispy_movement): Likewise. | ||
| 26 | * keyboard.h (last_event_timestamp): Likewise. | ||
| 27 | * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise. | ||
| 28 | * menu.h (xmenu_show): Likewise. | ||
| 29 | * term.c (term_mouse_position): Likewise. | ||
| 30 | * termhooks.h (struct input_event.timestamp): Likewise. | ||
| 31 | (struct terminal.mouse_position_hook): Likewise. | ||
| 32 | * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise. | ||
| 33 | * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise. | ||
| 34 | * systime.h (Time): New decl. Pull it in from <X11/X.h> if | ||
| 35 | HAVE_X_WINDOWS, otherwise define it as unsigned long, which is | ||
| 36 | what it was before. | ||
| 37 | * menu.h, termhooks.h: Include "systime.h", for Time. | ||
| 38 | |||
| 39 | * keyboard.c (make_lispy_event): Fix problem in integer overflow. | ||
| 40 | Don't assume that the difference between two unsigned long values | ||
| 41 | can fit into an integer. At this point, we know button_down_time | ||
| 42 | <= event->timestamp, so the difference must be nonnegative, so | ||
| 43 | there's no need to cast the result if double-click-time is | ||
| 44 | nonnegative, as it should be; check that it's nonnegative, just in | ||
| 45 | case. This bug is triggered when events are more than 2**31 ms | ||
| 46 | apart (about 25 days). (Bug#8664) | ||
| 47 | |||
| 48 | * xselect.c (last_event_timestamp): Remove duplicate decl. | ||
| 49 | (x_own_selection): Remove needless cast to unsigned long. | ||
| 50 | |||
| 51 | * xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes | ||
| 52 | that always fit in int. Use a sentinel instead of a counter, to | ||
| 53 | avoid a temp and to allay GCC's concerns about possible int overflow. | ||
| 54 | * frame.h (struct frame): Use int for menu_bar_items_used | ||
| 55 | instead of EMACS_INT, since it always fits in int. | ||
| 56 | |||
| 57 | * menu.c (grow_menu_items): Check for int overflow. | ||
| 58 | |||
| 59 | * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils. | ||
| 60 | |||
| 61 | * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers. | ||
| 62 | Before, the code was not consistent. These values cannot exceed | ||
| 63 | 2**31 - 1 so there's no need to make them unsigned. | ||
| 64 | (x_x_to_emacs_modifiers): Accept int and return EMACS_INT. | ||
| 65 | (x_emacs_to_x_modifiers): Accept EMACS_INT and return int. | ||
| 66 | (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers | ||
| 67 | as modifiers. | ||
| 68 | * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change. | ||
| 69 | |||
| 70 | * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT. | ||
| 71 | (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT. | ||
| 72 | Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)), | ||
| 73 | presumably because the widths might not match. | ||
| 74 | |||
| 75 | * window.c (size_window): Avoid needless test at loop start. | ||
| 76 | |||
| 1 | 2011-05-12 Drew Adams <drew.adams@oracle.com> | 77 | 2011-05-12 Drew Adams <drew.adams@oracle.com> |
| 2 | 78 | ||
| 3 | * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655). | 79 | * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655). |
diff --git a/src/dispextern.h b/src/dispextern.h index 72e23e6642a..77c45cf2fc6 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2709,7 +2709,7 @@ struct image | |||
| 2709 | { | 2709 | { |
| 2710 | /* The time in seconds at which the image was last displayed. Set | 2710 | /* The time in seconds at which the image was last displayed. Set |
| 2711 | in prepare_image_for_display. */ | 2711 | in prepare_image_for_display. */ |
| 2712 | unsigned long timestamp; | 2712 | time_t timestamp; |
| 2713 | 2713 | ||
| 2714 | /* Pixmaps of the image. */ | 2714 | /* Pixmaps of the image. */ |
| 2715 | Pixmap pixmap, mask; | 2715 | Pixmap pixmap, mask; |
| @@ -457,10 +457,10 @@ concat (size_t nargs, Lisp_Object *args, | |||
| 457 | Lisp_Object prev; | 457 | Lisp_Object prev; |
| 458 | int some_multibyte; | 458 | int some_multibyte; |
| 459 | /* When we make a multibyte string, we can't copy text properties | 459 | /* When we make a multibyte string, we can't copy text properties |
| 460 | while concatinating each string because the length of resulting | 460 | while concatenating each string because the length of resulting |
| 461 | string can't be decided until we finish the whole concatination. | 461 | string can't be decided until we finish the whole concatenation. |
| 462 | So, we record strings that have text properties to be copied | 462 | So, we record strings that have text properties to be copied |
| 463 | here, and copy the text properties after the concatination. */ | 463 | here, and copy the text properties after the concatenation. */ |
| 464 | struct textprop_rec *textprops = NULL; | 464 | struct textprop_rec *textprops = NULL; |
| 465 | /* Number of elements in textprops. */ | 465 | /* Number of elements in textprops. */ |
| 466 | int num_textprops = 0; | 466 | int num_textprops = 0; |
| @@ -704,7 +704,7 @@ concat (size_t nargs, Lisp_Object *args, | |||
| 704 | make_number (0), | 704 | make_number (0), |
| 705 | make_number (SCHARS (this)), | 705 | make_number (SCHARS (this)), |
| 706 | Qnil); | 706 | Qnil); |
| 707 | /* If successive arguments have properites, be sure that the | 707 | /* If successive arguments have properties, be sure that the |
| 708 | value of `composition' property be the copy. */ | 708 | value of `composition' property be the copy. */ |
| 709 | if (last_to_end == textprops[argnum].to) | 709 | if (last_to_end == textprops[argnum].to) |
| 710 | make_composition_value_copy (props); | 710 | make_composition_value_copy (props); |
| @@ -2076,7 +2076,7 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int | |||
| 2076 | return compare_window_configurations (o1, o2, 0); | 2076 | return compare_window_configurations (o1, o2, 0); |
| 2077 | 2077 | ||
| 2078 | /* Aside from them, only true vectors, char-tables, compiled | 2078 | /* Aside from them, only true vectors, char-tables, compiled |
| 2079 | functions, and fonts (font-spec, font-entity, font-ojbect) | 2079 | functions, and fonts (font-spec, font-entity, font-object) |
| 2080 | are sensible to compare, so eliminate the others now. */ | 2080 | are sensible to compare, so eliminate the others now. */ |
| 2081 | if (size & PSEUDOVECTOR_FLAG) | 2081 | if (size & PSEUDOVECTOR_FLAG) |
| 2082 | { | 2082 | { |
| @@ -2782,7 +2782,7 @@ ITEM should be one of the following: | |||
| 2782 | `months', returning a 12-element vector of month names (locale items MON_n); | 2782 | `months', returning a 12-element vector of month names (locale items MON_n); |
| 2783 | 2783 | ||
| 2784 | `paper', returning a list (WIDTH HEIGHT) for the default paper size, | 2784 | `paper', returning a list (WIDTH HEIGHT) for the default paper size, |
| 2785 | both measured in milimeters (locale items PAPER_WIDTH, PAPER_HEIGHT). | 2785 | both measured in millimeters (locale items PAPER_WIDTH, PAPER_HEIGHT). |
| 2786 | 2786 | ||
| 2787 | If the system can't provide such information through a call to | 2787 | If the system can't provide such information through a call to |
| 2788 | `nl_langinfo', or if ITEM isn't from the list above, return nil. | 2788 | `nl_langinfo', or if ITEM isn't from the list above, return nil. |
diff --git a/src/frame.c b/src/frame.c index b106c568e48..ce92a83b86c 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1631,7 +1631,7 @@ and returns whatever that function returns. */) | |||
| 1631 | enum scroll_bar_part party_dummy; | 1631 | enum scroll_bar_part party_dummy; |
| 1632 | Lisp_Object x, y, retval; | 1632 | Lisp_Object x, y, retval; |
| 1633 | int col, row; | 1633 | int col, row; |
| 1634 | unsigned long long_dummy; | 1634 | Time long_dummy; |
| 1635 | struct gcpro gcpro1; | 1635 | struct gcpro gcpro1; |
| 1636 | 1636 | ||
| 1637 | f = SELECTED_FRAME (); | 1637 | f = SELECTED_FRAME (); |
| @@ -1676,7 +1676,7 @@ and nil for X and Y. */) | |||
| 1676 | Lisp_Object lispy_dummy; | 1676 | Lisp_Object lispy_dummy; |
| 1677 | enum scroll_bar_part party_dummy; | 1677 | enum scroll_bar_part party_dummy; |
| 1678 | Lisp_Object x, y; | 1678 | Lisp_Object x, y; |
| 1679 | unsigned long long_dummy; | 1679 | Time long_dummy; |
| 1680 | 1680 | ||
| 1681 | f = SELECTED_FRAME (); | 1681 | f = SELECTED_FRAME (); |
| 1682 | x = y = Qnil; | 1682 | x = y = Qnil; |
diff --git a/src/frame.h b/src/frame.h index e73370340f1..db57b1be980 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -192,7 +192,7 @@ struct frame | |||
| 192 | struct face_cache *face_cache; | 192 | struct face_cache *face_cache; |
| 193 | 193 | ||
| 194 | /* Number of elements in `menu_bar_vector' that have meaningful data. */ | 194 | /* Number of elements in `menu_bar_vector' that have meaningful data. */ |
| 195 | EMACS_INT menu_bar_items_used; | 195 | int menu_bar_items_used; |
| 196 | 196 | ||
| 197 | /* A buffer to hold the frame's name. We can't use the Lisp | 197 | /* A buffer to hold the frame's name. We can't use the Lisp |
| 198 | string's pointer (`name', above) because it might get relocated. */ | 198 | string's pointer (`name', above) because it might get relocated. */ |
diff --git a/src/image.c b/src/image.c index 23da03b6264..2562d79a782 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1523,7 +1523,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter) | |||
| 1523 | { | 1523 | { |
| 1524 | /* Free cache based on timestamp. */ | 1524 | /* Free cache based on timestamp. */ |
| 1525 | EMACS_TIME t; | 1525 | EMACS_TIME t; |
| 1526 | unsigned long old; | 1526 | time_t old; |
| 1527 | int delay, nimages = 0; | 1527 | int delay, nimages = 0; |
| 1528 | 1528 | ||
| 1529 | for (i = 0; i < c->used; ++i) | 1529 | for (i = 0; i < c->used; ++i) |
diff --git a/src/keyboard.c b/src/keyboard.c index a94456fce2e..c471a91ebfb 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -238,7 +238,7 @@ Lisp_Object internal_last_event_frame; | |||
| 238 | 238 | ||
| 239 | /* The timestamp of the last input event we received from the X server. | 239 | /* The timestamp of the last input event we received from the X server. |
| 240 | X Windows wants this for selection ownership. */ | 240 | X Windows wants this for selection ownership. */ |
| 241 | unsigned long last_event_timestamp; | 241 | Time last_event_timestamp; |
| 242 | 242 | ||
| 243 | static Lisp_Object Qx_set_selection, Qhandle_switch_frame; | 243 | static Lisp_Object Qx_set_selection, Qhandle_switch_frame; |
| 244 | Lisp_Object QPRIMARY; | 244 | Lisp_Object QPRIMARY; |
| @@ -4085,7 +4085,7 @@ kbd_buffer_get_event (KBOARD **kbp, | |||
| 4085 | Lisp_Object bar_window; | 4085 | Lisp_Object bar_window; |
| 4086 | enum scroll_bar_part part; | 4086 | enum scroll_bar_part part; |
| 4087 | Lisp_Object x, y; | 4087 | Lisp_Object x, y; |
| 4088 | unsigned long t; | 4088 | Time t; |
| 4089 | 4089 | ||
| 4090 | *kbp = current_kboard; | 4090 | *kbp = current_kboard; |
| 4091 | /* Note that this uses F to determine which terminal to look at. | 4091 | /* Note that this uses F to determine which terminal to look at. |
| @@ -5088,7 +5088,7 @@ static Lisp_Object button_down_location; | |||
| 5088 | static int last_mouse_button; | 5088 | static int last_mouse_button; |
| 5089 | static int last_mouse_x; | 5089 | static int last_mouse_x; |
| 5090 | static int last_mouse_y; | 5090 | static int last_mouse_y; |
| 5091 | static unsigned long button_down_time; | 5091 | static Time button_down_time; |
| 5092 | 5092 | ||
| 5093 | /* The number of clicks in this multiple-click. */ | 5093 | /* The number of clicks in this multiple-click. */ |
| 5094 | 5094 | ||
| @@ -5099,7 +5099,7 @@ static int double_click_count; | |||
| 5099 | 5099 | ||
| 5100 | static Lisp_Object | 5100 | static Lisp_Object |
| 5101 | make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, | 5101 | make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, |
| 5102 | unsigned long t) | 5102 | Time t) |
| 5103 | { | 5103 | { |
| 5104 | enum window_part part; | 5104 | enum window_part part; |
| 5105 | Lisp_Object posn = Qnil; | 5105 | Lisp_Object posn = Qnil; |
| @@ -5556,9 +5556,9 @@ make_lispy_event (struct input_event *event) | |||
| 5556 | && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) | 5556 | && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) |
| 5557 | && button_down_time != 0 | 5557 | && button_down_time != 0 |
| 5558 | && (EQ (Vdouble_click_time, Qt) | 5558 | && (EQ (Vdouble_click_time, Qt) |
| 5559 | || (INTEGERP (Vdouble_click_time) | 5559 | || (NATNUMP (Vdouble_click_time) |
| 5560 | && ((int)(event->timestamp - button_down_time) | 5560 | && (event->timestamp - button_down_time |
| 5561 | < XINT (Vdouble_click_time))))); | 5561 | < XFASTINT (Vdouble_click_time))))); |
| 5562 | } | 5562 | } |
| 5563 | 5563 | ||
| 5564 | last_mouse_button = button; | 5564 | last_mouse_button = button; |
| @@ -5742,9 +5742,9 @@ make_lispy_event (struct input_event *event) | |||
| 5742 | && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) | 5742 | && (eabs (XINT (event->y) - last_mouse_y) <= fuzz) |
| 5743 | && button_down_time != 0 | 5743 | && button_down_time != 0 |
| 5744 | && (EQ (Vdouble_click_time, Qt) | 5744 | && (EQ (Vdouble_click_time, Qt) |
| 5745 | || (INTEGERP (Vdouble_click_time) | 5745 | || (NATNUMP (Vdouble_click_time) |
| 5746 | && ((int)(event->timestamp - button_down_time) | 5746 | && (event->timestamp - button_down_time |
| 5747 | < XINT (Vdouble_click_time))))); | 5747 | < XFASTINT (Vdouble_click_time))))); |
| 5748 | if (is_double) | 5748 | if (is_double) |
| 5749 | { | 5749 | { |
| 5750 | double_click_count++; | 5750 | double_click_count++; |
| @@ -5987,7 +5987,7 @@ make_lispy_event (struct input_event *event) | |||
| 5987 | 5987 | ||
| 5988 | static Lisp_Object | 5988 | static Lisp_Object |
| 5989 | make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, | 5989 | make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, |
| 5990 | Lisp_Object x, Lisp_Object y, unsigned long t) | 5990 | Lisp_Object x, Lisp_Object y, Time t) |
| 5991 | { | 5991 | { |
| 5992 | /* Is it a scroll bar movement? */ | 5992 | /* Is it a scroll bar movement? */ |
| 5993 | if (frame && ! NILP (bar_window)) | 5993 | if (frame && ! NILP (bar_window)) |
diff --git a/src/keyboard.h b/src/keyboard.h index 1f5cbd23639..802c99edb5e 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -16,7 +16,7 @@ GNU General Public License for more details. | |||
| 16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | 18 | ||
| 19 | #include "systime.h" /* for EMACS_TIME */ | 19 | #include "systime.h" /* for EMACS_TIME, Time */ |
| 20 | #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ | 20 | #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ |
| 21 | 21 | ||
| 22 | /* Lisp fields in struct keyboard are hidden from most code and accessed | 22 | /* Lisp fields in struct keyboard are hidden from most code and accessed |
| @@ -459,7 +459,7 @@ extern Lisp_Object Qevent_symbol_element_mask; | |||
| 459 | 459 | ||
| 460 | /* The timestamp of the last input event we received from the X server. | 460 | /* The timestamp of the last input event we received from the X server. |
| 461 | X Windows wants this for selection ownership. */ | 461 | X Windows wants this for selection ownership. */ |
| 462 | extern unsigned long last_event_timestamp; | 462 | extern Time last_event_timestamp; |
| 463 | 463 | ||
| 464 | extern int quit_char; | 464 | extern int quit_char; |
| 465 | 465 | ||
diff --git a/src/lisp.h b/src/lisp.h index 66f5c962be8..2342ea2bdbe 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -470,8 +470,8 @@ enum pvec_type | |||
| 470 | 470 | ||
| 471 | #define XHASH(a) ((a).i) | 471 | #define XHASH(a) ((a).i) |
| 472 | #define XTYPE(a) ((enum Lisp_Type) (a).u.type) | 472 | #define XTYPE(a) ((enum Lisp_Type) (a).u.type) |
| 473 | #define XINT(a) ((a).s.val) | 473 | #define XINT(a) ((EMACS_INT) (a).s.val) |
| 474 | #define XUINT(a) ((a).u.val) | 474 | #define XUINT(a) ((EMACS_UINT) (a).u.val) |
| 475 | 475 | ||
| 476 | #ifdef USE_LSB_TAG | 476 | #ifdef USE_LSB_TAG |
| 477 | 477 | ||
diff --git a/src/menu.c b/src/menu.c index 7a3edcb6f4f..d2486439fd0 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -176,6 +176,8 @@ save_menu_items (void) | |||
| 176 | static void | 176 | static void |
| 177 | grow_menu_items (void) | 177 | grow_menu_items (void) |
| 178 | { | 178 | { |
| 179 | if ((INT_MAX - MENU_ITEMS_PANE_LENGTH) / 2 < menu_items_allocated) | ||
| 180 | memory_full (); | ||
| 179 | menu_items_allocated *= 2; | 181 | menu_items_allocated *= 2; |
| 180 | menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); | 182 | menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); |
| 181 | } | 183 | } |
| @@ -1145,13 +1147,13 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1145 | #else /* not HAVE_X_WINDOWS */ | 1147 | #else /* not HAVE_X_WINDOWS */ |
| 1146 | Lisp_Object bar_window; | 1148 | Lisp_Object bar_window; |
| 1147 | enum scroll_bar_part part; | 1149 | enum scroll_bar_part part; |
| 1148 | unsigned long time; | 1150 | Time time; |
| 1149 | void (*mouse_position_hook) (struct frame **, int, | 1151 | void (*mouse_position_hook) (struct frame **, int, |
| 1150 | Lisp_Object *, | 1152 | Lisp_Object *, |
| 1151 | enum scroll_bar_part *, | 1153 | enum scroll_bar_part *, |
| 1152 | Lisp_Object *, | 1154 | Lisp_Object *, |
| 1153 | Lisp_Object *, | 1155 | Lisp_Object *, |
| 1154 | unsigned long *) = | 1156 | Time *) = |
| 1155 | FRAME_TERMINAL (new_f)->mouse_position_hook; | 1157 | FRAME_TERMINAL (new_f)->mouse_position_hook; |
| 1156 | 1158 | ||
| 1157 | if (mouse_position_hook) | 1159 | if (mouse_position_hook) |
diff --git a/src/menu.h b/src/menu.h index c3978dae8eb..451401b42d5 100644 --- a/src/menu.h +++ b/src/menu.h | |||
| @@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | #ifndef MENU_H | 19 | #ifndef MENU_H |
| 20 | #define MENU_H | 20 | #define MENU_H |
| 21 | 21 | ||
| 22 | #include "systime.h" /* for Time */ | ||
| 23 | |||
| 22 | extern void x_set_menu_bar_lines (struct frame *f, | 24 | extern void x_set_menu_bar_lines (struct frame *f, |
| 23 | Lisp_Object value, | 25 | Lisp_Object value, |
| 24 | Lisp_Object oldval); | 26 | Lisp_Object oldval); |
| @@ -48,6 +50,5 @@ extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int, | |||
| 48 | extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, | 50 | extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, |
| 49 | Lisp_Object, const char **); | 51 | Lisp_Object, const char **); |
| 50 | extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, | 52 | extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, |
| 51 | Lisp_Object, const char **, EMACS_UINT); | 53 | Lisp_Object, const char **, Time); |
| 52 | #endif /* MENU_H */ | 54 | #endif /* MENU_H */ |
| 53 | |||
diff --git a/src/msdos.c b/src/msdos.c index 3dc586e42f5..73804df55cc 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -287,7 +287,7 @@ mouse_button_depressed (int b, int *xp, int *yp) | |||
| 287 | void | 287 | void |
| 288 | mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, | 288 | mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, |
| 289 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, | 289 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, |
| 290 | unsigned long *time) | 290 | Time *time) |
| 291 | { | 291 | { |
| 292 | int ix, iy; | 292 | int ix, iy; |
| 293 | Lisp_Object frame, tail; | 293 | Lisp_Object frame, tail; |
diff --git a/src/nsterm.m b/src/nsterm.m index c4756dc83cd..ac9c44a57a9 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -158,7 +158,7 @@ long context_menu_value = 0; | |||
| 158 | /* display update */ | 158 | /* display update */ |
| 159 | NSPoint last_mouse_motion_position; | 159 | NSPoint last_mouse_motion_position; |
| 160 | static NSRect last_mouse_glyph; | 160 | static NSRect last_mouse_glyph; |
| 161 | static unsigned long last_mouse_movement_time = 0; | 161 | static Time last_mouse_movement_time = 0; |
| 162 | static Lisp_Object last_mouse_motion_frame; | 162 | static Lisp_Object last_mouse_motion_frame; |
| 163 | static EmacsScroller *last_mouse_scroll_bar = nil; | 163 | static EmacsScroller *last_mouse_scroll_bar = nil; |
| 164 | static struct frame *ns_updating_frame; | 164 | static struct frame *ns_updating_frame; |
| @@ -1789,7 +1789,7 @@ note_mouse_movement (struct frame *frame, float x, float y) | |||
| 1789 | static void | 1789 | static void |
| 1790 | ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | 1790 | ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, |
| 1791 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, | 1791 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, |
| 1792 | unsigned long *time) | 1792 | Time *time) |
| 1793 | /* -------------------------------------------------------------------------- | 1793 | /* -------------------------------------------------------------------------- |
| 1794 | External (hook): inform emacs about mouse position and hit parts. | 1794 | External (hook): inform emacs about mouse position and hit parts. |
| 1795 | If a scrollbar is being dragged, set bar_window, part, x, y, time. | 1795 | If a scrollbar is being dragged, set bar_window, part, x, y, time. |
| @@ -6531,5 +6531,3 @@ baseline level. The default value is nil. */); | |||
| 6531 | /* Tell emacs about this window system. */ | 6531 | /* Tell emacs about this window system. */ |
| 6532 | Fprovide (intern ("ns"), Qnil); | 6532 | Fprovide (intern ("ns"), Qnil); |
| 6533 | } | 6533 | } |
| 6534 | |||
| 6535 | |||
diff --git a/src/systime.h b/src/systime.h index cb1ea230f7d..db43b26dc5e 100644 --- a/src/systime.h +++ b/src/systime.h | |||
| @@ -30,6 +30,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | #endif | 30 | #endif |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #ifdef HAVE_X_WINDOWS | ||
| 34 | # include <X11/X.h> | ||
| 35 | #else | ||
| 36 | typedef unsigned long Time; | ||
| 37 | #endif | ||
| 38 | |||
| 33 | #ifdef HAVE_TZNAME | 39 | #ifdef HAVE_TZNAME |
| 34 | #ifndef tzname /* For SGI. */ | 40 | #ifndef tzname /* For SGI. */ |
| 35 | extern char *tzname[]; /* RS6000 and others want it this way. */ | 41 | extern char *tzname[]; /* RS6000 and others want it this way. */ |
diff --git a/src/term.c b/src/term.c index c68228cc51a..5fe258caa29 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2698,9 +2698,10 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) | |||
| 2698 | static void | 2698 | static void |
| 2699 | term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, | 2699 | term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, |
| 2700 | enum scroll_bar_part *part, Lisp_Object *x, | 2700 | enum scroll_bar_part *part, Lisp_Object *x, |
| 2701 | Lisp_Object *y, unsigned long *timeptr) | 2701 | Lisp_Object *y, Time *timeptr) |
| 2702 | { | 2702 | { |
| 2703 | struct timeval now; | 2703 | struct timeval now; |
| 2704 | Time sec, usec; | ||
| 2704 | 2705 | ||
| 2705 | *fp = SELECTED_FRAME (); | 2706 | *fp = SELECTED_FRAME (); |
| 2706 | (*fp)->mouse_moved = 0; | 2707 | (*fp)->mouse_moved = 0; |
| @@ -2711,7 +2712,9 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, | |||
| 2711 | XSETINT (*x, last_mouse_x); | 2712 | XSETINT (*x, last_mouse_x); |
| 2712 | XSETINT (*y, last_mouse_y); | 2713 | XSETINT (*y, last_mouse_y); |
| 2713 | gettimeofday(&now, 0); | 2714 | gettimeofday(&now, 0); |
| 2714 | *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000); | 2715 | sec = now.tv_sec; |
| 2716 | usec = now.tv_usec; | ||
| 2717 | *timeptr = (sec * 1000) + (usec / 1000); | ||
| 2715 | } | 2718 | } |
| 2716 | 2719 | ||
| 2717 | /* Prepare a mouse-event in *RESULT for placement in the input queue. | 2720 | /* Prepare a mouse-event in *RESULT for placement in the input queue. |
diff --git a/src/termhooks.h b/src/termhooks.h index 3a49b49aede..34e1364effd 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | /* Miscellanea. */ | 21 | /* Miscellanea. */ |
| 22 | 22 | ||
| 23 | #include "systime.h" /* for Time */ | ||
| 24 | |||
| 23 | struct glyph; | 25 | struct glyph; |
| 24 | struct frame; | 26 | struct frame; |
| 25 | 27 | ||
| @@ -233,7 +235,7 @@ struct input_event | |||
| 233 | int modifiers; /* See enum below for interpretation. */ | 235 | int modifiers; /* See enum below for interpretation. */ |
| 234 | 236 | ||
| 235 | Lisp_Object x, y; | 237 | Lisp_Object x, y; |
| 236 | unsigned long timestamp; | 238 | Time timestamp; |
| 237 | 239 | ||
| 238 | /* This is padding just to put the frame_or_window field | 240 | /* This is padding just to put the frame_or_window field |
| 239 | past the size of struct selection_input_event. */ | 241 | past the size of struct selection_input_event. */ |
| @@ -463,7 +465,7 @@ struct terminal | |||
| 463 | enum scroll_bar_part *part, | 465 | enum scroll_bar_part *part, |
| 464 | Lisp_Object *x, | 466 | Lisp_Object *x, |
| 465 | Lisp_Object *y, | 467 | Lisp_Object *y, |
| 466 | unsigned long *); | 468 | Time *); |
| 467 | 469 | ||
| 468 | /* The window system handling code should set this if the mouse has | 470 | /* The window system handling code should set this if the mouse has |
| 469 | moved since the last call to the mouse_position_hook. Calling that | 471 | moved since the last call to the mouse_position_hook. Calling that |
diff --git a/src/w32gui.h b/src/w32gui.h index 936709af181..2ba9cb53e22 100644 --- a/src/w32gui.h +++ b/src/w32gui.h | |||
| @@ -20,6 +20,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | #define EMACS_W32GUI_H | 20 | #define EMACS_W32GUI_H |
| 21 | #include <windows.h> | 21 | #include <windows.h> |
| 22 | 22 | ||
| 23 | #include "systime.h" /* for Time */ | ||
| 24 | |||
| 23 | /* Local memory management for menus. */ | 25 | /* Local memory management for menus. */ |
| 24 | #define local_heap (GetProcessHeap ()) | 26 | #define local_heap (GetProcessHeap ()) |
| 25 | #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n))) | 27 | #define local_alloc(n) (HeapAlloc (local_heap, HEAP_ZERO_MEMORY, (n))) |
| @@ -47,7 +49,6 @@ typedef char * XrmDatabase; | |||
| 47 | 49 | ||
| 48 | typedef XGCValues * GC; | 50 | typedef XGCValues * GC; |
| 49 | typedef COLORREF Color; | 51 | typedef COLORREF Color; |
| 50 | typedef DWORD Time; | ||
| 51 | typedef HWND Window; | 52 | typedef HWND Window; |
| 52 | typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ | 53 | typedef HDC Display; /* HDC so it doesn't conflict with xpm lib. */ |
| 53 | typedef HCURSOR Cursor; | 54 | typedef HCURSOR Cursor; |
| @@ -147,4 +148,3 @@ typedef struct { | |||
| 147 | 148 | ||
| 148 | 149 | ||
| 149 | #endif /* EMACS_W32GUI_H */ | 150 | #endif /* EMACS_W32GUI_H */ |
| 150 | |||
diff --git a/src/w32inevt.c b/src/w32inevt.c index 465f5ccb70f..fddde61663f 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c | |||
| @@ -45,7 +45,7 @@ extern HANDLE keyboard_handle; | |||
| 45 | 45 | ||
| 46 | /* Info for last mouse motion */ | 46 | /* Info for last mouse motion */ |
| 47 | static COORD movement_pos; | 47 | static COORD movement_pos; |
| 48 | static DWORD movement_time; | 48 | static Time movement_time; |
| 49 | 49 | ||
| 50 | /* from w32fns.c */ | 50 | /* from w32fns.c */ |
| 51 | extern unsigned int map_keypad_keys (unsigned int, unsigned int); | 51 | extern unsigned int map_keypad_keys (unsigned int, unsigned int); |
| @@ -544,7 +544,7 @@ w32_console_mouse_position (FRAME_PTR *f, | |||
| 544 | enum scroll_bar_part *part, | 544 | enum scroll_bar_part *part, |
| 545 | Lisp_Object *x, | 545 | Lisp_Object *x, |
| 546 | Lisp_Object *y, | 546 | Lisp_Object *y, |
| 547 | unsigned long *time) | 547 | Time *time) |
| 548 | { | 548 | { |
| 549 | BLOCK_INPUT; | 549 | BLOCK_INPUT; |
| 550 | 550 | ||
| @@ -756,4 +756,3 @@ w32_console_read_socket (struct terminal *terminal, | |||
| 756 | UNBLOCK_INPUT; | 756 | UNBLOCK_INPUT; |
| 757 | return ret; | 757 | return ret; |
| 758 | } | 758 | } |
| 759 | |||
diff --git a/src/window.c b/src/window.c index 4dbee41c5f4..bc9f31e03e8 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3094,11 +3094,14 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs | |||
| 3094 | Lisp_Object last_child; | 3094 | Lisp_Object last_child; |
| 3095 | int child_size; | 3095 | int child_size; |
| 3096 | 3096 | ||
| 3097 | for (child = *forward; !NILP (child); child = c->next) | 3097 | child = *forward; |
| 3098 | do | ||
| 3098 | { | 3099 | { |
| 3099 | c = XWINDOW (child); | 3100 | c = XWINDOW (child); |
| 3100 | last_child = child; | 3101 | last_child = child; |
| 3102 | child = c->next; | ||
| 3101 | } | 3103 | } |
| 3104 | while (!NILP (child)); | ||
| 3102 | 3105 | ||
| 3103 | child_size = WINDOW_TOTAL_SIZE (c, width_p); | 3106 | child_size = WINDOW_TOTAL_SIZE (c, width_p); |
| 3104 | size_window (last_child, size - old_size + child_size, | 3107 | size_window (last_child, size - old_size + child_size, |
diff --git a/src/xmenu.c b/src/xmenu.c index 2a4359fa84a..7d7515a8f25 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -240,7 +240,7 @@ for instance using the window manager, then this produces a quit and | |||
| 240 | FRAME_PTR new_f = SELECTED_FRAME (); | 240 | FRAME_PTR new_f = SELECTED_FRAME (); |
| 241 | Lisp_Object bar_window; | 241 | Lisp_Object bar_window; |
| 242 | enum scroll_bar_part part; | 242 | enum scroll_bar_part part; |
| 243 | unsigned long time; | 243 | Time time; |
| 244 | Lisp_Object x, y; | 244 | Lisp_Object x, y; |
| 245 | 245 | ||
| 246 | (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); | 246 | (*mouse_position_hook) (&new_f, 1, &bar_window, &part, &x, &y, &time); |
| @@ -922,7 +922,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 922 | #endif | 922 | #endif |
| 923 | Lisp_Object items; | 923 | Lisp_Object items; |
| 924 | widget_value *wv, *first_wv, *prev_wv = 0; | 924 | widget_value *wv, *first_wv, *prev_wv = 0; |
| 925 | EMACS_UINT i, last_i = 0; | 925 | int i; |
| 926 | int *submenu_start, *submenu_end; | 926 | int *submenu_start, *submenu_end; |
| 927 | int *submenu_top_level_items, *submenu_n_panes; | 927 | int *submenu_top_level_items, *submenu_n_panes; |
| 928 | 928 | ||
| @@ -966,7 +966,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 966 | Lisp_Object *previous_items | 966 | Lisp_Object *previous_items |
| 967 | = (Lisp_Object *) alloca (previous_menu_items_used | 967 | = (Lisp_Object *) alloca (previous_menu_items_used |
| 968 | * sizeof (Lisp_Object)); | 968 | * sizeof (Lisp_Object)); |
| 969 | EMACS_UINT subitems; | 969 | int subitems; |
| 970 | 970 | ||
| 971 | /* If we are making a new widget, its contents are empty, | 971 | /* If we are making a new widget, its contents are empty, |
| 972 | do always reinitialize them. */ | 972 | do always reinitialize them. */ |
| @@ -1012,7 +1012,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1012 | menu_items = f->menu_bar_vector; | 1012 | menu_items = f->menu_bar_vector; |
| 1013 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; | 1013 | menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; |
| 1014 | subitems = ASIZE (items) / 4; | 1014 | subitems = ASIZE (items) / 4; |
| 1015 | submenu_start = (int *) alloca (subitems * sizeof (int)); | 1015 | submenu_start = (int *) alloca ((subitems + 1) * sizeof (int)); |
| 1016 | submenu_end = (int *) alloca (subitems * sizeof (int)); | 1016 | submenu_end = (int *) alloca (subitems * sizeof (int)); |
| 1017 | submenu_n_panes = (int *) alloca (subitems * sizeof (int)); | 1017 | submenu_n_panes = (int *) alloca (subitems * sizeof (int)); |
| 1018 | submenu_top_level_items = (int *) alloca (subitems * sizeof (int)); | 1018 | submenu_top_level_items = (int *) alloca (subitems * sizeof (int)); |
| @@ -1021,8 +1021,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1021 | { | 1021 | { |
| 1022 | Lisp_Object key, string, maps; | 1022 | Lisp_Object key, string, maps; |
| 1023 | 1023 | ||
| 1024 | last_i = i; | ||
| 1025 | |||
| 1026 | key = XVECTOR (items)->contents[4 * i]; | 1024 | key = XVECTOR (items)->contents[4 * i]; |
| 1027 | string = XVECTOR (items)->contents[4 * i + 1]; | 1025 | string = XVECTOR (items)->contents[4 * i + 1]; |
| 1028 | maps = XVECTOR (items)->contents[4 * i + 2]; | 1026 | maps = XVECTOR (items)->contents[4 * i + 2]; |
| @@ -1039,6 +1037,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1039 | submenu_end[i] = menu_items_used; | 1037 | submenu_end[i] = menu_items_used; |
| 1040 | } | 1038 | } |
| 1041 | 1039 | ||
| 1040 | submenu_start[i] = -1; | ||
| 1042 | finish_menu_items (); | 1041 | finish_menu_items (); |
| 1043 | 1042 | ||
| 1044 | /* Convert menu_items into widget_value trees | 1043 | /* Convert menu_items into widget_value trees |
| @@ -1052,7 +1051,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 1052 | wv->help = Qnil; | 1051 | wv->help = Qnil; |
| 1053 | first_wv = wv; | 1052 | first_wv = wv; |
| 1054 | 1053 | ||
| 1055 | for (i = 0; i < last_i; i++) | 1054 | for (i = 0; 0 <= submenu_start[i]; i++) |
| 1056 | { | 1055 | { |
| 1057 | menu_items_n_panes = submenu_n_panes[i]; | 1056 | menu_items_n_panes = submenu_n_panes[i]; |
| 1058 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], | 1057 | wv = digest_single_submenu (submenu_start[i], submenu_end[i], |
| @@ -1421,7 +1420,8 @@ pop_down_menu (Lisp_Object arg) | |||
| 1421 | menu pops down. | 1420 | menu pops down. |
| 1422 | menu_item_selection will be set to the selection. */ | 1421 | menu_item_selection will be set to the selection. */ |
| 1423 | static void | 1422 | static void |
| 1424 | create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, int for_click, EMACS_UINT timestamp) | 1423 | create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, |
| 1424 | int for_click, Time timestamp) | ||
| 1425 | { | 1425 | { |
| 1426 | int i; | 1426 | int i; |
| 1427 | GtkWidget *menu; | 1427 | GtkWidget *menu; |
| @@ -1465,7 +1465,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, i | |||
| 1465 | gtk_widget_show_all (menu); | 1465 | gtk_widget_show_all (menu); |
| 1466 | 1466 | ||
| 1467 | gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, | 1467 | gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, |
| 1468 | timestamp > 0 ? timestamp : gtk_get_current_event_time()); | 1468 | timestamp ? timestamp : gtk_get_current_event_time ()); |
| 1469 | 1469 | ||
| 1470 | record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); | 1470 | record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); |
| 1471 | 1471 | ||
| @@ -1525,7 +1525,7 @@ pop_down_menu (Lisp_Object arg) | |||
| 1525 | menu_item_selection will be set to the selection. */ | 1525 | menu_item_selection will be set to the selection. */ |
| 1526 | static void | 1526 | static void |
| 1527 | create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, | 1527 | create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, |
| 1528 | int x, int y, int for_click, EMACS_UINT timestamp) | 1528 | int x, int y, int for_click, Time timestamp) |
| 1529 | { | 1529 | { |
| 1530 | int i; | 1530 | int i; |
| 1531 | Arg av[2]; | 1531 | Arg av[2]; |
| @@ -1599,7 +1599,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, | |||
| 1599 | 1599 | ||
| 1600 | Lisp_Object | 1600 | Lisp_Object |
| 1601 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 1601 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, |
| 1602 | Lisp_Object title, const char **error_name, EMACS_UINT timestamp) | 1602 | Lisp_Object title, const char **error_name, Time timestamp) |
| 1603 | { | 1603 | { |
| 1604 | int i; | 1604 | int i; |
| 1605 | widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; | 1605 | widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; |
| @@ -2242,7 +2242,7 @@ pop_down_menu (Lisp_Object arg) | |||
| 2242 | 2242 | ||
| 2243 | Lisp_Object | 2243 | Lisp_Object |
| 2244 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | 2244 | xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, |
| 2245 | Lisp_Object title, const char **error_name, EMACS_UINT timestamp) | 2245 | Lisp_Object title, const char **error_name, Time timestamp) |
| 2246 | { | 2246 | { |
| 2247 | Window root; | 2247 | Window root; |
| 2248 | XMenu *menu; | 2248 | XMenu *menu; |
diff --git a/src/xselect.c b/src/xselect.c index f11fc40fce8..3ddd4c54b49 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -121,10 +121,6 @@ static Lisp_Object Qforeign_selection; | |||
| 121 | 121 | ||
| 122 | #define SELECTION_QUANTUM(dpy) ((XMaxRequestSize(dpy) << 2) - 100) | 122 | #define SELECTION_QUANTUM(dpy) ((XMaxRequestSize(dpy) << 2) - 100) |
| 123 | 123 | ||
| 124 | /* The timestamp of the last input event Emacs received from the X server. */ | ||
| 125 | /* Defined in keyboard.c. */ | ||
| 126 | extern unsigned long last_event_timestamp; | ||
| 127 | |||
| 128 | /* This is an association list whose elements are of the form | 124 | /* This is an association list whose elements are of the form |
| 129 | ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME) | 125 | ( SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME) |
| 130 | SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom. | 126 | SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom. |
| @@ -356,7 +352,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value) | |||
| 356 | Lisp_Object selection_data; | 352 | Lisp_Object selection_data; |
| 357 | Lisp_Object prev_value; | 353 | Lisp_Object prev_value; |
| 358 | 354 | ||
| 359 | selection_time = long_to_cons ((unsigned long) timestamp); | 355 | selection_time = long_to_cons (timestamp); |
| 360 | selection_data = list4 (selection_name, selection_value, | 356 | selection_data = list4 (selection_name, selection_value, |
| 361 | selection_time, selected_frame); | 357 | selection_time, selected_frame); |
| 362 | prev_value = assq_no_quit (selection_name, Vselection_alist); | 358 | prev_value = assq_no_quit (selection_name, Vselection_alist); |
diff --git a/src/xterm.c b/src/xterm.c index 2352f51cfb7..64030a3151d 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -342,7 +342,7 @@ static struct scroll_bar *x_window_to_scroll_bar (Display *, Window); | |||
| 342 | static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, | 342 | static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, |
| 343 | enum scroll_bar_part *, | 343 | enum scroll_bar_part *, |
| 344 | Lisp_Object *, Lisp_Object *, | 344 | Lisp_Object *, Lisp_Object *, |
| 345 | unsigned long *); | 345 | Time *); |
| 346 | static void x_handle_net_wm_state (struct frame *, XPropertyEvent *); | 346 | static void x_handle_net_wm_state (struct frame *, XPropertyEvent *); |
| 347 | static void x_check_fullscreen (struct frame *); | 347 | static void x_check_fullscreen (struct frame *); |
| 348 | static void x_check_expected_move (struct frame *, int, int); | 348 | static void x_check_expected_move (struct frame *, int, int); |
| @@ -3637,23 +3637,23 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo) | |||
| 3637 | /* Convert between the modifier bits X uses and the modifier bits | 3637 | /* Convert between the modifier bits X uses and the modifier bits |
| 3638 | Emacs uses. */ | 3638 | Emacs uses. */ |
| 3639 | 3639 | ||
| 3640 | unsigned int | 3640 | EMACS_INT |
| 3641 | x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state) | 3641 | x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state) |
| 3642 | { | 3642 | { |
| 3643 | EMACS_UINT mod_meta = meta_modifier; | 3643 | EMACS_INT mod_meta = meta_modifier; |
| 3644 | EMACS_UINT mod_alt = alt_modifier; | 3644 | EMACS_INT mod_alt = alt_modifier; |
| 3645 | EMACS_UINT mod_hyper = hyper_modifier; | 3645 | EMACS_INT mod_hyper = hyper_modifier; |
| 3646 | EMACS_UINT mod_super = super_modifier; | 3646 | EMACS_INT mod_super = super_modifier; |
| 3647 | Lisp_Object tem; | 3647 | Lisp_Object tem; |
| 3648 | 3648 | ||
| 3649 | tem = Fget (Vx_alt_keysym, Qmodifier_value); | 3649 | tem = Fget (Vx_alt_keysym, Qmodifier_value); |
| 3650 | if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); | 3650 | if (INTEGERP (tem)) mod_alt = XINT (tem); |
| 3651 | tem = Fget (Vx_meta_keysym, Qmodifier_value); | 3651 | tem = Fget (Vx_meta_keysym, Qmodifier_value); |
| 3652 | if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); | 3652 | if (INTEGERP (tem)) mod_meta = XINT (tem); |
| 3653 | tem = Fget (Vx_hyper_keysym, Qmodifier_value); | 3653 | tem = Fget (Vx_hyper_keysym, Qmodifier_value); |
| 3654 | if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); | 3654 | if (INTEGERP (tem)) mod_hyper = XINT (tem); |
| 3655 | tem = Fget (Vx_super_keysym, Qmodifier_value); | 3655 | tem = Fget (Vx_super_keysym, Qmodifier_value); |
| 3656 | if (! EQ (tem, Qnil)) mod_super = XUINT (tem); | 3656 | if (INTEGERP (tem)) mod_super = XINT (tem); |
| 3657 | 3657 | ||
| 3658 | 3658 | ||
| 3659 | return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) | 3659 | return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) |
| @@ -3664,24 +3664,24 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state) | |||
| 3664 | | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0)); | 3664 | | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0)); |
| 3665 | } | 3665 | } |
| 3666 | 3666 | ||
| 3667 | static unsigned int | 3667 | static int |
| 3668 | x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, unsigned int state) | 3668 | x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state) |
| 3669 | { | 3669 | { |
| 3670 | EMACS_UINT mod_meta = meta_modifier; | 3670 | int mod_meta = meta_modifier; |
| 3671 | EMACS_UINT mod_alt = alt_modifier; | 3671 | int mod_alt = alt_modifier; |
| 3672 | EMACS_UINT mod_hyper = hyper_modifier; | 3672 | int mod_hyper = hyper_modifier; |
| 3673 | EMACS_UINT mod_super = super_modifier; | 3673 | int mod_super = super_modifier; |
| 3674 | 3674 | ||
| 3675 | Lisp_Object tem; | 3675 | Lisp_Object tem; |
| 3676 | 3676 | ||
| 3677 | tem = Fget (Vx_alt_keysym, Qmodifier_value); | 3677 | tem = Fget (Vx_alt_keysym, Qmodifier_value); |
| 3678 | if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); | 3678 | if (INTEGERP (tem)) mod_alt = XINT (tem); |
| 3679 | tem = Fget (Vx_meta_keysym, Qmodifier_value); | 3679 | tem = Fget (Vx_meta_keysym, Qmodifier_value); |
| 3680 | if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); | 3680 | if (INTEGERP (tem)) mod_meta = XINT (tem); |
| 3681 | tem = Fget (Vx_hyper_keysym, Qmodifier_value); | 3681 | tem = Fget (Vx_hyper_keysym, Qmodifier_value); |
| 3682 | if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); | 3682 | if (INTEGERP (tem)) mod_hyper = XINT (tem); |
| 3683 | tem = Fget (Vx_super_keysym, Qmodifier_value); | 3683 | tem = Fget (Vx_super_keysym, Qmodifier_value); |
| 3684 | if (! EQ (tem, Qnil)) mod_super = XUINT (tem); | 3684 | if (INTEGERP (tem)) mod_super = XINT (tem); |
| 3685 | 3685 | ||
| 3686 | 3686 | ||
| 3687 | return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0) | 3687 | return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0) |
| @@ -3827,7 +3827,7 @@ redo_mouse_highlight (void) | |||
| 3827 | static void | 3827 | static void |
| 3828 | XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, | 3828 | XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, |
| 3829 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, | 3829 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, |
| 3830 | long unsigned int *timestamp) | 3830 | Time *timestamp) |
| 3831 | { | 3831 | { |
| 3832 | FRAME_PTR f1; | 3832 | FRAME_PTR f1; |
| 3833 | 3833 | ||
| @@ -5562,7 +5562,7 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) | |||
| 5562 | static void | 5562 | static void |
| 5563 | x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, | 5563 | x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, |
| 5564 | enum scroll_bar_part *part, Lisp_Object *x, | 5564 | enum scroll_bar_part *part, Lisp_Object *x, |
| 5565 | Lisp_Object *y, long unsigned int *timestamp) | 5565 | Lisp_Object *y, Time *timestamp) |
| 5566 | { | 5566 | { |
| 5567 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); | 5567 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); |
| 5568 | Window w = bar->x_window; | 5568 | Window w = bar->x_window; |
diff --git a/src/xterm.h b/src/xterm.h index fbd638fe73b..1b90b6d8ff4 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -989,8 +989,7 @@ extern void x_mouse_leave (struct x_display_info *); | |||
| 989 | #ifdef USE_X_TOOLKIT | 989 | #ifdef USE_X_TOOLKIT |
| 990 | extern int x_dispatch_event (XEvent *, Display *); | 990 | extern int x_dispatch_event (XEvent *, Display *); |
| 991 | #endif | 991 | #endif |
| 992 | extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *, | 992 | extern EMACS_INT x_x_to_emacs_modifiers (struct x_display_info *, int); |
| 993 | unsigned); | ||
| 994 | extern int x_display_pixel_height (struct x_display_info *); | 993 | extern int x_display_pixel_height (struct x_display_info *); |
| 995 | extern int x_display_pixel_width (struct x_display_info *); | 994 | extern int x_display_pixel_width (struct x_display_info *); |
| 996 | 995 | ||