X Windows – Window Swallowing

X Windows “window swallowing” is the process of program 1 capturing the main window of program 2 to display it inside of program 1’s main window. For example, Firefox using an external program to display a PDF in a tab. Firefox’s built-in javascript PDF viewer leaves a lot to be desired. Slow rendering or no rendering at all, memory hog, with the download button not working when it doesn’t render.

The following description is derived from my experience getting MozPlugger to work in Firefox to display PDF files using Evince.


Swallowing Message Flow

X Windows uses messages for communication between programs and the X Server. Messages are queued for each program and read at the programs leisure.

The following diagram shows the programs involved in the process along with their windows.


  • Firefox registers for root window notitications, then starts Evince.
  • Evince creates its main window and asks X Server to display it.
  • X Server passes the display request to Window Manager.
  • Window Manager assumes control of Evinces main window.
  • Firefox requests that Window Manager relinquish control of Evinces main window.
  • Firefox requests control of Evinces main window.
  • Firefox gains control and moves and resizes Evinces main window to fit in a tab.


  • FF -> XSelectInput(wXS, SubstructureNotifyMask)
  • FF -> Exec(EV)
  • EV -> XCreateWindow(wEV) -> XS
  • XS -> CreateNotify\[w?] -> FF
    • FF -> Save w? (Note: FF doesn’t know yet which window is wEV)
  • EV -> XMapWindow(wEV) -> XS
  • XS -> MapRequest\[wEV] -> WM
    • WM -> XReparentWindow(wEV, parent: wXS -> wWM) -> XS
    • WM -> XChangeProperty(wEV, WM_STATE = Normal) -> XS
  • XS -> ReparentNotify\[wEV, parent: wXS -> wWM] -> FF
    • FF -> Locate wEV in w?s
    • FF -> XSelectInput(wEV, SubstructureNotifyMask | PropertyChangeMask)
    • FF -> If WM_STATE != Withdrawn: XWithdrawWindow(wEV) -> XS
  • XS -> PropertyNotify\[wEV, WM_STATE = Normal] -> FF (Note: This may not be seen by FF, depending on timing)
    • FF -> If wEV not withdrawn above: XWithdrawWindow(wEV) -> XS
  • XS -> ReparentNotify\[wEV, parent: wWM -> wXS] -> FF
    • FF -> XReparentWindow(wEV, parent: wXS -> wFF) -> XS
  • XS -> ReparentNotify\[wEv, parent: wXS -> wFF] -> FF
    • FF-> XMoveResizeWindow(wEv)


  • Because the messaging system is asynchronous, the PropertyNotify of wEVs WM_STATE change to Normal may come before FF is listening for PropertyNotifiy on wEV. In that case, FF checks wEVs WM_STATE in the initial ReparentNotify.


31 thoughts on “X Windows – Window Swallowing”

  1. I truly wanted to jot down a comment so as to appreciate you for the splendid ways you are writing at this website. My incredibly long internet lookup has at the end of the day been rewarded with professional points to share with my best friends. I ‘d mention that many of us visitors actually are very much fortunate to exist in a magnificent community with so many lovely people with helpful secrets. I feel somewhat grateful to have used your entire webpages and look forward to tons of more amazing moments reading here. Thanks again for everything.

  2. Superb website you have here but I was curious if you knew of any user discussion forums that cover the same topics talked about in this article? I’d really like to be a part of community where I can get advice from other knowledgeable people that share the same interest. If you have any suggestions, please let me know. Cheers!

  3. Sosyal medya başarınızı kat ve kat artırmak, postlarınız ve hesaplarınızla Instagram başlıca gönderilerde yer almak için takipçi sayınızın çok yüksek olması, etkileşiminizin fazla olması gerekir. Siz de sosyal medyada başarılı olmak, satışlarınızı artırmak istiyorsanız Instagramda takipçi satın almak için Crovu’yu tercih edin.

  4. I am writing to let you know of the awesome discovery our daughter enjoyed browsing your web site. She came to understand numerous issues, with the inclusion of what it’s like to have an awesome helping mindset to get certain people without problems thoroughly grasp specific advanced subject areas. You really did more than her expectations. Many thanks for churning out the helpful, healthy, explanatory and also easy guidance on your topic to Ethel.

  5. Aw, this was a really nice post. In thought I would like to put in writing like this moreover – taking time and precise effort to make a very good article… however what can I say… I procrastinate alot and not at all seem to get something done.

  6. I have been exploring for a little bit for any high-quality articles or blog posts in this sort of house . Exploring in Yahoo I at last stumbled upon this site. Reading this info So i am glad to convey that I’ve an incredibly good uncanny feeling I discovered exactly what I needed. I such a lot indisputably will make certain to don’t fail to remember this web site and give it a glance regularly.

  7. Having read this I thought it was very informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way to much time both reading and commenting. But so what, it was still worth it!

  8. I actually wanted to compose a simple message so as to thank you for some of the lovely tricks you are showing here. My long internet look up has at the end been honored with awesome information to talk about with my two friends. I ‘d assert that most of us site visitors actually are very fortunate to live in a decent place with many awesome people with valuable tactics. I feel somewhat happy to have seen the webpage and look forward to plenty of more pleasurable moments reading here. Thank you again for all the details.

  9. Thanks for sharing excellent informations. Your web site is very cool. I am impressed by the details that you’ve on this blog. It reveals how nicely you perceive this subject. Bookmarked this web page, will come back for more articles. You, my friend, ROCK! I found just the info I already searched everywhere and simply couldn’t come across. What a great web site.

  10. You can definitely see your skills in the work you write. The sector hopes for even more passionate writers such as you who are not afraid to say how they believe. All the time go after your heart. “What power has law where only money rules.” by Gaius Petronius.

  11. I have to show my admiration for your kindness supporting all those that require help with this particular idea. Your personal commitment to getting the message around came to be certainly advantageous and have specifically enabled guys much like me to reach their aims. Your own helpful help and advice indicates this much to me and further more to my colleagues. Warm regards; from each one of us.

  12. I’ve been browsing online greater than three hours these days, but I never found any interesting article like yours. It¦s pretty worth sufficient for me. In my view, if all website owners and bloggers made excellent content material as you did, the web shall be much more helpful than ever before.

  13. I beloved as much as you’ll receive performed right here. The sketch is tasteful, your authored subject matter stylish. however, you command get got an nervousness over that you wish be turning in the following. ill no doubt come further earlier once more since precisely the similar just about a lot regularly inside of case you shield this hike.

Leave a Reply

Your email address will not be published. Required fields are marked *