diff options
| author | Eli Zaretskii | 2013-09-17 15:47:37 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-09-17 15:47:37 +0300 |
| commit | ffc3882f6ceca6c1516d5dda6f719bbaed1fa7df (patch) | |
| tree | d2413e69344ca46602a136a29f91e3112b96a12a /src | |
| parent | 5877bb8d7e55eda3f81a36bfabe4dd816a34269f (diff) | |
| download | emacs-ffc3882f6ceca6c1516d5dda6f719bbaed1fa7df.tar.gz emacs-ffc3882f6ceca6c1516d5dda6f719bbaed1fa7df.zip | |
Minor fixes to interfaces, avoid assertion violation under GLYPH_DEBUG.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 5 | ||||
| -rw-r--r-- | src/menu.c | 8 | ||||
| -rw-r--r-- | src/term.c | 37 | ||||
| -rw-r--r-- | src/xdisp.c | 16 |
4 files changed, 50 insertions, 16 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 2378e72091e..fba38f13783 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3205,7 +3205,12 @@ update_frame_with_menu (struct frame *f) | |||
| 3205 | fflush (FRAME_TTY (f)->output); | 3205 | fflush (FRAME_TTY (f)->output); |
| 3206 | /* Check window matrices for lost pointers. */ | 3206 | /* Check window matrices for lost pointers. */ |
| 3207 | #if GLYPH_DEBUG | 3207 | #if GLYPH_DEBUG |
| 3208 | #if 0 | ||
| 3209 | /* We cannot possibly survive the matrix pointers check, since | ||
| 3210 | we have overwritten parts of the frame glyph matrix without | ||
| 3211 | making any updates to the window matrices. */ | ||
| 3208 | check_window_matrix_pointers (root_window); | 3212 | check_window_matrix_pointers (root_window); |
| 3213 | #endif | ||
| 3209 | add_frame_display_history (f, paused_p); | 3214 | add_frame_display_history (f, paused_p); |
| 3210 | #endif | 3215 | #endif |
| 3211 | 3216 | ||
diff --git a/src/menu.c b/src/menu.c index b9d1b7668b1..2560b00b3c1 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -1280,7 +1280,8 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1280 | #ifdef HAVE_MENUS | 1280 | #ifdef HAVE_MENUS |
| 1281 | #ifdef HAVE_WINDOW_SYSTEM | 1281 | #ifdef HAVE_WINDOW_SYSTEM |
| 1282 | /* Hide a previous tip, if any. */ | 1282 | /* Hide a previous tip, if any. */ |
| 1283 | Fx_hide_tip (); | 1283 | if (!FRAME_TERMCAP_P (f)) |
| 1284 | Fx_hide_tip (); | ||
| 1284 | #endif | 1285 | #endif |
| 1285 | 1286 | ||
| 1286 | #ifdef HAVE_NTGUI /* FIXME: Is it really w32-specific? --Stef */ | 1287 | #ifdef HAVE_NTGUI /* FIXME: Is it really w32-specific? --Stef */ |
| @@ -1289,7 +1290,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1289 | can occur if you press ESC or click outside a menu without selecting | 1290 | can occur if you press ESC or click outside a menu without selecting |
| 1290 | a menu item. | 1291 | a menu item. |
| 1291 | */ | 1292 | */ |
| 1292 | if (current_popup_menu) | 1293 | if (current_popup_menu && FRAME_W32_P (f)) |
| 1293 | { | 1294 | { |
| 1294 | discard_menu_items (); | 1295 | discard_menu_items (); |
| 1295 | FRAME_X_DISPLAY_INFO (f)->grabbed = 0; | 1296 | FRAME_X_DISPLAY_INFO (f)->grabbed = 0; |
| @@ -1342,7 +1343,8 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1342 | #endif | 1343 | #endif |
| 1343 | 1344 | ||
| 1344 | #ifdef HAVE_NTGUI /* FIXME: Is it really w32-specific? --Stef */ | 1345 | #ifdef HAVE_NTGUI /* FIXME: Is it really w32-specific? --Stef */ |
| 1345 | FRAME_X_DISPLAY_INFO (f)->grabbed = 0; | 1346 | if (FRAME_W32_P (f)) |
| 1347 | FRAME_X_DISPLAY_INFO (f)->grabbed = 0; | ||
| 1346 | #endif | 1348 | #endif |
| 1347 | 1349 | ||
| 1348 | #endif /* HAVE_MENUS */ | 1350 | #endif /* HAVE_MENUS */ |
diff --git a/src/term.c b/src/term.c index f3a750c70b6..f27bf8d900d 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -2900,7 +2900,7 @@ tty_menu_calc_size (tty_menu *menu, int *width, int *height) | |||
| 2900 | /* Display MENU at (X,Y) using FACES. */ | 2900 | /* Display MENU at (X,Y) using FACES. */ |
| 2901 | 2901 | ||
| 2902 | static void | 2902 | static void |
| 2903 | tty_menu_display (tty_menu *menu, int y, int x, int pn, int *faces, | 2903 | tty_menu_display (tty_menu *menu, int x, int y, int pn, int *faces, |
| 2904 | int disp_help) | 2904 | int disp_help) |
| 2905 | { | 2905 | { |
| 2906 | int i, face, width, mx = -1, my = -1, enabled, mousehere, row, col; | 2906 | int i, face, width, mx = -1, my = -1, enabled, mousehere, row, col; |
| @@ -2958,7 +2958,7 @@ tty_menu_display (tty_menu *menu, int y, int x, int pn, int *faces, | |||
| 2958 | menu_help_paneno = pn - 1; | 2958 | menu_help_paneno = pn - 1; |
| 2959 | menu_help_itemno = i; | 2959 | menu_help_itemno = i; |
| 2960 | } | 2960 | } |
| 2961 | display_tty_menu_item (menu->text[i], face, y + i, x, | 2961 | display_tty_menu_item (menu->text[i], face, x, y + i, |
| 2962 | menu->submenu[i] != NULL); | 2962 | menu->submenu[i] != NULL); |
| 2963 | } | 2963 | } |
| 2964 | update_frame_with_menu (sf); | 2964 | update_frame_with_menu (sf); |
| @@ -3139,10 +3139,17 @@ screen_update (struct frame *f, struct glyph_matrix *mtx) | |||
| 3139 | puts us. We only consider mouse movement and click events and | 3139 | puts us. We only consider mouse movement and click events and |
| 3140 | keyboard movement commands; the rest are ignored. */ | 3140 | keyboard movement commands; the rest are ignored. */ |
| 3141 | static void | 3141 | static void |
| 3142 | read_menu_input (int *x, int *y) | 3142 | read_menu_input (struct frame *sf, int *x, int *y, bool *first_time) |
| 3143 | { | 3143 | { |
| 3144 | Lisp_Object c; | 3144 | Lisp_Object c; |
| 3145 | 3145 | ||
| 3146 | if (*first_time) | ||
| 3147 | { | ||
| 3148 | *first_time = false; | ||
| 3149 | sf->mouse_moved = 1; | ||
| 3150 | return; | ||
| 3151 | } | ||
| 3152 | |||
| 3146 | while (1) | 3153 | while (1) |
| 3147 | { | 3154 | { |
| 3148 | do { | 3155 | do { |
| @@ -3174,7 +3181,10 @@ read_menu_input (int *x, int *y) | |||
| 3174 | break; | 3181 | break; |
| 3175 | } | 3182 | } |
| 3176 | if (usable_input) | 3183 | if (usable_input) |
| 3177 | return; | 3184 | { |
| 3185 | sf->mouse_moved = 1; | ||
| 3186 | return; | ||
| 3187 | } | ||
| 3178 | } | 3188 | } |
| 3179 | 3189 | ||
| 3180 | else if (EVENT_HAS_PARAMETERS (c)) | 3190 | else if (EVENT_HAS_PARAMETERS (c)) |
| @@ -3232,6 +3242,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3232 | int title_faces[4]; /* face to display the menu title */ | 3242 | int title_faces[4]; /* face to display the menu title */ |
| 3233 | int faces[4], buffers_num_deleted = 0; | 3243 | int faces[4], buffers_num_deleted = 0; |
| 3234 | struct frame *sf = SELECTED_FRAME (); | 3244 | struct frame *sf = SELECTED_FRAME (); |
| 3245 | bool first_time; | ||
| 3235 | Lisp_Object saved_echo_area_message, selectface; | 3246 | Lisp_Object saved_echo_area_message, selectface; |
| 3236 | 3247 | ||
| 3237 | /* Don't allow non-positive x0 and y0, lest the menu will wrap | 3248 | /* Don't allow non-positive x0 and y0, lest the menu will wrap |
| @@ -3298,8 +3309,11 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3298 | show_cursor (0); /* FIXME: need a new hook, for w32console. */ | 3309 | show_cursor (0); /* FIXME: need a new hook, for w32console. */ |
| 3299 | #endif | 3310 | #endif |
| 3300 | 3311 | ||
| 3301 | /* Display the menu title. */ | 3312 | /* Display the menu title. We subtract 1 from x0 and y0 because we |
| 3302 | tty_menu_display (menu, y0 - 1, x0 - 1, 1, title_faces, 0); | 3313 | want to interpret them as zero-based column and row coordinates, |
| 3314 | and also because we want the first item of the menu, not its | ||
| 3315 | title, to appear at x0,y0. */ | ||
| 3316 | tty_menu_display (menu, x0 - 1, y0 - 1, 1, title_faces, 0); | ||
| 3303 | if (buffers_num_deleted) | 3317 | if (buffers_num_deleted) |
| 3304 | menu->text[0][7] = ' '; | 3318 | menu->text[0][7] = ' '; |
| 3305 | if ((onepane = menu->count == 1 && menu->submenu[0])) | 3319 | if ((onepane = menu->count == 1 && menu->submenu[0])) |
| @@ -3317,6 +3331,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3317 | 3331 | ||
| 3318 | x = state[0].x; | 3332 | x = state[0].x; |
| 3319 | y = state[0].y; | 3333 | y = state[0].y; |
| 3334 | first_time = true; | ||
| 3320 | 3335 | ||
| 3321 | leave = 0; | 3336 | leave = 0; |
| 3322 | while (!leave) | 3337 | while (!leave) |
| @@ -3324,7 +3339,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3324 | int mouse_button_count = 3; /* FIXME */ | 3339 | int mouse_button_count = 3; /* FIXME */ |
| 3325 | 3340 | ||
| 3326 | if (!mouse_visible) mouse_on (); | 3341 | if (!mouse_visible) mouse_on (); |
| 3327 | read_menu_input (&x, &y); | 3342 | read_menu_input (sf, &x, &y, &first_time); |
| 3328 | if (sf->mouse_moved) | 3343 | if (sf->mouse_moved) |
| 3329 | { | 3344 | { |
| 3330 | sf->mouse_moved = 0; | 3345 | sf->mouse_moved = 0; |
| @@ -3359,8 +3374,8 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3359 | if (i == statecount - 1 && state[i].menu->submenu[dy]) | 3374 | if (i == statecount - 1 && state[i].menu->submenu[dy]) |
| 3360 | { | 3375 | { |
| 3361 | tty_menu_display (state[i].menu, | 3376 | tty_menu_display (state[i].menu, |
| 3362 | state[i].y, | ||
| 3363 | state[i].x, | 3377 | state[i].x, |
| 3378 | state[i].y, | ||
| 3364 | state[i].pane, | 3379 | state[i].pane, |
| 3365 | faces, 1); | 3380 | faces, 1); |
| 3366 | state[statecount].menu = state[i].menu->submenu[dy]; | 3381 | state[statecount].menu = state[i].menu->submenu[dy]; |
| @@ -3376,8 +3391,8 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3376 | } | 3391 | } |
| 3377 | } | 3392 | } |
| 3378 | tty_menu_display (state[statecount - 1].menu, | 3393 | tty_menu_display (state[statecount - 1].menu, |
| 3379 | state[statecount - 1].y, | ||
| 3380 | state[statecount - 1].x, | 3394 | state[statecount - 1].x, |
| 3395 | state[statecount - 1].y, | ||
| 3381 | state[statecount - 1].pane, | 3396 | state[statecount - 1].pane, |
| 3382 | faces, 1); | 3397 | faces, 1); |
| 3383 | } | 3398 | } |
| @@ -3413,6 +3428,9 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3413 | } | 3428 | } |
| 3414 | 3429 | ||
| 3415 | mouse_off (); /* FIXME */ | 3430 | mouse_off (); /* FIXME */ |
| 3431 | sf->mouse_moved = 0; | ||
| 3432 | /* FIXME: Since we set the fram's garbaged flag, do we need this | ||
| 3433 | call to screen_update? */ | ||
| 3416 | screen_update (sf, state[0].screen_behind); | 3434 | screen_update (sf, state[0].screen_behind); |
| 3417 | state[0].screen_behind = NULL; | 3435 | state[0].screen_behind = NULL; |
| 3418 | #if 0 | 3436 | #if 0 |
| @@ -3457,6 +3475,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, | |||
| 3457 | /* Allow mouse events generation by dos_rawgetc. */ | 3475 | /* Allow mouse events generation by dos_rawgetc. */ |
| 3458 | mouse_preempted--; | 3476 | mouse_preempted--; |
| 3459 | #endif | 3477 | #endif |
| 3478 | SET_FRAME_GARBAGED (sf); | ||
| 3460 | return result; | 3479 | return result; |
| 3461 | } | 3480 | } |
| 3462 | 3481 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 2d015fca887..29d8118ff8e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20589,8 +20589,9 @@ display_menu_bar (struct window *w) | |||
| 20589 | 20589 | ||
| 20590 | X and Y are coordinates of the first glyph in the desired matrix to | 20590 | X and Y are coordinates of the first glyph in the desired matrix to |
| 20591 | be overwritten by the menu item. Since this is a TTY, Y is the | 20591 | be overwritten by the menu item. Since this is a TTY, Y is the |
| 20592 | glyph row and X is the glyph number in the row, where to start | 20592 | zero-based number of the glyph row and X is the zero-based glyph |
| 20593 | displaying the item. | 20593 | number in the row, starting from left, where to start displaying |
| 20594 | the item. | ||
| 20594 | 20595 | ||
| 20595 | SUBMENU non-zero means this menu item drops down a submenu, which | 20596 | SUBMENU non-zero means this menu item drops down a submenu, which |
| 20596 | should be indicated by displaying a proper visual cue after the | 20597 | should be indicated by displaying a proper visual cue after the |
| @@ -20603,7 +20604,7 @@ display_tty_menu_item (const char *item_text, int face_id, int x, int y, | |||
| 20603 | struct it it; | 20604 | struct it it; |
| 20604 | struct frame *f = SELECTED_FRAME (); | 20605 | struct frame *f = SELECTED_FRAME (); |
| 20605 | struct window *w = XWINDOW (f->selected_window); | 20606 | struct window *w = XWINDOW (f->selected_window); |
| 20606 | int saved_used, saved_truncated, saved_width; | 20607 | int saved_used, saved_truncated, saved_width, saved_reversed; |
| 20607 | struct glyph_row *row; | 20608 | struct glyph_row *row; |
| 20608 | 20609 | ||
| 20609 | eassert (FRAME_TERMCAP_P (f)); | 20610 | eassert (FRAME_TERMCAP_P (f)); |
| @@ -20612,8 +20613,12 @@ display_tty_menu_item (const char *item_text, int face_id, int x, int y, | |||
| 20612 | it.first_visible_x = 0; | 20613 | it.first_visible_x = 0; |
| 20613 | it.last_visible_x = FRAME_COLS (f); | 20614 | it.last_visible_x = FRAME_COLS (f); |
| 20614 | row = it.glyph_row; | 20615 | row = it.glyph_row; |
| 20616 | /* Copy the row contents from the current matrix. */ | ||
| 20617 | *row = f->current_matrix->rows[y]; | ||
| 20615 | saved_width = row->full_width_p; | 20618 | saved_width = row->full_width_p; |
| 20616 | row->full_width_p = 1; | 20619 | row->full_width_p = 1; |
| 20620 | saved_reversed = row->reversed_p; | ||
| 20621 | row->reversed_p = 0; | ||
| 20617 | 20622 | ||
| 20618 | /* Arrange for the menu item glyphs to start at X and have the | 20623 | /* Arrange for the menu item glyphs to start at X and have the |
| 20619 | desired face. */ | 20624 | desired face. */ |
| @@ -20630,6 +20635,8 @@ display_tty_menu_item (const char *item_text, int face_id, int x, int y, | |||
| 20630 | term.c:append_glyph. */ | 20635 | term.c:append_glyph. */ |
| 20631 | it.paragraph_embedding = L2R; | 20636 | it.paragraph_embedding = L2R; |
| 20632 | 20637 | ||
| 20638 | /* Pad with a space on the left. */ | ||
| 20639 | display_string (" ", Qnil, Qnil, 0, 0, &it, 1, 0, 0, -1); | ||
| 20633 | if (submenu) | 20640 | if (submenu) |
| 20634 | { | 20641 | { |
| 20635 | /* Indicate with ">" that there's a submenu. */ | 20642 | /* Indicate with ">" that there's a submenu. */ |
| @@ -20646,8 +20653,9 @@ display_tty_menu_item (const char *item_text, int face_id, int x, int y, | |||
| 20646 | 20653 | ||
| 20647 | row->used[TEXT_AREA] = saved_used; | 20654 | row->used[TEXT_AREA] = saved_used; |
| 20648 | row->truncated_on_right_p = saved_truncated; | 20655 | row->truncated_on_right_p = saved_truncated; |
| 20649 | row->hash - row_hash (row); | 20656 | row->hash = row_hash (row); |
| 20650 | row->full_width_p = saved_width; | 20657 | row->full_width_p = saved_width; |
| 20658 | row->reversed_p = saved_reversed; | ||
| 20651 | } | 20659 | } |
| 20652 | #endif /* HAVE_MENUS */ | 20660 | #endif /* HAVE_MENUS */ |
| 20653 | 20661 | ||