void gsl_pump_events () { //This is your standard way of processing events. If you need key by key events, or key names //take a look at gsl_get_charkey. (deylen - 02/6/2009) pollAllEvents(); checkHasFocus(); calcMouseMotion(); }
void wm_redraw_ncarea(win *window) { GR_WINDOW_INFO info; GR_WM_PROPERTIES props; GR_BOOL active; GR_WINDOW_ID focusedwindow; Dprintf("wm_container_exposure window %d\n", window->wid); GrGetWindowInfo(window->wid, &info); GrGetWMProperties(window->clientid, &props); /* * Check for invalid window. This will be the * case if the client exited, and we're just * getting the paint notification for our parent. */ if (props.flags) { /* Get window with keyboard focus*/ focusedwindow = GrGetFocus(); /* * Check if the current window or any of its ancestors has the focus * A window is active even if any of its ancestors has focus * --Amit Kulkarni */ active = checkHasFocus(window->clientid,focusedwindow); /* * Note that we should also raise the window if its active and behind. * an active window deserves to be on the top :-) */ //if(active) //GrRaiseWindow(window->wid); // FIXME nxPaintNCArea(window->wid, info.width, info.height, props.title, active, props.props); } /* free title returned from GrGetWMProperties*/ if (props.title) free(props.title); }
/* * This function performs a depth first search on window * and finds if any of its children has focus. * i.e. wid equal to ref * -- Amit Kulkarni */ static GR_BOOL checkHasFocus(GR_WINDOW_ID wid,GR_WINDOW_ID ref) { GR_WINDOW_INFO winfo; GR_WINDOW_ID childwid; if(wid==ref) return GR_TRUE; GrGetWindowInfo(wid, &winfo); /*Go down*/ childwid = winfo.child; while (childwid) { if(checkHasFocus(childwid,ref)) return GR_TRUE; GrGetWindowInfo (childwid,&winfo); /*Go right*/ childwid=winfo.sibling; } /*Nah.. no match here*/ return GR_FALSE; }