X Window System Window Hierarchy exploration program - linux

Is there a program to explore X window hierarchy? Anything like Spy++ of MS
(http://msdn.microsoft.com/en-us/library/dd460727.aspx)

You could write one. Use XQueryTree starting from the root window.
Also, study carefully EWMH. It might have something relevant (e.g. _NET_CLIENT_LIST)
At last, code your own window manager, or adapt an existing one to fit your needs. A window manager has to know the list of top-level windows.
Remember that some X top-level windows might have been opened by some remote X11 client application running on a different machine (e.g. thru ssh -X)
Look also into xps and xwininfo; see this related question.

Related

keeping track of copy-paste in x11 using clipboard

I'm a newbie to x11. As part of my final project, i have to keep track of all copy paste's in a single machine(from which window to which window) using clipboard in linux X window system. For that i think i need to work with open source x11. But i completely don't know where to start. Which module of x11 should i deal with, to handle the inter-client communication of the x window system. http://www.x.org/releases/X11R7.7/src/
If possible please provide me some good source for developers in inter-client communications of x11. I found so many docs in x.org, but nothing is clearly given regarding the implementation.
Cut-and-paste in X11 is based on window properties and selections. This is a very good intro to X11 paste buffers/clipboards/selections. Read about associated selections/properties, then use XSelectInput and monitor property/selection changes.
See also:
X11 Get Clipboard Text

What window manager should I use as example?

I want to implement a simple specialized window manager for presentations (not user-controllable) that supports only the following operations:
Moving and resizing of windows
Switching desktops
Starting applications not on current desktop (in background) without disrupting current image.
I don't need any user input, button/titles, ...
What existing window manager should I use as example? There are many little "hello world" window managers, but they usually does not support desktop switching.
You don't need to reimplement the wheel.
openbox will do everything you mention and more besides.
Simply edit the rc.xml to disable the root menu, and re-launch.
Openbox also allows per app setting so that certain applications can open on a particular desktop by default, or with a particular size, or open hidden.
It also supports wildcards in the window selection, so that settings can apply to all windows.
devilspie2 is a window matching utility that can perform actions whenever a window opens.
It is highly hackable and the code is available on github. It will match windows by name/class/etc when they open, and perform actions on them. (including matching all windows and moving them to a different desktop. It will work with most window managers.
Based on the original devilspie which does not have Lua scripting, but is configured using s-exprs instead.
xdotool will also allow you to perform complex actions on windows without hacking any code. It will even fake user input (mouse/kbd) if you need it.
There are a few window managers written in Python that could be good starting points. Qtile and whimsy both describe themselves as hackable.

Debian Start Qt GUI application with no desktop

I have Debian 2.6 running on a SBC that I plan on using in an embedded setup. What I need to do is configure it so that linux will start up and run just my Qt GUI application. Do I need a window manager to do this or can I just do it with X11. Also because it is going to be for an embedded system I do not want to load any desktop manager. Any info on how this can be done would be great!
Yes you can do this without a window manager.
first: You need to boot into a non X session, init level 1 or 3.
second: You need to start the X server, in a basic mode by just calling X or xinit.
third: Start your app. You may need to take a little more control over where your app is positioned on the screen and its dimensions in your code, as you will not have a window manager to help with this.
alternatively: you can launch one of the more basic window managers to see how they play with your system. Motif Window Manager (mwm) and Tab Window Manager (twm)
Note: While working without a window manager, you may get into a state where you cannot do some very basic operations (ex: close a window, move a window, resize a window). You may find that you cannot survive without at least some of the more basic window management functions. Until you close the loop on this, remember, Ctrl + Alt + Backspace will kill the XServer.
If you want to start your app just with X11, you need do:
copy file /etc/X11/xinit/xinitrc to ~/.xinitrc
write all you want to run to it
run command startx
It worked for me and I hope it will help you

Name of window manager for Windows

i have a simple question,
i search the exact name of the window manager for Windows.
For Unix : X Window System
Mac : Quartz
Windows : ?
Thanks you.
In the sense of the linked article, Windows does not have a discrete window manager. The windowing system is responsible for drawing the windows, and "the shell" - typically explorer - is responsible for displaying a task bar and any icons on the desktop.
The appearance of a window manager however is an emergent property in Microsoft Windows: All windows have a WindowProc that handles messages - and all messages not handled by the application code must get passed to a function called DefWindowProc. DefWindowProc handles the clicks in the non client areas of the windows to perform the tasks typical of window managers - sizing, moving, maximizing and so on.
Because all window's WindowProcs get to choose how to handle messages, they can choose to not implement the typical window manager behaviors by handling the message them self and not calling DefWindowProc.
The taskbar - provided by explorer - provides buttons to manipulate windows but ultimately (a) Its just a regular window itself, and (b) It sends messages to the windows to get them to maximize, minimize, restore etc. themselves, so again, any particular window could choose to not act like the other windows.
DefWindowProc is implemented in user32.dll - so really that is the window manager.
It's got a really original name - It's called the "Desktop Window Manager". You can see they thought long and hard about how to get that one exactly right.
(This obviously had absolutely nothing to do with the Microsoft marketing department, otherwise it would have been called something crazy and unrelated like silverstuff or aero.)
Its called "Windows Explorer"
See http://en.wikipedia.org/wiki/Window_manager
The thing that does the drawing of lines and pixels on the screen has traditionally been GDI (gdi32.dll), or now WDDM (for Win7) - Windows Display Driver Model, which has another layert on top of that, DWM - Desktop Window Manager.
On top of all that, you have Aero and then Windows Explorer that display and manipulates windows.
Oh yes, I nearly forgot about Direct2D which is another rendering layer that fits in there somewhere. I suppose they'll come up with a final technology one day that'll form the basis of graphics and windowing for the next 25 years.

How to change focus in X-Windows?

I am working on old Motif-based application for Linux. I want to be able to programmatically change the active window of our application. I can redirect the input by using XSetInputFocus() function and the keyboard input start to go there, but XReconfigureWMWindow() and XRaiseWindow() functions just don't work.
I've read that Window Managers try to stop this behaviour, so tried to disable configure redirection, but this doesn't work either. Any ideas how to make one of my own windows on top of the window stack?
There is a tiny program called wmctrl available (at least in Debian/Ubuntu it is in standard distribution) which is able to perform many operations on windows and desktops, and handles plenty of window managers. I'd suggest testing whether it works in your environment, and if so, peeking at its sources.
You may find the answer to this is dependent on the Window Manager the user is using, or even what settings they've given to the Window Manager. I like to set my Window Managers to do "focus follows mouse", which means you can't send the focus to a window that I haven't put my mouse on, unless you also warp the mouse there (is that function called XWarpMouse?).

Resources