sync
svn path=/trunk/kdenetwork/krfb/; revision=126377
@@ -1,6 +1,6 @@
|
|||||||
####### kdevelop will overwrite this part!!! (begin)##########
|
####### kdevelop will overwrite this part!!! (begin)##########
|
||||||
|
|
||||||
SUBDIRS = krfb po doc
|
SUBDIRS = krfb po doc lib include
|
||||||
|
|
||||||
EXTRA_DIST = krfb.kdevprj admin AUTHORS COPYING ChangeLog INSTALL README TODO krfb.lsm
|
EXTRA_DIST = krfb.kdevprj admin AUTHORS COPYING ChangeLog INSTALL README TODO krfb.lsm
|
||||||
|
|
||||||
|
|||||||
194
krfb.kdevprj
@@ -28,13 +28,15 @@ author=Tim Jansen
|
|||||||
configure_args=
|
configure_args=
|
||||||
email=tim@tjansen.de
|
email=tim@tjansen.de
|
||||||
kdevprj_version=1.3
|
kdevprj_version=1.3
|
||||||
makefiles=Makefile.am,krfb/Makefile.am,doc/Makefile.am,doc/en/Makefile.am,po/Makefile.am
|
lfv_open_groups=
|
||||||
|
makefiles=Makefile.am,krfb/Makefile.am,doc/Makefile.am,doc/en/Makefile.am,po/Makefile.am,lib/Makefile.am,include/Makefile.am
|
||||||
project_name=Krfb
|
project_name=Krfb
|
||||||
project_type=mini_kde2
|
project_type=mini_kde2
|
||||||
sgml_file=/home/tim/work/krfb/doc/en/index.docbook
|
sgml_file=/home/tim/work/krfb/doc/en/index.docbook
|
||||||
sub_dir=krfb/
|
sub_dir=krfb/
|
||||||
version=0.1
|
version=0.1
|
||||||
version_control=CVS
|
version_control=CVS
|
||||||
|
workspace=1
|
||||||
|
|
||||||
[INSTALL]
|
[INSTALL]
|
||||||
dist=true
|
dist=true
|
||||||
@@ -53,7 +55,7 @@ groups=Headers,Sources,User Interface,Translations,GNU,Others
|
|||||||
|
|
||||||
[Makefile.am]
|
[Makefile.am]
|
||||||
files=krfb.kdevprj,admin,AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,krfb.lsm
|
files=krfb.kdevprj,admin,AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,krfb.lsm
|
||||||
sub_dirs=krfb,po,doc
|
sub_dirs=krfb,po,doc,lib,include
|
||||||
type=normal
|
type=normal
|
||||||
|
|
||||||
[README]
|
[README]
|
||||||
@@ -89,6 +91,69 @@ install=false
|
|||||||
install_location=$$(kde_icondir)/locolor/16x16/apps/krfb.png
|
install_location=$$(kde_icondir)/locolor/16x16/apps/krfb.png
|
||||||
type=DATA
|
type=DATA
|
||||||
|
|
||||||
|
[include/Connection.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/Framebuffer.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/Makefile.am]
|
||||||
|
files=include/Connection.h,include/d3des.h,include/Framebuffer.h,include/PixelFormatFramebuffer.h,include/rfb.h,include/rfbClient.h,include/rfbServer.h,include/ScaleFramebuffer.h,include/version.h,include/ZlibConnection.h
|
||||||
|
|
||||||
|
[include/PixelFormatFramebuffer.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/ScaleFramebuffer.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/ZlibConnection.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/d3des.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/rfb.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/rfbClient.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/rfbServer.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[include/version.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
[krfb.kdevprj]
|
[krfb.kdevprj]
|
||||||
dist=true
|
dist=true
|
||||||
install=false
|
install=false
|
||||||
@@ -102,28 +167,40 @@ install_location=
|
|||||||
type=DATA
|
type=DATA
|
||||||
|
|
||||||
[krfb/Makefile.am]
|
[krfb/Makefile.am]
|
||||||
files=krfb/main.cpp,krfb/krfb.cpp,krfb/krfb.h,krfb/krfb.desktop,krfb/lo32-app-krfb.png,krfb/lo16-app-krfb.png
|
files=krfb/main.cpp,krfb/krfb.desktop,krfb/lo32-app-krfb.png,krfb/lo16-app-krfb.png,krfb/rfbserver.cpp,krfb/rfbserver.h,krfb/eyes-closed24.png,krfb/eyes-open24.png,krfb/XUpdateScanner.cc,krfb/XUpdateScanner.h
|
||||||
sub_dirs=
|
sub_dirs=
|
||||||
type=prog_main
|
type=prog_main
|
||||||
|
|
||||||
[krfb/krfb.cpp]
|
[krfb/XUpdateScanner.cc]
|
||||||
dist=true
|
dist=true
|
||||||
install=false
|
install=false
|
||||||
install_location=
|
install_location=
|
||||||
type=SOURCE
|
type=SOURCE
|
||||||
|
|
||||||
|
[krfb/XUpdateScanner.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[krfb/eyes-closed24.png]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=DATA
|
||||||
|
|
||||||
|
[krfb/eyes-open24.png]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=DATA
|
||||||
|
|
||||||
[krfb/krfb.desktop]
|
[krfb/krfb.desktop]
|
||||||
dist=true
|
dist=true
|
||||||
install=true
|
install=true
|
||||||
install_location=$$(kde_appsdir)/Applications/krfb.desktop
|
install_location=$$(kde_appsdir)/Applications/krfb.desktop
|
||||||
type=DATA
|
type=DATA
|
||||||
|
|
||||||
[krfb/krfb.h]
|
|
||||||
dist=true
|
|
||||||
install=false
|
|
||||||
install_location=
|
|
||||||
type=HEADER
|
|
||||||
|
|
||||||
[krfb/lo16-app-krfb.png]
|
[krfb/lo16-app-krfb.png]
|
||||||
dist=true
|
dist=true
|
||||||
install=true
|
install=true
|
||||||
@@ -142,6 +219,103 @@ install=false
|
|||||||
install_location=
|
install_location=
|
||||||
type=SOURCE
|
type=SOURCE
|
||||||
|
|
||||||
|
[krfb/rfbserver.cpp]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[krfb/rfbserver.h]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=HEADER
|
||||||
|
|
||||||
|
[lib/Connection.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/Framebuffer.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/Makefile.am]
|
||||||
|
files=lib/computeSubrectDimensions.cc,lib/Connection.cc,lib/d3des.cc,lib/encodeRectangleCoRRE.cc,lib/encodeRectangleHextile.cc,lib/encodeRectangleRRE.cc,lib/Framebuffer.cc,lib/PixelFormatFramebuffer.cc,lib/rfb.cc,lib/rfbClient.cc,lib/rfbServer.cc,lib/ScaleFramebuffer.cc,lib/ZlibConnection.cc
|
||||||
|
sharedlib_LDFLAGS=-version-info 0:0:1
|
||||||
|
sharedlib_rootname=lib
|
||||||
|
sub_dirs=
|
||||||
|
type=static_library
|
||||||
|
|
||||||
|
[lib/PixelFormatFramebuffer.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/ScaleFramebuffer.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/ZlibConnection.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/computeSubrectDimensions.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/d3des.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/encodeRectangleCoRRE.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/encodeRectangleHextile.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/encodeRectangleRRE.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/rfb.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/rfbClient.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
|
[lib/rfbServer.cc]
|
||||||
|
dist=true
|
||||||
|
install=false
|
||||||
|
install_location=
|
||||||
|
type=SOURCE
|
||||||
|
|
||||||
[po/Makefile.am]
|
[po/Makefile.am]
|
||||||
sub_dirs=
|
sub_dirs=
|
||||||
type=po
|
type=po
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
####### kdevelop will overwrite this part!!! (begin)##########
|
####### kdevelop will overwrite this part!!! (begin)##########
|
||||||
bin_PROGRAMS = krfb
|
bin_PROGRAMS = krfb
|
||||||
krfb_SOURCES = krfb.cpp main.cpp
|
krfb_SOURCES = XUpdateScanner.cc rfbserver.cpp main.cpp
|
||||||
krfb_LDADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET)
|
krfb_LDADD = lib/liblib.a $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET)
|
||||||
|
|
||||||
|
|
||||||
EXTRA_DIST = main.cpp krfb.cpp krfb.h krfb.desktop lo32-app-krfb.png lo16-app-krfb.png
|
EXTRA_DIST = main.cpp krfb.desktop lo32-app-krfb.png lo16-app-krfb.png rfbserver.cpp rfbserver.h eyes-closed24.png eyes-open24.png XUpdateScanner.cc XUpdateScanner.h
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
$(mkinstalldirs) $(kde_appsdir)/Applications/
|
$(mkinstalldirs) $(kde_appsdir)/Applications/
|
||||||
@@ -34,7 +34,7 @@ uninstall-local:
|
|||||||
# kde_wallpaperdir Where general wallpapers should go to.
|
# kde_wallpaperdir Where general wallpapers should go to.
|
||||||
|
|
||||||
# set the include path for X, qt and KDE
|
# set the include path for X, qt and KDE
|
||||||
INCLUDES= $(all_includes)
|
INCLUDES= $(all_includes) ../include
|
||||||
|
|
||||||
METASOURCES = AUTO
|
METASOURCES = AUTO
|
||||||
|
|
||||||
|
|||||||
343
krfb/XUpdateScanner.cc
Normal file
@@ -0,0 +1,343 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2000 heXoNet Support GmbH, D-66424 Homburg.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/ipc.h>
|
||||||
|
#include <sys/shm.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/extensions/XShm.h>
|
||||||
|
|
||||||
|
#include "XUpdateScanner.h"
|
||||||
|
#include "OXProperties.h"
|
||||||
|
|
||||||
|
extern Properties properties;
|
||||||
|
|
||||||
|
namespace rfb {
|
||||||
|
|
||||||
|
unsigned int scanlines[32] = { 0, 16, 8, 24,
|
||||||
|
4, 20, 12, 28,
|
||||||
|
10, 26, 18, 2,
|
||||||
|
22, 6, 30, 14,
|
||||||
|
1, 17, 9, 25,
|
||||||
|
7, 23, 15, 31,
|
||||||
|
19, 3, 27, 11,
|
||||||
|
29, 13, 5, 21 };
|
||||||
|
|
||||||
|
XUpdateScanner::XUpdateScanner( Display *_dpy,
|
||||||
|
Window _window,
|
||||||
|
Framebuffer *_fb,
|
||||||
|
unsigned int _tileWidth,
|
||||||
|
unsigned int _tileHeight,
|
||||||
|
unsigned int _blockWidth,
|
||||||
|
unsigned int _blockHeight )
|
||||||
|
: dpy( _dpy )
|
||||||
|
, window( _window )
|
||||||
|
, fb( _fb )
|
||||||
|
, tileWidth( 32 )
|
||||||
|
, tileHeight( 32 )
|
||||||
|
, blockWidth( _blockWidth )
|
||||||
|
, blockHeight( _blockHeight )
|
||||||
|
, count ( 0 )
|
||||||
|
, scanline( NULL )
|
||||||
|
, tile( NULL )
|
||||||
|
{
|
||||||
|
// tile = XGetImage( dpy, window, 0, 0, tileWidth, tileHeight, AllPlanes, ZPixmap );
|
||||||
|
tile = XShmCreateImage( dpy,
|
||||||
|
DefaultVisual( dpy, 0 ),
|
||||||
|
fb->pixelFormat.bits_per_pixel,
|
||||||
|
ZPixmap,
|
||||||
|
NULL,
|
||||||
|
&shminfo_tile,
|
||||||
|
tileWidth,
|
||||||
|
tileHeight );
|
||||||
|
|
||||||
|
shminfo_tile.shmid = shmget( IPC_PRIVATE,
|
||||||
|
tile->bytes_per_line * tile->height,
|
||||||
|
IPC_CREAT | 0777 );
|
||||||
|
shminfo_tile.shmaddr = tile->data = (char *) shmat( shminfo_tile.shmid, 0, 0 );
|
||||||
|
shminfo_tile.readOnly = False;
|
||||||
|
|
||||||
|
XShmAttach( dpy, &shminfo_tile );
|
||||||
|
|
||||||
|
tilesX = (fb->width + tileWidth - 1) / tileWidth;
|
||||||
|
tilesY = (fb->height + tileHeight - 1) / tileHeight;
|
||||||
|
tileMap = (char *) malloc( tilesX * tilesY );
|
||||||
|
|
||||||
|
unsigned int i;
|
||||||
|
for ( i = 0; i < tilesX * tilesY; i++ ) tileMap[i] = 0;
|
||||||
|
|
||||||
|
scanline = XShmCreateImage( dpy,
|
||||||
|
DefaultVisual( dpy, 0 ),
|
||||||
|
fb->pixelFormat.bits_per_pixel,
|
||||||
|
ZPixmap,
|
||||||
|
NULL,
|
||||||
|
&shminfo_scanline,
|
||||||
|
fb->width,
|
||||||
|
1 );
|
||||||
|
|
||||||
|
shminfo_scanline.shmid = shmget( IPC_PRIVATE,
|
||||||
|
scanline->bytes_per_line,
|
||||||
|
IPC_CREAT | 0777 );
|
||||||
|
shminfo_scanline.shmaddr = scanline->data = (char *) shmat( shminfo_scanline.shmid, 0, 0 );
|
||||||
|
shminfo_scanline.readOnly = False;
|
||||||
|
|
||||||
|
XShmAttach( dpy, &shminfo_scanline );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
XUpdateScanner::~XUpdateScanner()
|
||||||
|
{
|
||||||
|
XShmDetach( dpy, &shminfo_scanline );
|
||||||
|
XDestroyImage( scanline );
|
||||||
|
shmdt( shminfo_scanline.shmaddr );
|
||||||
|
shmctl( shminfo_scanline.shmid, IPC_RMID, 0 );
|
||||||
|
free( tileMap );
|
||||||
|
XShmDetach( dpy, &shminfo_tile );
|
||||||
|
XDestroyImage( tile );
|
||||||
|
shmdt( shminfo_tile.shmaddr );
|
||||||
|
shmctl( shminfo_tile.shmid, IPC_RMID, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void XUpdateScanner::checkTile( int x, int y, list< Hint > &hintList )
|
||||||
|
{
|
||||||
|
unsigned int maxWidth = fb->width - x;
|
||||||
|
unsigned int maxHeight = fb->height - y;
|
||||||
|
if ( maxWidth > tileWidth ) maxWidth = tileWidth;
|
||||||
|
if ( maxHeight > tileHeight ) maxHeight = tileHeight;
|
||||||
|
|
||||||
|
if ( ( maxWidth == tileWidth ) && ( maxHeight == tileHeight ) ) {
|
||||||
|
XShmGetImage( dpy, window, tile, x, y, AllPlanes );
|
||||||
|
} else {
|
||||||
|
XGetSubImage( dpy, window, x, y, maxWidth, maxHeight, AllPlanes, ZPixmap, tile, 0, 0 );
|
||||||
|
}
|
||||||
|
unsigned int line;
|
||||||
|
bool changed = false;
|
||||||
|
unsigned char *src = (unsigned char*) tile->data;
|
||||||
|
unsigned char *dest = fb->data + y * fb->bytesPerLine + x * (fb->pixelFormat.bits_per_pixel >> 3);
|
||||||
|
for ( line = 0; line < maxHeight; line++ ) {
|
||||||
|
if ( memcmp( dest, src, maxWidth * (fb->pixelFormat.bits_per_pixel >> 3) ) ) {
|
||||||
|
changed = true;
|
||||||
|
memcpy( dest, src, maxWidth * (fb->pixelFormat.bits_per_pixel >> 3) );
|
||||||
|
}
|
||||||
|
src += tile->bytes_per_line;
|
||||||
|
dest += fb->bytesPerLine;
|
||||||
|
}
|
||||||
|
unsigned int tx = x / tileWidth;
|
||||||
|
unsigned int ty = y / tileHeight;
|
||||||
|
if ( changed ) {
|
||||||
|
Hint hint;
|
||||||
|
hint.type = hintRefresh;
|
||||||
|
hint.hint.refresh.x = x;
|
||||||
|
hint.hint.refresh.y = y;
|
||||||
|
hint.hint.refresh.width = maxWidth;
|
||||||
|
hint.hint.refresh.height = maxHeight;
|
||||||
|
hintList.push_back( hint );
|
||||||
|
|
||||||
|
/*
|
||||||
|
tileMap[ tx + ty * tilesX ] += 2;
|
||||||
|
|
||||||
|
if ( tx > 0 )
|
||||||
|
if ( tileMap[ (tx-1) + ty * tilesX ] <= 1 ) tileMap[ (tx-1) + ty * tilesX ] = 2;
|
||||||
|
if ( ty > 0 )
|
||||||
|
if ( tileMap[ tx + (ty-1) * tilesX ] <= 1 ) tileMap[ tx + (ty-1) * tilesX ] = 2;
|
||||||
|
if ( tx < tilesX-1 )
|
||||||
|
if ( tileMap[ (tx+1) + ty * tilesX ] <= 1 ) tileMap[ (tx+1) + ty * tilesX ] = 2;
|
||||||
|
if ( ty < tilesY-1 )
|
||||||
|
if ( tileMap[ tx + (ty+1) * tilesX ] <= 1 ) tileMap[ tx + (ty+1) * tilesX ] = 2;
|
||||||
|
} else {
|
||||||
|
if ( tileMap[ tx + ty * tilesX ] >= 2 )
|
||||||
|
tileMap[ tx + ty * tilesX ] -= 2;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define POINTER_WIDTH 12
|
||||||
|
#define POINTER_HEIGHT 18
|
||||||
|
|
||||||
|
char pointerMap[] =
|
||||||
|
" "
|
||||||
|
" .. "
|
||||||
|
" .+. "
|
||||||
|
" .++. "
|
||||||
|
" .+++. "
|
||||||
|
" .++++. "
|
||||||
|
" .+++++. "
|
||||||
|
" .++++++. "
|
||||||
|
" .+++++++. "
|
||||||
|
" .++++++++. "
|
||||||
|
" .+++++.... "
|
||||||
|
" .++.++. "
|
||||||
|
" .+. .++. "
|
||||||
|
" .. .++. "
|
||||||
|
" .++. "
|
||||||
|
" .++. "
|
||||||
|
" .. "
|
||||||
|
" ";
|
||||||
|
|
||||||
|
void XUpdateScanner::searchUpdates( list< Hint > &hintList )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
count %= (blockWidth * blockHeight);
|
||||||
|
if ( count % 4 == 0 ) {
|
||||||
|
unsigned int i;
|
||||||
|
for ( i = 0; i < tilesX * tilesY; i++ ) {
|
||||||
|
if ( tileMap[i] > 0 ) tileMap[i]--;
|
||||||
|
if ( tileMap[i] <= 0 )
|
||||||
|
tileMap[i] += (count == (i % (blockWidth * blockHeight)))? 1 : 0;
|
||||||
|
if ( tileMap[i] > 16 )
|
||||||
|
tileMap[i] = 16;
|
||||||
|
if ( tileMap[i] < -8 )
|
||||||
|
tileMap[i] = -8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
count %= 32;
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int x, y;
|
||||||
|
|
||||||
|
for ( i = 0; i < tilesX * tilesY; i++ ) {
|
||||||
|
// if ( tileMap[i] > 0 ) tileMap[i]--;
|
||||||
|
// if ( tileMap[i] > 8 ) tileMap[i] = 8;
|
||||||
|
tileMap[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
y = scanlines[count];
|
||||||
|
while ( y < fb->height ) {
|
||||||
|
XShmGetImage( dpy, window, scanline, 0, y, AllPlanes );
|
||||||
|
x = 0;
|
||||||
|
while ( x < fb->width ) {
|
||||||
|
unsigned char *src = (unsigned char*) scanline->data + x * (fb->pixelFormat.bits_per_pixel >> 3);
|
||||||
|
unsigned char *dest = fb->data + y * fb->bytesPerLine + x * (fb->pixelFormat.bits_per_pixel >> 3);
|
||||||
|
if ( memcmp( dest, src, 32 * (fb->pixelFormat.bits_per_pixel >> 3) ) ) {
|
||||||
|
tileMap[ (x / tileWidth) + (y / tileHeight) * tilesX ] = 1;
|
||||||
|
}
|
||||||
|
x += 32;
|
||||||
|
}
|
||||||
|
y += 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( y = 0; y < tilesY; y++ ) {
|
||||||
|
for ( x = 0; x < tilesX; x++ ) {
|
||||||
|
if ( tileMap[x + y * tilesX] > 0 )
|
||||||
|
checkTile( x * tileWidth, y * tileHeight, hintList );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( properties.showMousePointer ) {
|
||||||
|
|
||||||
|
Window root_return, child_return;
|
||||||
|
int root_x, root_y;
|
||||||
|
int win_x, win_y;
|
||||||
|
unsigned int mask_return;
|
||||||
|
XQueryPointer( dpy, window, &root_return, &child_return,
|
||||||
|
&root_x, &root_y,
|
||||||
|
&win_x, &win_y,
|
||||||
|
&mask_return );
|
||||||
|
|
||||||
|
// draw Pointer Map
|
||||||
|
|
||||||
|
int px, py, mx, my;
|
||||||
|
mx = fb->width - root_x;
|
||||||
|
if ( mx > POINTER_WIDTH ) mx = POINTER_WIDTH;
|
||||||
|
my = fb->height - root_y;
|
||||||
|
if ( my > POINTER_HEIGHT ) my = POINTER_HEIGHT;
|
||||||
|
|
||||||
|
for ( py = 0; py < my; py++ )
|
||||||
|
for ( px = 0; px < mx; px++ ) {
|
||||||
|
int ofs = (root_x + px) * (fb->pixelFormat.bits_per_pixel >> 3)
|
||||||
|
+ (root_y + py) * fb->bytesPerLine;
|
||||||
|
switch ( pointerMap[ px + py * POINTER_WIDTH ] ) {
|
||||||
|
|
||||||
|
case '.':
|
||||||
|
switch ( fb->pixelFormat.bits_per_pixel ) {
|
||||||
|
case 8:
|
||||||
|
fb->data[ofs] = 0;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
fb->data[ofs] = 0;
|
||||||
|
fb->data[ofs+1] = 0;
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
fb->data[ofs] = 0;
|
||||||
|
fb->data[ofs+1] = 0;
|
||||||
|
fb->data[ofs+2] = 0;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
fb->data[ofs] = 0;
|
||||||
|
fb->data[ofs+1] = 0;
|
||||||
|
fb->data[ofs+2] = 0;
|
||||||
|
fb->data[ofs+3] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '+':
|
||||||
|
switch ( fb->pixelFormat.bits_per_pixel ) {
|
||||||
|
case 8:
|
||||||
|
fb->data[ofs] = 255;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
fb->data[ofs] = 255;
|
||||||
|
fb->data[ofs+1] = 255;
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
fb->data[ofs] = 255;
|
||||||
|
fb->data[ofs+1] = 255;
|
||||||
|
fb->data[ofs+2] = 255;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
fb->data[ofs] = 255;
|
||||||
|
fb->data[ofs+1] = 255;
|
||||||
|
fb->data[ofs+2] = 255;
|
||||||
|
fb->data[ofs+3] = 255;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Hint hint;
|
||||||
|
hint.type = hintRefresh;
|
||||||
|
hint.hint.refresh.x = root_x;
|
||||||
|
hint.hint.refresh.y = root_y;
|
||||||
|
hint.hint.refresh.width = mx;
|
||||||
|
hint.hint.refresh.height = my;
|
||||||
|
hintList.push_back( hint );
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace rfb
|
||||||
|
|
||||||
|
|
||||||
66
krfb/XUpdateScanner.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2000 heXoNet Support GmbH, D-66424 Homburg.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
* USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _hexonet_rfb_XUpdateScanner_h_
|
||||||
|
#define _hexonet_rfb_XUpdateScanner_h_
|
||||||
|
|
||||||
|
|
||||||
|
#include "rfbServer.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace rfb {
|
||||||
|
|
||||||
|
class XUpdateScanner
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XUpdateScanner( Display *_dpy,
|
||||||
|
Window _window,
|
||||||
|
Framebuffer *_fb,
|
||||||
|
unsigned int _tileWidth = 32,
|
||||||
|
unsigned int _tileHeight = 32,
|
||||||
|
unsigned int _blockWidth = 9,
|
||||||
|
unsigned int _blockHeight = 9);
|
||||||
|
|
||||||
|
~XUpdateScanner();
|
||||||
|
|
||||||
|
void checkTile( int x, int y, list< Hint > &hintList );
|
||||||
|
void searchUpdates( list< Hint > &hintList );
|
||||||
|
|
||||||
|
|
||||||
|
Display *dpy;
|
||||||
|
Window window;
|
||||||
|
Framebuffer *fb;
|
||||||
|
unsigned int tileWidth, tileHeight, blockWidth, blockHeight;
|
||||||
|
unsigned int count;
|
||||||
|
|
||||||
|
XImage *scanline;
|
||||||
|
XShmSegmentInfo shminfo_scanline;
|
||||||
|
|
||||||
|
XImage *tile;
|
||||||
|
XShmSegmentInfo shminfo_tile;
|
||||||
|
|
||||||
|
unsigned int tilesX, tilesY;
|
||||||
|
char *tileMap;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace rfb
|
||||||
|
|
||||||
|
#endif _hexonet_rfb_XUpdateScanner_h_
|
||||||
BIN
krfb/eyes-closed.png
Normal file
|
After Width: | Height: | Size: 542 B |
BIN
krfb/eyes-closed24.png
Normal file
|
After Width: | Height: | Size: 877 B |
BIN
krfb/eyes-open.png
Normal file
|
After Width: | Height: | Size: 592 B |
BIN
krfb/eyes-open24.png
Normal file
|
After Width: | Height: | Size: 1002 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 561 B |
|
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 592 B |
@@ -15,16 +15,17 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include <kpixmap.h>
|
||||||
|
#include <kapplication.h>
|
||||||
|
#include <ksystemtray.h>
|
||||||
#include <kcmdlineargs.h>
|
#include <kcmdlineargs.h>
|
||||||
#include <kaboutdata.h>
|
#include <kaboutdata.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
|
|
||||||
#include "krfb.h"
|
#define VERSION "0.1"
|
||||||
|
|
||||||
|
static const char *description = I18N_NOOP("Krfb");
|
||||||
|
|
||||||
static const char *description =
|
|
||||||
I18N_NOOP("Krfb");
|
|
||||||
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
|
|
||||||
|
|
||||||
|
|
||||||
static KCmdLineOptions options[] =
|
static KCmdLineOptions options[] =
|
||||||
{
|
{
|
||||||
@@ -32,20 +33,36 @@ static KCmdLineOptions options[] =
|
|||||||
// INSERT YOUR COMMANDLINE OPTIONS HERE
|
// INSERT YOUR COMMANDLINE OPTIONS HERE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static KPixmap *trayIconOpen;
|
||||||
|
static KPixmap *trayIconClosed;
|
||||||
|
static KSystemTray *tray;
|
||||||
|
|
||||||
|
void setOpenIcon() {
|
||||||
|
tray->setPixmap(*trayIconOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setClosedIcon() {
|
||||||
|
tray->setPixmap(*trayIconClosed);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
KAboutData aboutData( "krfb", I18N_NOOP("Krfb"),
|
KAboutData aboutData( "krfb", I18N_NOOP("Krfb"),
|
||||||
VERSION, description, KAboutData::License_GPL,
|
VERSION, description, KAboutData::License_GPL,
|
||||||
"(c) 2001, Tim Jansen", 0, 0, "tim@tjansen.de");
|
"(c) 2001, Tim Jansen", 0, 0, "tim@tjansen.de");
|
||||||
aboutData.addAuthor("Tim Jansen",0, "tim@tjansen.de");
|
aboutData.addAuthor("Tim Jansen",0, "tim@tjansen.de");
|
||||||
KCmdLineArgs::init( argc, argv, &aboutData );
|
KCmdLineArgs::init( argc, argv, &aboutData );
|
||||||
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
|
KCmdLineArgs::addCmdLineOptions( options );
|
||||||
|
|
||||||
KApplication a;
|
KApplication app;
|
||||||
Krfb *krfb = new Krfb();
|
|
||||||
a.setMainWidget(krfb);
|
|
||||||
krfb->show();
|
|
||||||
|
|
||||||
return a.exec();
|
tray = new KSystemTray();
|
||||||
|
trayIconOpen = new KPixmap();
|
||||||
|
trayIconClosed = new KPixmap();
|
||||||
|
trayIconOpen->load("eyes-open24.png");
|
||||||
|
trayIconClosed->load("eyes-closed24.png");
|
||||||
|
setClosedIcon();
|
||||||
|
tray->show();
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
59
krfb/rfbserver.cpp
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
rfbserver.cpp - description
|
||||||
|
-------------------
|
||||||
|
begin : Sun Dec 9 2001
|
||||||
|
copyright : (C) 2001 by Tim Jansen
|
||||||
|
email : tim@tjansen.de
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Contains portions & concept from rfb's x0rfbserver.cc
|
||||||
|
* Copyright (C) 2000 heXoNet Support GmbH, D-66424 Homburg.
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
RFBServer::RFBServer(int fd) :
|
||||||
|
Server(),
|
||||||
|
fd(fd),
|
||||||
|
buttonMask(0)
|
||||||
|
{
|
||||||
|
InitBlocks(32, 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
RFBServer::~RFBServer() {
|
||||||
|
DeleteBlocks();
|
||||||
|
shutdown(fd, 2);
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RFBServer::handleKeyEvent(KeyEvent &keyEvent) {
|
||||||
|
KeyCode kc = XKeysymToKeycode(dpy, keyEvent.key);
|
||||||
|
if (kc != NoSymbol)
|
||||||
|
XTestFakeKeyEvent(dpy,
|
||||||
|
XKeysymToKeycode( dpy, keyEvent.key ),
|
||||||
|
keyEvent.down_flag,
|
||||||
|
CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RFBServer::handlePointerEvent(PointerEvent &pointerEvent) {
|
||||||
|
XTestFakeMotionEvent(dpy,
|
||||||
|
0,
|
||||||
|
pointerEvent.x_position,
|
||||||
|
pointerEvent.y_position,
|
||||||
|
CurrentTime);
|
||||||
|
int i = 1;
|
||||||
|
while (i <= 5) {
|
||||||
|
if ( (buttonMask & (1 << (i-1))) != (pointerEvent.button_mask & (1 << (i-1))) )
|
||||||
|
XTestFakeButtonEvent( dpy, i, (pointerEvent.button_mask & (1 << (i-1)))? True : False, CurrentTime );
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
buttonMask = pointerEvent.button_mask;
|
||||||
|
}
|
||||||
42
krfb/rfbserver.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
rfbserver.h - description
|
||||||
|
-------------------
|
||||||
|
begin : Sun Dec 9 2001
|
||||||
|
copyright : (C) 2001 by Tim Jansen
|
||||||
|
email : tim@tjansen.de
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* Contains portions & concept from rfb's x0rfbserver.cc
|
||||||
|
* Copyright (C) 2000 heXoNet Support GmbH, D-66424 Homburg.
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef RFBSERVER_H
|
||||||
|
#define RFBSERVER_H
|
||||||
|
|
||||||
|
#include <rfbserver.h>
|
||||||
|
|
||||||
|
using namespace rfb;
|
||||||
|
|
||||||
|
/**KDE-specific implementation of the Server base class
|
||||||
|
*@author Tim Jansen
|
||||||
|
*/
|
||||||
|
|
||||||
|
class RFBServer : public Server {
|
||||||
|
public:
|
||||||
|
RFBServer(int fd);
|
||||||
|
~RFBServer();
|
||||||
|
virtual void handleKeyEvent();
|
||||||
|
virtual void handlePointerEvent(PointerEvent &pointerEvent);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||