Re: Issue using the "gtk_widget_get_allocated_height" instruction



Probably it's a consequence of this work for porting GtkMenuBar to use css
gadgets internally:
https://gitlab.gnome.org/GNOME/gtk/commit/700286c6

You should be able to get the appropriate size if you add menu items to the
bar, i.e. as long as the
menubar is not empty you get the appropriate height with
gtk_widget_get_allocated_height().

Luca

Il giorno ven 23 nov 2018 alle ore 16:23 Sébastien Le Roux <
sebastien leroux ipcms unistra fr> ha scritto:

Dear all, thanks for reading this,
I recently updated GTK from 3.22.24 to 3.22.30 (Fedora 27 to Fedora 28
update),
doing so something changed in behaviour of the program I am working on
(C code) at runtime.

In my program I create a GtkMenuBar widget, using the code:

GtkWidget * win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkWidget * gl_vbox =  gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (win), gl_vbox);
GtkWidget * menu_bar = gtk_menu_bar_new ();
gtk_box_pack_start (GTK_BOX (gl_box), menu_bar, FALSE, FALSE, 0);
GtkWidget * gl_area = gtk_gl_area_new ();
gtk_widget_set_size_request (gl_area, 100, 100);
gtk_box_pack_start (GTK_BOX (gl_box), gl_area, FALSE, FALSE, 0);

Before my update I could get the height of the menu bar after drawing
using:

int size = gtk_widget_get_allocated_height (menu_bar);

After my update the value of size is always 1, before the update it was
around 15,
obviously this new 1 value is messing with my program, not to mention
that it is not
what I see on the my computer screen, could anyone explain to me what to
do the get
the proper size of the GtkMenuBar ? (the gtk_widget_get_size_request is
useless).

Thanks for your help in the matter.

Best regards.

Sébastien Le Roux

--
===========================================================
Dr. Sébastien Le Roux
Ingénieur de Recherche CNRS
Institut de Physique et Chimie des Matériaux de Strasbourg
Département des Matériaux Organiques
23, rue du Loess
BP 43
F-67034 Strasbourg Cedex 2, France
E-mail: sebastien leroux ipcms unistra fr
Webpage: http://www-ipcms.u-strasbg.fr/spip.php?article1771
RINGS project: http://rings-code.sourceforge.net/
ISAACS project: http://isaacs.sourceforge.net/
Fax:   +33 3 88 10 72 46
Phone: +33 3 88 10 71 62
===========================================================

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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