XEmbedContainerView.st
changeset 6277 c31ad6485bb1
parent 6241 08a125ba42d2
child 6340 78263ccba8d0
equal deleted inserted replaced
6276:08a809f9180a 6277:c31ad6485bb1
   136     
   136     
   137     topView open.
   137     topView open.
   138     Delay waitForMilliseconds:5.
   138     Delay waitForMilliseconds:5.
   139     topView 
   139     topView 
   140         label:(self classResources string:'XEmbedContainerView ' 
   140         label:(self classResources string:'XEmbedContainerView ' 
   141                         , xembed embeddingWindowId address printString).
   141                         , xembed embeddingWindowId printString).
   142     self == XEmbedContainerView 
   142     self == XEmbedContainerView 
   143         ifTrue:
   143         ifTrue:
   144             [ Transcript
   144             [ Transcript
   145                 show:'XEmbed Socket WID: ' , xembed embeddingWindowId address printString;
   145                 show:'XEmbed Socket WID: ' , xembed embeddingWindowId printString;
   146                 cr ].
   146                 cr ].
   147     ^ xembed
   147     ^ xembed
   148 
   148 
   149     "
   149     "
   150      Workspace open"
   150       Workspace open
       
   151     "
   151 
   152 
   152     "Modified: / 16-05-1998 / 16:53:53 / cg"
   153     "Modified: / 16-05-1998 / 16:53:53 / cg"
   153     "Created: / 30-05-2011 / 23:05:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   154     "Created: / 30-05-2011 / 23:05:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   154     "Modified: / 06-06-2011 / 18:40:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   155     "Modified: / 06-06-2011 / 18:40:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   155 ! !
   156 ! !
   156 
   157 
   157 !XEmbedContainerView methodsFor:'accessing'!
   158 !XEmbedContainerView methodsFor:'accessing'!
   158 
   159 
   159 embeddingWindowId
   160 embeddingWindowId
   160     ^ drawableId address
   161     ^ self drawableId address
   161 
   162 
   162     "Created: / 06-06-2011 / 10:27:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   163     "Created: / 06-06-2011 / 10:27:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   163 !
   164 !
   164 
   165 
   165 workarounds
   166 workarounds
   191 !
   192 !
   192 
   193 
   193 createWindowX:x y:y width:w height:h
   194 createWindowX:x y:y width:w height:h
   194     |childWindowIds|
   195     |childWindowIds|
   195 
   196 
   196     childWindowIds := device childIdsOf:drawableId.
   197     childWindowIds := self graphicsDevice childIdsOf:self drawableId.
   197     childWindowIds size == 1 
   198     childWindowIds size == 1 
   198         ifFalse:[ self error:'I should have exactly one child'. ].
   199         ifFalse:[ self error:'I should have exactly one child'. ].
   199     clientViewId := childWindowIds first.
   200     clientViewId := childWindowIds first.
   200     clientView := ClientView new setContainer: self id: clientViewId.
   201     clientView := ClientView new setContainer: self id: clientViewId.
   201     self sendXEmbeddedNotify.    
   202     self sendXEmbeddedNotify.    
   208     "Created: / 01-06-2011 / 12:56:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   209     "Created: / 01-06-2011 / 12:56:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   209     "Modified: / 02-06-2011 / 18:11:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   210     "Modified: / 02-06-2011 / 18:11:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   210 !
   211 !
   211 
   212 
   212 destroyed
   213 destroyed
   213 
       
   214     "A client just destroyed its window"
   214     "A client just destroyed its window"
   215 
   215 
   216     | childWindowIds |
   216     | childWindowIds |
   217 
   217 
   218     childWindowIds := device childIdsOf: drawableId.  
   218     childWindowIds := self graphicsDevice childIdsOf: self drawableId.  
   219     childWindowIds size == 0 ifTrue:[
   219     childWindowIds size == 0 ifTrue:[
   220         device removeKnownView: clientView withId: clientViewId.
   220         device removeKnownView: clientView withId: clientViewId.
   221         clientViewId := nil.
   221         clientViewId := nil.
   222         clientView := nil.        
   222         clientView := nil.        
   223     ].
   223     ].
   261 
   261 
   262 sendXEmbedEvent: message detail: detail data1: data1 data2: data2
   262 sendXEmbedEvent: message detail: detail data1: data1 data2: data2
   263 
   263 
   264     clientViewId ifNil:[^self].
   264     clientViewId ifNil:[^self].
   265 
   265 
   266     (device 
   266     (self graphicsDevice 
   267         sendClientEvent: (device atomIDOf:'_XEMBED') 
   267         sendClientEvent: (device atomIDOf:'_XEMBED') 
   268         format:32 
   268         format:32 
   269         to:clientViewId 
   269         to:clientViewId 
   270         propagate:false 
   270         propagate:false 
   271         eventMask:nil 
   271         eventMask:nil 
   279     "Created: / 30-05-2011 / 19:40:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   279     "Created: / 30-05-2011 / 19:40:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   280     "Modified: / 01-06-2011 / 13:04:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   280     "Modified: / 01-06-2011 / 13:04:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   281 !
   281 !
   282 
   282 
   283 sendXEmbeddedNotify
   283 sendXEmbeddedNotify
   284 
       
   285     self 
   284     self 
   286         sendXEmbedEvent: XEMBED_EMBEDDED_NOTIFY
   285         sendXEmbedEvent: XEMBED_EMBEDDED_NOTIFY
   287         detail: nil 
   286         detail: nil 
   288         data1: drawableId 
   287         data1: self drawableId 
   289         data2: 0
   288         data2: 0
   290 
   289 
   291     "Created: / 30-05-2011 / 19:42:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   290     "Created: / 30-05-2011 / 19:42:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   292 ! !
   291 ! !
   293 
   292 
   351 
   350 
   352     "Created: / 03-04-2012 / 10:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   351     "Created: / 03-04-2012 / 10:10:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   353 !
   352 !
   354 
   353 
   355 propertyChange:propertyId state:state 
   354 propertyChange:propertyId state:state 
   356     propertyId == (device atomIDOf:'_XEMBED_INFO') ifTrue:[ 
   355     propertyId == (self graphicsDevice atomIDOf:'_XEMBED_INFO') ifTrue:[ 
   357         self mapUnmapAccordingToXEmbedInfo. 
   356         self mapUnmapAccordingToXEmbedInfo. 
   358         ^self.
   357         ^self.
   359     ].
   358     ].
   360 
   359 
   361 
       
   362     (superView notNil and:[superView hasWorkaround: #uzbl]) ifTrue:[
   360     (superView notNil and:[superView hasWorkaround: #uzbl]) ifTrue:[
   363         propertyId == (device atomIDOf:'WM_NORMAL_HINTS') ifTrue:[         
   361         propertyId == (self graphicsDevice atomIDOf:'WM_NORMAL_HINTS') ifTrue:[         
   364         device 
   362             self graphicsDevice
   365             resizeWindow:drawableId 
   363                 resizeWindow:self drawableId 
   366             width: 0  height: 0.
   364                 width: 0  height: 0.
   367         device 
   365             self graphicsDevice
   368             resizeWindow:drawableId 
   366                 resizeWindow:self drawableId 
   369             width: self width - 1  height: self height - 1.
   367                 width: self width - 1  height: self height - 1.
   370     ]
   368         ]
   371 
       
   372 
       
   373     
       
   374     ]
   369     ]
   375 
   370 
   376     "Created: / 01-06-2011 / 13:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   371     "Created: / 01-06-2011 / 13:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   377     "Modified: / 10-06-2011 / 23:29:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   372     "Modified: / 10-06-2011 / 23:29:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   378 ! !
   373 ! !
   379 
   374 
   380 !XEmbedContainerView::ClientView methodsFor:'initialization & release'!
   375 !XEmbedContainerView::ClientView methodsFor:'initialization & release'!
   381 
   376 
   382 destroy
   377 destroy
   383 
       
   384     superView notNil ifTrue:[
   378     superView notNil ifTrue:[
   385         superView clientUnplugged: false.
   379         superView clientUnplugged: false.
   386         superView removeSubView:self.
   380         superView removeSubView:self.
   387     ].
   381     ].
   388     drawableId ifNotNil:[
   382     self drawableId notNil ifTrue:[
   389     device 
   383         self graphicsDevice
   390        reparentWindow: drawableId to: device rootWindowId;
   384            reparentWindow: self drawableId to: self graphicsDevice rootWindowId;
   391        removeKnownView:self withId:drawableId.
   385            removeKnownView:self withId:self drawableId.
   392     ]
   386     ]
   393 
   387 
   394     "Created: / 02-06-2011 / 17:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   388     "Created: / 02-06-2011 / 17:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   395     "Modified: / 11-02-2012 / 17:56:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   389     "Modified: / 11-02-2012 / 17:56:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   396 !
   390 !
   397 
   391 
   398 initEvents
   392 initEvents
   399 
   393     |graphicsDevice|
   400     device 
   394 
       
   395     graphicsDevice := self graphicsDevice.
       
   396 
       
   397     graphicsDevice
   401         setEventMask:
   398         setEventMask:
   402             ((device eventMaskFor:#structureNotify) bitOr:
   399             ((graphicsDevice eventMaskFor:#structureNotify) bitOr:
   403             ((device eventMaskFor:#propertyChange) bitOr:
   400             ((graphicsDevice eventMaskFor:#propertyChange) bitOr:
   404              (device eventMaskFor:#focusChange)))
   401              (graphicsDevice eventMaskFor:#focusChange)))
   405 
   402         in:self drawableId.
   406         in:drawableId.
       
   407 
   403 
   408     "Created: / 02-06-2011 / 17:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   404     "Created: / 02-06-2011 / 17:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   409 !
   405 !
   410 
   406 
   411 setContainer: container id: wid
   407 setContainer: container id: wid
   412 
   408     self setDevice:container device id:wid gcId:nil.
   413     drawableId := wid.
       
   414     superView := container.
   409     superView := container.
   415     device := container device.
       
   416     windowGroup := container windowGroup.
   410     windowGroup := container windowGroup.
   417     device addKnownView: self withId: wid.
   411     self graphicsDevice addKnownView: self withId: wid.
   418     container add: self.
   412     container add: self.
   419     self initEvents.
   413     self initEvents.
   420     self origin: 0.0@0.0 corner: 1.0@1.0.
   414     self origin: 0.0@0.0 corner: 1.0@1.0.
   421 
   415 
   422     "Created: / 02-06-2011 / 17:33:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   416     "Created: / 02-06-2011 / 17:33:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   426 !XEmbedContainerView::ClientView methodsFor:'private'!
   420 !XEmbedContainerView::ClientView methodsFor:'private'!
   427 
   421 
   428 mapUnmapAccordingToXEmbedInfo
   422 mapUnmapAccordingToXEmbedInfo
   429     |val|
   423     |val|
   430 
   424 
   431     val := device 
   425     val := self graphicsDevice 
   432                 getProperty:(device atomIDOf:'_XEMBED_INFO')
   426                 getProperty:(device atomIDOf:'_XEMBED_INFO')
   433                 from:drawableId
   427                 from:self drawableId
   434                 delete:false.
   428                 delete:false.
   435     val ifNil:
   429     val ifNil:
   436             [ self map.
   430             [ self map.
   437             ^ self ].
   431             ^ self ].
   438     val key == 0 ifTrue:
   432     val key == 0 ifTrue:
   445 ! !
   439 ! !
   446 
   440 
   447 !XEmbedContainerView class methodsFor:'documentation'!
   441 !XEmbedContainerView class methodsFor:'documentation'!
   448 
   442 
   449 version_CVS
   443 version_CVS
   450     ^ '$Header: /cvs/stx/stx/libview/XEmbedContainerView.st,v 1.4 2014-02-05 18:59:59 cg Exp $'
   444     ^ '$Header: /cvs/stx/stx/libview/XEmbedContainerView.st,v 1.5 2014-02-18 17:20:21 stefan Exp $'
   451 !
   445 !
   452 
   446 
   453 version_SVN
   447 version_SVN
   454     ^ '$ Id $'
   448     ^ '$ Id $'
   455 ! !
   449 ! !