I am working on some application, where we draw widgets like "RadioButton", 
"CheckButton" etc. by calling "gtk_render_option", "gtk_render_check" and so 
forth. Our application works fine on gtk 3.18, but on gtk 3.22, the widgets are 
not drawn correctly. I have gone through the changes made in theme handling on 
3.20 and tried to make some changes in my application, but I am not able to 
understand what I need to do exactly. 


I have created a small demo where I draw "RadioButton" using the 
gtk_render_option API. This works fine for me in gtk-3.18, but the causes issue 
in gtk 3.22. I am attaching images and Demo.c for reference. It would be great 
if someone here can guide me on "How can I make this small demo work on gtk 
3.22". I should be able to take care of the rest myself. I can provide any 
further information required.


Note: I have tried both "radio" and "radiobutton" in 
gtk_style_context_add_class API. Both don't work for me.





#include <string.h>
#include <gtk/gtk.h>

static gboolean
draw_cb_options (GtkWidget *widget, cairo_t *cr)
  GtkStyleContext *context;

  context = gtk_widget_get_style_context (widget);

  gtk_style_context_save (context);

  gtk_style_context_add_class (context, "radio");
  gtk_style_context_set_state (context, 0);
  gtk_render_option (context, cr, 10, 50, 40, 40);
  gtk_style_context_set_state (context, GTK_STATE_FLAG_CHECKED);
  gtk_render_option (context, cr, 70, 50, 40, 40);
  gtk_style_context_set_state (context, GTK_STATE_FLAG_INCONSISTENT);
  gtk_render_option (context, cr, 120, 50, 40, 40);
  gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE);
  gtk_render_option (context, cr, 170, 50, 40, 40);

  gtk_style_context_restore (context);

  return TRUE;

int main (int argc, char *argv[])
  GtkWidget *window;
  GtkStyleContext *context;
  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "draw", G_CALLBACK (draw_cb_options), NULL);
  gtk_widget_show_all (window);

  gtk_main ();

  return 0;

gtk-app-devel-list mailing list

Reply via email to