Wait cursor animation does not work properly



Since a few months I have observed that for my chess game the mouse
pointer/cursor animation stopped working properly.

Yesterday I tried cleaning up the code for moving the game GUI to the
new high level Nim GTK GUI, but I was unable to get it working.

When I moved the busy-cursor out of the application window and back
again, animation stops. Same if I used g_idle_add() call -- animation
stops as long as idle function (computer chess engine) is active.

I was not able to find recent bug reports about this, so I am not sure
if I am doing something wrong (do not really think so.)

So I just grabbed a C demo application from the gnome side and added
set cursor stuff. There is no idle function currently, but the problem
occurs already when I move the animated cursor out of the window and
back again. Animation stops.

This is for gtk+-3.22.16:3::gentoo GDM display manager logged in under
WAYLAND.

// gcc t.c `pkg-config --libs --cflags gtk+-3.0`

#include <gtk/gtk.h>

static void
button_clicked (GtkButton *button,
                gpointer   user_data)
{
  const char *old_label;
  char *new_label;
  old_label = gtk_button_get_label (button);
  new_label = g_utf8_strreverse (old_label, -1);
  gtk_button_set_label (button, new_label);
  g_free (new_label);
}
static void
activate (GtkApplication *app,
          gpointer        user_data)
{
  GtkWidget *window;
  GtkWidget *button;
  GdkDisplay *display;
  GdkCursor *cursor;
  window = gtk_application_window_new (app);
  gtk_window_set_title (GTK_WINDOW (window), "GNOME Button");
  gtk_window_set_default_size (GTK_WINDOW (window), 250, 50);
  button = gtk_button_new_with_label ("Click Me");
  gtk_container_add (GTK_CONTAINER (window), button);
  g_signal_connect (GTK_BUTTON (button),
                    "clicked", 
                    G_CALLBACK (button_clicked), 
                    G_OBJECT (window));
  gtk_widget_show_all (window);
  display = gdk_display_get_default();
  cursor = gdk_cursor_new_from_name(display, "wait");
  gdk_window_set_cursor(gtk_widget_get_window(window), cursor);
}

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]