xref: /OK3568_Linux_fs/external/xserver/hw/xwin/winclipboard/internal.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 
2 /*
3  *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
4  *
5  *Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  *"Software"), to deal in the Software without restriction, including
8  *without limitation the rights to use, copy, modify, merge, publish,
9  *distribute, sublicense, and/or sell copies of the Software, and to
10  *permit persons to whom the Software is furnished to do so, subject to
11  *the following conditions:
12  *
13  *The above copyright notice and this permission notice shall be
14  *included in all copies or substantial portions of the Software.
15  *
16  *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
20  *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21  *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  *Except as contained in this notice, the name of Harold L Hunt II
25  *shall not be used in advertising or otherwise to promote the sale, use
26  *or other dealings in this Software without prior written authorization
27  *from Harold L Hunt II.
28  *
29  * Authors:	Harold L Hunt II
30  */
31 
32 #ifndef WINCLIPBOARD_INTERNAL_H
33 #define WINCLIPBOARD_INTERNAL_H
34 
35 /* X headers */
36 #include <X11/Xlib.h>
37 
38 /* Windows headers */
39 #include <X11/Xwindows.h>
40 
41 #define WIN_XEVENTS_SUCCESS			0
42 #define WIN_XEVENTS_FAILED			1
43 #define WIN_XEVENTS_NOTIFY_DATA			3
44 #define WIN_XEVENTS_NOTIFY_TARGETS		4
45 
46 #define WM_WM_REINIT                           (WM_USER + 1)
47 #define WM_WM_QUIT                             (WM_USER + 2)
48 
49 #define ARRAY_SIZE(a)  (sizeof((a)) / sizeof((a)[0]))
50 
51 /*
52  * References to external symbols
53  */
54 
55 extern void winDebug(const char *format, ...) _X_ATTRIBUTE_PRINTF(1, 2);
56 extern void ErrorF(const char *format, ...) _X_ATTRIBUTE_PRINTF(1, 2);
57 
58 /*
59  * winclipboardtextconv.c
60  */
61 
62 void
63  winClipboardDOStoUNIX(char *pszData, int iLength);
64 
65 void
66  winClipboardUNIXtoDOS(char **ppszData, int iLength);
67 
68 /*
69  * winclipboardthread.c
70  */
71 
72 
73 typedef struct
74 {
75     Atom atomClipboard;
76     Atom atomLocalProperty;
77     Atom atomUTF8String;
78     Atom atomCompoundText;
79     Atom atomTargets;
80 } ClipboardAtoms;
81 
82 /* Modern clipboard API functions */
83 typedef wBOOL WINAPI (*ADDCLIPBOARDFORMATLISTENERPROC)(HWND hwnd);
84 typedef wBOOL WINAPI (*REMOVECLIPBOARDFORMATLISTENERPROC)(HWND hwnd);
85 
86 extern Bool g_fHasModernClipboardApi;
87 extern ADDCLIPBOARDFORMATLISTENERPROC g_fpAddClipboardFormatListener;
88 extern REMOVECLIPBOARDFORMATLISTENERPROC g_fpRemoveClipboardFormatListener;
89 
90 /*
91  * winclipboardwndproc.c
92  */
93 
94 Bool winClipboardFlushWindowsMessageQueue(HWND hwnd);
95 
96 LRESULT CALLBACK
97 winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
98 
99 typedef struct
100 {
101   Display *pClipboardDisplay;
102   Window iClipboardWindow;
103   ClipboardAtoms *atoms;
104 } ClipboardWindowCreationParams;
105 
106 /*
107  * winclipboardxevents.c
108  */
109 
110 typedef struct
111 {
112   Bool fUseUnicode;
113   Atom *targetList;
114 } ClipboardConversionData;
115 
116 int
117 winClipboardFlushXEvents(HWND hwnd,
118                          Window iWindow, Display * pDisplay, ClipboardConversionData *data, ClipboardAtoms *atom);
119 
120 
121 Atom
122 winClipboardGetLastOwnedSelectionAtom(ClipboardAtoms *atoms);
123 
124 void
125 winClipboardInitMonitoredSelections(void);
126 
127 #endif
128