S
S
Sergey2015-01-02 00:23:12
linux
Sergey, 2015-01-02 00:23:12

XLib: XSetInputFocus not working, how to fix?

I'm writing a (justforfun) window manager.
When a new window is created (i.e. on a ConfigureRequest), the following is done:

//... (В классе окна)

    XWindowChanges  changes;                                                                                                                                                               
    changes.x = e->x;                                                                                                                                                                      
    changes.y = e->y;                                                                                                                                                                      
    changes.width = e->width;                                                                                                                                                              
    changes.height = e->height;                                                                                                                                                            
    changes.border_width = e->border_width;                                                                                                                                                
    changes.sibling = e->above;                                                                                                                                                            
    changes.stack_mode = e->detail;                                                                                                                                                        
    XConfigureWindow(display, this->window, e->value_mask, &changes); 

    //... (В классе самого оконного менеджера)

    XRaiseWindow(this->display, tw->get_xwindow());                                                                                                                                        
    XSetInputFocus(this->display, tw->get_xwindow(), RevertToPointerRoot, CurrentTime);

But the focus is still given to the window under the cursor.
How to make focus only on one (specified) window?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question