LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Gentoo (https://www.linuxquestions.org/questions/gentoo-87/)
-   -   GTK+-2.24.32 Labels background cannot be changed (https://www.linuxquestions.org/questions/gentoo-87/gtk-2-24-32-labels-background-cannot-be-changed-4175640723/)

dr_berta 10-19-2018 10:58 AM

GTK+-2.24.32 Labels background cannot be changed
 
Hi,
I have a graphic program based on GTK2 running on a panel PC with gentoo kernel 4.4.150. It worked well for years with kernel 3.x, but now we had to change the panel PC crossing from a 32 bits to a 64 bits system.
Also Gentoo has been upgraded from kernel 3.14 to 4.4.150. I tried before even the last kernel (4.15), but some drivers were incompatible, so I downgraded the kernel to the 4.4.150

The problem is that when I try to run the progran on the new system I see that the background of the labels is always white instead of the correct color and their dimensions are changed
I developed the software with gtk+ 2.24.5, but now the revision is 2.24.32.

Do you have some suggestion about how to solve the probel?

Thanks
Claudio

BW-userx 10-19-2018 11:15 AM

gtk has a deprecated use thins instead listings \
https://developer.gnome.org/gtk2/sta...eprecated.html

maybe needs updating, maybe rewrite it from the start. ??

dr_berta 10-19-2018 12:35 PM

GTK+-2.24.32 Labels background cannot be changed
 
We are evaluating if it is better to migrate to the GTK3 than to the Qt, but, in any case, this will require time because the software is complex.
During this time, since the software was working well on an ubuntu 16.04 system (kernel 4.4), we were confident that even on a gentoo system it should work well.
We tested it on the new panel pc using a gentoo kernel 3.14.14 and 3.16 and it was working well.

The problem is born when we installed the last version of gentoo with kernel 4.15. At this point I tried to downgrade the kernel to the 4.4.150 hoping that this could solve the issue. Unfortunately not.

In any case the software is running well even on an ubuntu 18.04 with kernel 4.15, so I'm asking were the problem could be located.
Doing ldd we saw that all the required dependencies are satisfied, thus were is the difference between the two systems?
Why do the instruction
Code:

gtk_widget_modify_base(gkt_entry,GTK_STATE_NORMAL &color)
works in one system and not into the other?

the part of code that is not running is the following:
Code:

for (j=0; j<=9; j++)
        {
            eventkbd[k] = gtk_event_box_new ();
            g_signal_connect(G_OBJECT(eventkbd[k]), "button_press_event", G_CALLBACK(keyboard_button_pressed_L), (gpointer)k);
                gtk_box_pack_start(GTK_BOX(kbox1), eventkbd[k], FALSE, FALSE, 0);
                gtk_widget_modify_bg (eventkbd[k], GTK_STATE_NORMAL, &color4);
                gtk_widget_show (eventkbd[k]);
                imgkbd[k] = gtk_image_new_from_file(z);
                gtk_container_add (GTK_CONTAINER (eventkbd[k]), imgkbd[k]);
                gtk_widget_show (imgkbd[k++]);
                //
                text2[q] = gtk_entry_new ();
                gtk_widget_modify_font (text2[q], fd);
                gtk_widget_set_size_request(text2[q], KTW, KTH);
                gtk_widget_modify_text(text2[q], GTK_STATE_NORMAL, &color5);
                gtk_widget_modify_text(text2[q], GTK_STATE_ACTIVE, &color5);
                gtk_widget_modify_base (text2[q], GTK_STATE_NORMAL, &color6);
                gtk_widget_modify_base (text2[q], GTK_STATE_ACTIVE, &color6);
                gtk_entry_set_alignment(GTK_ENTRY(text2[q]), 0.5);
                sprintf(z3, "%c", kc[k-1]);
                gtk_entry_set_text(GTK_ENTRY(text2[q]), z3);
                gtk_entry_set_editable(GTK_ENTRY(text2[q]), FALSE);
                gtk_entry_set_has_frame (GTK_ENTRY(text2[q]), FALSE);
                gtk_widget_show(text2[q]);
                align = gtk_alignment_new(0.5, 0.5, 0, 0);
                gtk_widget_show(align);
                gtk_container_add(GTK_CONTAINER(align), text2[q++]);
                gtk_box_pack_start(GTK_BOX(ktbox1), align, FALSE, FALSE, (KBDIW-KTW)/2);
        }

I prefer gentoo instead of ubuntu because gentoo is optimized for the system.

I'm open to any suggestion
Thank's
Claudio

dr_berta 02-16-2019 08:18 AM

I tried, as recommended in the gtk2 documentation, to create an event box and place the gtk_entry into the event box to change the background color of the entry.

Unfortunately, this doesn't work.
Better, this doesnt work on a gentoo system, but it works on an ubuntu system where the gtk2 have been patched.
Does this means that the gtk+ 2.24.32 library has a bug?

dr_berta 02-28-2019 12:39 PM

HI,
finally I found the solution to my problem.

The issue is due to the theme. In particular the Adwaita theme interferes with the functionaslity of the gtk_entry, gtk_frame and gtk_labels.

So, to solve my issue I had to remove the Adwaita theme and load the gentoo-engine with its standard themes.
After that, all the graphic functionality of my application started to work properly.

No comments about this.


All times are GMT -5. The time now is 09:45 AM.