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
45a6c8f5
Commit
45a6c8f5
authored
Dec 08, 2001
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start to probe single pixels for updates
parent
d6717523
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
8 deletions
+55
-8
x11vnc.c
x11vnc.c
+55
-8
No files found.
x11vnc.c
View file @
45a6c8f5
/* This file is part of LibVNCServer. It is a small clone of x0rfbserver by HexoNet, demonstrating the
/* This file is part of LibVNCServer.
It is a small clone of x0rfbserver by HexoNet, demonstrating the
capabilities of LibVNCServer.
capabilities of LibVNCServer.
*/
*/
...
@@ -216,6 +217,47 @@ void checkForImageUpdates(rfbScreenInfoPtr s,char *b,int rowstride,int x,int y,i
...
@@ -216,6 +217,47 @@ void checkForImageUpdates(rfbScreenInfoPtr s,char *b,int rowstride,int x,int y,i
}
}
}
}
int
probeX
=
0
,
probeY
=
0
;
void
probeScreen
(
rfbScreenInfoPtr
s
,
int
xscreen
)
{
int
i
,
j
,
pixel
,
bpp
=
s
->
rfbServerFormat
.
bitsPerPixel
/
8
,
mask
=
(
1
<<
bpp
)
-
1
,
rstride
=
s
->
paddedWidthInBytes
;
XImage
*
im
;
probeX
++
;
if
(
probeX
>=
tileWidth
)
{
probeX
=
0
;
probeY
++
;
if
(
probeY
>=
tileHeight
)
probeY
=
0
;
}
for
(
j
=
probeY
;
j
<
s
->
height
;
j
+=
tileHeight
)
for
(
i
=
probeX
;
i
<
s
->
width
;
i
+=
tileWidth
)
{
im
=
XGetImage
(
dpy
,
window
,
i
,
j
,
1
,
1
,
AllPlanes
,
ZPixmap
);
pixel
=
XGetPixel
(
im
,
0
,
0
);
XDestroyImage
(
im
);
if
(
!
memcmp
(
&
pixel
,
s
->
frameBuffer
+
i
*
bpp
+
j
*
rstride
,
bpp
))
{
/* do update */
int
i1
,
j1
,
x
=
i
-
probeX
,
w
=
(
x
+
tileWidth
>
s
->
width
)
?
s
->
width
-
x
:
tileWidth
,
y
=
j
-
probeY
,
h
=
(
y
+
tileHeight
>
s
->
height
)
?
s
->
height
-
y
:
tileHeight
;
//getImage(bpp,dpy,xscreen,&im,x,y,w,h);
im
=
XGetImage
(
dpy
,
window
,
x
,
y
,
w
,
h
,
AllPlanes
,
ZPixmap
);
for
(
j1
=
0
;
j1
<
h
;
j1
++
)
memcpy
(
s
->
frameBuffer
+
x
*
bpp
+
(
y
+
j1
)
*
rstride
,
im
->
data
+
j1
*
im
->
bytes_per_line
,
bpp
*
w
);
//checkForImageUpdates(s,im->data,rstride,x,y,w,h);
//if(0 && !useSHM)
XDestroyImage
(
im
);
//memcpy(s->frameBuffer+i*bpp+j*rstride,&pixel,bpp);
rfbMarkRectAsModified
(
s
,
x
,
y
,
x
+
w
,
y
+
h
);
//fprintf(stderr,"%d:%d:%x\n",i,j,pixel);
}
}
}
/* the main program */
/* the main program */
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
...
@@ -334,16 +376,21 @@ int main(int argc,char** argv)
...
@@ -334,16 +376,21 @@ int main(int argc,char** argv)
c
=
0
;
c
=
0
;
while
(
1
)
{
while
(
1
)
{
if
(
screen
->
rfbClientHead
)
if
(
screen
->
rfbClientHead
)
maxMsecsToConnect
=
5000
;
maxMsecsToConnect
=
1
<<
16
;
maxMsecsToConnect
-=
screen
->
rfbDeferUpdateTime
;
else
{
if
(
maxMsecsToConnect
<
0
)
{
maxMsecsToConnect
-=
screen
->
rfbDeferUpdateTime
;
fprintf
(
stderr
,
"Maximum time to connect reached. Exiting.
\n
"
);
if
(
maxMsecsToConnect
<
0
)
{
XTestDiscard
(
dpy
);
fprintf
(
stderr
,
"Maximum time to connect reached. Exiting.
\n
"
);
exit
(
2
);
XTestDiscard
(
dpy
);
exit
(
2
);
}
}
}
rfbProcessEvents
(
screen
,
-
1
);
rfbProcessEvents
(
screen
,
-
1
);
#if 1
probeScreen
(
screen
,
xscreen
);
#else
if
(
gotInput
)
{
if
(
gotInput
)
{
gotInput
=
FALSE
;
gotInput
=
FALSE
;
c
=
updateCounter
;
c
=
updateCounter
;
...
@@ -375,8 +422,8 @@ int main(int argc,char** argv)
...
@@ -375,8 +422,8 @@ int main(int argc,char** argv)
}
else
}
else
tileX
+=
tileWidth
;
tileX
+=
tileWidth
;
}
}
//fprintf(stderr,"+");
}
}
#endif
#ifdef WRITE_SNAPS
#ifdef WRITE_SNAPS
{
{
int
i
,
j
,
r
,
g
,
b
;
int
i
,
j
,
r
,
g
,
b
;
...
...
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