Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johnny Cai
wine
Commits
9289a5df
Commit
9289a5df
authored
24 years ago
by
Gerard Patel
Committed by
Alexandre Julliard
24 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Cancel a few changes to get back basic text clipboard functionality.
parent
4d24e0f5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
windows/clipboard.c
+88
-72
88 additions, 72 deletions
windows/clipboard.c
windows/x11drv/clipboard.c
+10
-5
10 additions, 5 deletions
windows/x11drv/clipboard.c
with
98 additions
and
77 deletions
windows/clipboard.c
+
88
−
72
View file @
9289a5df
...
...
@@ -57,7 +57,7 @@ static HWND hWndViewer = 0; /* start of viewers chain */
static
WORD
LastRegFormat
=
CF_REGFORMATBASE
;
/* Clipboard cache initial data.
* WARNING: This data ordering is dependen
den
t on the WINE_CLIPFORMAT structure
* WARNING: This data ordering is dependent on the WINE_CLIPFORMAT structure
* declared in clipboard.h
*/
WINE_CLIPFORMAT
ClipFormats
[]
=
{
...
...
@@ -390,8 +390,9 @@ static BOOL CLIPBOARD_RenderFormat(LPWINE_CLIPFORMAT lpFormat)
{
/*
* If WINE is not the selection owner, and the format is available
* we must ask the
the
driver to render the data to the clipboard cache.
* we must ask the driver to render the data to the clipboard cache.
*/
TRACE
(
"enter format=%d
\n
"
,
lpFormat
->
wFormatID
);
if
(
!
USER_Driver
.
pIsSelectionOwner
()
&&
USER_Driver
.
pIsClipboardFormatAvailable
(
lpFormat
->
wFormatID
)
)
{
...
...
@@ -492,8 +493,9 @@ static INT CLIPBOARD_ConvertText(WORD src_fmt, void const *src, INT src_size,
static
LPWINE_CLIPFORMAT
CLIPBOARD_RenderText
(
UINT
wFormat
)
{
LPWINE_CLIPFORMAT
lpSource
=
ClipFormats
;
LPWINE_CLIPFORMAT
lpTarget
;
LPWINE_CLIPFORMAT
lpTarget
=
NULL
;
BOOL
foundData
=
FALSE
;
/* Asked for CF_TEXT but not available - always attempt to convert
from CF_UNICODETEXT or CF_OEMTEXT */
if
(
wFormat
==
CF_TEXT
&&
!
ClipFormats
[
CF_TEXT
-
1
].
wDataPresent
)
...
...
@@ -503,7 +505,7 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
/* Convert UNICODETEXT -> TEXT */
lpSource
=
&
ClipFormats
[
CF_UNICODETEXT
-
1
];
lpTarget
=
&
ClipFormats
[
CF_TEXT
-
1
];
foundData
=
TRUE
;
TRACE
(
"
\t
UNICODETEXT -> TEXT
\n
"
);
}
else
if
(
ClipFormats
[
CF_OEMTEXT
-
1
].
wDataPresent
)
...
...
@@ -511,11 +513,9 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
/* Convert OEMTEXT -> TEXT */
lpSource
=
&
ClipFormats
[
CF_OEMTEXT
-
1
];
lpTarget
=
&
ClipFormats
[
CF_TEXT
-
1
];
foundData
=
TRUE
;
TRACE
(
"
\t
OEMTEXT -> TEXT
\n
"
);
}
else
lpSource
=
NULL
;
/* Conversion format is not available */
}
/* Asked for CF_OEMTEXT but not available - always attempt to convert
from CF_UNICODETEXT or CF_TEXT */
...
...
@@ -526,7 +526,7 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
/* Convert UNICODETEXT -> OEMTEXT */
lpSource
=
&
ClipFormats
[
CF_UNICODETEXT
-
1
];
lpTarget
=
&
ClipFormats
[
CF_OEMTEXT
-
1
];
foundData
=
TRUE
;
TRACE
(
"
\t
UNICODETEXT -> OEMTEXT
\n
"
);
}
else
if
(
ClipFormats
[
CF_TEXT
-
1
].
wDataPresent
)
...
...
@@ -534,11 +534,9 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
/* Convert TEXT -> OEMTEXT */
lpSource
=
&
ClipFormats
[
CF_TEXT
-
1
];
lpTarget
=
&
ClipFormats
[
CF_OEMTEXT
-
1
];
foundData
=
TRUE
;
TRACE
(
"
\t
TEXT -> OEMTEXT
\n
"
);
}
else
lpSource
=
NULL
;
/* Conversion format is not available */
}
/* Asked for CF_UNICODETEXT but not available - always attempt to convert
from CF_TEXT or CF_OEMTEXT */
...
...
@@ -549,7 +547,7 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
/* Convert TEXT -> UNICODETEXT */
lpSource
=
&
ClipFormats
[
CF_TEXT
-
1
];
lpTarget
=
&
ClipFormats
[
CF_UNICODETEXT
-
1
];
foundData
=
TRUE
;
TRACE
(
"
\t
TEXT -> UNICODETEXT
\n
"
);
}
else
if
(
ClipFormats
[
CF_OEMTEXT
-
1
].
wDataPresent
)
...
...
@@ -557,17 +555,22 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
/* Convert OEMTEXT -> UNICODETEXT */
lpSource
=
&
ClipFormats
[
CF_OEMTEXT
-
1
];
lpTarget
=
&
ClipFormats
[
CF_UNICODETEXT
-
1
];
foundData
=
TRUE
;
TRACE
(
"
\t
OEMTEXT -> UNICODETEXT
\n
"
);
}
else
lpSource
=
NULL
;
/* Conversion format is not available */
}
/* Text format requested is available - no conversion necessary */
else
{
lpSource
=
__lookup_format
(
ClipFormats
,
wFormat
);
lpTarget
=
lpSource
;
if
(
!
foundData
)
{
if
((
wFormat
==
CF_TEXT
)
||
(
wFormat
==
CF_OEMTEXT
))
{
lpSource
=
&
ClipFormats
[
CF_UNICODETEXT
-
1
];
lpTarget
=
__lookup_format
(
ClipFormats
,
wFormat
);
}
else
{
lpSource
=
__lookup_format
(
ClipFormats
,
wFormat
);
lpTarget
=
lpSource
;
}
}
/* First render the source text format */
...
...
@@ -633,6 +636,62 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
return
(
lpTarget
->
hData16
||
lpTarget
->
hData32
)
?
lpTarget
:
NULL
;
}
/**************************************************************************
* CLIPBOARD_EnumClipboardFormats (internal)
*/
static
UINT
CLIPBOARD_EnumClipboardFormats
(
UINT
wFormat
)
{
LPWINE_CLIPFORMAT
lpFormat
=
ClipFormats
;
BOOL
bFormatPresent
;
if
(
wFormat
==
0
)
/* start from the beginning */
lpFormat
=
ClipFormats
;
else
{
/* walk up to the specified format record */
if
(
!
(
lpFormat
=
__lookup_format
(
lpFormat
,
wFormat
))
)
return
0
;
lpFormat
=
lpFormat
->
NextFormat
;
/* right */
}
while
(
TRUE
)
{
if
(
lpFormat
==
NULL
)
return
0
;
if
(
CLIPBOARD_IsPresent
(
lpFormat
->
wFormatID
))
break
;
/* Query the driver if not yet in the cache */
if
(
!
USER_Driver
.
pIsSelectionOwner
())
{
if
(
lpFormat
->
wFormatID
==
CF_UNICODETEXT
||
lpFormat
->
wFormatID
==
CF_TEXT
||
lpFormat
->
wFormatID
==
CF_OEMTEXT
)
{
if
(
USER_Driver
.
pIsClipboardFormatAvailable
(
CF_UNICODETEXT
)
||
USER_Driver
.
pIsClipboardFormatAvailable
(
CF_TEXT
)
||
USER_Driver
.
pIsClipboardFormatAvailable
(
CF_OEMTEXT
))
bFormatPresent
=
TRUE
;
else
bFormatPresent
=
FALSE
;
}
else
bFormatPresent
=
USER_Driver
.
pIsClipboardFormatAvailable
(
lpFormat
->
wFormatID
);
if
(
bFormatPresent
)
break
;
}
lpFormat
=
lpFormat
->
NextFormat
;
}
TRACE
(
"Next available format %d
\n
"
,
lpFormat
->
wFormatID
);
return
lpFormat
->
wFormatID
;
}
/**************************************************************************
* WIN32 Clipboard implementation
**************************************************************************/
...
...
@@ -1074,7 +1133,6 @@ INT WINAPI CountClipboardFormats(void)
return
FormatCount
;
}
/**************************************************************************
* EnumClipboardFormats (USER.144)
*/
...
...
@@ -1089,9 +1147,6 @@ UINT16 WINAPI EnumClipboardFormats16( UINT16 wFormat )
*/
UINT
WINAPI
EnumClipboardFormats
(
UINT
wFormat
)
{
LPWINE_CLIPFORMAT
lpFormat
=
ClipFormats
;
BOOL
bFormatPresent
;
TRACE
(
"(%04X)
\n
"
,
wFormat
);
if
(
CLIPBOARD_IsLocked
())
...
...
@@ -1100,51 +1155,7 @@ UINT WINAPI EnumClipboardFormats( UINT wFormat )
return
0
;
}
if
(
wFormat
==
0
)
/* start from the beginning */
lpFormat
=
ClipFormats
;
else
{
/* walk up to the specified format record */
if
(
!
(
lpFormat
=
__lookup_format
(
lpFormat
,
wFormat
))
)
return
0
;
lpFormat
=
lpFormat
->
NextFormat
;
/* right */
}
while
(
TRUE
)
{
if
(
lpFormat
==
NULL
)
return
0
;
if
(
CLIPBOARD_IsPresent
(
lpFormat
->
wFormatID
))
break
;
/* Query the driver if not yet in the cache */
if
(
!
USER_Driver
.
pIsSelectionOwner
())
{
if
(
lpFormat
->
wFormatID
==
CF_UNICODETEXT
||
lpFormat
->
wFormatID
==
CF_TEXT
||
lpFormat
->
wFormatID
==
CF_OEMTEXT
)
{
if
(
USER_Driver
.
pIsClipboardFormatAvailable
(
CF_UNICODETEXT
)
||
USER_Driver
.
pIsClipboardFormatAvailable
(
CF_TEXT
)
||
USER_Driver
.
pIsClipboardFormatAvailable
(
CF_OEMTEXT
))
bFormatPresent
=
TRUE
;
else
bFormatPresent
=
FALSE
;
}
else
bFormatPresent
=
USER_Driver
.
pIsClipboardFormatAvailable
(
lpFormat
->
wFormatID
);
if
(
bFormatPresent
)
break
;
}
lpFormat
=
lpFormat
->
NextFormat
;
}
TRACE
(
"Next available format %d
\n
"
,
lpFormat
->
wFormatID
);
return
lpFormat
->
wFormatID
;
return
CLIPBOARD_EnumClipboardFormats
(
wFormat
);
}
...
...
@@ -1368,8 +1379,13 @@ BOOL WINAPI IsClipboardFormatAvailable( UINT wFormat )
if
(
wFormat
==
0
)
/* Reject this case quickly */
bRet
=
FALSE
;
else
bRet
=
EnumClipboardFormats
(
wFormat
-
1
)
==
wFormat
;
{
UINT
iret
=
CLIPBOARD_EnumClipboardFormats
(
wFormat
-
1
);
if
((
wFormat
==
CF_TEXT
)
||
(
wFormat
==
CF_OEMTEXT
)
||
(
wFormat
==
CF_UNICODETEXT
))
bRet
=
((
iret
==
CF_TEXT
)
||
(
iret
==
CF_OEMTEXT
)
||
(
iret
==
CF_UNICODETEXT
));
else
bRet
=
iret
==
wFormat
;
}
TRACE
(
"(%04X)- ret(%d)
\n
"
,
wFormat
,
bRet
);
return
bRet
;
}
...
...
This diff is collapsed.
Click to expand it.
windows/x11drv/clipboard.c
+
10
−
5
View file @
9289a5df
...
...
@@ -192,7 +192,7 @@ Atom X11DRV_CLIPBOARD_MapFormatToProperty(UINT wFormat)
/**************************************************************************
* X11DRV_CLIPBOARD_IsNativeProperty
*
* Checks if a property is a native property type
* Checks if a property is a native
Wine
property type
*/
BOOL
X11DRV_CLIPBOARD_IsNativeProperty
(
Atom
prop
)
{
...
...
@@ -332,6 +332,7 @@ int X11DRV_CLIPBOARD_CacheDataFormats( Atom SelectionName )
Window
w
;
Window
ownerSelection
=
0
;
TRACE
(
"enter
\n
"
);
/*
* Empty the clipboard cache
*/
...
...
@@ -379,7 +380,7 @@ int X11DRV_CLIPBOARD_CacheDataFormats( Atom SelectionName )
if
(
(
xe
.
xselection
.
target
!=
aTargets
)
||
(
xe
.
xselection
.
property
==
None
)
)
{
TRACE
(
"
\t
C
ould not retrieve TARGETS
\n
"
);
TRACE
(
"
\t
Exit, c
ould not retrieve TARGETS
\n
"
);
return
cSelectionTargets
;
}
...
...
@@ -444,7 +445,7 @@ int X11DRV_CLIPBOARD_CacheDataFormats( Atom SelectionName )
/* Free the list of targets */
TSXFree
(
targetList
);
}
return
cSelectionTargets
;
}
...
...
@@ -890,7 +891,7 @@ BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
Window
ownerPrimary
=
TSXGetSelectionOwner
(
display
,
XA_PRIMARY
);
Window
ownerClipboard
=
TSXGetSelectionOwner
(
display
,
xaClipboard
);
TRACE
(
"%d
\n
"
,
wFormat
);
TRACE
(
"
enter for
%d
\n
"
,
wFormat
);
/*
* If the selection has not been previously cached, or the selection has changed,
...
...
@@ -915,9 +916,13 @@ BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
/* Exit if there is no selection */
if
(
!
ownerClipboard
&&
!
ownerPrimary
)
{
TRACE
(
"There is no selection
\n
"
);
TRACE
(
"There is no selection
owner
\n
"
);
return
FALSE
;
}
/* 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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment