On Wed, 18 Apr 2012 00:12:07 +0200 Michaël Bouchaud <y...@efl.so> said:
aaah... well... there is no GUARANTEED way to know a wm has started managing the root window. there are things you can do that will work in MOSt caes, but ecore_x_window_manage is NOT one of them as this makes you a window manager. you will conflict with the wm wanting to start up and the wm starting will barf and exit/abort if it find you managing the root window. so dont do this. what you want to do is something like this. 1. set up a timeout and close your x connection (shut down ecore_x or use ecore_x_disconnect()). lets say you wait 10 seconds for this ultimate "give up" 2. if CHILD process (login session) exits before timeout, close connection, terminate xserver, restart, and go back to login screen. 3. while waiting for timeout ecore_x_window_sniff() the root window id - this listens for events on root without managing it. 4. as events come in, you need to actually not just wait for the first create, you need to listen for PROPERTY change events. 5. when u get property notify events, check the atom of the property is ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK or not. If it is not - ignore. If it is then: 5.1 n = ecore_x_window_prop_window_get(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &win, 1); if this succeeds (if n > 0) then 5.2 n = ecore_x_window_prop_window_get(win, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &win2, 1); if (win == win2) then... 5.3 you have a valid netwm supporting wm up and running and you can close your x connection and let the wm keep doing what it does best - manage windows. if anything fails in the steps above just ignore event and keep waiting for timeout. for code look at e_hints.c - e_hints_init(). e checks for a previous netwm wm there and waits for it to go away (yes - it spins... ugly, but it almost never happens). this covers netwm wms - that's most of them these days. but older ones not doing netwm or others not supporting this part of netwm will not be detectable this way, thus your timeout is just going to wait around until you HOPE they are up and working anyway. i can add other heuristics like other properties that may hint at there being a wm there with other netwm properties, or you can create a normal 1x1 window (not override-redirect) and listen to its properties until it gets a WM_STATE property on it - this means the wm has picked it up and started managing it, so you know a wm is there. this has an artefact of a little border appearing then disappearing on startup, so i tend to not suggest it. > Hi :) > Now for elsa, a greater. I have experienced some race condition with x11 > connection. > I need to release x11 connection when the wm has took the hand on it > for time, I catch ECORE_X_EVENT_WINDOW_CREATE. > But for this I need to manage the root window (ecore_x_window_manage I'm > wrong ?). > If I'm still right, fluxbox doesn't work with this. He tries to manage > before creating some windows :( > Don't notice some signal about connection on x11. So I try to find some > help ... > Hope to find one > -- > Michaël Bouchaud (yoz) <y...@efl.so> > ------------------------------------------------------------------------------ > Better than sec? Nothing is better than sec when it comes to > monitoring Big Data applications. Try Boundary one-second > resolution app monitoring today. Free. > http://p.sf.net/sfu/Boundary-dev2dev > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) ras...@rasterman.com ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel