test/common.c
changeset 4497 098a8f3835f0
parent 4482 8058f5ab4a75
child 4503 524dfefd554c
equal deleted inserted replaced
4496:aea9e96d7973 4497:098a8f3835f0
  1048         }
  1048         }
  1049         break;
  1049         break;
  1050     case SDL_KEYDOWN:
  1050     case SDL_KEYDOWN:
  1051         switch (event->key.keysym.sym) {
  1051         switch (event->key.keysym.sym) {
  1052             /* Add hotkeys here */
  1052             /* Add hotkeys here */
       
  1053         case SDLK_c:
       
  1054             if (event->key.keysym.mod & KMOD_CTRL) {
       
  1055                 /* Ctrl-C copy awesome text! */
       
  1056                 SDL_SetClipboardText("SDL rocks!\nYou know it!");
       
  1057                 printf("Copied text to clipboard\n");
       
  1058             }
       
  1059             break;
       
  1060         case SDLK_v:
       
  1061             if (event->key.keysym.mod & KMOD_CTRL) {
       
  1062                 /* Ctrl-V paste awesome text! */
       
  1063                 char *text = SDL_GetClipboardText();
       
  1064                 if (*text) {
       
  1065                     printf("Clipboard: %s\n", text);
       
  1066                 } else {
       
  1067                     printf("Clipboard is empty\n");
       
  1068                 }
       
  1069                 SDL_free(text);
       
  1070             }
       
  1071             break;
  1053         case SDLK_g:
  1072         case SDLK_g:
  1054             if (event->key.keysym.mod & KMOD_CTRL) {
  1073             if (event->key.keysym.mod & KMOD_CTRL) {
  1055                 /* Ctrl-G toggle grab */
  1074                 /* Ctrl-G toggle grab */
  1056             }
  1075             }
  1057             break;
  1076             break;