Пример #1
0
/** Set the next layout
 * \param cmd uicb_t type unused
*/
void
uicb_layout_next(uicb_t cmd)
{
     (void)cmd;
     layoutswitch(True);

     return;
}
Пример #2
0
/** Set the previous layout
 * \param cmd uicb_t type unused
*/
void
uicb_layout_prev(uicb_t cmd)
{
     (void)cmd;
     layoutswitch(False);

     return;
}
Пример #3
0
Файл: event.c Проект: n4cht/kwm
/** ButtonPress handle event
 * \param ev XButtonEvent pointer
*/
static void
buttonpress(XButtonEvent *ev)
{
     Client *c;
     int i, j, n;

     screen_get_sel();

     /* If the mouse is on a not selected client and you click on it. */
     if(((c = client_gb_win(ev->window)) || (c = client_gb_titlebar(ev->window))) && c != sel
        && (ev->button == Button1 || ev->button == Button2 || ev->button == Button3))
     {
          client_focus(c);
          client_raise(c);

          return;
     }

     /* Titlebar */
     if((c = client_gb_titlebar(ev->window)) && c == sel)
          for(i = 0; i < conf.titlebar.nmouse; ++i)
                if(ev->button == conf.titlebar.mouse[i].button)
                    if(conf.titlebar.mouse[i].func)
                         conf.titlebar.mouse[i].func(conf.titlebar.mouse[i].cmd);

     /* Titlebar buttons */
     if((c = client_gb_button(ev->window, &n)))
          for(i = 0; i < conf.titlebar.button[n].nmouse; ++i)
               if(ev->button == conf.titlebar.button[n].mouse[i].button)
                    if(conf.titlebar.button[n].mouse[i].func)
                    {
                         client_focus(c);
                         conf.titlebar.button[n].mouse[i].func(conf.titlebar.button[n].mouse[i].cmd);
                    }

     /* Frame Resize Area */
     if((c = client_gb_resize(ev->window)))
          mouse_resize(c);

     /* Client */
     if((c = client_gb_win(ev->window)) && c == sel)
          for(i = 0; i < conf.client.nmouse; ++i)
               if(ev->button == conf.client.mouse[i].button)
                    if(conf.client.mouse[i].func)
                         conf.client.mouse[i].func(conf.client.mouse[i].cmd);

     /* Root */
     if(ev->window == ROOT)
          for(i = 0; i < conf.root.nmouse; ++i)
               if(conf.root.mouse[i].tag == seltag[conf.root.mouse[i].screen]
                  || conf.root.mouse[i].tag < 0)
                    if(ev->button == conf.root.mouse[i].button)
                         if(conf.root.mouse[i].func)
                              conf.root.mouse[i].func(conf.root.mouse[i].cmd);

     /* Infobars */
     for(i = 0; i < screen_count(); ++i)
          if(ev->window == infobar[i].bar->win)
               for(j = 0; j < conf.bars.nmouse; ++j)
                    if(conf.bars.mouse[j].screen == i
                       || conf.bars.mouse[j].screen < 0)
                         if(conf.bars.mouse[j].tag == seltag[i]
                            || conf.bars.mouse[j].tag < 0)
                              if(ev->button == conf.bars.mouse[j].button)
                                   if(conf.bars.mouse[j].func)
                                        conf.bars.mouse[j].func(conf.bars.mouse[j].cmd);

     /* Selbar */
     if(conf.bars.selbar && ev->window == infobar[selscreen].selbar->win)
          for(i = 0; i < conf.selbar.nmouse; ++i)
               if(conf.selbar.mouse[i].tag == seltag[conf.selbar.mouse[i].screen]
                  || conf.selbar.mouse[i].tag < 0)
                    if(ev->button == conf.selbar.mouse[i].button)
                         if(conf.selbar.mouse[i].func)
                              conf.selbar.mouse[i].func(conf.selbar.mouse[i].cmd);

     /* Tags */
     for(i = 1; i < conf.ntag[selscreen] + 1; ++i)
          if(ev->window == infobar[selscreen].tags[i]->win)
          {
               for(j = 0; j < tags[selscreen][i].nmouse; ++j)
                    if(ev->button == tags[selscreen][i].mouse[j].button)
                         if(tags[selscreen][i].mouse[j].func)
                              tags[selscreen][i].mouse[j].func(tags[selscreen][i].mouse[j].cmd);

               /* Mouse button action on tag */
               if(ev->button == conf.mouse_tag_action[TagSel])
                    tag_set(i);
               else if(ev->button == conf.mouse_tag_action[TagTransfert])
                    tag_transfert(sel, i);
               else if(ev->button == conf.mouse_tag_action[TagAdd])
                    tag_additional(selscreen, seltag[selscreen], i);
               else if(ev->button == conf.mouse_tag_action[TagNext])
                    tag_set(seltag[selscreen] + 1);
               else if(ev->button == conf.mouse_tag_action[TagPrev])
                    tag_set(seltag[selscreen] - 1);
          }

     /* Layout button */
     if(ev->window == infobar[selscreen].layout_button->win && conf.nlayout > 1)
     {
          if(conf.layout_system && (ev->button == Button1 || ev->button == Button3)) /* True -> menu */
          {
               menulayout.y = spgeo[selscreen].y + infobar[selscreen].layout_button->geo.y + INFOBARH;
               menulayout.x = infobar[selscreen].layout_button->geo.x + (sgeo[selscreen].x - BORDH);

               if(infobar[selscreen].geo.y != spgeo[selscreen].y)
                    menulayout.y = infobar[selscreen].geo.y - (INFOBARH * menulayout.nitem) - SHADH;

               uicb_menu("menulayout");
          }
          else
          {
               switch(ev->button)
               {
               case Button1: case Button4: layoutswitch(True);  break;
               case Button3: case Button5: layoutswitch(False); break;
               }
          }
     }

     return;
}