John Levon wrote: > On Sun, Feb 13, 2005 at 12:43:22PM +0000, Angus Leeming wrote: > >> Pretty dumm ;-) At a quick look, it looks to me like wa_ptr (work area >> pointer?) is a hack. Also at a quick look, it means that QWorkArea is > > Right, it's a horrible hack because we don't have access to a work-area > in the context we need it. Nor is it clear what we could do about it. > > john
What about something that maps between an X11 window ID and a QWorkArea? F.ex below. Of course, that requires a way to find the X11 window ID associated with a particular QWorkArea and I've no idea if that is possible... namespace { typedef std::map<Window, QWorkArea *> work_area_map; work_area_map registered_work_areas; } QWorkArea::QWorkArea() { // Add entry to the map registered_work_areas[x11_window_id] = this; } QWorkArea::~QWorkArea() { // Remove 'this' from the work_area_map } bool lyxX11EventFilter(XEvent * xev) { work_area_map::const_iterator it = registered_work_areas.find(xev->window); if (it == registered_work_areas.end()) return; QWorkArea * wa_ptr = it->second; ... } -- Angus