[Bug 928076] GTK+ 3: Trying for changing the cursor-type in GTK+ 3 has no effect
http://bugzilla.suse.com/show_bug.cgi?id=928076
Felix Zhang
GTK+ 3: Trying for changing the cursor-type in GTK+ 3 has no effect 'gdk_cursor_new_for_display()' or 'gdk_cursor_new_from_name()' has no effect, you see only the standard cursor. Here an example:
#include
void program_end(GtkWidget *window) { gtk_widget_destroy(window); gtk_main_quit(); }
int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; GtkWidget *image; GdkWindow *cwindow,*parent; GdkDisplay *display; GdkCursor *cursor=NULL; GdkWindowAttr attributes; gint attributes_mask;
gtk_init (&argc, &argv);
attributes.window_type = GDK_WINDOW_OFFSCREEN | GDK_WINDOW_TOPLEVEL; attributes.cursor = cursor; attributes_mask = GDK_WA_CURSOR;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window),"Iconbuttontest"); gtk_window_set_default_size(GTK_WINDOW(window),200,50); gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER_ALWAYS); g_signal_connect(G_OBJECT(window),"destroy",G_CALLBACK(program_end),NULL);
button = gtk_button_new(); image=gtk_image_new_from_file("/home/rootuser/C-Programme/Anjuta-Programme/ Test/Iconbutton/DialogAbbruch1.png"); gtk_container_add(GTK_CONTAINER(window),button); gtk_container_add(GTK_CONTAINER(button),image); g_signal_connect_swapped (G_OBJECT(button),"clicked", G_CALLBACK(program_end),G_OBJECT(window));
parent = gtk_widget_get_parent_window(window); if (parent == NULL) parent = gdk_screen_get_root_window(gtk_widget_get_screen(window)); cwindow=gdk_window_new(parent, &attributes, attributes_mask); ^ // using default root window seems working cwindow=gdk_get_default_root_window(); display=gdk_display_get_default(); cursor=gdk_cursor_new_for_display(display,GDK_WATCH); /* also no effect: */ //cursor=gdk_cursor_new_from_name(display,"watch.png"); //cursor=gdk_cursor_new_for_display(gdk_display_get_default(),GDK_WATCH); gdk_window_set_cursor(cwindow, cursor);
gtk_widget_show_all(window);
gtk_main (); return 0; }
-- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com