Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
Irrlicht New
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Irrlicht New
Commits
e44c6720
Commit
e44c6720
authored
Dec 10, 2021
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix linux paste
parent
cffd67d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
23 deletions
+27
-23
source/Irrlicht/CIrrDeviceLinux.cpp
source/Irrlicht/CIrrDeviceLinux.cpp
+27
-23
No files found.
source/Irrlicht/CIrrDeviceLinux.cpp
View file @
e44c6720
...
@@ -63,6 +63,7 @@ namespace
...
@@ -63,6 +63,7 @@ namespace
Atom
X_ATOM_TARGETS
;
Atom
X_ATOM_TARGETS
;
Atom
X_ATOM_UTF8_STRING
;
Atom
X_ATOM_UTF8_STRING
;
Atom
X_ATOM_TEXT
;
Atom
X_ATOM_TEXT
;
Atom
X_ATOM_XSEL_DATA
;
};
};
namespace
irr
namespace
irr
...
@@ -1875,34 +1876,36 @@ const c8* CIrrDeviceLinux::getTextFromClipboard() const
...
@@ -1875,34 +1876,36 @@ const c8* CIrrDeviceLinux::getTextFromClipboard() const
Clipboard
=
""
;
Clipboard
=
""
;
if
(
ownerWindow
!=
None
)
if
(
ownerWindow
!=
None
)
{
{
XConvertSelection
(
display
,
X_ATOM_CLIPBOARD
,
XA_STRING
,
XA_PRIMARY
,
ownerWindow
,
CurrentTime
);
XConvertSelection
(
display
,
X_ATOM_CLIPBOARD
,
X_ATOM_UTF8_STRING
,
X_ATOM_XSEL_DATA
,
window
,
CurrentTime
);
XFlush
(
display
);
XSync
(
display
,
0
);
XEvent
event
;
// check for data
do
nanosleep
((
const
struct
timespec
[]){{
0
,
1L
}},
NULL
);
Atom
type
;
while
(
!
XCheckTypedEvent
(
display
,
SelectionNotify
,
&
event
));
int
format
;
if
(
(
event
.
xselection
.
selection
==
X_ATOM_CLIPBOARD
)
&&
event
.
xselection
.
property
)
unsigned
long
numItems
,
bytesLeft
,
dummy
;
{
unsigned
char
*
data
;
Atom
type
;
XGetWindowProperty
(
display
,
ownerWindow
,
int
format
;
XA_PRIMARY
,
// property name
unsigned
long
size
,
dummy
;
0
,
// offset
unsigned
char
*
data
;
0
,
// length (we only check for data, so 0)
int
result
=
XGetWindowProperty
(
event
.
xselection
.
display
,
event
.
xselection
.
requestor
,
event
.
xselection
.
property
,
0L
,
// offset
(
~
0L
),
// length (max)
0
,
// Delete 0==false
0
,
// Delete 0==false
AnyPropertyType
,
// AnyPropertyType or property identifier
AnyPropertyType
,
// AnyPropertyType or property identifier
&
type
,
// return type
&
type
,
// return type
&
format
,
// return format
&
format
,
// return format
&
numItems
,
// number items
&
size
,
// number items
&
bytesLeft
,
// remaining bytes for partial reads
&
dummy
,
// remaining bytes for partial reads
&
data
);
// data
&
data
);
// data
if
(
bytesLeft
>
0
)
if
(
result
==
Success
{
&&
(
type
==
X_ATOM_UTF8_STRING
||
type
==
XA_STRING
)
)
// not implemented: INCR (partial reads)
// there is some data to get
{
int
result
=
XGetWindowProperty
(
display
,
ownerWindow
,
XA_PRIMARY
,
0
,
Clipboard
=
strndup
((
char
*
)
data
,
size
);
bytesLeft
,
0
,
AnyPropertyType
,
&
type
,
&
format
,
XFree
(
data
);
&
numItems
,
&
dummy
,
&
data
);
}
if
(
result
==
Success
)
XDeleteProperty
(
event
.
xselection
.
display
,
event
.
xselection
.
requestor
,
event
.
xselection
.
property
);
Clipboard
=
(
irr
::
c8
*
)
data
;
XFree
(
data
);
}
}
}
}
...
@@ -1966,6 +1969,7 @@ void CIrrDeviceLinux::initXAtoms()
...
@@ -1966,6 +1969,7 @@ void CIrrDeviceLinux::initXAtoms()
X_ATOM_TARGETS
=
XInternAtom
(
display
,
"TARGETS"
,
False
);
X_ATOM_TARGETS
=
XInternAtom
(
display
,
"TARGETS"
,
False
);
X_ATOM_UTF8_STRING
=
XInternAtom
(
display
,
"UTF8_STRING"
,
False
);
X_ATOM_UTF8_STRING
=
XInternAtom
(
display
,
"UTF8_STRING"
,
False
);
X_ATOM_TEXT
=
XInternAtom
(
display
,
"TEXT"
,
False
);
X_ATOM_TEXT
=
XInternAtom
(
display
,
"TEXT"
,
False
);
X_ATOM_XSEL_DATA
=
XInternAtom
(
display
,
"XSEL_DATA"
,
False
);
#endif
#endif
}
}
...
...
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