1
0
mirror of https://invent.kde.org/network/krfb synced 2024-06-26 05:02:13 +00:00

added dcop stuff from greiser

svn path=/trunk/kdenetwork/krfb/; revision=136620
This commit is contained in:
Tim Jansen 2002-02-14 23:20:39 +00:00
parent 6547f67359
commit 2aac6a48ba
13 changed files with 194 additions and 50 deletions

View File

@ -1 +1,2 @@
Tim Jansen <tim@tjansen.de>
Ian Reinhart Geiser <geiseri@kde.org>

View File

@ -1,3 +1,8 @@
2002-02-14 Tim Jansen <tjansen@tjansen.de>
* krfb/krfbiface.h: integrated DCOP interface patch by
Ian Reinhart Geiser <geiseri@kde.org>. Thanks!
2002-02-04 Tim Jansen <tim@tjansen.de>
* replaced x0rfbserver's library with libvncserver

View File

@ -1,7 +1,7 @@
SUBDIRS = libvncserver krfb po doc
EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO NOTES \
README_KDE3 krfb.lsm
krfb.lsm
# not a GNU package. You can remove this line, if
# have all needed files, that a GNU package needs

11
NOTES
View File

@ -15,17 +15,6 @@ Some comments on various aspects of KRfb:
issues like setting a password
- design goal of KRfb is to make it as easy to use as possible. I tried to
limit functionality whereever possible.
- to limit the required testing efforts I try to limit the number of provided
codecs.
As far as I can tell there are three major classes of VNC clients: the
original ones that support RRE, CoRRE and Hextiles, the Tridia ones
with additional ZLib and sometimes HexZLib support and the TightVNC one
with additional TightVNC encoding. So I will have four primary codecs to
support: Raw as a fall-back and for local traffic, Hextiles for original
VNC clients, ZLib for the Tridia ones and TightVNC. RRE and CoRRE won't be
supported, and probably neither HexZLib. 4 codecs ought to be enough for
everybody. TightVNC is the preferred codec and the one that clients should
use.
- the original x0rfbserver has a features for selecting the port number
automatically. I skipped that because it is too complicated on the client
side, but I this will change when there are mechanisms for inviting people.

View File

@ -3,7 +3,7 @@ Version 0.5 (2002/01/02): First release
- port x0rfbserver with simplified KDE/Qt interface
Version 0.6 (2002/02/??): Improve RFB backend
Version 0.6 (2002/02/20): Improve RFB backend
- replace x0rfbserver's backend with libvncserver
<- knotify

View File

@ -1,17 +1,17 @@
METASOURCES = AUTO
# Code
noinst_LIBRARIES = kinetd.a
noinst_LIBRARIES = libkinetd.a
kinetd_a_SOURCES = kinetd.cpp
kinetd_a_LDADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI)
libkinetd_a_SOURCES = kinetd.cpp kinetd.h
libkinetd_a_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI)
# Services
kdedir = $(kde_servicesdir)/kded
kde_DATA = kdeprintd.desktop
EXTRA_DIST = $(krfb_SOURCES) $(kde_DATA) kinetd.h
EXTRA_DIST = $(libkinetd_a_SOURCES) $(kde_DATA)
KDE_ICON = kinetd
@ -19,8 +19,6 @@ KDE_ICON = kinetd
# set the include path for X, qt and KDE
INCLUDES= $(all_includes)
# the library search path.
kinetd_a_LDFLAGS = $(all_libraries) $(KDE_RPATH)
CXXFLAGS = @CXXFLAGS@

View File

@ -1,10 +1,15 @@
METASOURCES = AUTO
bin_PROGRAMS = krfb
krfb_SOURCES = rfbcontroller.cc configuration.cc trayicon.cpp XUpdateScanner.cc main.cpp configurationdialog.ui newconnectiondialog.ui
krfb_LDADD = ../libvncserver/libvncserver.a -lz -lpthread -ljpeg -lXtst $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET)
krfb_SOURCES = rfbcontroller.cc configuration.cc trayicon.cpp \
XUpdateScanner.cc main.cpp configurationdialog.ui newconnectiondialog.ui \
krfbifaceimpl.cc krfbiface.skel
krfb_LDADD = ../libvncserver/libvncserver.a -lz -lpthread -ljpeg -lXtst \
$(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET)
EXTRA_DIST = $(krfb_SOURCES) krfb.desktop lo32-app-krfb.png lo16-app-krfb.png rfbcontroller.h eyes-closed24.png eyes-open24.png XUpdateScanner.h trayicon.h configuration.h
EXTRA_DIST = $(krfb_SOURCES) krfb.desktop lo32-app-krfb.png \
lo16-app-krfb.png rfbcontroller.h eyes-closed24.png eyes-open24.png \
XUpdateScanner.h trayicon.h configuration.h krfbiface.h krfbiface.kidl
install-data-local:
$(mkinstalldirs) $(kde_appsdir)/Applications/

View File

@ -131,6 +131,45 @@ int Configuration::port() const {
return (portNumber < 100) ? (portNumber + 5900) : portNumber;
}
void Configuration::setOnceConnection(bool oneConnection)
{
oneConnectionFlag = oneConnection;
saveToKConfig();
saveToDialog();
}
void Configuration::setAskOnConnect(bool askOnConnect)
{
askOnConnectFlag = askOnConnect;
saveToKConfig();
saveToDialog();
}
void Configuration::setAllowDesktopControl(bool allowDesktopControl)
{
allowDesktopControlFlag = allowDesktopControl;
saveToKConfig();
saveToDialog();
}
void Configuration::setPassword(QString password)
{
passwordString = password;
saveToKConfig();
saveToDialog();
}
void Configuration::setPort(int port)
{
if ((port >= 5900) && (port < 6000))
portNumber = port-5900;
else
portNumber = port;
emit portChanged();
saveToKConfig();
saveToDialog();
}
void Configuration::showDialog() {
confDlg.show();
}

View File

@ -49,10 +49,15 @@ public:
bool oneConnection() const;
bool askOnConnect() const;
bool allowDesktopControl() const;
QString password() const;
int port() const;
void setOnceConnection(bool oneConnection);
void setAskOnConnect(bool askOnConnect);
void setAllowDesktopControl(bool allowDesktopControl);
void setPassword(QString password);
void setPort(int port);
signals:
void portChanged();

24
krfb/krfbiface.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef __KRFB_IFACE_H
#define __KRFB_IFACE_H
#include <dcopobject.h>
class krfbIface : virtual public DCOPObject
{
K_DCOP
k_dcop:
virtual void disconnect() = 0;
// virtual void setWindowID(int) = 0;
virtual void exit() = 0;
virtual bool oneConnection() = 0;
virtual void setOneConnection(bool) = 0;
virtual bool askOnConnect() = 0;
virtual void setAskOnConnect(bool) = 0;
virtual bool allowDesktopControl() = 0;
virtual void setAllowDesktopControl(bool) = 0;
virtual void setPassword(QString) = 0;
virtual int port() = 0;
virtual void setPort(int) = 0;
};
#endif

69
krfb/krfbifaceimpl.cc Normal file
View File

@ -0,0 +1,69 @@
/***************************************************************************
* *
* 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 "krfbifaceimpl.h"
KRfbIfaceImpl::KRfbIfaceImpl(Configuration *c) :
DCOPObject("krfbIface"),
configuration(c)
{
}
void KRfbIfaceImpl::disconnect()
{
emit connectionClosed();
}
/*
void KRfbIfaceImpl::setWindowID(int)
{
}
*/
void KRfbIfaceImpl::exit()
{
emit exitApp();
}
bool KRfbIfaceImpl::oneConnection()
{
return configuration->oneConnection();
}
void KRfbIfaceImpl::setOneConnection(bool b)
{
configuration->setOnceConnection(b);
}
bool KRfbIfaceImpl::askOnConnect()
{
return configuration->askOnConnect();
}
void KRfbIfaceImpl::setAskOnConnect(bool b)
{
configuration->setAskOnConnect(b);
}
bool KRfbIfaceImpl::allowDesktopControl()
{
return configuration->allowDesktopControl();
}
void KRfbIfaceImpl::setAllowDesktopControl(bool b)
{
configuration->setAllowDesktopControl(b);
}
void KRfbIfaceImpl::setPassword(QString password)
{
configuration->setPassword(password);
}
int KRfbIfaceImpl::port()
{
return configuration->port();
}
void KRfbIfaceImpl::setPort(int port)
{
configuration->setPort(port);
}

View File

