Hi, I'm Luca from Savona, Italy. I'm using Compiz and I'm writing an application with Xlib to draw two windows, let's say window_A and window_B. I would like to keep fixed the relative position between two established corners of them that they have when mapped. So that if I move or resize one of the window, the other if necessary automatically moves to observe the condition. I'm close with this code, let's see for example the case for window A: XSelectInput ( display, RootWindow ( display, 0 ), SubstructureNotifyMask );> > XEvent event; > while ( true ) > { > XNextEvent ( display, & event ); > /* ... */ > if ( event.type == ConfigureNotify and event.xconfigure.window => window_B ) > { > // new_x, new_y based on event.xconfigure.x, event.xconfigure.y, > etc... > XMoveWindow ( display, window_A, new_x, new_y ); > } > /* ... */ > } >The problem is that the move correction of a window is only applied at the end of the move/resize operation of the other and not continuously during it. Is there a way to obtain this as if the two windows could behave like one rigid body? Thank you in advance, Luca -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/compiz/attachments/20130619/cf1adec4/attachment.html>
Hi Luca, In recent versions of compiz (0.9.10) if you have lazy positioning on (org.compiz.move 'lazy-positioning') other clients won't get a configure notification until the end of the move. This is a performance optimization to avoid a slow path on the nvidia drivers with vsync. If you want such notifications you need to turn this option off. Either that or implement this as a compiz plugin so that you can get move notifications in real time. Sam. On 19/06/2013 1:57 PM, "Luca Rocca" <disquisitiones at gmail.com> wrote:> Hi, > I'm Luca from Savona, Italy. > I'm using Compiz and I'm writing an application with Xlib to draw two > windows, > let's say window_A and window_B. I would like to keep fixed the relative > position > between two established corners of them that they have when mapped. > So that if I move or resize one of the window, the other if necessary > automatically > moves to observe the condition. I'm close with this code, let's see for > example > the case for window A: > > XSelectInput ( display, RootWindow ( display, 0 ), SubstructureNotifyMask >> ); >> >> XEvent event; >> while ( true ) >> { >> XNextEvent ( display, & event ); >> /* ... */ >> if ( event.type == ConfigureNotify and event.xconfigure.window =>> window_B ) >> { >> // new_x, new_y based on event.xconfigure.x, event.xconfigure.y, >> etc... >> XMoveWindow ( display, window_A, new_x, new_y ); >> } >> /* ... */ >> } >> > > The problem is that the move correction of a window is only applied at the > end of the move/resize > operation of the other and not continuously during it. > Is there a way to obtain this as if the two windows could behave like one > rigid body? > Thank you in advance, > > Luca > _______________________________________________ > compiz mailing list > compiz at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/compiz > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/compiz/attachments/20130619/9294af1f/attachment.html>
Hi Sam, thank you for your answer. I have compiz 0.8.4 and there is a "Lazy Positioning" option in the "Move Window" plugin settings page. It was on by default and turning it off solved the problem! Now a window follows continuosly the changes of the other. Wunderbar. One thing more, however, which seems strange to me. In case of a resize the movement of the "linked " window is perfectly smooth. But in case of a move the movement is jerky, the window shivers and there is a noticeable spring effect i.e. there is a visible delay in the movement response. It seems strange to me because there aren't two different code paths for the two cases, the code is perfectly the same. I get a ConfigureNotify event, and on the basis of the new window position/geometry move the other, regardless of the type of the generating event (move or resize). May be that in the two cases compiz generates configure notifications differently? A huge thanks, Luca 2013/6/19 Sam Spilsbury <smspillaz at gmail.com>> Hi Luca, > > In recent versions of compiz (0.9.10) if you have lazy positioning on > (org.compiz.move 'lazy-positioning') other clients won't get a configure > notification until the end of the move. > > This is a performance optimization to avoid a slow path on the nvidia > drivers with vsync. > > If you want such notifications you need to turn this option off. Either > that or implement this as a compiz plugin so that you can get move > notifications in real time. > > Sam. > On 19/06/2013 1:57 PM, "Luca Rocca" <disquisitiones at gmail.com> wrote: > >> Hi, >> I'm Luca from Savona, Italy. >> I'm using Compiz and I'm writing an application with Xlib to draw two >> windows, >> let's say window_A and window_B. I would like to keep fixed the relative >> position >> between two established corners of them that they have when mapped. >> So that if I move or resize one of the window, the other if necessary >> automatically >> moves to observe the condition. I'm close with this code, let's see for >> example >> the case for window A: >> >> XSelectInput ( display, RootWindow ( display, 0 ), SubstructureNotifyMask >>> ); >>> >>> XEvent event; >>> while ( true ) >>> { >>> XNextEvent ( display, & event ); >>> /* ... */ >>> if ( event.type == ConfigureNotify and event.xconfigure.window =>>> window_B ) >>> { >>> // new_x, new_y based on event.xconfigure.x, event.xconfigure.y, >>> etc... >>> XMoveWindow ( display, window_A, new_x, new_y ); >>> } >>> /* ... */ >>> } >>> >> >> The problem is that the move correction of a window is only applied at >> the end of the move/resize >> operation of the other and not continuously during it. >> Is there a way to obtain this as if the two windows could behave like one >> rigid body? >> Thank you in advance, >> >> Luca >> _______________________________________________ >> compiz mailing list >> compiz at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/compiz >> >>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/compiz/attachments/20130620/c17432cf/attachment.html>