nanogui: what about the nanowm
Subject:
Re: what about the nanowm
From:
####@####.####
Date:
26 Oct 2000 09:01:30 -0000
Message-Id: <003401c03f2b$a66cb6a0$316416ac@milk>
----- Original Message -----
From: "Tony Hoo" ####@####.####
To: "nanoX-MailList" ####@####.####
Sent: Wednesday, October 25, 2000 5:01 PM
Subject: what about the nanowm
> Greg
>
> I cannot understand why nanowm can recognise different application's
wondows, because when nanowm received a event, it always handle the windows
identfied by "wid" of event ,but applications can has the same "wid" ? (as
I known ,in the main() of the nanowm.c file, GR_ROOT_WINDOW_ID had be add to
windowlist , but two application can produce two GR_ROOT_WINDOW_ID )
>
> another question is , why ordinary clients can get only their own
vents( I known that it used by unix socket) , but nanowm can get all the
events ?
You may be confused among the event queues. Every client has its own
event queue (ref. GsAllocEvent). But different clients may select the
events from a window at the same time, if these clients can both get the id
of this window.
There may be a bug in the function GsDeliverUpdateEvent: it delivers two
update events to child window instead of one update event to child and one
update-chld event to parent.
This may be the reson that "nanowm can get all the events." The events
recieved by nanowm must be all with the attribute wid = root-window-id, not
the ones of root's children.
M. L. Kao
>
> I will add a application to work like nanowm , but if some client program
press a special key, my program (I call it XIM server, for chinese input
purpose) will respond to pop a input window, and hold up it's keyevent .and
after processing ,return back another keycode to instead of initial key
event. so , do I must update the nano-X?
>
> regards
>
> Tony Hoo
my fix of this 'bug':
p.s.: GR_UPDATECHLD(utype) is a macro, = utype + 8
void GsDeliverUpdateEvent(GR_WINDOW *wp, GR_UPDATE_TYPE utype, GR_COORD x,
GR_COORD y, GR_SIZE width, GR_SIZE height)
{
GR_EVENT_MASK cmask = GR_EVENT_MASK_UPDATE;
GR_EVENT_UPDATE *ep; /* update event */
GR_EVENT_CLIENT *ecp; /* current event client */
GR_WINDOW_ID id = wp->id;
int lcount = 0;
update_again:
if (lcount)
for (ecp = wp->eventclients; ecp; ecp = ecp->next) {
if ((ecp->eventmask & cmask) == 0)
continue;
ep = (GR_EVENT_UPDATE *) GsAllocEvent(ecp->client);
if (ep == NULL)
continue;
ep->type = (lcount) ? GR_EVENT_TYPE_CHLD_UPDATE : GR_EVENT_TYPE_UPDATE;
ep->utype = (lcount) ? GR_UPDATECHLD(utype) : utype; /* FIXME */
ep->wid = wp->id;
ep->subwid = id;
ep->x = x;
ep->y = y;
ep->width = width;
ep->height = height;
}
/* If we are currently checking the window updated, go back and
* check its parent too */
if (!lcount++)
wp = wp->parent;
cmask = GR_EVENT_MASK_CHLD_UPDATE;
goto update_again;
}
}