Subject: Re: bug#19990: 24.4; Bad resizing interaction when WM ignores size hints

From: "Jan D." <[email-masked]>
Date: Thu, 05 Mar 2015 17:36:07 +0100

martin rudalics skrev den 2015-03-05 09:04:
>  > Gtk+ does have code that tries to resize a window if it did not get
> the size it requested.
>
> How does it do that?

It keeps track of what resize it has done, and when the ConfigureNotify 
event arrives, it checks to see if it matches its constraints.  See code 
in Gtk+, gtkwindow.c (it is a mess).

> Why does a first resize with an odd size
> apparently get through at all?

Why shouldn't it?

>  Can't Gtk+ intercept thet first request?
> And how comes that Gtk+ is apparently not able to intercept the focus in
> reqest in the same way?

What do you mean by intercept?  Intercept from who?

>
> BTW, I never understood the following two comments in gtkutil.c:
>
>    /* Must use GTK routines here, otherwise GTK resets the size hints
>       to its own defaults.  */
>
> and
>
>        /* Don't set hints when maximized or fullscreen.  Apparently KWin
> and
>           Gtk3 don't get along and the frame shrinks (!).
>
> How could that possibly work?

Fine so far.  The hints specify things like resize increments which are 
the character size, i.e. you can only resize one full row at the time 
(at least when that comment was made).  If you have a fullscreen frame, 
and the font changes, in principle the hints should change.  But a 
change leads to a war between KWin and Gtk+ regarding who shall control 
the size of the frame.  So we don't change hints, we leave the old in place.

Gtk+ has its own copy of hints, which it sets by itself from time to 
time, and which it tries to enforce.  If we where to set hints with X 
functions, Gtk+ would try to enforce something it has, while the window 
manager would enforce what we actually set.  So we use Gtk+ routines sp 
that Gtk+ and the window manager have the same hints.

These to comments are not really related to each other.

> According to the first comment when we
> "don't set hints when maximized or fullscreen" we get "otherwise GTK
> resets the size hints to its own defaults".

I.e. make sure the window manager and Gtk+ have the same hints, but 
don't change them when fullscreen because Gtk+ and KWin implements 
enforcements of hints differently.  Gtk+ and the window manager still 
has our last non-fullscreen hints.

	Jan D.