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
26343799
Commit
26343799
authored
Aug 14, 2001
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments & new example: pnmshow
parent
47341aa5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
2 deletions
+73
-2
Makefile
Makefile
+4
-1
example.c
example.c
+1
-0
main.c
main.c
+1
-1
pnmshow.c
pnmshow.c
+67
-0
No files found.
Makefile
View file @
26343799
...
@@ -26,7 +26,7 @@ OBJS=main.o rfbserver.o miregion.o auth.o sockets.o xalloc.o \
...
@@ -26,7 +26,7 @@ OBJS=main.o rfbserver.o miregion.o auth.o sockets.o xalloc.o \
stats.o corre.o hextile.o rre.o translate.o cutpaste.o
\
stats.o corre.o hextile.o rre.o translate.o cutpaste.o
\
zlib.o tight.o
zlib.o tight.o
all
:
example storepasswd
all
:
example
pnmshow
storepasswd
install_OSX
:
OSXvnc-server
install_OSX
:
OSXvnc-server
cp
OSXvnc-server storepasswd ../OSXvnc/build/OSXvnc.app/Contents/MacOS
cp
OSXvnc-server storepasswd ../OSXvnc/build/OSXvnc.app/Contents/MacOS
...
@@ -41,6 +41,9 @@ libvncserver.a: $(OBJS)
...
@@ -41,6 +41,9 @@ libvncserver.a: $(OBJS)
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)
$(PTHREAD_LIBS)
pnmshow
:
pnmshow.o libvncauth/libvncauth.a libvncserver.a
$(CC)
-o
pnmshow pnmshow.o
$(LIBS)
$(PTHREAD_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)
...
...
example.c
View file @
26343799
...
@@ -145,6 +145,7 @@ int main(int argc,char** argv)
...
@@ -145,6 +145,7 @@ int main(int argc,char** argv)
initBuffer
(
rfbScreen
->
frameBuffer
);
initBuffer
(
rfbScreen
->
frameBuffer
);
/* 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 */
runEventLoop
(
rfbScreen
,
40000
,
FALSE
);
runEventLoop
(
rfbScreen
,
40000
,
FALSE
);
/* this is the non-blocking event loop; a background thread is started */
/* this is the non-blocking event loop; a background thread is started */
...
...
main.c
View file @
26343799
...
@@ -276,7 +276,7 @@ processArguments(rfbScreenInfoPtr rfbScreen,int argc, char *argv[])
...
@@ -276,7 +276,7 @@ processArguments(rfbScreenInfoPtr rfbScreen,int argc, char *argv[])
}
else
if
(
strcmp
(
argv
[
i
],
"-dontdisconnect"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-dontdisconnect"
)
==
0
)
{
rfbScreen
->
rfbDontDisconnect
=
TRUE
;
rfbScreen
->
rfbDontDisconnect
=
TRUE
;
}
else
{
}
else
{
usage
();
/* usage(); we no longer exit for unknown arguments */
}
}
}
}
}
}
...
...
pnmshow.c
0 → 100644
View file @
26343799
#include <stdio.h>
#include "rfb.h"
#define XK_MISCELLANY
#include "keysymdef.h"
void
HandleKey
(
Bool
down
,
KeySym
key
,
rfbClientPtr
cl
)
{
if
(
down
&&
(
key
==
XK_Escape
||
key
==
'q'
||
key
==
'Q'
))
rfbCloseClient
(
cl
);
}
int
main
(
int
argc
,
char
**
argv
)
{
FILE
*
in
=
stdin
;
int
i
,
width
,
height
;
unsigned
char
buffer
[
1024
];
rfbScreenInfoPtr
rfbScreen
;
if
(
argc
>
1
)
{
in
=
fopen
(
argv
[
1
],
"rb"
);
if
(
!
in
)
{
printf
(
"Couldn't find file %s.
\n
"
,
argv
[
1
]);
exit
(
1
);
}
}
fgets
(
buffer
,
1024
,
in
);
if
(
strncmp
(
buffer
,
"P6"
,
2
))
{
printf
(
"Not a ppm.
\n
"
);
exit
(
2
);
}
/* skip comments */
do
{
fgets
(
buffer
,
1024
,
in
);
}
while
(
buffer
[
0
]
==
'#'
);
/* get width & height */
sscanf
(
buffer
,
"%d %d"
,
&
width
,
&
height
);
fprintf
(
stderr
,
"Got width %d and height %d (%s).
\n
"
,
width
,
height
,
buffer
);
fgets
(
buffer
,
1024
,
in
);
/* initialize data for vnc server */
rfbScreen
=
rfbDefaultScreenInit
(
argc
,
argv
,
width
,
height
,
8
,
3
,
4
);
if
(
argc
>
1
)
rfbScreen
->
desktopName
=
argv
[
1
];
else
rfbScreen
->
desktopName
=
"Picture"
;
rfbScreen
->
rfbAlwaysShared
=
TRUE
;
rfbScreen
->
kbdAddEvent
=
HandleKey
;
/* allocate picture and read it */
rfbScreen
->
frameBuffer
=
(
char
*
)
malloc
(
width
*
height
*
4
);
fread
(
rfbScreen
->
frameBuffer
,
width
*
3
,
height
,
in
);
/* correct the format to 4 bytes instead of 3 */
for
(
i
=
width
*
height
-
1
;
i
>=
0
;
i
--
)
{
rfbScreen
->
frameBuffer
[
i
*
4
+
3
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
2
];
rfbScreen
->
frameBuffer
[
i
*
4
+
2
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
1
];
rfbScreen
->
frameBuffer
[
i
*
4
+
1
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
0
];
}
/* run event loop */
runEventLoop
(
rfbScreen
,
40000
,
FALSE
);
return
(
0
);
}
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