aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/presentation.c2
-rw-r--r--src/presentation.h2
-rw-r--r--src/slide_sorter.c26
3 files changed, 25 insertions, 5 deletions
diff --git a/src/presentation.c b/src/presentation.c
index 2e6eb03..f4e5bb6 100644
--- a/src/presentation.c
+++ b/src/presentation.c
@@ -322,7 +322,7 @@ static char *frame_options_string(struct frame *fr, StyleSheet *ss)
}
-static char *packed_sc(struct frame *fr, StyleSheet *ss)
+char *packed_sc(struct frame *fr, StyleSheet *ss)
{
char *sc;
int i;
diff --git a/src/presentation.h b/src/presentation.h
index 7a8c723..308cb3c 100644
--- a/src/presentation.h
+++ b/src/presentation.h
@@ -202,6 +202,8 @@ extern void free_slide(struct slide *s);
extern void get_titlebar_string(struct presentation *p);
+extern char *packed_sc(struct frame *fr, StyleSheet *ss);
+
extern int slide_number(struct presentation *p, struct slide *s);
extern int load_presentation(struct presentation *p, const char *filename);
diff --git a/src/slide_sorter.c b/src/slide_sorter.c
index 91d68bd..9cfa44a 100644
--- a/src/slide_sorter.c
+++ b/src/slide_sorter.c
@@ -265,16 +265,24 @@ static void dnd_receive(GtkWidget *widget, GdkDragContext *drag_context,
if ( n->drag_preview_pending ) {
+ /* In theory: do something with the data to generate a
+ * proper preview. */
+
n->have_drag_data = 1;
n->drag_preview_pending = 0;
- printf("Got preview data.\n");
+ gdk_drag_status(drag_context, GDK_ACTION_MOVE, time);
} else {
- printf("Drop! Got data\n");
+ const guchar *sc;
+
+ sc = gtk_selection_data_get_data(seldata);
+
n->dragging = 0;
gtk_drag_finish(drag_context, TRUE, TRUE, time);
+ printf("Got SC: '%s'\n", sc);
+
}
}
@@ -284,9 +292,19 @@ static void dnd_get(GtkWidget *widget, GdkDragContext *drag_context,
GtkSelectionData *seldata, guint info, guint time,
struct slide_sorter *n)
{
- printf("Get data!\n");
+ GdkAtom target;
- gtk_selection_data_set_text(seldata, "Hello!", -1);
+ target = gtk_drag_dest_find_target(widget, drag_context, NULL);
+
+ if ( target != GDK_NONE ) {
+
+ char *sc;
+ sc = packed_sc(n->p->slides[n->selection]->top, n->p->ss);
+ printf("Sending SC: '%s'\n", sc);
+ gtk_selection_data_set(seldata, target, 8, (guchar *)sc,
+ strlen(sc));
+
+ }
}