Re: Issue using the "gtk_widget_get_allocated_height" instruction
Le 24/11/2018 à 15:59, Luca Bacci a écrit : 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 Thank you very much for your reply, it works nicely with the "invisible" item. I do have in my code objects (GtkColorBar, GtkButtton) for which I created css properties my self to match some specifics using: void provide_gtk_css (gchar * css) { GtkCssProvider * provider = gtk_css_provider_new (); gtk_css_provider_load_from_data (provider, css, -1, NULL); gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); } About what I understand this is now automatic (somewhat) for many (all ?) widgets, Out of curiosity do you think that there is anyway to get that heigh value from a query to the css properties of that menu bar ? is there anyway to send query to the css ? Best Sébastien -- === 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.ler...@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
Re: Issue using the "gtk_widget_get_allocated_height" instruction
Hi Sébastien! It's not simple, but you may try with combinations of GtkStyleContext *style = gtk_widget_get_style_context(widget); GValue value = G_VALUE_INIT; gtk_style_context_get_style_property(style, "prop-name", &value); //or gtk_style_context_get_property(style, "prop-name", &value); /* ... */ g_value_unset(&value) //free memory Unfortunately, that's all I can say, I'm not expert in this area. Probably it's going to be rather complicated. Luca Il giorno lun 26 nov 2018 alle ore 16:34 Sébastien Le Roux < sebastien.ler...@ipcms.unistra.fr> ha scritto: > Le 24/11/2018 à 15:59, Luca Bacci a écrit : > > 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 > > Thank you very much for your reply, it works nicely with the "invisible" > item. > > I do have in my code objects (GtkColorBar, GtkButtton) for which I created > css > properties my self to match some specifics using: > > > void provide_gtk_css (gchar * css) > { > GtkCssProvider * provider = gtk_css_provider_new (); > gtk_css_provider_load_from_data (provider, css, -1, NULL); > gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), > GTK_STYLE_PROVIDER(provider), > > GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); > g_object_unref (provider); > } > > > About what I understand this is now automatic (somewhat) for many (all ?) > widgets, > > Out of curiosity do you think that there is anyway to get that heigh value > from > a query to the css properties of that menu bar ? is there anyway to send > query to the css ? > > > Best > > > Sébastien > > -- > === > 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.ler...@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
Re: Issue using the "gtk_widget_get_allocated_height" instruction
If you really need, you can fake it by adding a menuitem with empty text and setting it to invisible with gtk_widget_set_visible(menuitem, false); Il giorno sab 24 nov 2018 alle ore 15:59 Luca Bacci ha scritto: > 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.ler...@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.ler...@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 > > ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
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.ler...@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.ler...@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 ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list