summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-05-01 04:38:20 +0000
committerRichard M. Stallman <rms@gnu.org>1998-05-01 04:38:20 +0000
commit12857dfd21cd7f07bc6b2a9731203f36824f81a4 (patch)
tree6bd1f4969322944cf82ddeb2635b1f542c45a3d9
parentcb9e33d4a56f5bc9067df32244dbb4c4dfac5348 (diff)
downloademacs-12857dfd21cd7f07bc6b2a9731203f36824f81a4.tar.gz
Include shellapi.h.
(construct_drag_n_drop): New function. (w32_read_socket): Handle WM_DROPFILES messages.
-rw-r--r--src/w32term.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/w32term.c b/src/w32term.c
index 34045bf6ea4..7a329964fe7 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA. */
#include "blockinput.h"
#include "w32term.h"
+#include <shellapi.h>
#include "systty.h"
#include "systime.h"
@@ -1408,6 +1409,52 @@ construct_mouse_wheel (result, msg, f)
XSETFRAME (result->frame_or_window, f);
}
+static void
+construct_drag_n_drop (result, msg, f)
+ struct input_event *result;
+ W32Msg *msg;
+ struct frame *f;
+{
+ Lisp_Object files;
+ Lisp_Object frame;
+ HDROP hdrop;
+ POINT p;
+ WORD num_files;
+ char *name;
+ int i, len;
+
+ result->kind = drag_n_drop;
+ result->code = 0;
+ result->timestamp = msg->msg.time;
+ result->modifiers = msg->dwModifiers;
+
+ p.x = LOWORD (msg->msg.lParam);
+ p.y = HIWORD (msg->msg.lParam);
+ ScreenToClient (msg->msg.hwnd, &p);
+ XSETINT (result->x, p.x);
+ XSETINT (result->y, p.y);
+
+ hdrop = (HDROP) msg->msg.wParam;
+ DragQueryPoint (hdrop, &p);
+ num_files = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
+ files = Qnil;
+
+ for (i = 0; i < num_files; i++)
+ {
+ len = DragQueryFile (hdrop, i, NULL, 0);
+ if (len <= 0)
+ continue;
+ name = alloca (len + 1);
+ DragQueryFile (hdrop, i, name, len + 1);
+ files = Fcons (build_string (name), files);
+ }
+
+ DragFinish (hdrop);
+
+ XSETFRAME (frame, f);
+ result->frame_or_window = Fcons (frame, files);
+}
+
/* Function to report a mouse movement to the mainstream Emacs code.
The input handler calls this.
@@ -2991,6 +3038,18 @@ w32_read_socket (sd, bufp, numchars, expected)
}
break;
+ case WM_DROPFILES:
+ f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
+
+ if (f)
+ {
+ construct_drag_n_drop (bufp, &msg, f);
+ bufp++;
+ count++;
+ numchars--;
+ }
+ break;
+
case WM_VSCROLL:
{
struct scroll_bar *bar =