Can't realize widget after gtk_drag_set_icon_pixmap ()

I have got a problem.
The result of code below work is following warning message:
Gdk-ERROR **: The program 'test' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 148 error_code 8 request_code 2 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error()
Trace/breakpoint trap

This error erase only if I call gtk_widget_realize () for new widget
after gtk_drag_set_icon_pixmap ().
 What's wrong here? Is any way exist to avoid this problem?


Code example:
#include <gtk/gtk.h>
#include <stdlib.h>

main (int argc, char** argv)
GtkTargetEntry target_table[] = {
    {"text/plain", GTK_TARGET_SAME_APP, 0},
    {"text/html", GTK_TARGET_SAME_APP, 1},
    {"image/x-pixmap", GTK_TARGET_SAME_APP, 2},
    {"application/x-rootwin-drop", GTK_TARGET_SAME_APP, 3}
gint n_targets = 3; /*no rootwin*/

GtkWidget* widget;
GdkDragContext* drag_context;
GtkTargetList* target_list;
GdkColormap *colormap;
GdkPixmap *pixmap;

gtk_init (&argc, &argv);

colormap = gdk_colormap_get_system ();
pixmap = gdk_pixmap_new (NULL, 1, 1, 1);

widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_realize (widget);
target_list =  gtk_target_list_new (target_table, n_targets);
drag_context = gtk_drag_begin (widget, target_list, GDK_ACTION_DEFAULT,
0, NULL);

gtk_drag_set_icon_pixmap (drag_context, colormap, pixmap, NULL, 0, 0);

widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_realize (widget);

return 0;

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