SDL_dropevents.c File Reference
`#include "../SDL_internal.h"`
`#include "SDL_events.h"`
`#include "SDL_events_c.h"`
`#include "SDL_dropevents_c.h"`
`#include "../video/SDL_sysvideo.h"`
Include dependency graph for SDL_dropevents.c:

Go to the source code of this file.

## Functions

static int | SDL_SendDrop (SDL_Window *window, const SDL_EventType evtype, const char *data)
int | SDL_SendDropFile (SDL_Window *window, const char *file)
int | SDL_SendDropText (SDL_Window *window, const char *text)
int | SDL_SendDropComplete (SDL_Window *window)

## Function Documentation

## SDL_SendDrop()

static int SDL_SendDrop | ( | SDL_Window * | window,
|  | const SDL_EventType | evtype,
|  | const char * | data
| ) |  |

static

Definition at line 33 of file SDL_dropevents.c.

References SDL_Window::id, SDL_Window::is_dropping, NULL, SDL_DROPBEGIN, SDL_DROPCOMPLETE, SDL_ENABLE, SDL_FALSE, SDL_GetEventState, SDL_PushEvent, SDL_strdup, SDL_TRUE, and SDL_zero.

Referenced by SDL_SendDropComplete(), SDL_SendDropFile(), and SDL_SendDropText().

{
static SDL_bool app_is_dropping = SDL_FALSE;
int posted = 0;
/* Post the event, if desired */
if (SDL_GetEventState(evtype) == SDL_ENABLE) {
const SDL_bool need_begin = window ? !window->is_dropping : !app_is_dropping;
SDL_Event event;
if (need_begin) {
SDL_zero(event);
event.type = SDL_DROPBEGIN;
if (window) {
event.drop.windowID = window->id;
}
posted = (SDL_PushEvent(&event) > 0);
if (!posted) {
return 0;
}
if (window) {
window->is_dropping = SDL_TRUE;
} else {
app_is_dropping = SDL_TRUE;
}
}
SDL_zero(event);
event.type = evtype;
event.drop.file = data ? SDL_strdup(data) : NULL;
event.drop.windowID = window ? window->id : 0;
posted = (SDL_PushEvent(&event) > 0);
if (posted && (evtype == SDL_DROPCOMPLETE)) {
if (window) {
window->is_dropping = SDL_FALSE;
} else {
app_is_dropping = SDL_FALSE;
}
}
}
return posted;
}
SDL_TRUE
Definition: SDL_stdinc.h:142
SDL_FALSE
Definition: SDL_stdinc.h:141
SDL_Window::is_dropping
SDL_bool is_dropping
Definition: SDL_sysvideo.h:102
SDL_ENABLE
#define SDL_ENABLE
Definition: SDL_events.h:722
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
SDL_DROPBEGIN
Definition: SDL_events.h:140
SDL_GetEventState
#define SDL_GetEventState(type)
Definition: SDL_events.h:735
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
SDL_PushEvent
#define SDL_PushEvent
Definition: SDL_dynapi_overrides.h:125
SDL_zero
#define SDL_zero(x)
Definition: SDL_stdinc.h:416
NULL
#define NULL
Definition: begin_code.h:164
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:139
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:397
SDL_Window::id
Uint32 id
Definition: SDL_sysvideo.h:76
SDL_Event
General event structure.
Definition: SDL_events.h:525
SDL_DROPCOMPLETE
Definition: SDL_events.h:141

## SDL_SendDropComplete()

int SDL_SendDropComplete | ( | SDL_Window * | window | ) |

Definition at line 92 of file SDL_dropevents.c.

References NULL, SDL_DROPCOMPLETE, and SDL_SendDrop().

{
return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL);
}
SDL_SendDrop
static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data)
Definition: SDL_dropevents.c:33
NULL
#define NULL
Definition: begin_code.h:164
SDL_DROPCOMPLETE
Definition: SDL_events.h:141

## SDL_SendDropFile()

int SDL_SendDropFile | ( | SDL_Window * | window,
|  | const char * | file
| ) |  |

Definition at line 80 of file SDL_dropevents.c.

References SDL_DROPFILE, and SDL_SendDrop().

{
return SDL_SendDrop(window, SDL_DROPFILE, file);
}
SDL_SendDrop
static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data)
Definition: SDL_dropevents.c:33
SDL_DROPFILE
Definition: SDL_events.h:138

## SDL_SendDropText()

int SDL_SendDropText | ( | SDL_Window * | window,
|  | const char * | text
| ) |  |

Definition at line 86 of file SDL_dropevents.c.

References SDL_DROPTEXT, and SDL_SendDrop().

{
return SDL_SendDrop(window, SDL_DROPTEXT, text);
}
SDL_DROPTEXT
Definition: SDL_events.h:139
SDL_SendDrop
static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data)
Definition: SDL_dropevents.c:33
text
static char text[MAX_TEXT_LENGTH]
Definition: testime.c:47