Gtk stack widget transition mode discrepancy

I have installed gtk4-widget-factory using the command “sudo apt -y install gtk-4-examples”
in page 2, refer to center widget on the leftmost side. Two icons with title as News and Logo. In widget-factory*.ui, transition is set to crossfade.

but when I try executing gtk4-widget-factory transition was happening like rotating box.

I tried downloading source from Ubuntu – Details of package gtk-4-examples in jammy and used the widget-factory.ui. To my surprise, it is crossfade.

can some one help me understand why the difference between installed gtk4-widget-factory and the source compiled from widget-factory.ui

I am using Ubuntu 22.04

$ gtk4-widget-factory --version
gtk4-widget-factory 4.6.2

following is the small piece of code :

#include <gtk/gtk.h>

GtkWidget *
do_stack (GtkWidget *do_widget)
{
  static GtkWidget *window = NULL;

  if (!window)
    {
      GtkBuilder *builder;

	 builder = gtk_builder_new_from_file( "./widget-factory.ui" );
//      builder = gtk_builder_new_from_resource ("stack.ui");
      window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
      gtk_window_set_display (GTK_WINDOW (window),
                              gtk_widget_get_display (do_widget));
      g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);

      g_object_unref (builder);
    }

  if (!gtk_widget_get_visible (window))
    gtk_widget_show (window);
  else
    gtk_window_destroy (GTK_WINDOW (window));


  return window;
}

static void activate( GtkApplication *app, gpointer user_data )
{
	GtkWidget *window = gtk_application_window_new( app );
	do_stack( window );
	gtk_widget_show (window);
}

int main( int argc, char **argv )
{
	GtkApplication *app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
	g_signal_connect( app, "activate", G_CALLBACK( activate ), NULL );
	int status = g_application_run( G_APPLICATION( app ), argc, argv);
	g_object_unref( app );
	return status;
}

In widget-factory*.ui, transition is set to crossfade.

It’s not. https://gitlab.gnome.org/GNOME/gtk/-/blob/main/demos/widget-factory/widget-factory.ui#L1615

Magic numbers aside, that’s rotate-left-right. Are you sure you weren’t looking at the page 1/2/3 stack?

Alexm,

I checked again. It is widget-factory*.ui however, I commented crossfade and replaced with 22/rotate-left-right.
now the transition is as expected.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.