Re: Size negotiation and initial top-window size



Nikolaj Thygesen wrote:
Olivier Guilyardi wrote:
Hi all,

Isn't there a way for a widget to say "I would like this size, but I
can shrink"
 during the size negotiation process ?

Regards,

As I understand your question, I believe what you need is:

gtk_window_set_default_size(GTK_WINDOW(window), width, height);

No, in my case it makes no difference with gtk_window_resize ().

I cannot determine the window size before the size negotiation has started. My
window contains normal widgets, but also a special (audio pattern) editor
widget, which content size scales with gtk's default font size.

The editor widget's content is a grid, composed of an undetermined number of
rows and columns. The cell sized is indexed on gtk's font size.

So here's what I currently do:

1 - the editor widget receives the size-request event. It sets the requisition
size to the smallest possible.

2 - the editor widget receives the size-allocate event. It organized its layout
accordingly to this allocation, but also sends a special "size-delta-event",
which indicates by how much it needs to grow in order to display the whole grid

3 - the first time the main window receives the "size-delta-event", it tries to
resize itself by increasing its widget and height according to what the editor
widget needs.

It works fine, the editor content fits well into the initial window size, and
the user can shrink the window.

However, my question was about removing the extra step induced by the
"size-delta-event", by finding a way for the editor widget to request a
non-mandatory/default size.

Regards,

-- 
  Olivier Guilyardi / Samalyse



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