Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
87a4c9be
Commit
87a4c9be
authored
Sep 12, 2006
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support clipboard
parent
6cfd9afe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
11 deletions
+61
-11
nacro.c
VisualNaCro/nacro.c
+50
-5
nacro.h
VisualNaCro/nacro.h
+11
-6
No files found.
VisualNaCro/nacro.c
View file @
87a4c9be
#include <assert.h>
#include <string.h>
#include <rfb/rfb.h>
#include <rfb/rfbclient.h>
...
...
@@ -22,6 +23,8 @@ typedef struct private_resource_t {
int
x
,
y
;
int
buttons
;
char
*
text
;
image_t
*
grep_image
;
int
x_origin
,
y_origin
;
...
...
@@ -87,6 +90,30 @@ static void got_mouse(int buttons,int x,int y,rfbClientRec* cl)
res
->
result
|=
RESULT_MOUSE
;
}
static
void
got_text
(
char
*
str
,
int
len
,
rfbClientRec
*
cl
)
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
screen
->
screenData
;
SendClientCutText
(
res
->
client
,
str
,
len
);
if
(
res
->
text
)
free
(
res
->
text
);
res
->
text
=
strdup
(
str
);
res
->
result
|=
RESULT_TEXT
;
}
static
void
got_text_from_server
(
rfbClient
*
cl
,
const
char
*
str
,
int
textlen
)
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
clientData
;
rfbSendServerCutText
(
res
->
server
,
(
char
*
)
str
,
textlen
);
if
(
res
->
text
)
free
(
res
->
text
);
res
->
text
=
strdup
(
str
);
res
->
result
|=
RESULT_TEXT
;
}
static
rfbBool
malloc_frame_buffer
(
rfbClient
*
cl
)
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
clientData
;
...
...
@@ -102,6 +129,7 @@ static rfbBool malloc_frame_buffer(rfbClient* cl)
res
->
server
->
frameBuffer
=
res
->
client
->
frameBuffer
;
res
->
server
->
kbdAddEvent
=
got_key
;
res
->
server
->
ptrAddEvent
=
got_mouse
;
res
->
server
->
setXCutText
=
got_text
;
rfbInitServer
(
res
->
server
);
}
else
{
/* TODO: realloc if necessary */
...
...
@@ -174,11 +202,14 @@ resource_t initvnc(const char* server,int server_port,int listen_port)
/* remember for later */
res
->
listen_port
=
listen_port
;
res
->
text
=
NULL
;
res
->
client
=
rfbGetClient
(
8
,
3
,
4
);
res
->
client
->
clientData
=
res
;
res
->
client
->
clientData
=
(
void
*
)
res
;
res
->
client
->
GotFrameBufferUpdate
=
got_frame_buffer
;
res
->
client
->
MallocFrameBuffer
=
malloc_frame_buffer
;
res
->
client
->
GotXCutText
=
got_text_from_server
;
res
->
client
->
serverHost
=
strdup
(
server
);
res
->
client
->
serverPort
=
server_port
;
res
->
client
->
appData
.
encodingsString
=
"raw"
;
...
...
@@ -484,7 +515,7 @@ result_t alert(resource_t resource,const char* message,timeout_t timeout)
int
x
,
y
,
w
,
h
;
result_t
result
;
if
(
res
->
server
==
0
)
if
(
res
==
NULL
||
res
->
server
==
NULL
)
return
-
1
;
w
=
res
->
server
->
width
;
...
...
@@ -540,12 +571,18 @@ buttons_t getbuttons(resource_t res)
return
r
->
buttons
;
}
const
char
*
gettext
(
resource_t
res
)
{
private_resource_t
*
r
=
get_resource
(
res
);
return
r
->
text
;
}
/* send events to the server */
bool_t
sendkey
(
resource_t
res
,
keysym_t
keysym
,
bool_t
keydown
)
{
private_resource_t
*
r
=
get_resource
(
res
);
if
(
r
==
0
)
if
(
r
==
NULL
)
return
0
;
return
SendKeyEvent
(
r
->
client
,
keysym
,
keydown
);
}
...
...
@@ -553,11 +590,19 @@ bool_t sendkey(resource_t res,keysym_t keysym,bool_t keydown)
bool_t
sendmouse
(
resource_t
res
,
coordinate_t
x
,
coordinate_t
y
,
buttons_t
buttons
)
{
private_resource_t
*
r
=
get_resource
(
res
);
if
(
r
==
0
)
if
(
r
==
NULL
)
return
0
;
return
SendPointerEvent
(
r
->
client
,
x
,
y
,
buttons
);
}
bool_t
sendtext
(
resource_t
res
,
const
char
*
string
)
{
private_resource_t
*
r
=
get_resource
(
res
);
if
(
r
==
NULL
)
return
0
;
return
SendClientCutText
(
r
->
client
,
(
char
*
)
string
,
(
int
)
strlen
(
string
));
}
/* for visual grepping */
coordinate_t
getxorigin
(
resource_t
res
)
...
...
VisualNaCro/nacro.h
View file @
87a4c9be
...
...
@@ -32,9 +32,10 @@ typedef int result_t;
%constant int RESULT_TIMEOUT=1;
%constant int RESULT_KEY=2;
%constant int RESULT_MOUSE=4;
%constant int RESULT_SCREEN=8;
%constant int RESULT_FOUNDIMAGE=16;
%constant int RESULT_SHUTDOWN=32;
%constant int RESULT_TEXT=8
%constant int RESULT_SCREEN=16;
%constant int RESULT_FOUNDIMAGE=32;
%constant int RESULT_SHUTDOWN=64;
*/
%
}
...
...
@@ -51,9 +52,10 @@ typedef int result_t;
#define RESULT_TIMEOUT 1
#define RESULT_KEY 2
#define RESULT_MOUSE 4
#define RESULT_SCREEN 8
#define RESULT_FOUNDIMAGE 16
#define RESULT_SHUTDOWN 32
#define RESULT_TEXT 8
#define RESULT_SCREEN 16
#define RESULT_FOUNDIMAGE 32
#define RESULT_SHUTDOWN 64
/* init/shutdown */
...
...
@@ -84,10 +86,13 @@ coordinate_t getx(resource_t res);
coordinate_t
gety
(
resource_t
res
);
buttons_t
getbuttons
(
resource_t
res
);
const
char
*
gettext
(
resource_t
res
);
/* send events to the server */
bool_t
sendkey
(
resource_t
res
,
keysym_t
keysym
,
bool_t
keydown
);
bool_t
sendmouse
(
resource_t
res
,
coordinate_t
x
,
coordinate_t
y
,
buttons_t
buttons
);
bool_t
sendtext
(
resource_t
res
,
const
char
*
string
);
/* for visual grepping */
...
...
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