hw/xwin: Separate libwinclipboard interface and internal header files

Rename the libwinclipboard internal header from winclipboard.h to internal.h

Put libwinclipboard's public interface into winclipboard.h

This lets winclipboardinit.c partake of that public interface, and all X server
headers without clashes

winInitClipboard() prototype belongs in a server header

v2: Remove duplicate declaration of winClipboardWindowDestroy()

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2013-06-17 18:27:56 +01:00
parent 30c535219e
commit 126c1cfaa5
8 changed files with 165 additions and 143 deletions

View File

@ -792,9 +792,6 @@ RegionPtr
Bool
winInitClipboard(void);
void
winFixClipboardChain(void);
void
winClipboardShutdown(void);
#endif

View File

@ -0,0 +1,123 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
*"Software"), to deal in the Software without restriction, including
*without limitation the rights to use, copy, modify, merge, publish,
*distribute, sublicense, and/or sell copies of the Software, and to
*permit persons to whom the Software is furnished to do so, subject to
*the following conditions:
*
*The above copyright notice and this permission notice shall be
*included in all copies or substantial portions of the Software.
*
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*Except as contained in this notice, the name of Harold L Hunt II
*shall not be used in advertising or otherwise to promote the sale, use
*or other dealings in this Software without prior written authorization
*from Harold L Hunt II.
*
* Authors: Harold L Hunt II
*/
#ifndef WINCLIPBOARD_INTERNAL_H
#define WINCLIPBOARD_INTERNAL_H
/* Standard library headers */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef __CYGWIN__
#include <sys/select.h>
#else
#include <X11/Xwinsock.h>
#endif
#include <fcntl.h>
#include <setjmp.h>
#include <pthread.h>
/* X headers */
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
/* Windows headers */
#include <X11/Xwindows.h>
/* Clipboard module constants */
#ifdef HAS_DEVWINDOWS
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_JMP_OKAY 0
#define WIN_JMP_ERROR_IO 2
#define WIN_LOCAL_PROPERTY "CYGX_CUT_BUFFER"
#define WIN_XEVENTS_SUCCESS 0
#define WIN_XEVENTS_CONVERT 2
#define WIN_XEVENTS_NOTIFY 3
#define WM_WM_REINIT (WM_USER + 1)
/*
* References to external symbols
*/
extern void winDebug(const char *format, ...);
extern void winErrorFVerb(int verb, const char *format, ...);
/*
* winclipboardtextconv.c
*/
void
winClipboardDOStoUNIX(char *pszData, int iLength);
void
winClipboardUNIXtoDOS(char **ppszData, int iLength);
/*
* winclipboardthread.c
*/
/*
* winclipboardwndproc.c
*/
BOOL winClipboardFlushWindowsMessageQueue(HWND hwnd);
LRESULT CALLBACK
winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
typedef struct
{
Display *pClipboardDisplay;
Window iClipboardWindow;
} ClipboardWindowCreationParams;
/*
* winclipboardxevents.c
*/
int
winClipboardFlushXEvents(HWND hwnd,
int iWindow, Display * pDisplay, Bool fUnicodeSupport);
Atom
winClipboardGetLastOwnedSelectionAtom(void);
void
winClipboardInitMonitoredSelections(void);
#endif

View File

@ -35,15 +35,18 @@
#else
#define HAS_WINSOCK 1
#endif
#include <sys/types.h>
#include <signal.h>
#include "winclipboard.h"
#include "windisplay.h"
#ifdef __CYGWIN__
#include <errno.h>
#endif
#include "misc.h"
#include <X11/extensions/Xfixes.h>
#include "winclipboard.h"
#include "internal.h"
#define WIN_CONNECT_RETRIES 40
#define WIN_CONNECT_DELAY 4

View File

