From caecb91c581d4ec0fc008a35005d8009f43087ee Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 20 Mar 2014 10:09:37 -0400 Subject: [PATCH] * src/frame.h (SET_FRAME_VISIBLE): Keep frame_garbaged up to date. * src/xterm.c (handle_one_xevent) : Don't garbage the frame. * src/frame.c (frame_garbaged): Make "docstring" more precise. --- src/ChangeLog | 14 ++++++++++---- src/alloc.c | 4 ++-- src/frame.c | 5 ++--- src/frame.h | 19 ++++++++++++------- src/term.c | 20 ++++++++++---------- src/xdisp.c | 2 +- src/xterm.c | 18 +++++------------- 7 files changed, 42 insertions(+), 40 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3256a92e37..93d1ba247b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-03-20 Stefan Monnier + + * frame.h (SET_FRAME_VISIBLE): Keep frame_garbaged up to date. + * xterm.c (handle_one_xevent) : Don't garbage the frame. + * frame.c (frame_garbaged): Make "docstring" more precise. + 2014-03-20 Glenn Morris * charset.c (init_charset): When we cannot find the charsets directory, @@ -74,8 +80,8 @@ we eventually back up the iterator to the wrap point. This avoids delusional behavior of move_it_to, whereby it proceeds to the next display line, but sets current_x to zero for all the glyphs that - without word-wrap would fit on the previous display line. One - result was that visual-order cursor movement behaved erratically + without word-wrap would fit on the previous display line. + One result was that visual-order cursor movement behaved erratically under word-wrap. (Fmove_point_visually): Add code to find the x coordinate of the last character before wrap point, under word-wrap on a TTY. @@ -107,8 +113,8 @@ SSDATA (Vx_resource_name), which may be changed from Lisp. (xim_close_display): For XUnregisterIMInstantiateCallback, always eassert return value and pass exactly the same values - as were used for XRegisterIMInstantiateCallback. Otherwise - XUnregisterIMInstantiateCallback will always fail. See Xlib + as were used for XRegisterIMInstantiateCallback. + Otherwise XUnregisterIMInstantiateCallback will always fail. See Xlib sources to check why if you are interested. 2014-03-05 Martin Rudalics diff --git a/src/alloc.c b/src/alloc.c index 7c671e25cf..62c3beec1d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1138,8 +1138,8 @@ lisp_align_malloc (size_t nbytes, enum mem_type type) } abase = ABLOCK_ABASE (free_ablock); - ABLOCKS_BUSY (abase) = - (struct ablocks *) (2 + (intptr_t) ABLOCKS_BUSY (abase)); + ABLOCKS_BUSY (abase) + = (struct ablocks *) (2 + (intptr_t) ABLOCKS_BUSY (abase)); val = free_ablock; free_ablock = free_ablock->x.next_free; diff --git a/src/frame.c b/src/frame.c index 3d0c9d057c..055ce36ff4 100644 --- a/src/frame.c +++ b/src/frame.c @@ -125,8 +125,7 @@ Lisp_Object selected_frame; static struct frame *last_nonminibuf_frame; -/* Nonzero means there is at least one garbaged frame. */ - +/* False means there are no visible garbaged frames. */ bool frame_garbaged; #ifdef HAVE_WINDOW_SYSTEM @@ -621,7 +620,7 @@ make_terminal_frame (struct terminal *terminal) FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); - /* Set the top frame to the newly created frame. */ + /* Set the top frame to the newly created frame. */ if (FRAMEP (FRAME_TTY (f)->top_frame) && FRAME_LIVE_P (XFRAME (FRAME_TTY (f)->top_frame))) SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (f)->top_frame), 2); /* obscured */ diff --git a/src/frame.h b/src/frame.h index 1230e97f04..62dc33511b 100644 --- a/src/frame.h +++ b/src/frame.h @@ -439,7 +439,7 @@ struct frame /* The baud rate that was used to calculate costs for this frame. */ int cost_calculation_baud_rate; - /* frame opacity + /* Frame opacity alpha[0]: alpha transparency of the active frame alpha[1]: alpha transparency of inactive frames Negative values mean not to change alpha. */ @@ -453,7 +453,7 @@ struct frame /* Additional space to put between text lines on this frame. */ int extra_line_spacing; - /* All display backends seem to need these two pixel values. */ + /* All display backends seem to need these two pixel values. */ unsigned long background_pixel; unsigned long foreground_pixel; }; @@ -946,6 +946,9 @@ default_pixels_per_inch_y (void) } \ } while (false) +/* False means there are no visible garbaged frames. */ +extern bool frame_garbaged; + /* Set visibility of frame F. We call redisplay_other_windows to make sure the frame gets redisplayed if some changes were applied to it while it wasn't visible (and hence @@ -955,8 +958,13 @@ INLINE void SET_FRAME_VISIBLE (struct frame *f, int v) { eassert (0 <= v && v <= 2); - if (v == 1 && f->visible != 1) - redisplay_other_windows (); + if (v) + { + if (v == 1 && f->visible != 1) + redisplay_other_windows (); + if (FRAME_GARBAGED_P (f)) + frame_garbaged = true; + } f->visible = v; } @@ -972,9 +980,6 @@ extern Lisp_Object Qtty_color_mode; extern Lisp_Object Qterminal; extern Lisp_Object Qnoelisp; -/* True means there is at least one garbaged frame. */ -extern bool frame_garbaged; - extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); extern struct frame *decode_window_system_frame (Lisp_Object); extern struct frame *decode_live_frame (Lisp_Object); diff --git a/src/term.c b/src/term.c index 61a8d39d97..773e85faab 100644 --- a/src/term.c +++ b/src/term.c @@ -3054,7 +3054,7 @@ free_saved_screen (struct glyph_matrix *saved) int i; if (!saved) - return; /* already freed */ + return; /* Already freed! */ for (i = 0; i < saved->nrows; ++i) { @@ -3170,7 +3170,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, int statecount, x, y, i; bool leave, onepane; int result IF_LINT (= 0); - int title_faces[4]; /* face to display the menu title */ + int title_faces[4]; /* Face to display the menu title. */ int faces[4], buffers_num_deleted = 0; struct frame *sf = SELECTED_FRAME (); struct tty_display_info *tty = FRAME_TTY (sf); @@ -3332,7 +3332,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, have been opened. That does not include an open and active submenu. */ if (i != statecount - 2 - || state[i].menu->submenu[dy] != state[i+1].menu) + || state[i].menu->submenu[dy] != state[i + 1].menu) while (i != statecount - 1) { statecount--; @@ -3383,7 +3383,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, screen_update (sf, state[0].screen_behind); while (statecount--) free_saved_screen (state[statecount].screen_behind); - tty_show_cursor (tty); /* turn cursor back on */ + tty_show_cursor (tty); /* Turn cursor back on. */ fflush (tty->output); /* Clean up any mouse events that are waiting inside Emacs event queue. @@ -3474,7 +3474,7 @@ tty_menu_last_menubar_item (struct frame *f) break; i += 4; } - i -= 4; /* went one too far */ + i -= 4; /* Went one too far! */ } return i; } @@ -3519,7 +3519,7 @@ tty_menu_new_item_coords (struct frame *f, int which, int *x, int *y) if (i < last_i) *x = XINT (AREF (items, i + 4 + 3)); else - *x = 0; /* wrap around to the first item */ + *x = 0; /* Wrap around to the first item. */ } else if (prev_x < 0) { @@ -3647,7 +3647,7 @@ tty_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, if (!NILP (descrip)) { - /* if alloca is fast, use that to make the space, + /* If alloca is fast, use that to make the space, to reduce gc needs. */ item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1); memcpy (item_data, SSDATA (item_name), SBYTES (item_name)); @@ -3694,7 +3694,7 @@ tty_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, uly = dispheight - height; } - if (FRAME_HAS_MINIBUF_P (f) && uly+height > dispheight - 2) + if (FRAME_HAS_MINIBUF_P (f) && uly + height > dispheight - 2) { /* Move the menu away of the echo area, to avoid overwriting the menu with help echo messages or vice versa. */ @@ -3723,8 +3723,8 @@ tty_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, /* If position was not given by a mouse click, adjust so upper left corner of the menu as a whole ends up at given coordinates. This is what x-popup-menu says in its documentation. */ - x += width/2; - y += 1.5*height/(maxlines+2); + x += width / 2; + y += 1.5 * height / (maxlines + 2); } #endif diff --git a/src/xdisp.c b/src/xdisp.c index b7821eb504..6f39324d2f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -27253,7 +27253,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) if (/* If window is in the process of being destroyed, don't bother to do anything. */ w->current_matrix != NULL - /* Don't update mouse highlight if hidden */ + /* Don't update mouse highlight if hidden. */ && (draw != DRAW_MOUSE_FACE || !hlinfo->mouse_face_hidden) /* Recognize when we are called to operate on rows that don't exist anymore. This can happen when a window is split. */ diff --git a/src/xterm.c b/src/xterm.c index 8ae26344f9..1136b67182 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -5667,7 +5667,7 @@ static struct input_event *current_hold_quit; /* This is the filter function invoked by the GTK event loop. It is invoked before the XEvent is translated to a GdkEvent, - so we have a chance to act on the event before GTK. */ + so we have a chance to act on the event before GTK. */ static GdkFilterReturn event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data) { @@ -5696,9 +5696,9 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data) if (! dpyinfo) current_finish = X_EVENT_NORMAL; else - current_count += - handle_one_xevent (dpyinfo, xev, ¤t_finish, - current_hold_quit); + current_count + += handle_one_xevent (dpyinfo, xev, ¤t_finish, + current_hold_quit); } else current_finish = x_dispatch_event (xev, xev->xany.display); @@ -6142,14 +6142,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (f) { bool iconified = FRAME_ICONIFIED_P (f); - /* wait_reading_process_output will notice this and update - the frame's display structures. - If we where iconified, we should not set garbaged, - because that stops redrawing on Expose events. This looks - bad if we are called from a recursive event loop - (x_dispatch_event), for example when a dialog is up. */ - if (!iconified) - SET_FRAME_GARBAGED (f); /* Check if fullscreen was specified before we where mapped the first time, i.e. from the command line. */ @@ -6700,7 +6692,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, #ifdef USE_GTK /* GTK creates windows but doesn't map them. - Only get real positions when mapped. */ + Only get real positions when mapped. */ if (FRAME_GTK_OUTER_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_OUTER_WIDGET (f))) #endif -- 2.20.1