static void clipboard_target_received_func(GtkClipboard *clipboard, GdkAtom *atoms, gint n_atoms, gpointer func) { gint i; VALUE ary = rb_ary_new(); for (i = 0; i < n_atoms; i++){ rb_ary_push(ary, BOXED2RVAL(atoms[i], GDK_TYPE_ATOM)); } rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), ary); }
static void clipboard_text_received_func(GtkClipboard *clipboard, const gchar *text, gpointer func) { VALUE vtext = Qnil; if (text) { vtext = CSTR2RVAL(text); } rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), vtext); }
static VALUE rg_s_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self) { GtkClipboard *clipboard; if (argc == 1){ VALUE selection; rb_scan_args(argc, argv, "10", &selection); clipboard = gtk_clipboard_get(RVAL2ATOM(selection)); } else { #if GTK_CHECK_VERSION(2,2,0) VALUE display, selection; rb_scan_args(argc, argv, "20", &display, &selection); clipboard = gtk_clipboard_get_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)), RVAL2ATOM(selection)); #else rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc); #endif } return CLIPBOARD2RVAL(clipboard); }
static void clipboard_get_func(GtkClipboard *clipboard, GtkSelectionData *selection_data, G_GNUC_UNUSED guint info, gpointer func) { rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), BOXED2RVAL(selection_data, GTK_TYPE_SELECTION_DATA)); }
static void clipboard_rich_text_received_func(GtkClipboard *clipboard, GdkAtom format, const guint8 *text, gsize length, gpointer func) { rb_funcall((VALUE)func, id_call, 3, CLIPBOARD2RVAL(clipboard), BOXED2RVAL(format, GDK_TYPE_ATOM), rb_str_new((char*)text, length)); }
static void clipboard_image_received_func(GtkClipboard *clipboard, GdkPixbuf *pixbuf, gpointer func) { rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), GOBJ2RVAL(pixbuf)); }
static void clipboard_received_func(GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer func) { rb_funcall((VALUE)func, id_call, 2, CLIPBOARD2RVAL(clipboard), BOXED2RVAL(selection_data, GTK_TYPE_SELECTION_DATA)); }
static VALUE rg_get_clipboard(VALUE self, VALUE selection) { return CLIPBOARD2RVAL(gtk_widget_get_clipboard(_SELF(self), RVAL2ATOM(selection))); }