This repository was archived by the owner on Feb 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed
Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -216,10 +216,11 @@ tty_got_winch (void)
216216
217217/* --------------------------------------------------------------------------------------------- */
218218
219- void
219+ gboolean
220220tty_flush_winch (void )
221221{
222222 ssize_t n ;
223+ gboolean ret = FALSE;
223224
224225 /* merge all SIGWINCH events raised to this moment */
225226 do
@@ -228,8 +229,14 @@ tty_flush_winch (void)
228229
229230 /* read multiple events at a time */
230231 n = read (sigwinch_pipe [0 ], & x , sizeof (x ));
232+
233+ /* at least one SIGWINCH came */
234+ if (n > 0 )
235+ ret = TRUE;
231236 }
232237 while (n > 0 || (n == -1 && errno == EINTR ));
238+
239+ return ret ;
233240}
234241
235242/* --------------------------------------------------------------------------------------------- */
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ extern void tty_disable_interrupt_key (void);
8181extern gboolean tty_got_interrupt (void );
8282
8383extern gboolean tty_got_winch (void );
84- extern void tty_flush_winch (void );
84+ extern gboolean tty_flush_winch (void );
8585
8686extern void tty_reset_prog_mode (void );
8787extern void tty_reset_shell_mode (void );
Original file line number Diff line number Diff line change @@ -386,6 +386,14 @@ dialog_change_screen_size (void)
386386{
387387 GList * d ;
388388
389+ /* On startup, when mc reads directories top_dlg isn't created yet. If window is resized
390+ * at this time, SIGWINCH can be missed because tty_flush_winch() is called here before
391+ * a first tty_got_winch() call in frontend_dlg_run().
392+ *
393+ * Keep SIGWINCH events in pipe if top_dlg isn't created yet. */
394+ if (top_dlg == NULL )
395+ return ;
396+
389397 tty_flush_winch ();
390398 tty_change_screen_size ();
391399
Original file line number Diff line number Diff line change @@ -547,8 +547,7 @@ toggle_subshell (void)
547547 * Save sigwinch flag that will be reset in mc_refresh() called via update_panels().
548548 * There is some problem with screen redraw in ncurses-based mc in this situation.
549549 */
550- was_sigwinch = tty_got_winch ();
551- tty_flush_winch ();
550+ was_sigwinch = tty_flush_winch ();
552551
553552#ifdef ENABLE_SUBSHELL
554553 if (mc_global .tty .use_subshell )
You can’t perform that action at this time.
0 commit comments