XEmbedContainerView.st
branchjv
changeset 7287 1e2a3258dd8a
parent 7107 47aff5c3560b
child 8420 76e39223f5ab
equal deleted inserted replaced
7286:c3b4c3c664d4 7287:1e2a3258dd8a
   194 !
   194 !
   195 
   195 
   196 createWindowX:x y:y width:w height:h
   196 createWindowX:x y:y width:w height:h
   197     |childWindowIds|
   197     |childWindowIds|
   198 
   198 
   199     childWindowIds := self graphicsDevice childIdsOf:self drawableId.
   199     childWindowIds := device childIdsOf:self drawableId.
   200     childWindowIds size == 1 
   200     childWindowIds size == 1 
   201         ifFalse:[ self error:'I should have exactly one child'. ].
   201         ifFalse:[ self error:'I should have exactly one child'. ].
   202     clientViewId := childWindowIds first.
   202     clientViewId := childWindowIds first.
   203     clientView := ClientView new setContainer: self id: clientViewId.
   203     clientView := ClientView new setContainer: self id: clientViewId.
   204     self sendXEmbeddedNotify.    
   204     self sendXEmbeddedNotify.    
   215 destroyed
   215 destroyed
   216     "A client just destroyed its window"
   216     "A client just destroyed its window"
   217 
   217 
   218     | childWindowIds |
   218     | childWindowIds |
   219 
   219 
   220     childWindowIds := self graphicsDevice childIdsOf: self drawableId.  
   220     childWindowIds := device childIdsOf: self drawableId.  
   221     childWindowIds size == 0 ifTrue:[
   221     childWindowIds size == 0 ifTrue:[
   222         self graphicsDevice removeKnownView: clientView withId: clientViewId.
   222         device removeKnownView: clientView withId: clientViewId.
   223         clientViewId := nil.
   223         clientViewId := nil.
   224         clientView := nil.        
   224         clientView := nil.        
   225     ].
   225     ].
   226     self clientUnplugged: true.
   226     self clientUnplugged: true.
   227 
   227 
   263 
   263 
   264 sendXEmbedEvent: message detail: detail data1: data1 data2: data2
   264 sendXEmbedEvent: message detail: detail data1: data1 data2: data2
   265 
   265 
   266     clientViewId ifNil:[^self].
   266     clientViewId ifNil:[^self].
   267 
   267 
   268     (self graphicsDevice 
   268     (device 
   269         sendClientEvent: (self graphicsDevice atomIDOf:'_XEMBED') 
   269         sendClientEvent: (device atomIDOf:'_XEMBED') 
   270         format:32 
   270         format:32 
   271         to:clientViewId 
   271         to:clientViewId 
   272         propagate:false 
   272         propagate:false 
   273         eventMask:nil 
   273         eventMask:nil 
   274         window:clientViewId 
   274         window:clientViewId 
   352 
   352 
   353     "Created: / 03-04-2012 / 10:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   353     "Created: / 03-04-2012 / 10:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   354 !
   354 !
   355 
   355 
   356 propertyChange:propertyId state:state 
   356 propertyChange:propertyId state:state 
   357     propertyId == (self graphicsDevice atomIDOf:'_XEMBED_INFO') ifTrue:[ 
   357     propertyId == (device atomIDOf:'_XEMBED_INFO') ifTrue:[ 
   358         self mapUnmapAccordingToXEmbedInfo. 
   358         self mapUnmapAccordingToXEmbedInfo. 
   359         ^self.
   359         ^self.
   360     ].
   360     ].
   361 
   361 
   362     (superView notNil and:[superView hasWorkaround: #uzbl]) ifTrue:[
   362     (superView notNil and:[superView hasWorkaround: #uzbl]) ifTrue:[
   363         propertyId == (self graphicsDevice atomIDOf:'WM_NORMAL_HINTS') ifTrue:[         
   363         propertyId == (device atomIDOf:'WM_NORMAL_HINTS') ifTrue:[         
   364             self graphicsDevice
   364             device
   365                 resizeWindow:self drawableId 
   365                 resizeWindow:self drawableId 
   366                 width: 0  height: 0.
   366                 width: 0  height: 0.
   367             self graphicsDevice
   367             device
   368                 resizeWindow:self drawableId 
   368                 resizeWindow:self drawableId 
   369                 width: self width - 1  height: self height - 1.
   369                 width: self width - 1  height: self height - 1.
   370         ]
   370         ]
   371     ]
   371     ]
   372 
   372 
   380     superView notNil ifTrue:[
   380     superView notNil ifTrue:[
   381         superView clientUnplugged: false.
   381         superView clientUnplugged: false.
   382         superView removeSubView:self.
   382         superView removeSubView:self.
   383     ].
   383     ].
   384     self drawableId notNil ifTrue:[
   384     self drawableId notNil ifTrue:[
   385         self graphicsDevice
   385         device
   386            reparentWindow: self drawableId to: self graphicsDevice rootWindowId;
   386            reparentWindow: self drawableId to: device rootWindowId;
   387            removeKnownView:self withId:self drawableId.
   387            removeKnownView:self withId:self drawableId.
   388     ]
   388     ]
   389 
   389 
   390     "Created: / 02-06-2011 / 17:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   390     "Created: / 02-06-2011 / 17:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   391     "Modified: / 11-02-2012 / 17:56:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   391     "Modified: / 11-02-2012 / 17:56:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   392 !
   392 !
   393 
   393 
   394 initEvents
   394 initEvents
   395     |graphicsDevice|
   395     |graphicsDevice|
   396 
   396 
   397     graphicsDevice := self graphicsDevice.
   397     graphicsDevice := device.
   398 
   398 
   399     graphicsDevice
   399     graphicsDevice
   400         setEventMask:
   400         setEventMask:
   401             ((graphicsDevice eventMaskFor:#structureNotify) bitOr:
   401             ((graphicsDevice eventMaskFor:#structureNotify) bitOr:
   402             ((graphicsDevice eventMaskFor:#propertyChange) bitOr:
   402             ((graphicsDevice eventMaskFor:#propertyChange) bitOr:
   408 
   408 
   409 setContainer: container id: wid
   409 setContainer: container id: wid
   410     self setDevice:container device id:wid gcId:nil.
   410     self setDevice:container device id:wid gcId:nil.
   411     superView := container.
   411     superView := container.
   412     windowGroup := container windowGroup.
   412     windowGroup := container windowGroup.
   413     self graphicsDevice addKnownView: self withId: wid.
   413     device addKnownView: self withId: wid.
   414     container add: self.
   414     container add: self.
   415     self initEvents.
   415     self initEvents.
   416     self origin: 0.0@0.0 corner: 1.0@1.0.
   416     self origin: 0.0@0.0 corner: 1.0@1.0.
   417 
   417 
   418     "Created: / 02-06-2011 / 17:33:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   418     "Created: / 02-06-2011 / 17:33:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   422 !XEmbedContainerView::ClientView methodsFor:'private'!
   422 !XEmbedContainerView::ClientView methodsFor:'private'!
   423 
   423 
   424 mapUnmapAccordingToXEmbedInfo
   424 mapUnmapAccordingToXEmbedInfo
   425     |val|
   425     |val|
   426 
   426 
   427     val := self graphicsDevice 
   427     val := device 
   428                 getProperty:(self graphicsDevice atomIDOf:'_XEMBED_INFO')
   428                 getProperty:(device atomIDOf:'_XEMBED_INFO')
   429                 from:self drawableId
   429                 from:self drawableId
   430                 delete:false.
   430                 delete:false.
   431     val ifNil:
   431     val ifNil:
   432             [ self map.
   432             [ self map.
   433             ^ self ].
   433             ^ self ].