Subject: Re: bug#25851: 25.2; GTK warning when starting Emacs when desktop file has more than one frame

From: [email-masked] (N. Jackson)
Date: Fri, 24 Feb 2017 11:09:22 -0500

At 16:10 +0200 on Friday 2017-02-24, Eli Zaretskii wrote:
>
> So the question now becomes: how is invoking
> x-create-frame-with-faces via frameset-restore is different from
> the same operation invoked, say, via "C-x 5 b"? (I understand
> that the latter doesn't cause GTK to emit the warning, right?)

Right. And the answer is that with `C-x 5 2' (and `C-x 5 b'),
while `xg_set_geometry' is called, the body of it seems to be
skipped [you had better check my use of GDB, here because the
results confuse me so maybe I'm using it wrong] so
`gtk_window_parse_geometry' never gets called.

For convenience, the full code, with line numbers, of
`xg_set_geometry' is:

  (gdb) list gtkutil.c:780
  775     static void
  776     xg_set_geometry (struct frame *f)
  777     {
  778       if (f->size_hint_flags & (USPosition | PPosition))
  779         {
  780           int left = f->left_pos;
  781           int xneg = f->size_hint_flags & XNegative;
  782           int top = f->top_pos;
  783           int yneg = f->size_hint_flags & YNegative;
  784           char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
  (gdb) list +20
  800                                   | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
  801
  802           if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
  803                                           geom_str))
  804             fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
  805
  806           g_log_remove_handler ("Gtk", id);
  807         }
  808     }
  809

This is my interaction with GDB after `C-x 5 2':

  Thread 1 "emacs" hit Breakpoint 3, xg_set_geometry (f=0x386d000) at gtkutil.c:778
  778       if (f->size_hint_flags & (USPosition | PPosition))
  (gdb) print f->size_hint_flags 
  $3 = 0
  (gdb) print USPosition
  No symbol "USPosition" in current context.
  (gdb) print PPosition
  No symbol "PPosition" in current context.
  (gdb) print (USPosition | PPosition)
  No symbol "USPosition" in current context.
  (gdb) print (f->size_hint_flags & (USPosition | PPosition))
  No symbol "USPosition" in current context.
  (gdb) n
  808     }
  (gdb)

Is my syntax wrong when I try to get the values?

Thanks.

N.