Subject: bug#27357: 26.0.50; Emacs starts fullscreen in Ubuntu 17.04

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 05 Jul 2017 21:42:17 +0200

Man, this stuff is difficult to figure out...

I think I've found the call that resizes the frame erroneously.

I'm running under gdb with

(gdb) run -Q -geometry 80x20

to get a smallish frame.

change_frame_size is called a lot of times, but eventually with the
correct size:

#0  0x00000000004272f9 in adjust_frame_size (f=0x133ec30 <bss_sbrk_buffer+6645648>, new_width=1040, new_height=520, inhibit=0, pretend=true, parameter=XIL(0xd800)) at frame.c:546
#1  0x000000000053b497 in Fx_create_frame (parms=XIL(0x1151c43))
    at xfns.c:3996

So everything is OK up till now: Emacs has popped up a frame, and it has
the right size.

Then shenanigans start, and they are all seemingly triggered from inside
gtk:

0  0x0000000000424bf8 in change_frame_size (f=0x133ec30 <bss_sbrk_buffer+6645648>, new_width=2112, new_height=1040, pretend=false, delay=true, safe=false, pixelwise=true) at dispnew.c:5546
#1  0x000000000054de1d in xg_frame_resized (f=0x133ec30 <bss_sbrk_buffer+6645648>, pixelwidth=2144, pixelheight=1040) at gtkutil.c:886
#2  0x000000000052a10c in handle_one_xevent (dpyinfo=0x2f8a540, event=0x7fffffffb280, finish=0xc6dc14 <current_finish>, hold_quit=0x7fffffffb550)
    at xterm.c:8676
#3  0x000000000052785f in event_handler_gdk (gxev=0x7fffffffb280, ev=0x2d6d3d0, data=0x0) at xterm.c:7538
#4  0x00007ffff66f4c81 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#5  0x00007ffff66f4f39 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#6  0x00007ffff66bf259 in gdk_display_get_event ()
    at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#7  0x00007ffff66f4cf2 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#8  0x00007ffff5653377 in g_main_context_dispatch ()
    at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007ffff56535e0 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007ffff565368c in g_main_context_iteration ()

xg_frame_resized has apparently now decided that the frame should be
2112x1040 instead of 1040x520, which is the real target size.  So...
twice as high, and slightly less as wide.

And then:

#0  0x0000000000424bf8 in change_frame_size (f=0x133ec30 <bss_sbrk_buffer+6645648>, new_width=2528, new_height=1264, pretend=false, delay=true, safe=false, pixelwise=true) at dispnew.c:5546
#1  0x000000000054de1d in xg_frame_resized (f=0x133ec30 <bss_sbrk_buffer+6645648>, pixelwidth=2560, pixelheight=1264) at gtkutil.c:886
#2  0x000000000052a10c in handle_one_xevent (dpyinfo=0x2e75b70, event=0x7fffffff90b0, finish=0xc6dc14 <current_finish>, hold_quit=0x7fffffff9380)
    at xterm.c:8676
#3  0x000000000052785f in event_handler_gdk (gxev=0x7fffffff90b0, ev=0x2d6d6f0, data=0x0) at xterm.c:7538
#4  0x00007ffff66f4c81 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#5  0x00007ffff66f4f39 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#6  0x00007ffff66bf259 in gdk_display_get_event ()
    at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#7  0x00007ffff66f4cf2 in  () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#8  0x00007ffff5653377 in g_main_context_dispatch ()
    at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007ffff56535e0 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007ffff565368c in g_main_context_iteration ()
    at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#11 0x00007ffff6bc2275 in gtk_main_iteration ()
    at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x000000000052ade8 in XTread_socket (terminal=0x1275e40 <bss_sbrk_buffer+5

So now gtk decided that the size should be 2528x1264 (which is the max
size and makes Emacs maximized).

So what could be the cause of these xg_frame_resized events?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no