Added simple clipboard test
This commit is contained in:
parent
316197f968
commit
b75fc9b1a1
1 changed files with 19 additions and 0 deletions
|
@ -1050,6 +1050,25 @@ CommonEvent(CommonState * state, SDL_Event * event, int *done)
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
switch (event->key.keysym.sym) {
|
switch (event->key.keysym.sym) {
|
||||||
/* Add hotkeys here */
|
/* Add hotkeys here */
|
||||||
|
case SDLK_c:
|
||||||
|
if (event->key.keysym.mod & KMOD_CTRL) {
|
||||||
|
/* Ctrl-C copy awesome text! */
|
||||||
|
SDL_SetClipboardText("SDL rocks!\nYou know it!");
|
||||||
|
printf("Copied text to clipboard\n");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDLK_v:
|
||||||
|
if (event->key.keysym.mod & KMOD_CTRL) {
|
||||||
|
/* Ctrl-V paste awesome text! */
|
||||||
|
char *text = SDL_GetClipboardText();
|
||||||
|
if (*text) {
|
||||||
|
printf("Clipboard: %s\n", text);
|
||||||
|
} else {
|
||||||
|
printf("Clipboard is empty\n");
|
||||||
|
}
|
||||||
|
SDL_free(text);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SDLK_g:
|
case SDLK_g:
|
||||||
if (event->key.keysym.mod & KMOD_CTRL) {
|
if (event->key.keysym.mod & KMOD_CTRL) {
|
||||||
/* Ctrl-G toggle grab */
|
/* Ctrl-G toggle grab */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue