From: Holger Schemel Date: Thu, 10 Jan 2019 19:03:25 +0000 (+0100) Subject: added experimental (cross-platform) drag and drop test code X-Git-Tag: 4.1.2.0~55 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=7b6d70dfe3762a3ea666871df51c284a4377d5cf added experimental (cross-platform) drag and drop test code --- diff --git a/src/events.c b/src/events.c index e770480d..f8a888ad 100644 --- a/src/events.c +++ b/src/events.c @@ -268,6 +268,14 @@ void HandleOtherEvents(Event *event) HandleJoystickEvent(event); break; + case SDL_DROPFILE: + HandleDropFileEvent(event); + break; + + case SDL_DROPTEXT: + HandleDropTextEvent(event); + break; + default: break; } @@ -1518,6 +1526,30 @@ void HandleClientMessageEvent(ClientMessageEvent *event) CloseAllAndExit(0); } +static void HandleDropFileEventExt(char *filename) +{ + Error(ERR_DEBUG, "DROP FILE EVENT: '%s'", filename); +} + +static void HandleDropTextEventExt(char *text) +{ + Error(ERR_DEBUG, "DROP TEXT EVENT: '%s'", text); +} + +void HandleDropFileEvent(Event *event) +{ + HandleDropFileEventExt(event->drop.file); + + SDL_free(event->drop.file); +} + +void HandleDropTextEvent(Event *event) +{ + HandleDropTextEventExt(event->drop.file); + + SDL_free(event->drop.file); +} + void HandleButton(int mx, int my, int button, int button_nr) { static int old_mx = 0, old_my = 0; diff --git a/src/events.h b/src/events.h index c90580b0..5c0630e7 100644 --- a/src/events.h +++ b/src/events.h @@ -35,6 +35,8 @@ boolean HandleKeysDebug(Key, int); void HandleKeyEvent(KeyEvent *); void HandleFocusEvent(FocusChangeEvent *); void HandleClientMessageEvent(ClientMessageEvent *); +void HandleDropFileEvent(Event *); +void HandleDropTextEvent(Event *); void HandleToonAnimations(void);