Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[RISOLTO]GTK+-2.24.32 sfondo label diverso su due VM gemelle
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
dr_berta
n00b
n00b


Joined: 07 Mar 2016
Posts: 36
Location: Carpi (MO)

PostPosted: Tue Jan 21, 2020 10:56 am    Post subject: [RISOLTO]GTK+-2.24.32 sfondo label diverso su due VM gemelle Reply with quote

Ciao,
ho un problema con gli sfondi delle label delle GTK+ 2.24.32. Ho due macchine virtuali gentoo gemelle su cui sono installati gli stessi packages. kernel 4.14.83.
Sto lavorando su una applicazione grafica basata sulle GTK 2 ed ho visto che a seconda della macchina su cui provo a far girare il codice, lo sfondo delle label e delle gtk_entry è diverso
Lo sfondo è gestito usando una event box come base per le labels e modificando lo sfondo della event box.

Avete idea del perchè l'applicativo si comporta diversamente sulle due macchine virtuali?
Come posso risolvere la cosa?
Questo comportamento è nato solo a partire da questa versione delle GTK2

Grazie
Claudio


Last edited by dr_berta on Tue Jan 21, 2020 1:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
dr_berta
n00b
n00b


Joined: 07 Mar 2016
Posts: 36
Location: Carpi (MO)

PostPosted: Tue Jan 21, 2020 11:22 am    Post subject: Reply with quote

Nei link sotto potete vedere cosa ottengo nei due casi

Effetto errato:
https://ibb.co/WFq7n6J

Effetto buono:
https://ibb.co/CPfsnrp
Back to top
View user's profile Send private message
sabayonino
Veteran
Veteran


Joined: 03 Jan 2012
Posts: 1057

PostPosted: Tue Jan 21, 2020 12:00 pm    Post subject: Reply with quote

Impostazioni GTK utente diverse ?
_________________
LRS 64/32
Back to top
View user's profile Send private message
dr_berta
n00b
n00b


Joined: 07 Mar 2016
Posts: 36
Location: Carpi (MO)

PostPosted: Tue Jan 21, 2020 1:36 pm    Post subject: Reply with quote

Sì. Il tema delle finestre è diverso.
Nella macchina in cui tutto va bene ho il tema xfce 4.4, mentre nell'altra ho il tema adwaita.

Pare che il tema adwaita sia il responsabile di questa cosa. Ho messo il tema xfce 4.4 anche nell'altra VM ed ora tutto funziona perfettamente.

Non mi sembra una gran bella cosa che il tema delle finestre vada ad influenzare una applicazione che ha un suo tema. 8O

Grazie della dritta.
Claudio
Back to top
View user's profile Send private message
sabayonino
Veteran
Veteran


Joined: 03 Jan 2012
Posts: 1057

PostPosted: Tue Jan 21, 2020 8:30 pm    Post subject: Reply with quote

prova a fare un confronto del file

Code:
.gtkrc-2.0


nella home di ogni utente , sia applicando lo stesso tema in entrambe le VM , sia alternando i due temi

PS : noto dalle due immagini da te postate che ogni "etichetta" del tasto ha uno sfondo suo. Probabilmente il background e la relativa inversione del colore applicato tra PrimoPiano/Sfondo è gestita diversamente dall'engine oltre che dal tema stesso.

Oppure alle etichette dei vari tasti dovresti dare una trasparenza e non uno sfondo fisso
_________________
LRS 64/32
Back to top
View user's profile Send private message
dr_berta
n00b
n00b


Joined: 07 Mar 2016
Posts: 36
Location: Carpi (MO)

PostPosted: Wed Jan 22, 2020 1:45 pm    Post subject: Reply with quote

.gtkrc-2.0 non è presente nella cartella utente.

Confermo che se abilito lo stile adwaita ho il problema in entrambe le VM e se uso lo stile Xfce non ho il problema.

Il codice usato per ogni riga di tasti è il seguente:
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);
   }


Edit: Le gtk_entry sarebbero trasparenti. Il codice è vecchio quindi non proprio corretto (infatti cerco di cambiare lo sfondo della gtk_entry). Qui però ho una event box in cui metto il disegno di un pulsante (per avere il mio stile) e poi sovrappongo all'array di tasti un array di gtk_entry che quindi dovrebbero prendere come sfondo quello dell'align o del gtk_box. Se esiste un altro modo per sovrapporre una gtk_entry ad una gtk_image vi sono grato se me lo fate conoscere

Ciao
Back to top
View user's profile Send private message
sabayonino
Veteran
Veteran


Joined: 03 Jan 2012
Posts: 1057

PostPosted: Thu Jan 23, 2020 11:59 am    Post subject: Reply with quote

Purtroppo non ho mai smanettato con le GTK.
Non saprei come aiutarti in questo caso.
_________________
LRS 64/32
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum