Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xwin / winclipboard.h
1 #ifndef _WINCLIPBOARD_H_
2 #define _WINCLIPBOARD_H_
3 /*
4 *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
5 *
6 *Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 *"Software"), to deal in the Software without restriction, including
9 *without limitation the rights to use, copy, modify, merge, publish,
10 *distribute, sublicense, and/or sell copies of the Software, and to
11 *permit persons to whom the Software is furnished to do so, subject to
12 *the following conditions:
13 *
14 *The above copyright notice and this permission notice shall be
15 *included in all copies or substantial portions of the Software.
16 *
17 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
21 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 *Except as contained in this notice, the name of Harold L Hunt II
26 *shall not be used in advertising or otherwise to promote the sale, use
27 *or other dealings in this Software without prior written authorization
28 *from Harold L Hunt II.
29 *
30 * Authors: Harold L Hunt II
31 */
32
33 /* Standard library headers */
34 #include <assert.h>
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <unistd.h>
38 #ifdef __CYGWIN__
39 #include <sys/select.h>
40 #else
41 #include <X11/Xwinsock.h>
42 #endif
43 #include <fcntl.h>
44 #include <setjmp.h>
45 #include <pthread.h>
46
47 /* X headers */
48 #include <X11/X.h>
49 #include <X11/Xatom.h>
50 #include <X11/Xproto.h>
51 #include <X11/Xutil.h>
52 #include <X11/Xlocale.h>
53
54 /* Windows headers */
55 #include <X11/Xwindows.h>
56
57 /* Clipboard module constants */
58 #define WIN_CLIPBOARD_WINDOW_CLASS "xwinclip"
59 #define WIN_CLIPBOARD_WINDOW_TITLE "xwinclip"
60 #ifdef HAS_DEVWINDOWS
61 #define WIN_MSG_QUEUE_FNAME "/dev/windows"
62 #endif
63 #define WIN_CONNECT_RETRIES 40
64 #define WIN_CONNECT_DELAY 4
65 #define WIN_JMP_OKAY 0
66 #define WIN_JMP_ERROR_IO 2
67 #define WIN_LOCAL_PROPERTY "CYGX_CUT_BUFFER"
68 #define WIN_XEVENTS_SUCCESS 0
69 #define WIN_XEVENTS_CONVERT 2
70 #define WIN_XEVENTS_NOTIFY 3
71 #define WIN_CLIPBOARD_RETRIES 40
72 #define WIN_CLIPBOARD_DELAY 1
73
74 #define WM_WM_REINIT (WM_USER + 1)
75
76 /*
77 * References to external symbols
78 */
79
80 extern char *display;
81 extern void winDebug(const char *format, ...);
82 extern void winErrorFVerb(int verb, const char *format, ...);
83
84 /*
85 * winclipboardinit.c
86 */
87
88 Bool
89 winInitClipboard(void);
90
91 HWND winClipboardCreateMessagingWindow(void);
92
93 /*
94 * winclipboardtextconv.c
95 */
96
97 void
98 winClipboardDOStoUNIX(char *pszData, int iLength);
99
100 void
101 winClipboardUNIXtoDOS(char **ppszData, int iLength);
102
103 /*
104 * winclipboardthread.c
105 */
106
107 void *winClipboardProc(void *);
108
109 /*
110 * winclipboardwndproc.c
111 */
112
113 BOOL winClipboardFlushWindowsMessageQueue(HWND hwnd);
114
115 LRESULT CALLBACK
116 winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
117
118 /*
119 * winclipboardxevents.c
120 */
121
122 int
123
124 winClipboardFlushXEvents(HWND hwnd,
125 int iWindow, Display * pDisplay, Bool fUnicodeSupport);
126 #endif