emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 30dbdecd4a: * src/xterm.c: Add a small writeup on input handl


From: Po Lu
Subject: Re: master 30dbdecd4a: * src/xterm.c: Add a small writeup on input handling on X.
Date: Sat, 15 Jan 2022 18:10:45 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

martin rudalics <rudalics@gmx.at> writes:

> I can do that but note that most of the frame resizing code is shared
> among X and other backends - in particular, the necessity to call
> change_frame_size, set delayed_size_change there, call adjust_frame_size
> eventually ...

I think xterm.c is still the right place to put that information, since
xterm is essentially the reference implementation for an Emacs window
system.

> Can you see any necessity to call widget_update_wm_size_hints here?

Yes.  Xt has its own idea about size hints, and bad things will happen
if Xt doesn't know about them.

Ideally, we would actually just set the size hints on the EmacsShell
widget (that is the WMShell, since EmacsShell extends ApplicationShell,
which subclasses WMShell), and rely on Xt to do the heavy lifting.  I
will give that a look soon enough.

> The second question is with XSetWMSizeHints in emacsgtkfixed.c: _My_
> version of its starts as
>
> /* Override the X function so we can intercept Gtk+ 3 calls.
>    Use our values for min_width/height so that KDE don't freak out
>    (Bug#8919), and so users can resize our frames as they wish.
>
>    2021 REMIX: But do override only if x_gtk_override_size_hints is true
>    (the default).  If x_gtk_override_size_hints is false, proceed with
>    the original specification so shrinking frames with a specified
>    minimum size works as intended (Bug#46963) and Emacs is always
>    informed of the real sizes the WM reserves for its windows.
>
>    We really should default x_gtk_override_size_hints to nil by default,
>    but this can be done only after sufficient experience has been
>    gathered, in particular on KDE.  Ideally, the code below will be
>    dropped, the sooner the better.  */
>
> void
> XSetWMSizeHints (Display *d, Window w, XSizeHints *hints, Atom prop)
> {
>   struct x_display_info *dpyinfo = x_display_info_for_display (d);
>   struct frame *f = x_top_window_to_frame (dpyinfo, w);
>   long data[18];
>
>   data[0] = hints->flags;
>   ...
>   data[17] = hints->win_gravity;
>
>   if (x_gtk_override_size_hints && hints->flags & PMinSize && f)
>     {
> #ifdef HAVE_PGTK
>       int w = f->output_data.pgtk->size_hints.min_width;
>       int h = f->output_data.pgtk->size_hints.min_height;
> #else
>       int w = f->output_data.x->size_hints.min_width;
>       int h = f->output_data.x->size_hints.min_height;
> #endif
>       data[5] = w;
>       data[6] = h;
>     }
>
> Do you think we could eventually drop that overriding code invented by
> Jan back then?

Yes, I think we could (and should).  But I would introduce that option
first, ask most of the the people tracking master to set it to nil, and
if it seems okay after a year or two to then delete the code entirely.

> BTW one of these
>
> #ifndef HAVE_PGTK
> #ifdef HAVE_PGTK
> #else
> #endif
> #endif
>
> in that code should be eliminated - but I don't know which.

#ifdef HAVE_PGTK
      int w = f->output_data.pgtk->size_hints.min_width;
      int h = f->output_data.pgtk->size_hints.min_height;
#else
      int w = f->output_data.x->size_hints.min_width;
      int h = f->output_data.x->size_hints.min_height;
#endif

Should be replaced by the contents of the !HAVE_PGTK branch, since no X
function is overridden on PGTK.

Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]