static gboolean dnd_target_receive_data(JNIEnv *env, GdkAtom target, selection_data_ctx *selection_ctx) { GevlHookRegistration hookReg; memset(selection_ctx, 0, sizeof(selection_data_ctx)); gdk_selection_convert(GLASS_GDK_DRAG_CONTEXT_GET_DEST_WINDOW(enter_ctx.ctx), gdk_drag_get_selection(enter_ctx.ctx), target, GDK_CURRENT_TIME); hookReg = glass_evloop_hook_add( (GevlHookFunction) wait_for_selection_data_hook, selection_ctx); if (HANDLE_MEM_ALLOC_ERROR(env, hookReg, "Failed to allocate event hook")) { return TRUE; } do { gtk_main_iteration(); } while (!(selection_ctx->received)); glass_evloop_hook_remove(hookReg); return selection_ctx->data != NULL; }
void process_dnd_source(GdkWindow *window, GdkEvent *event) { switch(event->type) { case GDK_MOTION_NOTIFY: process_dnd_source_mouse_motion(window, &event->motion); break; case GDK_BUTTON_RELEASE: process_dnd_source_mouse_release(window, &event->button); break; case GDK_DRAG_STATUS: process_dnd_source_drag_status(window, &event->dnd); break; case GDK_DROP_FINISHED: process_dnd_source_drop_finished(window, &event->dnd); break; case GDK_KEY_PRESS: case GDK_KEY_RELEASE: process_dnd_source_key_press_release(window, &event->key); break; case GDK_DRAG_ENTER: gdk_selection_owner_set(dnd_window, gdk_drag_get_selection(get_drag_context()), GDK_CURRENT_TIME, FALSE); break; case GDK_SELECTION_REQUEST: process_dnd_source_selection_req(window, &event->selection); break; default: break; } }
int clip_GDK_DRAGGETSELECTION(ClipMachine * cm) { C_object *ccontext = _fetch_co_arg(cm); GdkAtom atom ; C_object *catom ; if (!ccontext || ccontext->type != GDK_TYPE_DRAG_CONTEXT) goto err; atom = gdk_drag_get_selection((GdkDragContext*)ccontext->object); if (atom) { catom = _list_get_cobject(cm, atom); if (!catom) catom = _register_object(cm, atom, GDK_TYPE_ATOM, NULL, NULL); if (catom) _clip_mclone(cm, RETPTR(cm), &catom->obj); } return 0; err: return 1; }
/* Instance Methods */ static VALUE rg_selection(VALUE self) { return BOXED2RVAL(gdk_drag_get_selection(_SELF(self)), GDK_TYPE_ATOM); }