mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:41:17 -07:00
sync
svn path=/trunk/kdenetwork/krfb/; revision=126691
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -25,9 +25,8 @@
|
||||
#include <X11/extensions/XShm.h>
|
||||
|
||||
#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;
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
39
krfb/krfb.h
39
krfb/krfb.h
@@ -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 <config.h>
|
||||
#endif
|
||||
|
||||
#include <kapp.h>
|
||||
#include <qwidget.h>
|
||||
|
||||
/** 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
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -20,40 +20,51 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
RFBServer::RFBServer(int fd) :
|
||||
#include "rfbserver.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -23,20 +23,28 @@
|
||||
#ifndef RFBSERVER_H
|
||||
#define RFBSERVER_H
|
||||
|
||||
#include <rfbserver.h>
|
||||
#include "../include/rfbServer.h"
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user