?? gdkdnd-fb.c
字號:
gdk_window_ref (window); tmp_list = g_list_last (targets); new_context->targets = NULL; while (tmp_list) { new_context->targets = g_list_prepend (new_context->targets, tmp_list->data); tmp_list = tmp_list->prev; } new_context->actions = 0; return new_context;}guint32gdk_drag_get_protocol_for_display (GdkDisplay *display, guint32 xid, GdkDragProtocol *protocol){ GdkWindow *window; window = gdk_window_lookup ((GdkNativeWindow) xid); if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered"))) { *protocol = GDK_DRAG_PROTO_LOCAL; return xid; } *protocol = GDK_DRAG_PROTO_NONE; return 0;}static GdkWindow *get_toplevel_window_at (GdkWindow *ignore, gint x_root, gint y_root){ GdkWindowObject *private; GdkWindowObject *sub; GdkWindowObject *child; GList *ltmp, *ltmp2; private = (GdkWindowObject *)_gdk_parent_root; for (ltmp = private->children; ltmp; ltmp = ltmp->next) { sub = ltmp->data; if ((GDK_WINDOW (sub) != ignore) && (GDK_WINDOW_IS_MAPPED (sub)) && (x_root >= sub->x) && (x_root < sub->x + GDK_DRAWABLE_IMPL_FBDATA (sub)->width) && (y_root >= sub->y) && (y_root < sub->y + GDK_DRAWABLE_IMPL_FBDATA (sub)->height)) { if (g_object_get_data (G_OBJECT (sub), "gdk-window-child-handler")) { /* Managed window, check children */ for (ltmp2 = sub->children; ltmp2; ltmp2 = ltmp2->next) { child = ltmp2->data; if ((GDK_WINDOW (child) != ignore) && (GDK_WINDOW_IS_MAPPED (child)) && (x_root >= sub->x + child->x) && (x_root < sub->x + child->x + GDK_DRAWABLE_IMPL_FBDATA (child)->width) && (y_root >= sub->y + child->y) && (y_root < sub->y + child->y + GDK_DRAWABLE_IMPL_FBDATA (child)->height)) return GDK_WINDOW (child); } } else return GDK_WINDOW (sub); } } return NULL;}voidgdk_drag_find_window_for_screen (GdkDragContext *context, GdkWindow *drag_window, GdkScreen *screen, gint x_root, gint y_root, GdkWindow **dest_window, GdkDragProtocol *protocol){ GdkWindow *dest; g_return_if_fail (context != NULL); dest = get_toplevel_window_at (drag_window, x_root, y_root); if (dest == NULL) dest = _gdk_parent_root; if (context->dest_window != dest) { guint32 recipient; /* Check if new destination accepts drags, and which protocol */ if ((recipient = gdk_drag_get_protocol ((guint32)dest, protocol))) { *dest_window = gdk_window_lookup ((GdkNativeWindow) recipient); gdk_window_ref (*dest_window); } else *dest_window = NULL; } else { *dest_window = context->dest_window; if (*dest_window) gdk_window_ref (*dest_window); *protocol = context->protocol; } }gboolean gdk_drag_motion (GdkDragContext *context, GdkWindow *dest_window, GdkDragProtocol protocol, gint x_root, gint y_root, GdkDragAction suggested_action, GdkDragAction possible_actions, guint32 time){ GdkDragContextPrivate *private; g_return_val_if_fail (context != NULL, FALSE); private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context); if (context->dest_window != dest_window) { GdkEvent temp_event; /* Send a leave to the last destination */ gdk_drag_do_leave (context, time); private->drag_status = GDK_DRAG_STATUS_DRAG; /* Check if new destination accepts drags, and which protocol */ if (dest_window) { context->dest_window = dest_window; gdk_window_ref (context->dest_window); context->protocol = protocol; switch (protocol) { case GDK_DRAG_PROTO_LOCAL: local_send_enter (context, time); break; default: break; } context->suggested_action = suggested_action; } else { context->dest_window = NULL; context->action = 0; } /* Push a status event, to let the client know that * the drag changed */ temp_event.dnd.type = GDK_DRAG_STATUS; temp_event.dnd.window = context->source_window; /* We use this to signal a synthetic status. Perhaps * we should use an extra field... */ temp_event.dnd.send_event = TRUE; temp_event.dnd.context = context; temp_event.dnd.time = time; gdk_event_put (&temp_event); } else { context->suggested_action = suggested_action; } /* Send a drag-motion event */ private->last_x = x_root; private->last_y = y_root; if (context->dest_window) { if (private->drag_status == GDK_DRAG_STATUS_DRAG) { switch (context->protocol) { case GDK_DRAG_PROTO_LOCAL: local_send_motion (context, x_root, y_root, suggested_action, time); break; case GDK_DRAG_PROTO_NONE: g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_motion()"); break; default: break; } } else return TRUE; } return FALSE;}voidgdk_drag_drop (GdkDragContext *context, guint32 time){ g_return_if_fail (context != NULL); if (context->dest_window) { switch (context->protocol) { case GDK_DRAG_PROTO_LOCAL: local_send_drop (context, time); break; case GDK_DRAG_PROTO_NONE: g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_drop()"); break; default: break; } }}voidgdk_drag_abort (GdkDragContext *context, guint32 time){ g_return_if_fail (context != NULL); gdk_drag_do_leave (context, time);}/* Destination side */void gdk_drag_status (GdkDragContext *context, GdkDragAction action, guint32 time){ GdkDragContextPrivate *private; GdkDragContext *src_context; GdkEvent tmp_event; g_return_if_fail (context != NULL); private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context); src_context = gdk_drag_context_find (TRUE, context->source_window, context->dest_window); if (src_context) { GdkDragContextPrivate *private = GDK_DRAG_CONTEXT_PRIVATE_DATA (src_context); if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT) private->drag_status = GDK_DRAG_STATUS_DRAG; tmp_event.dnd.type = GDK_DRAG_STATUS; tmp_event.dnd.window = context->source_window; tmp_event.dnd.send_event = FALSE; tmp_event.dnd.context = src_context; gdk_drag_context_ref (src_context); tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */ if (action == GDK_ACTION_DEFAULT) action = 0; src_context->action = action; gdk_event_put (&tmp_event); }}void gdk_drop_reply (GdkDragContext *context, gboolean ok, guint32 time){ g_return_if_fail (context != NULL);}void gdk_drop_finish (GdkDragContext *context, gboolean success, guint32 time){ GdkDragContextPrivate *private; GdkDragContext *src_context; GdkEvent tmp_event; g_return_if_fail (context != NULL); private = GDK_DRAG_CONTEXT_PRIVATE_DATA (context); src_context = gdk_drag_context_find (TRUE, context->source_window, context->dest_window); if (src_context) { tmp_event.dnd.type = GDK_DROP_FINISHED; tmp_event.dnd.window = src_context->source_window; tmp_event.dnd.send_event = FALSE; tmp_event.dnd.context = src_context; gdk_drag_context_ref (src_context); gdk_event_put (&tmp_event); }}void gdk_window_register_dnd (GdkWindow *window){ g_return_if_fail (window != NULL); if (GPOINTER_TO_INT (gdk_drawable_get_data (window, "gdk-dnd-registered"))) return; else gdk_drawable_set_data (window, "gdk-dnd-registered", GINT_TO_POINTER(TRUE), NULL);}/************************************************************* * gdk_drag_get_selection: * Returns the selection atom for the current source window * arguments: * * results: *************************************************************/GdkAtom gdk_drag_get_selection (GdkDragContext *context){ g_return_val_if_fail (context != NULL, GDK_NONE); if (context->protocol == GDK_DRAG_PROTO_LOCAL) return (GDK_DRAG_CONTEXT_PRIVATE_DATA (context))->local_selection; else return GDK_NONE;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -