diff --git a/src/frame.h b/src/frame.h index 744b95e1e0..75a0b184c1 100644 --- a/src/frame.h +++ b/src/frame.h @@ -456,7 +456,11 @@ #define EMACS_FRAME_H /* True when new_width or new_height were set by change_frame_size, false when they were set by adjust_frame_size internally or not set. */ - bool_bf new_size_p; + bool_bf new_size_p : 1; + + /* True when frame was invisible before first MapNotify event. Used + in X builds only. */ + bool_bf was_invisible : 1; /* Bitfield area ends here. */ diff --git a/src/nsfns.m b/src/nsfns.m index 1f281f75fd..d14f7b51ea 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1404,6 +1404,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. else { /* Must have been Qnil. */ + f->was_invisible = true; } } diff --git a/src/w32fns.c b/src/w32fns.c index 66baeaecbd..e5edd62abb 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6107,6 +6107,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, if (!NILP (visibility)) w32_make_frame_visible (f); + else + f->was_invisible = true; } store_frame_param (f, Qvisibility, visibility); diff --git a/src/xfns.c b/src/xfns.c index 782e0a483c..82ad15c52c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4140,6 +4140,8 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, if (!NILP (visibility)) x_make_frame_visible (f); + else + f->was_invisible = true; } store_frame_param (f, Qvisibility, visibility); diff --git a/src/xterm.c b/src/xterm.c index 9edaed9a34..a663a0f184 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8181,8 +8181,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, #if defined USE_GTK && defined HAVE_GTK3 /* If GTK3 wants to impose some old size here (Bug#24526), tell it that the current size is what we want. */ - xg_frame_set_char_size - (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + if (f->was_invisible) + { + xg_frame_set_char_size + (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + f->was_invisible = false; + } #endif XSETFRAME (inev.ie.frame_or_window, f); } @@ -8443,8 +8447,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, #if defined USE_GTK && defined HAVE_GTK3 /* If GTK3 wants to impose some old size here (Bug#24526), tell it that the current size is what we want. */ - xg_frame_set_char_size - (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + if (f->was_invisible) + { + xg_frame_set_char_size + (f, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)); + f->was_invisible = false; + } #endif f->output_data.x->has_been_visible = true; }