Problem with changing cursor; can you help, please?



I am trying to find out how to change the cursor style, but I have not
yet found out how to do it successfully.

I generated a small program with glade, that has only a top-level window
containing a button.  The callback for the button is shown below.

When I run this, and click the button, I get:

Gdk-ERROR **: BadCursor (invalid Cursor parameter)
  serial 194 error_code 6 request_code 2 minor_code 0

I can't relate any of these numbers to anything I have done.

============================= callbacks.c =============================

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif
    
#include <gtk/gtk.h>
#include <gdk/gdk.h>
    
#include "callbacks.h"
#include "interface.h"
#include "support.h"
    
static int cursorno = GDK_HAND1;
    
void
on_button1_clicked                     (GtkButton       *button,
                                        gpointer         user_data)
{
        GdkCursor cursorstruct;
        GdkWindow *w;
    
        switch (cursorno) {
            case GDK_ARROW:
                cursorno = GDK_DIAMOND_CROSS;
                break;
            case GDK_DIAMOND_CROSS:
                cursorno = GDK_HAND1;
                break;
            case GDK_HAND1:
                cursorno = GDK_ARROW;
                break;
        };
                
    
        cursorstruct.type = cursorno;
    
        w = button->bin.container.widget.window;
        gdk_window_set_cursor(w, &cursorstruct);
}
-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "Follow peace with all men, and holiness, without which
      no man shall see the Lord."       Hebrews 12:14 




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