]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Added CTRL+V paste into the console for win32 users.
authortomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Aug 2004 18:00:26 +0000 (18:00 +0000)
committertomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Aug 2004 18:00:26 +0000 (18:00 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4296 d7cf8633-e32d-0410-b094-e92efae38249

sys.h
sys_linux.c
sys_win.c

diff --git a/sys.h b/sys.h
index 608e53c3d85e3a813384ebb094e58e11d7a5b8b6..2644d074311baf99ad68fc21285a967ec007eb1c 100644 (file)
--- a/sys.h
+++ b/sys.h
@@ -83,5 +83,7 @@ void Sys_Sleep(int milliseconds);
 void Sys_SendKeyEvents (void);
 // Perform Key_Event () callbacks until the input que is empty
 
+char *Sys_GetClipboardData (void);
+
 #endif
 
index ef11c6be1ca172ea741c5f43fcdbb7d921fde4ff..499aaada5c43ae599ed3f4dfffd8a28df0b4b836 100644 (file)
@@ -202,6 +202,11 @@ void Sys_Sleep(int milliseconds)
 #endif
 }
 
+char *Sys_GetClipboardData (void)
+{
+       return NULL;
+}
+
 int main (int argc, const char **argv)
 {
        double frameoldtime, framenewtime;
index e7ec1630cbec129be1ed7f83fbad0a80aaeab714..8e3c628f850ef06d14d2beb96aa4fee1db77458e 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -277,6 +277,29 @@ void Sys_Sleep(int milliseconds)
        Sleep(milliseconds);
 }
 
+char *Sys_GetClipboardData (void)
+{
+       char *data = NULL;
+       char *cliptext;
+
+       if (OpenClipboard (NULL) != 0)
+       {
+               HANDLE hClipboardData;
+
+               if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0)
+               {
+                       if ((cliptext = GlobalLock (hClipboardData)) != 0) 
+                       {
+                               data = malloc (GlobalSize(hClipboardData)+1);
+                               strcpy (data, cliptext);
+                               GlobalUnlock (hClipboardData);
+                       }
+               }
+               CloseClipboard ();
+       }
+       return data;
+}
+
 /*
 ==============================================================================
 
@@ -439,4 +462,3 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
        /* return success of application */
        return true;
 }
-