@ -17,12 +17,13 @@
#include "trayicon.h"
#include "configuration.h"
#include "krfbifaceimpl.h"
#include "rfbcontroller.h"
#include <kpixmap.h>
#include <kaction.h>
#include <kdebug.h>
#include <kapp.h>
#include <kapplication.h>
#include <ksystemtray.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>
@ -73,6 +74,7 @@ int main(int argc, char *argv[])
"(c) 1999, AT&T Laboratories Cambridge\n",
0, "http://www.tjansen.de/krfb", "ml@tjansen.de");
aboutData.addAuthor("Tim Jansen", "", "tim@tjansen.de");
aboutData.addAuthor("Ian Reinhart Geiser", "DCOP interface", "geiseri@kde.org");
aboutData.addCredit("Johannes E. Schindelin",
I18N_NOOP("libvncserver"));
aboutData.addCredit("Const Kaplinsky",
@ -117,6 +119,7 @@ int main(int argc, char *argv[])
TrayIcon trayicon(new KAboutApplication(&aboutData),
config);
KRfbIfaceImpl dcopiface(config);
RFBController controller(config);
QObject::connect(&app, SIGNAL(lastWindowClosed()),
@ -131,6 +134,12 @@ int main(int argc, char *argv[])
QObject::connect(&trayicon, SIGNAL(showConfigure()),
config, SLOT(showDialog()));
QObject::connect(&dcopiface, SIGNAL(connectionClosed()),
&controller, SLOT(closeConnection()));
QObject::connect(&dcopiface, SIGNAL(exitApp()),
&controller, SLOT(quit()));
QObject::connect(config, SIGNAL(portChanged()),
&controller, SLOT(rebind()));

View File

@ -21,7 +21,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <kapp.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <klocale.h>
@ -119,6 +119,31 @@ KeyboardEvent::KeyboardEvent(bool d, KeySym k) :
}
}
void KeyboardEvent::initKeycodes() {
KeySym key,*keymap;
int i,j,minkey,maxkey,syms_per_keycode;
memset(modifiers,-1,sizeof(modifiers));
XDisplayKeycodes(dpy,&minkey,&maxkey);
keymap=XGetKeyboardMapping(dpy,minkey,(maxkey - minkey + 1),&syms_per_keycode);
for (i = minkey; i <= maxkey; i++)
for(j=0;j<syms_per_keycode;j++) {
key=keymap[(i-minkey)*syms_per_keycode+j];
if(key>=' ' && key<0x100 && i==XKeysymToKeycode(dpy,key)) {
keycodes[key]=i;
modifiers[key]=j;
}
}
leftShiftCode = XKeysymToKeycode(dpy,XK_Shift_L);
rightShiftCode = XKeysymToKeycode(dpy,XK_Shift_R);
altGrCode = XKeysymToKeycode(dpy,XK_Mode_switch);
XFree ((char *)keymap);
}
/* this function adjusts the modifiers according to mod (as from modifiers) and ModifierState */
void KeyboardEvent::tweakModifiers(char mod, bool down) {
@ -147,31 +172,6 @@ void KeyboardEvent::tweakModifiers(char mod, bool down) {
down, CurrentTime);
}
void KeyboardEvent::initKeycodes() {
KeySym key,*keymap;
int i,j,minkey,maxkey,syms_per_keycode;
memset(modifiers,-1,sizeof(modifiers));
XDisplayKeycodes(dpy,&minkey,&maxkey);
keymap=XGetKeyboardMapping(dpy,minkey,(maxkey - minkey + 1),&syms_per_keycode);
for (i = minkey; i <= maxkey; i++)
for(j=0;j<syms_per_keycode;j++) {
key=keymap[(i-minkey)*syms_per_keycode+j];
if(key>=' ' && key<0x100 && i==XKeysymToKeycode(dpy,key)) {
keycodes[key]=i;
modifiers[key]=j;
}
}
leftShiftCode = XKeysymToKeycode(dpy,XK_Shift_L);
rightShiftCode = XKeysymToKeycode(dpy,XK_Shift_R);
altGrCode = XKeysymToKeycode(dpy,XK_Mode_switch);
XFree ((char *)keymap);
}
void KeyboardEvent::exec() {
#define ADJUSTMOD(sym,state) \
if(keySym==sym) { if(down) ModifierState|=state; else ModifierState&=~state; }