Add screen def
This commit is contained in:
@@ -36,6 +36,13 @@ class RDPClientQtFactory(rdp.ClientFactory):
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
Build RFB observer
|
||||
@@ -45,7 +52,7 @@ class RDPClientQtFactory(rdp.ClientFactory):
|
||||
client = RDPClientQt(controller)
|
||||
#create qt widget
|
||||
self._w = client.getWidget()
|
||||
self._w.resize(1024, 800)
|
||||
self._w.resize(self._width, self._height)
|
||||
self._w.setWindowTitle('rdpyclient-rdp')
|
||||
self._w.show()
|
||||
return client
|
||||
@@ -82,7 +89,7 @@ if __name__ == '__main__':
|
||||
qt4reactor.install()
|
||||
|
||||
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()
|
||||
app.exec_()
|
||||
reactor.stop()
|
||||
@@ -209,7 +209,7 @@ class ClientCoreSettings(CompositeType):
|
||||
CompositeType.__init__(self)
|
||||
self.rdpVersion = Version.RDP_VERSION_5_PLUS
|
||||
self.desktopWidth = UInt16Le(1280)
|
||||
self.desktopHeight = UInt16Le(1024)
|
||||
self.desktopHeight = UInt16Le(800)
|
||||
self.colorDepth = ColorDepth.RNS_UD_COLOR_8BPP
|
||||
self.sasSequence = Sequence.RNS_UD_SAS_DEL
|
||||
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)
|
||||
|
||||
class ClientFactory(protocol.Factory):
|
||||
'''
|
||||
"""
|
||||
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):
|
||||
'''
|
||||
Function call from twisted and build rdp protocol stack
|
||||
@@ -55,7 +63,13 @@ class ClientFactory(protocol.Factory):
|
||||
'''
|
||||
controller = RDPController(LayerMode.CLIENT)
|
||||
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):
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user