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
8c599f70
Commit
8c599f70
authored
Sep 13, 2001
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now you can write something in addition to mouse movements ...
parent
26343799
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
320 additions
and
14 deletions
+320
-14
Makefile
Makefile
+3
-4
bdf2c.pl
bdf2c.pl
+44
-0
example.c
example.c
+79
-10
radon.h
radon.h
+194
-0
No files found.
Makefile
View file @
8c599f70
...
@@ -9,7 +9,7 @@ VNCSERVERLIB=-L. -lvncserver -lz -ljpeg
...
@@ -9,7 +9,7 @@ VNCSERVERLIB=-L. -lvncserver -lz -ljpeg
# These two lines enable useage of PThreads
# These two lines enable useage of PThreads
#CFLAGS += -DHAVE_PTHREADS
#CFLAGS += -DHAVE_PTHREADS
VNCSERVERLIB
+=
-lpthread
#
VNCSERVERLIB += -lpthread
LIBS
=
$(LDFLAGS)
$(VNCSERVERLIB)
$(VNCAUTHLIB)
LIBS
=
$(LDFLAGS)
$(VNCSERVERLIB)
$(VNCAUTHLIB)
...
@@ -17,7 +17,6 @@ LIBS=$(LDFLAGS) $(VNCSERVERLIB) $(VNCAUTHLIB)
...
@@ -17,7 +17,6 @@ LIBS=$(LDFLAGS) $(VNCSERVERLIB) $(VNCAUTHLIB)
OSX_LIBS
=
-framework
ApplicationServices
-framework
Carbon
OSX_LIBS
=
-framework
ApplicationServices
-framework
Carbon
# for Example
# for Example
PTHREAD_LIBS
=
-lpthread
SOURCES
=
main.c rfbserver.c miregion.c auth.c sockets.c xalloc.c
\
SOURCES
=
main.c rfbserver.c miregion.c auth.c sockets.c xalloc.c
\
stats.c corre.c hextile.c rre.c translate.c cutpaste.c
\
stats.c corre.c hextile.c rre.c translate.c cutpaste.c
\
...
@@ -39,10 +38,10 @@ libvncserver.a: $(OBJS)
...
@@ -39,10 +38,10 @@ libvncserver.a: $(OBJS)
$(RANLIB)
$@
$(RANLIB)
$@
example
:
example.o libvncauth/libvncauth.a libvncserver.a
example
:
example.o libvncauth/libvncauth.a libvncserver.a
$(CC)
-o
example example.o
$(LIBS)
$(PTHREAD_LIBS)
$(CC)
-o
example example.o
$(LIBS)
pnmshow
:
pnmshow.o libvncauth/libvncauth.a libvncserver.a
pnmshow
:
pnmshow.o libvncauth/libvncauth.a libvncserver.a
$(CC)
-o
pnmshow pnmshow.o
$(LIBS)
$(PTHREAD_LIBS)
$(CC)
-o
pnmshow pnmshow.o
$(LIBS)
OSXvnc-server
:
mac.o libvncauth/libvncauth.a libvncserver.a
OSXvnc-server
:
mac.o libvncauth/libvncauth.a libvncserver.a
$(CC)
-o
OSXvnc-server mac.o
$(LIBS)
$(OSX_LIBS)
$(CC)
-o
OSXvnc-server mac.o
$(LIBS)
$(OSX_LIBS)
...
...
bdf2c.pl
0 → 100644
View file @
8c599f70
#!/usr/bin/perl
@encodings
=
();
for
(
$i
=
0
;
$i
<
256
*
5
;
$i
++
)
{
$encodings
[
$i
]
=
"0"
;
}
$out
=
""
;
$counter
=
0
;
$i
=
0
;
$searchfor
=
""
;
$nullx
=
"0x"
;
while
(
<>
)
{
if
(
/^ENCODING (.*)$/
)
{
$glyphindex
=
$1
;
$searchfor
=
"BBX"
;
}
elsif
(
/^BBX (.*) (.*) (.*) (.*)$/
)
{
(
$width
,
$height
,
$x
,
$y
)
=
(
$1
,
$2
,
$3
,
$4
);
@encodings
[
$glyphindex
*
5
..
(
$glyphindex
*
5
+
4
)]
=
(
$counter
,
$width
,
$height
,
$x
,
$y
);
$searchfor
=
"BITMAP"
;
}
elsif
(
/^BITMAP/
)
{
$i
=
1
;
}
elsif
(
$i
>
0
)
{
if
(
$i
>
$height
)
{
$i
=
0
;
$out
.=
" /* $glyphindex */\n"
;
}
else
{
$_
=
substr
(
$_
,
0
,
length
(
$_
)
-
1
);
$counter
+=
length
(
$_
)
/
2
;
s/(..)/$nullx$1,/g
;
$out
.=
$_
;
$i
++
;
}
}
}
print
"unsigned char bdffontdata[$counter]={\n"
.
$out
;
print
"};\nint bdffontmetadata[256*5]={\n"
;
for
(
$i
=
0
;
$i
<
256
*
5
;
$i
++
)
{
print
$encodings
[
$i
]
.
","
;
}
print
"};\n"
;
example.c
View file @
8c599f70
...
@@ -39,8 +39,8 @@ void initBuffer(unsigned char* buffer)
...
@@ -39,8 +39,8 @@ void initBuffer(unsigned char* buffer)
int
i
,
j
;
int
i
,
j
;
for
(
i
=
0
;
i
<
maxx
;
++
i
)
for
(
i
=
0
;
i
<
maxx
;
++
i
)
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
for
(
j
=
0
;
j
<
maxy
;
++
j
)
{
buffer
[(
j
*
maxx
+
i
)
*
bpp
+
1
]
=
(
i
+
j
)
*
256
/
(
maxx
+
maxy
);
/* red */
buffer
[(
j
*
maxx
+
i
)
*
bpp
+
1
]
=
(
i
+
j
)
*
128
/
(
maxx
+
maxy
);
/* red */
buffer
[(
j
*
maxx
+
i
)
*
bpp
+
2
]
=
i
*
256
/
maxx
;
/* green */
buffer
[(
j
*
maxx
+
i
)
*
bpp
+
2
]
=
i
*
128
/
maxx
;
/* green */
buffer
[(
j
*
maxx
+
i
)
*
bpp
+
3
]
=
j
*
256
/
maxy
;
/* blue */
buffer
[(
j
*
maxx
+
i
)
*
bpp
+
3
]
=
j
*
256
/
maxy
;
/* blue */
}
}
}
}
...
@@ -111,25 +111,92 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
...
@@ -111,25 +111,92 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl)
/* we could get a selection like that:
/* we could get a selection like that:
rfbGotXCutText(cl->screen,"Hallo",5);
rfbGotXCutText(cl->screen,"Hallo",5);
*/
*/
cd
->
oldx
=
x
;
cd
->
oldy
=
y
;
cd
->
oldButton
=
buttonMask
;
}
else
}
else
cd
->
oldButton
=
0
;
cd
->
oldButton
=
0
;
cd
->
oldx
=
x
;
cd
->
oldy
=
y
;
cd
->
oldButton
=
buttonMask
;
}
/* aux function to draw a character to x, y */
#include "radon.h"
int
drawchar
(
unsigned
char
*
buffer
,
int
rowstride
,
int
bpp
,
int
x
,
int
y
,
char
c
)
{
int
i
,
j
,
k
,
width
,
height
;
unsigned
char
d
;
unsigned
char
*
data
=
bdffontdata
+
bdffontmetadata
[
c
*
5
];
width
=
bdffontmetadata
[
c
*
5
+
1
];
height
=
bdffontmetadata
[
c
*
5
+
2
];
x
+=
bdffontmetadata
[
c
*
5
+
3
];
y
+=
bdffontmetadata
[
c
*
5
+
4
]
-
height
+
1
;
for
(
j
=
0
;
j
<
height
;
j
++
)
{
for
(
i
=
0
;
i
<
width
;
i
++
)
{
if
((
i
&
7
)
==
0
)
{
d
=*
data
;
data
++
;
}
if
(
d
&
0x80
)
{
for
(
k
=
0
;
k
<
bpp
;
k
++
)
buffer
[(
y
+
j
)
*
rowstride
+
(
x
+
i
)
*
bpp
+
k
]
=
0xff
;
}
d
<<=
1
;
}
if
((
i
&
7
)
==
0
)
data
++
;
}
return
(
width
);
}
void
drawstring
(
unsigned
char
*
buffer
,
int
rowstride
,
int
bpp
,
int
x
,
int
y
,
char
*
string
)
{
while
(
*
string
)
{
x
+=
drawchar
(
buffer
,
rowstride
,
bpp
,
x
,
y
,
*
string
);
string
++
;
}
}
int
bdflength
(
char
*
string
)
{
int
i
;
while
(
*
string
)
{
i
+=
bdffontmetadata
[
*
string
*
5
+
1
];
string
++
;
}
return
(
i
);
}
void
bdfbbox
(
char
c
,
int
*
x1
,
int
*
y1
,
int
*
x2
,
int
*
y2
)
{
*
x1
+=
bdffontmetadata
[
c
*
5
+
3
];
*
y1
+=
bdffontmetadata
[
c
*
5
+
4
]
-
bdffontmetadata
[
c
*
5
+
2
]
+
1
;
*
x2
=*
x1
+
bdffontmetadata
[
c
*
5
+
1
];
*
y2
=*
y1
+
bdffontmetadata
[
c
*
5
+
2
];
}
}
/* Here the key events are handled */
/* Here the key events are handled */
void
dokey
(
Bool
down
,
KeySym
key
,
rfbClientPtr
cl
)
void
dokey
(
Bool
down
,
KeySym
key
,
rfbClientPtr
cl
)
{
{
if
(
down
&&
key
==
XK_Escape
)
if
(
down
)
{
rfbCloseClient
(
cl
);
if
(
key
==
XK_Escape
)
else
if
(
down
&&
key
==
'c'
)
{
rfbCloseClient
(
cl
);
initBuffer
(
cl
->
screen
->
frameBuffer
);
else
if
(
key
==
XK_Page_Up
)
{
rfbMarkRectAsModified
(
cl
->
screen
,
0
,
0
,
maxx
,
maxy
);
initBuffer
(
cl
->
screen
->
frameBuffer
);
rfbMarkRectAsModified
(
cl
->
screen
,
0
,
0
,
maxx
,
maxy
);
}
else
if
(
key
>=
' '
&&
key
<
0x100
)
{
ClientData
*
cd
=
cl
->
clientData
;
int
x1
=
cd
->
oldx
,
y1
=
cd
->
oldy
,
x2
,
y2
;
cd
->
oldx
+=
drawchar
(
cl
->
screen
->
frameBuffer
,
cl
->
screen
->
paddedWidthInBytes
,
bpp
,
cd
->
oldx
,
cd
->
oldy
,
key
);
bdfbbox
(
key
,
&
x1
,
&
y1
,
&
x2
,
&
y2
);
rfbMarkRectAsModified
(
cl
->
screen
,
x1
,
y1
,
x2
-
1
,
y2
-
1
);
}
}
}
}
}
/* Initiali
s
ation */
/* Initiali
z
ation */
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
...
@@ -144,6 +211,8 @@ int main(int argc,char** argv)
...
@@ -144,6 +211,8 @@ int main(int argc,char** argv)
initBuffer
(
rfbScreen
->
frameBuffer
);
initBuffer
(
rfbScreen
->
frameBuffer
);
drawstring
(
rfbScreen
->
frameBuffer
,
maxx
*
bpp
,
bpp
,
20
,
100
,
"Hallo, Welt!"
);
/* this is the blocking event loop, i.e. it never returns */
/* this is the blocking event loop, i.e. it never returns */
/* 40000 are the microseconds, i.e. 0.04 seconds */
/* 40000 are the microseconds, i.e. 0.04 seconds */
runEventLoop
(
rfbScreen
,
40000
,
FALSE
);
runEventLoop
(
rfbScreen
,
40000
,
FALSE
);
...
...
radon.h
0 → 100644
View file @
8c599f70
This diff is collapsed.
Click to expand it.
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