Add screen def
This commit is contained in:
@@ -36,6 +36,13 @@ class RDPClientQtFactory(rdp.ClientFactory):
|
|||||||
"""
|
"""
|
||||||
Factory create a RDP GUI client
|
Factory create a RDP GUI client
|
||||||
"""
|
"""
|
||||||
|
def __init__(self, width, height):
|
||||||
|
"""
|
||||||
|
init client with correct definition
|
||||||
|
"""
|
||||||
|
rdp.ClientFactory.__init__(self, width, height)
|
||||||
|
self._w = None
|
||||||
|
|
||||||
def buildObserver(self, controller):
|
def buildObserver(self, controller):
|
||||||
"""
|
"""
|
||||||
Build RFB observer
|
Build RFB observer
|
||||||
@@ -45,7 +52,7 @@ class RDPClientQtFactory(rdp.ClientFactory):
|
|||||||
client = RDPClientQt(controller)
|
client = RDPClientQt(controller)
|
||||||
#create qt widget
|
#create qt widget
|
||||||
self._w = client.getWidget()
|
self._w = client.getWidget()
|
||||||
self._w.resize(1024, 800)
|
self._w.resize(self._width, self._height)
|
||||||
self._w.setWindowTitle('rdpyclient-rdp')
|
self._w.setWindowTitle('rdpyclient-rdp')
|
||||||
self._w.show()
|
self._w.show()
|
||||||
return client
|
return client
|
||||||
@@ -82,7 +89,7 @@ if __name__ == '__main__':
|
|||||||
qt4reactor.install()
|
qt4reactor.install()
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
reactor.connectTCP(sys.argv[1], int(sys.argv[2]), RDPClientQtFactory())
|
reactor.connectTCP(sys.argv[1], int(sys.argv[2]), RDPClientQtFactory(1024, 800))
|
||||||
reactor.runReturn()
|
reactor.runReturn()
|
||||||
app.exec_()
|
app.exec_()
|
||||||
reactor.stop()
|
reactor.stop()
|
||||||
@@ -209,7 +209,7 @@ class ClientCoreSettings(CompositeType):
|
|||||||
CompositeType.__init__(self)
|
CompositeType.__init__(self)
|
||||||
self.rdpVersion = Version.RDP_VERSION_5_PLUS
|
self.rdpVersion = Version.RDP_VERSION_5_PLUS
|
||||||
self.desktopWidth = UInt16Le(1280)
|
self.desktopWidth = UInt16Le(1280)
|
||||||
self.desktopHeight = UInt16Le(1024)
|
self.desktopHeight = UInt16Le(800)
|
||||||
self.colorDepth = ColorDepth.RNS_UD_COLOR_8BPP
|
self.colorDepth = ColorDepth.RNS_UD_COLOR_8BPP
|
||||||
self.sasSequence = Sequence.RNS_UD_SAS_DEL
|
self.sasSequence = Sequence.RNS_UD_SAS_DEL
|
||||||
self.kbdLayout = KeyboardLayout.FRENCH
|
self.kbdLayout = KeyboardLayout.FRENCH
|
||||||
|
|||||||
@@ -45,9 +45,17 @@ class RDPController(object):
|
|||||||
observer.onBitmapUpdate(rectangle.destLeft.value, rectangle.destTop.value, rectangle.destRight.value, rectangle.destBottom.value, rectangle.width.value, rectangle.height.value, rectangle.bitsPerPixel.value, (rectangle.flags & pdu.BitmapFlag.BITMAP_COMPRESSION).value, rectangle.bitmapDataStream.value)
|
observer.onBitmapUpdate(rectangle.destLeft.value, rectangle.destTop.value, rectangle.destRight.value, rectangle.destBottom.value, rectangle.width.value, rectangle.height.value, rectangle.bitsPerPixel.value, (rectangle.flags & pdu.BitmapFlag.BITMAP_COMPRESSION).value, rectangle.bitmapDataStream.value)
|
||||||
|
|
||||||
class ClientFactory(protocol.Factory):
|
class ClientFactory(protocol.Factory):
|
||||||
'''
|
"""
|
||||||
Factory of Client RDP protocol
|
Factory of Client RDP protocol
|
||||||
'''
|
"""
|
||||||
|
def __init__(self, width = 1024, height = 800):
|
||||||
|
"""
|
||||||
|
@param width: width of screen
|
||||||
|
@param height: height of screen
|
||||||
|
"""
|
||||||
|
self._width = width
|
||||||
|
self._height = height
|
||||||
|
|
||||||
def buildProtocol(self, addr):
|
def buildProtocol(self, addr):
|
||||||
'''
|
'''
|
||||||
Function call from twisted and build rdp protocol stack
|
Function call from twisted and build rdp protocol stack
|
||||||
@@ -55,7 +63,13 @@ class ClientFactory(protocol.Factory):
|
|||||||
'''
|
'''
|
||||||
controller = RDPController(LayerMode.CLIENT)
|
controller = RDPController(LayerMode.CLIENT)
|
||||||
self.buildObserver(controller)
|
self.buildObserver(controller)
|
||||||
return tpkt.TPKT(tpdu.createClient(mcs.createClient(controller)));
|
mcsLayer = mcs.createClient(controller)
|
||||||
|
|
||||||
|
#set screen definition in MCS layer
|
||||||
|
mcsLayer._clientSettings.core.desktopHeight.value = self._height
|
||||||
|
mcsLayer._clientSettings.core.desktopWidth.value = self._width
|
||||||
|
|
||||||
|
return tpkt.TPKT(tpdu.createClient(mcsLayer));
|
||||||
|
|
||||||
def buildObserver(self, controller):
|
def buildObserver(self, controller):
|
||||||
'''
|
'''
|
||||||
|
|||||||
Reference in New Issue
Block a user