Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
1df0d365
Commit
1df0d365
authored
Dec 11, 2000
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Dec 11, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CF_UNICODETEXT as primary text clipboard format.
Use [x11drv].TextCP for interchange with X.
parent
93dd2d69
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
51 deletions
+62
-51
clipboard.h
include/clipboard.h
+3
-3
clipboard.c
windows/clipboard.c
+0
-0
queue.c
windows/queue.c
+0
-1
user.c
windows/user.c
+0
-1
clipboard.c
windows/x11drv/clipboard.c
+40
-39
event.c
windows/x11drv/event.c
+19
-7
No files found.
include/clipboard.h
View file @
1df0d365
...
...
@@ -7,9 +7,9 @@
struct
tagWND
;
typedef
struct
tagWINE_CLIPFORMAT
{
WORD
wFormatID
;
WORD
wRefCount
;
WORD
wDataPresent
;
UINT
wFormatID
;
UINT
wRefCount
;
BOOL
wDataPresent
;
LPSTR
Name
;
HANDLE16
hData16
;
HANDLE
hDataSrc32
;
...
...
windows/clipboard.c
View file @
1df0d365
This diff is collapsed.
Click to expand it.
windows/queue.c
View file @
1df0d365
...
...
@@ -14,7 +14,6 @@
#include "queue.h"
#include "task.h"
#include "win.h"
#include "clipboard.h"
#include "hook.h"
#include "heap.h"
#include "thread.h"
...
...
windows/user.c
View file @
1df0d365
...
...
@@ -15,7 +15,6 @@
#include "task.h"
#include "queue.h"
#include "win.h"
#include "clipboard.h"
#include "controls.h"
#include "cursoricon.h"
#include "hook.h"
...
...
windows/x11drv/clipboard.c
View file @
1df0d365
...
...
@@ -107,7 +107,7 @@ UINT X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName)
else
if
(
0
==
strncmp
(
itemFmtName
,
FMT_PREFIX
,
strlen
(
FMT_PREFIX
))
)
return
RegisterClipboardFormatA
(
itemFmtName
+
strlen
(
FMT_PREFIX
));
else
if
(
0
==
strcmp
(
itemFmtName
,
"STRING"
)
)
return
CF_
OEM
TEXT
;
return
CF_
UNICODE
TEXT
;
else
if
(
0
==
strcmp
(
itemFmtName
,
"PIXMAP"
)
||
0
==
strcmp
(
itemFmtName
,
"BITMAP"
)
)
{
...
...
@@ -139,8 +139,12 @@ Atom X11DRV_CLIPBOARD_MapFormatToProperty(UINT wFormat)
switch
(
wFormat
)
{
/* We support only CF_UNICODETEXT, other formats are synthesized */
case
CF_OEMTEXT
:
case
CF_TEXT
:
return
None
;
case
CF_UNICODETEXT
:
prop
=
XA_STRING
;
break
;
...
...
@@ -516,9 +520,9 @@ static BOOL X11DRV_CLIPBOARD_ReadSelection(UINT wFormat, Window w, Atom prop, At
* format, if possible.
*/
if
(
(
reqType
==
XA_STRING
)
&&
(
atype
==
XA_STRING
)
&&
(
aformat
==
8
)
)
/* treat Unix text as CF_OEMTEXT */
&&
(
atype
==
XA_STRING
)
&&
(
aformat
==
8
)
)
/* convert Unix text to CF_UNICODETEXT */
{
HANDLE16
hText
=
0
;
int
i
,
inlcount
=
0
;
char
*
lpstr
;
...
...
@@ -527,37 +531,32 @@ static BOOL X11DRV_CLIPBOARD_ReadSelection(UINT wFormat, Window w, Atom prop, At
for
(
i
=
0
;
i
<=
nitems
;
i
++
)
if
(
val
[
i
]
==
'\n'
)
inlcount
++
;
hText
=
GlobalAlloc16
(
GMEM_MOVEABLE
,
nitems
+
inlcount
+
1
);
if
(
(
lpstr
=
(
char
*
)
GlobalLock16
(
hText
))
)
{
ZeroMemory
(
lpstr
,
nitems
+
inlcount
+
1
);
if
(
(
lpstr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
nitems
+
inlcount
+
1
))
)
{
static
UINT
text_cp
=
(
UINT
)
-
1
;
UINT
count
;
HANDLE
hUnicodeText
;
for
(
i
=
0
,
inlcount
=
0
;
i
<=
nitems
;
i
++
)
{
if
(
val
[
i
]
==
'\n'
)
lpstr
[
inlcount
++
]
=
'\r'
;
lpstr
[
inlcount
++
]
=
val
[
i
];
}
GlobalUnlock16
(
hText
);
}
else
hText
=
0
;
if
(
hText
)
{
/* delete previous CF_TEXT and CF_OEMTEXT data */
lpFormat
=
CLIPBOARD_LookupFormat
(
CF_TEXT
);
if
(
lpFormat
->
wDataPresent
||
lpFormat
->
hData16
||
lpFormat
->
hData32
)
CLIPBOARD_DeleteRecord
(
lpFormat
,
!
(
hWndClipWindow
));
lpFormat
=
CLIPBOARD_LookupFormat
(
CF_OEMTEXT
);
if
(
lpFormat
->
wDataPresent
||
lpFormat
->
hData16
||
lpFormat
->
hData32
)
CLIPBOARD_DeleteRecord
(
lpFormat
,
!
(
hWndClipWindow
));
/* Update the CF_OEMTEXT record */
lpFormat
->
wDataPresent
=
1
;
lpFormat
->
hData32
=
0
;
lpFormat
->
hData16
=
hText
;
bRet
=
TRUE
;
if
(
text_cp
==
(
UINT
)
-
1
)
text_cp
=
PROFILE_GetWineIniInt
(
"x11drv"
,
"TextCP"
,
CP_ACP
);
count
=
MultiByteToWideChar
(
text_cp
,
0
,
lpstr
,
-
1
,
NULL
,
0
);
hUnicodeText
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_DDESHARE
,
count
*
sizeof
(
WCHAR
));
if
(
hUnicodeText
)
{
WCHAR
*
textW
=
GlobalLock
(
hUnicodeText
);
MultiByteToWideChar
(
text_cp
,
0
,
lpstr
,
-
1
,
textW
,
count
);
GlobalUnlock
(
hUnicodeText
);
SetClipboardData
(
CF_UNICODETEXT
,
hUnicodeText
);
bRet
=
TRUE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
lpstr
);
}
}
else
if
(
reqType
==
XA_PIXMAP
||
reqType
==
XA_BITMAP
)
/* treat PIXMAP as CF_DIB or CF_BITMAP */
...
...
@@ -594,7 +593,7 @@ static BOOL X11DRV_CLIPBOARD_ReadSelection(UINT wFormat, Window w, Atom prop, At
WARN
(
"PIXMAP conversion failed!
\n
"
);
goto
END
;
}
/* Delete previous clipboard data */
lpFormat
=
CLIPBOARD_LookupFormat
(
wFormat
);
if
(
lpFormat
->
wDataPresent
&&
(
lpFormat
->
hData16
||
lpFormat
->
hData32
))
...
...
@@ -891,6 +890,8 @@ BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
Window
ownerPrimary
=
TSXGetSelectionOwner
(
display
,
XA_PRIMARY
);
Window
ownerClipboard
=
TSXGetSelectionOwner
(
display
,
xaClipboard
);
TRACE
(
"%d
\n
"
,
wFormat
);
/*
* If the selection has not been previously cached, or the selection has changed,
* try and cache the list of available selection targets from the current selection.
...
...
@@ -913,14 +914,10 @@ BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
/* Exit if there is no selection */
if
(
!
ownerClipboard
&&
!
ownerPrimary
)
{
TRACE
(
"There is no selection
\n
"
);
return
FALSE
;
if
(
wFormat
==
CF_TEXT
)
wFormat
=
CF_OEMTEXT
;
/* Check if the format is available in the clipboard cache */
if
(
CLIPBOARD_IsPresent
(
wFormat
)
)
return
TRUE
;
}
/*
* Many X client apps (such as XTerminal) don't support being queried
...
...
@@ -930,6 +927,7 @@ BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
if
(
!
cSelectionTargets
)
return
X11DRV_GetClipboardData
(
wFormat
);
TRACE
(
"There is no selection
\n
"
);
return
FALSE
;
}
...
...
@@ -987,8 +985,7 @@ void X11DRV_SetClipboardData(UINT wFormat)
*
* This method is invoked only when we DO NOT own the X selection
*
* NOTE: Clipboard driver doesn't get requests for CF_TEXT data, only
* for CF_OEMTEXT.
* NOTE: Clipboard driver get requests only for CF_UNICODETEXT data.
* We always get the data from the selection client each time,
* since we have no way of determining if the data in our cache is stale.
*/
...
...
@@ -1000,6 +997,8 @@ BOOL X11DRV_GetClipboardData(UINT wFormat)
WND
*
wnd
=
NULL
;
LPWINE_CLIPFORMAT
lpFormat
;
TRACE
(
"%d
\n
"
,
wFormat
);
if
(
!
selectionAcquired
&&
(
wnd
=
WIN_FindWndPtr
(
hWnd
))
)
{
XEvent
xe
;
...
...
@@ -1054,6 +1053,8 @@ BOOL X11DRV_GetClipboardData(UINT wFormat)
TRACE
(
"
\t
present %s = %i
\n
"
,
CLIPBOARD_GetFormatName
(
wFormat
),
bRet
);
}
TRACE
(
"Returning %d
\n
"
,
bRet
);
return
bRet
;
}
...
...
windows/x11drv/event.c
View file @
1df0d365
...
...
@@ -1071,29 +1071,40 @@ static Atom EVENT_SelectionRequest_TARGETS( Window requestor, Atom target, Atom
*/
static
Atom
EVENT_SelectionRequest_STRING
(
Window
requestor
,
Atom
target
,
Atom
rprop
)
{
HANDLE16
hText
;
static
UINT
text_cp
=
(
UINT
)
-
1
;
HANDLE
hUnicodeText
;
LPWSTR
uni_text
;
LPSTR
text
;
int
size
,
i
,
j
;
char
*
lpstr
=
0
;
char
*
itemFmtName
;
int
xRc
;
if
(
text_cp
==
(
UINT
)
-
1
)
text_cp
=
PROFILE_GetWineIniInt
(
"x11drv"
,
"TextCP"
,
CP_ACP
);
/*
* Map the requested X selection property type atom name to a
* windows clipboard format ID.
*/
itemFmtName
=
TSXGetAtomName
(
display
,
target
);
TRACE
(
"Request for %s (wFormat=%x %s)
\n
"
,
itemFmtName
,
CF_TEXT
,
CLIPBOARD_GetFormatName
(
CF_
TEXT
));
itemFmtName
,
CF_UNICODETEXT
,
CLIPBOARD_GetFormatName
(
CF_UNICODE
TEXT
));
TSXFree
(
itemFmtName
);
hText
=
GetClipboardData16
(
CF_TEXT
);
if
(
!
hText
)
hUnicodeText
=
GetClipboardData
(
CF_UNICODETEXT
);
if
(
!
hUnicodeText
)
return
None
;
uni_text
=
GlobalLock
(
hUnicodeText
);
if
(
!
uni_text
)
return
None
;
text
=
GlobalLock16
(
hText
);
size
=
WideCharToMultiByte
(
text_cp
,
0
,
uni_text
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
text
)
return
None
;
size
=
GlobalSize16
(
hText
);
WideCharToMultiByte
(
text_cp
,
0
,
uni_text
,
-
1
,
text
,
size
,
NULL
,
NULL
);
/* remove carriage returns */
lpstr
=
(
char
*
)
HeapAlloc
(
GetProcessHeap
(),
0
,
size
--
);
...
...
@@ -1113,7 +1124,8 @@ static Atom EVENT_SelectionRequest_STRING( Window requestor, Atom target, Atom r
lpstr
,
j
);
TRACE
(
"(Rc=%d)
\n
"
,
xRc
);
GlobalUnlock16
(
hText
);
GlobalUnlock
(
hUnicodeText
);
HeapFree
(
GetProcessHeap
(),
0
,
text
);
HeapFree
(
GetProcessHeap
(),
0
,
lpstr
);
return
rprop
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment