Prev: الشرح المصور للحصول على أجهزه إلكترونيه مجانا من xpango الأن
Next: احصل على لاب توب مجانى المقدم من شركة EZLapTop الأن
From: Sun on 22 Jan 2010 10:38 Hi, I have an overlay input-only window created as following: .... screen = DefaultScreen(dpy); width = DisplayWidth(dpy, screen); height = DisplayHeight(dpy, screen); root = RootWindow(dpy, screen); vmask |= CWDontPropagate; attrib.do_not_propagate_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; window = XCreateWindow(dpy, root, 0, 0, width, height, 0, CopyFromParent, InputOnly, CopyFromParent, vmask, &attrib); /* Put the wait cursor into the window */ XDefineCursor(dpy, window, 0); .... Now, when this window is mapped and raised, the application's main event loop still receives keypress and mouse events. When such event occurs (For ex: F1 key press), the following function is called to raise a window: static void SendButtonEvent(Widget cascadebutton) { static XButtonEvent *ButtonEvent=NULL; XSetInputFocus(UxDisplay,XtWindow (UxTopLevel),RevertToPointerRoot,CurrentTime); if (ButtonEvent) { free(ButtonEvent); ButtonEvent = NULL; } ButtonEvent = (XButtonEvent *)malloc(sizeof (XButtonEvent)); ButtonEvent->type = ButtonPress; ButtonEvent->window = XtWindow(cascadebutton); ButtonEvent->subwindow = XtWindow(cascadebutton); ButtonEvent->state = 0; ButtonEvent->button = Button1; XSendEvent(XtDisplay(cascadebutton), XtWindow (cascadebutton), True, ButtonPressMask, (XEvent*) ButtonEvent); ButtonEvent->type = ButtonRelease; XSendEvent(XtDisplay(cascadebutton), XtWindow (cascadebutton), True, ButtonReleaseMask, (XEvent*) ButtonEvent); } At this point the UI looks frozen. No more key events or buttons events are processed by the main event loop. My questions are: 1. Why does the main event loop continue to receive the key press event when the overlay window is up? 2. When the overlay window is up and keypress event is generated, why does the keyboard and mouse becomes inactive? We are using X/Motif 1.2 and Solaris 2.6. |