@ -1,134 +1,36 @@
/*
*Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
*"Software"), to deal in the Software without restriction, including
*without limitation the rights to use, copy, modify, merge, publish,
*distribute, sublicense, and/or sell copies of the Software, and to
*permit persons to whom the Software is furnished to do so, subject to
*the following conditions:
*
*The above copyright notice and this permission notice shall be
*included in all copies or substantial portions of the Software.
*
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*Except as contained in this notice, the name of Harold L Hunt II
*shall not be used in advertising or otherwise to promote the sale, use
*or other dealings in this Software without prior written authorization
*from Harold L Hunt II.
*
* Authors: Harold L Hunt II
*/
//
// Copyright © Jon TURNEY 2013
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice (including the next
// paragraph) shall be included in all copies or substantial portions of the
// Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File: winclipboard.h
// Purpose: public interface to winclipboard library
//
#ifndef _WINCLIPBOARD_H_
#define _WINCLIPBOARD_H_
/* Standard library headers */
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef __CYGWIN__
#include <sys/select.h>
#else
#include <X11/Xwinsock.h>
#endif
#include <fcntl.h>
#include <setjmp.h>
#include <pthread.h>
/* X headers */
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
#include <X11/Xlocale.h>
/* Windows headers */
#include <X11/Xwindows.h>
/* Clipboard module constants */
#ifdef HAS_DEVWINDOWS
#define WIN_MSG_QUEUE_FNAME "/dev/windows"
#endif
#define WIN_JMP_OKAY 0
#define WIN_JMP_ERROR_IO 2
#define WIN_LOCAL_PROPERTY "CYGX_CUT_BUFFER"
#define WIN_XEVENTS_SUCCESS 0
#define WIN_XEVENTS_CONVERT 2
#define WIN_XEVENTS_NOTIFY 3
#define WM_WM_REINIT (WM_USER + 1)
/*
* References to external symbols
*/
extern void winDebug(const char *format, ...);
extern void winErrorFVerb(int verb, const char *format, ...);
/*
* winclipboardinit.c
*/
Bool
winInitClipboard(void);
/*
* winclipboardtextconv.c
*/
void
winClipboardDOStoUNIX(char *pszData, int iLength);
void
winClipboardUNIXtoDOS(char **ppszData, int iLength);
/*
* winclipboardthread.c
*/
#ifndef WINCLIPBOARD_H
#define WINCLIPBOARD_H
Bool winClipboardProc(char *szDisplay);
void
winClipboardWindowDestroy(void);
void winFixClipboardChain(void);
/*
* winclipboardwndproc.c
*/
BOOL winClipboardFlushWindowsMessageQueue(HWND hwnd);
LRESULT CALLBACK
winClipboardWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
typedef struct
{
Display *pClipboardDisplay;
Window iClipboardWindow;
} ClipboardWindowCreationParams;
/*
* winclipboardxevents.c
*/
int
winClipboardFlushXEvents(HWND hwnd,
int iWindow, Display * pDisplay, Bool fUnicodeSupport);
Atom
winClipboardGetLastOwnedSelectionAtom(void);
void
winClipboardInitMonitoredSelections(void);
void winClipboardWindowDestroy(void);
#endif

View File

@ -33,10 +33,13 @@
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include <sys/types.h>
#include <sys/time.h>
#include "winclipboard.h"
#include "internal.h"
#include "misc.h"
#include "winclipboard.h"
/*
* Constants

View File

@ -34,7 +34,7 @@
#include <xwin-config.h>
#endif
#include "winclipboard.h"
#include "internal.h"
#include "misc.h"
#include <X11/extensions/Xfixes.h>

View File

@ -35,22 +35,13 @@
#include <unistd.h>
#include <pthread.h>
#include "os.h"
#include "win.h"
#include "winclipboard/winclipboard.h"
#include "windisplay.h"
#define WIN_CLIPBOARD_RETRIES 40
#define WIN_CLIPBOARD_DELAY 1
extern void winSetAuthorization(void);
/*
* References to external symbols
*/
extern Bool g_fClipboard;
extern Bool g_fClipboardStarted;
/*
* Local variables
*/

View File

@ -42,6 +42,9 @@
#include "winmsg.h"
#include "winmonitors.h"
#include "inputstr.h"
#ifdef XWIN_CLIPBOARD
#include "winclipboard/winclipboard.h"
#endif
/*
* Global variables