Howto monitor Window Manager Moving my Top Level Window (relatedtopics: GtkSocket and gtk_socket_steal())

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

Short version of my question...
-------------------------------

How can I get an indication, whenever the window manager moves (only
moves, not resizes) my top level window ? When such move occures, I want
to fireup one of my functions. How can I do that ( hopefully using GDK
or GTK interface, without having to resort to Xlib calls ).

Is there a signal I can connect to ? 
Any thoughts/help would be greatly appreciated !

My setup: RH 8.0, Gtk 1.2.10, Using Gtk through its C Interface.

Long version
------------

I'm experimenting with gtk_socket_steal(), in order to embed an external
(non-Gtk) arbitrary top level window into my Gtk Application.

The external application is written in Motif (it's the NEdit text
editor).

By large, the embedding works (after a small correction in gtksocket.c &
rebuilding Gtk, I'm using Gtk 1.2.10), and I can move my app around and
resize it, and the NEdit window moves OK and resizes OK.

However, I'm getting problems with NEdit's pop down menu(s). When I move
my app around, and try to launch a pop down menu, they pop down menu
tends to appear in its initial position, i.e. the pop down menu think
the app did not move one bit from its original position. For example, if
the app was initially positioned at the top left, then I move (without
resizing) to bottom down corner, then the pop down menu(s) will still
open at top left.

But it seems that when I resize my window, then this 'fixes' the problem
for the current location of the app, and the pop down menu(s) open at
the correct location (which should be just under the menu bar ..).

It appears, that the problem originates from the fact (fact ? more like
speculation..), that Motif pop down menus (and probably any toolkit's
pop down menu), are not descendants (in terms of X Windows Hierarchy) of
the the top level window (which I am trying to embed/steal). From what
I've read thus far, it seems that pop down menus in general are top
level windows on their own.

However, although the lack of parent-child between the top level window
and the pop down menu(s), I would guess that the pop down menus are
monitoring the size/position of top level window, and re-loacting
themselfs relative to it everytime it moves/resizes, so they would
always open at the correct position. 

However, after stealing the top level window and reparenting it to my
GtkSocket, when I move my app, the former top level window does not get
an X Window event for move/resize, because it has not moved/resized
relative to its new parent (which is now the GtkSocket) ! Therefor, the
pop down which monitor move/resize on the former top level window, do
not re-calculate their position, and thus open up at the wrong position.

If I can somehow monitor (via a signal, or similar) when my app is being
moved by the window manager, then I can send a dummy event to the
(formerly top level) embedded window, and the pop down menu(s) will be
updated. However I don't know how.


Any ideas/thoughts will be much appreciated,

Thanks a lot - Gal Aviel.







[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux