LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices


Reply
  Search this Thread
Old 10-19-2018, 10:58 AM   #1
dr_berta
Member
 
Registered: Sep 2005
Location: Carpi (Modena) - Italy
Distribution: Ubuntu 20.04_x86_64 LTS; Slackware 13 64bit; Gentoo, Fedora, Yocto
Posts: 77

Rep: Reputation: 1
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
 
Old 10-19-2018, 11:15 AM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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. ??
 
Old 10-19-2018, 12:35 PM   #3
dr_berta
Member
 
Registered: Sep 2005
Location: Carpi (Modena) - Italy
Distribution: Ubuntu 20.04_x86_64 LTS; Slackware 13 64bit; Gentoo, Fedora, Yocto
Posts: 77

Original Poster
Rep: Reputation: 1
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

Last edited by dr_berta; 10-19-2018 at 12:40 PM. Reason: added new part of code
 
Old 02-16-2019, 08:18 AM   #4
dr_berta
Member
 
Registered: Sep 2005
Location: Carpi (Modena) - Italy
Distribution: Ubuntu 20.04_x86_64 LTS; Slackware 13 64bit; Gentoo, Fedora, Yocto
Posts: 77

Original Poster
Rep: Reputation: 1
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?
 
Old 02-28-2019, 12:39 PM   #5
dr_berta
Member
 
Registered: Sep 2005
Location: Carpi (Modena) - Italy
Distribution: Ubuntu 20.04_x86_64 LTS; Slackware 13 64bit; Gentoo, Fedora, Yocto
Posts: 77

Original Poster
Rep: Reputation: 1
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changed my theme to GTK on kde4 and can't get it back.. Vic1ous Slackware 6 01-15-2011 02:07 AM
GTK theme: not all widgets are changed kornerr Linux - General 1 01-16-2006 09:05 AM
PHP code did not create a cookie and it did not changed the background and text color Linh Programming 5 07-29-2004 10:15 PM
get-background-color in GTK+-2.0 fromzj Programming 0 04-04-2004 03:46 AM
GTK 1.2 Changing labels on the fly The Yeti Lives Linux - Newbie 1 06-12-2003 02:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo

All times are GMT -5. The time now is 09:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration