Esempio n. 1
0
File: event.c Progetto: n4cht/kwm
/** EnterNotify handle event
 * \param ev XCrossingEvent pointer
*/
static void
enternotify(XCrossingEvent *ev)
{
     Client *c;
     int n;

     if((ev->mode != NotifyNormal
         || ev->detail == NotifyInferior)
        && ev->window != ROOT)
          return;

     /* Don't handle EnterNotify event if it's about systray */
     if(systray_find(ev->window) || ev->window == traywin)
          return;

     if(conf.focus_fmouse)
     {
          if((c = client_gb_win(ev->window))
                    || (c = client_gb_frame(ev->window))
                    || (c = client_gb_titlebar(ev->window))
                    || (c = client_gb_button(ev->window, &n)))
               client_focus(c);
          else
               client_focus(NULL);
     }


     return;
}
Esempio n. 2
0
static void
event_enternotify(XEvent *e)
{
     XCrossingEvent *ev = &e->xcrossing;
     struct client *c;

     if((ev->mode != NotifyNormal
         || ev->detail == NotifyInferior)
               && ev->window != W->root)
          return;

     if(ev->window == W->systray.win || systray_find(ev->window))
          return;

     if((c = client_gb_win(ev->window))
        || (c = client_gb_frame(ev->window)))
     {
          if(c->flags & CLIENT_IGNORE_ENTER)
               c->flags ^= CLIENT_IGNORE_ENTER;
          else if(c->tag->flags & TAG_IGNORE_ENTER)
               c->tag->flags ^= TAG_IGNORE_ENTER;
          else if(c != W->client && !(c->flags & CLIENT_TABBED)
                  && W->cfocus & CFOCUS_ENTER)
               client_focus(c);
     }
}
Esempio n. 3
0
/** Move a client in tile grid with the mouse
 *\param c Client double pointer
 */
static void
mouse_move_tile_client(Client **c)
{
     Client *sc;
     Window w;
     int d;

     if(!((*c)->flags & TileFlag) && !((*c)->flags & LMaxFlag))
          return;

     XQueryPointer(dpy, ROOT, &w, &w, &d, &d, &d, &d, (uint*)&d);

     if(((sc = client_gb_win(w)) || (sc = client_gb_frame(w)) || (sc = client_gb_titlebar(w)))
        && (*c)->win != sc->win && !((*c)->flags & HideFlag) && !(sc->flags & HideFlag))
     {
          client_swap(sc, *c);
          client_focus(sc);
          swap_ptr((void**)c, (void**)&sc);
     }

     return;

}