1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
/*
*Copyright (C) 1994-2000 The XFree86 Project, Inc. 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 THE XFREE86 PROJECT 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 the XFree86 Project
*shall not be used in advertising or otherwise to promote the sale, use
*or other dealings in this Software without prior written authorization
*from the XFree86 Project.
*
* Authors: Harold L Hunt II
*/
/* $XFree86: xc/programs/Xserver/hw/xwin/wincutpaste.c,v 1.2 2001/09/07 08:41:54 alanh Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#include <X11/XWDFile.h>
#ifdef HAS_MMAP
#include <sys/mman.h>
#ifndef MAP_FILE
#define MAP_FILE 0
#endif /* MAP_FILE */
#endif /* HAS_MMAP */
#include "X.h"
#include "Xos.h"
#include "miscstruct.h"
#include "keysym.h"
#include <X11/Xlib.h>
#undef MINSHORT
#undef MAXSHORT
#define NONAMELESSUNION
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <windowsx.h>
#undef CreateWindow
#undef FreeResource
Display *g_display = NULL;
Window g_window = 0;
Bool
winInitializeClipboard ()
{
g_display = XOpenDisplay (NULL);
if (g_display == NULL)
FatalError ("winInitializeClipboard () - XOpenDisplay () returned NULL\n");
g_window = XCreateSimpleWindow (g_display,
RootWindow (g_display, 0),
1, 1,
500, 500,
0,
BlackPixel (g_display, 0),
BlackPixel (g_display, 0));
if (g_window == 0)
FatalError ("winInitializeClipboard () - XCreateSimpleWindow () returned "
"0\n");
/* Don't display our message window */
#if 0
XMapWindow (g_display, g_window);
#endif
return TRUE;
}
#if 0
#define NEED_EVENTS
#include <X.h>
#include <Xproto.h>
#include "selection.h"
#include "input.h"
#include <Xatom.h>
extern WindowPtr *WindowTable; /* Why isn't this in a header file? */
extern Selection *CurrentSelections;
extern int NumCurrentSelections;
static Bool inSetXCutText = FALSE;
void
winSetXCutText (char *str, int len)
{
int i = 0;
inSetXCutText = TRUE;
ChangeWindowProperty (WindowTable[0], XA_CUT_BUFFER0, XA_STRING,
8, PropModeReplace, len,
(pointer)str, TRUE);
while ((i < NumCurrentSelections) &&
CurrentSelections[i].selection != XA_PRIMARY)
i++;
if (i < NumCurrentSelections) {
xEvent event;
if (CurrentSelections[i].client) {
event.u.u.type = SelectionClear;
event.u.selectionClear.time = GetTimeInMillis();
event.u.selectionClear.window = CurrentSelections[i].window;
event.u.selectionClear.atom = CurrentSelections[i].selection;
(void) TryClientEvents (CurrentSelections[i].client,
&event,
1,
NoEventMask,
NoEventMask,
NullGrab);
}
CurrentSelections[i].window = None;
CurrentSelections[i].pWin = NULL;
CurrentSelections[i].client = NullClient;
}
inSetXCutText = FALSE;
}
#endif
|