From 584e22d6c823a85d17f8bef808eff035ef03b900 Mon Sep 17 00:00:00 2001 From: Tim Jansen Date: Tue, 11 Dec 2001 20:29:19 +0000 Subject: [PATCH] sync svn path=/trunk/kdenetwork/krfb/; revision=126691 --- krfb/Makefile.am | 31 ++++++++++++++++++----------- krfb/XUpdateScanner.cc | 5 ++--- krfb/krfb.cpp | 26 ------------------------ krfb/krfb.h | 39 ------------------------------------ krfb/main.cpp | 16 +++++++-------- krfb/rfbserver.cpp | 45 ++++++++++++++++++++++++++---------------- krfb/rfbserver.h | 22 ++++++++++++++------- 7 files changed, 72 insertions(+), 112 deletions(-) delete mode 100644 krfb/krfb.cpp delete mode 100644 krfb/krfb.h diff --git a/krfb/Makefile.am b/krfb/Makefile.am index 03fccca9..c0b26862 100644 --- a/krfb/Makefile.am +++ b/krfb/Makefile.am @@ -1,23 +1,30 @@ ####### kdevelop will overwrite this part!!! (begin)########## bin_PROGRAMS = krfb krfb_SOURCES = XUpdateScanner.cc rfbserver.cpp main.cpp -krfb_LDADD = lib/liblib.a $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET) +krfb_LDADD = ./lib/liblib.a $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET) +SUBDIRS = lib 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: - $(mkinstalldirs) $(kde_appsdir)/Applications/ - $(INSTALL_DATA) $(srcdir)/krfb.desktop $(kde_appsdir)/Applications/krfb.desktop - $(mkinstalldirs) $(kde_icondir)/locolor/32x32/apps/ - $(INSTALL_DATA) $(srcdir)/lo32-app-krfb.png $(kde_icondir)/locolor/32x32/apps/krfb.png - $(mkinstalldirs) $(kde_icondir)/locolor/16x16/apps/ - $(INSTALL_DATA) $(srcdir)/lo16-app-krfb.png $(kde_icondir)/locolor/16x16/apps/krfb.png + $(mkinstalldirs) $$(kde_appsdir)/Applications/ + $(INSTALL_DATA) $(srcdir)/krfb.desktop $$(kde_appsdir)/Applications/krfb.desktop + $(mkinstalldirs) $$(kde_icondir)/locolor/32x32/apps/ + $(INSTALL_DATA) $(srcdir)/lo32-app-krfb.png $$(kde_icondir)/locolor/32x32/apps/krfb.png + $(mkinstalldirs) $$(kde_icondir)/locolor/16x16/apps/ + $(INSTALL_DATA) $(srcdir)/lo16-app-krfb.png $$(kde_icondir)/locolor/16x16/apps/krfb.png + $(mkinstalldirs) $$(kde_icondir)/hicolor/22x22/apps/ + $(INSTALL_DATA) $(srcdir)/eyes-closed24.png $$(kde_icondir)/hicolor/22x22/apps/krfb.png + $(mkinstalldirs) $$(kde_icondir)/hicolor/22x22/apps/ + $(INSTALL_DATA) $(srcdir)/eyes-open24.png $$(kde_icondir)/hicolor/22x22/apps/krfb.png uninstall-local: - -rm -f $(kde_appsdir)/Applications/krfb.desktop - -rm -f $(kde_icondir)/locolor/32x32/apps/krfb.png - -rm -f $(kde_icondir)/locolor/16x16/apps/krfb.png + -rm -f $$(kde_appsdir)/Applications/krfb.desktop + -rm -f $$(kde_icondir)/locolor/32x32/apps/krfb.png + -rm -f $$(kde_icondir)/locolor/16x16/apps/krfb.png + -rm -f $$(kde_icondir)/hicolor/22x22/apps/krfb.png + -rm -f $$(kde_icondir)/hicolor/22x22/apps/krfb.png ####### kdevelop will overwrite this part!!! (end)############ # this 10 paths are KDE specific. Use them: @@ -34,12 +41,12 @@ uninstall-local: # kde_wallpaperdir Where general wallpapers should go to. # set the include path for X, qt and KDE -INCLUDES= $(all_includes) ../include +INCLUDES= $(all_includes) -I../include METASOURCES = AUTO # the library search path. -krfb_LDFLAGS = $(all_libraries) $(KDE_RPATH) +krfb_LDFLAGS = $(all_libraries) $(KDE_RPATH) -lXtst # Uncomment the following two lines if you add a ui.rc file for your application to make use of # KDE´s XML GUI builing diff --git a/krfb/XUpdateScanner.cc b/krfb/XUpdateScanner.cc index e240798a..5d20d548 100644 --- a/krfb/XUpdateScanner.cc +++ b/krfb/XUpdateScanner.cc @@ -25,9 +25,8 @@ #include #include "XUpdateScanner.h" -#include "OXProperties.h" -extern Properties properties; +#define SHOW_MOUSE_POINTER 1 namespace rfb { @@ -245,7 +244,7 @@ void XUpdateScanner::searchUpdates( list< Hint > &hintList ) } - if ( properties.showMousePointer ) { + if ( SHOW_MOUSE_POINTER ) { Window root_return, child_return; int root_x, root_y; diff --git a/krfb/krfb.cpp b/krfb/krfb.cpp deleted file mode 100644 index 33f3a72e..00000000 --- a/krfb/krfb.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*************************************************************************** - krfb.cpp - description - ------------------- - begin : Sat Dec 8 03:23:02 CET 2001 - copyright : (C) 2001 by Tim Jansen - email : tim@tjansen.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -#include "krfb.h" - -Krfb::Krfb(QWidget *parent, const char *name) : QWidget(parent, name) -{ -} - -Krfb::~Krfb() -{ -} diff --git a/krfb/krfb.h b/krfb/krfb.h deleted file mode 100644 index b6dcdf73..00000000 --- a/krfb/krfb.h +++ /dev/null @@ -1,39 +0,0 @@ -/*************************************************************************** - krfb.h - description - ------------------- - begin : Sat Dec 8 03:23:02 CET 2001 - copyright : (C) 2001 by Tim Jansen - email : tim@tjansen.de - ***************************************************************************/ - -/*************************************************************************** - * * - * 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 KRFB_H -#define KRFB_H - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -/** Krfb is the base class of the project */ -class Krfb : public QWidget -{ - Q_OBJECT - public: - /** construtor */ - Krfb(QWidget* parent=0, const char *name=0); - /** destructor */ - ~Krfb(); -}; - -#endif diff --git a/krfb/main.cpp b/krfb/main.cpp index 49c09f0c..7363539e 100644 --- a/krfb/main.cpp +++ b/krfb/main.cpp @@ -29,7 +29,7 @@ static const char *description = I18N_NOOP("Krfb"); static KCmdLineOptions options[] = { - { 0, 0, 0 } + { 0, 0, 0 } // INSERT YOUR COMMANDLINE OPTIONS HERE }; @@ -47,12 +47,12 @@ void setClosedIcon() { int main(int argc, char *argv[]) { - KAboutData aboutData( "krfb", I18N_NOOP("Krfb"), - VERSION, description, KAboutData::License_GPL, - "(c) 2001, Tim Jansen", 0, 0, "tim@tjansen.de"); - aboutData.addAuthor("Tim Jansen",0, "tim@tjansen.de"); - KCmdLineArgs::init( argc, argv, &aboutData ); - KCmdLineArgs::addCmdLineOptions( options ); + KAboutData aboutData( "krfb", I18N_NOOP("Krfb"), + VERSION, description, KAboutData::License_GPL, + "(c) 2001, Tim Jansen", 0, 0, "tim@tjansen.de"); + aboutData.addAuthor("Tim Jansen",0, "tim@tjansen.de"); + KCmdLineArgs::init( argc, argv, &aboutData ); + KCmdLineArgs::addCmdLineOptions( options ); KApplication app; @@ -64,5 +64,5 @@ int main(int argc, char *argv[]) setClosedIcon(); tray->show(); - return app.exec(); + return app.exec(); } diff --git a/krfb/rfbserver.cpp b/krfb/rfbserver.cpp index 204ca4a1..32a33950 100644 --- a/krfb/rfbserver.cpp +++ b/krfb/rfbserver.cpp @@ -20,40 +20,51 @@ * * ***************************************************************************/ -RFBServer::RFBServer(int fd) : +#include "rfbserver.h" + +#include + + +RFBServer::RFBServer(Display *dpy, int fd) : Server(), + dpy(dpy), fd(fd), - buttonMask(0) + buttonMask(0) { + connection = bufferedConnection = new BufferedConnection(32768, + 32768); InitBlocks(32, 32); + connection->send((unsigned char*) RFB_PROTOCOL_VERSION, 12); } RFBServer::~RFBServer() { DeleteBlocks(); - shutdown(fd, 2); - close(fd); + delete bufferedConnection; + close(fd); } void RFBServer::handleKeyEvent(KeyEvent &keyEvent) { KeyCode kc = XKeysymToKeycode(dpy, keyEvent.key); if (kc != NoSymbol) - XTestFakeKeyEvent(dpy, + 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; + 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; } diff --git a/krfb/rfbserver.h b/krfb/rfbserver.h index eef682fe..70c177c3 100644 --- a/krfb/rfbserver.h +++ b/krfb/rfbserver.h @@ -23,20 +23,28 @@ #ifndef RFBSERVER_H #define RFBSERVER_H -#include +#include "../include/rfbServer.h" +#include + using namespace rfb; -/**KDE-specific implementation of the Server base class - *@author Tim Jansen +/** + * KDE-specific implementation of the Server base class + * @author Tim Jansen */ - class RFBServer : public Server { public: - RFBServer(int fd); + RFBServer(Display *dpy, int fd); ~RFBServer(); - virtual void handleKeyEvent(); - virtual void handlePointerEvent(PointerEvent &pointerEvent); + virtual void handleKeyEvent(KeyEvent &keyEvent); + virtual void handlePointerEvent(PointerEvent &pointerEvent); + +private: + int fd; + int buttonMask; + BufferedConnection *bufferedConnection; + Display *dpy; }; #endif