Exemple #1
0
/** Handle an expose event. */
char HandleExpose(const XExposeEvent *event)
{
   ClientNode *np;
   np = FindClientByParent(event->window);
   if(np) {
      if(event->count == 0) {
         DrawBorder(np);
      }
      return 1;
   } else {
      np = FindClientByWindow(event->window);
      if(np) {
         if(np->state.status & STAT_WMDIALOG) {

            /* Dialog expose events are handled elsewhere. */
            return 0;

         } else {

            /* Ignore other expose events for client windows. */
            return 1;

         }
      }
      return event->count ? 1 : 0;
   }
}
Exemple #2
0
/** Find a client by parent or window. */
ClientNode *FindClient(Window w)
{
   ClientNode *np;
   np = FindClientByWindow(w);
   if(!np) {
      np = FindClientByParent(w);
   }
   return np;
}
Exemple #3
0
/** Process a button event. */
void HandleButtonEvent(const XButtonEvent *event)
{

   ClientNode *np;
   int north, south, east, west;

   np = FindClientByParent(event->window);
   if(np) {
      if(event->type == ButtonPress) {
         FocusClient(np);
         RaiseClient(np);
      }
      DispatchBorderButtonEvent(event, np);
   } else if(event->window == rootWindow && event->type == ButtonPress) {
      if(!ShowRootMenu(event->button, event->x, event->y, 0)) {
         if(event->button == Button4) {
            LeftDesktop();
         } else if(event->button == Button5) {
            RightDesktop();
         }
      }
   } else {
      const unsigned int mask = event->state & ~lockMask;
      np = FindClientByWindow(event->window);
      if(np) {
         switch(event->button) {
         case Button1:
         case Button2:
            FocusClient(np);
            RaiseClient(np);
            if(mask == Mod1Mask) {
               GetBorderSize(&np->state, &north, &south, &east, &west);
               MoveClient(np, event->x + west, event->y + north);
            }
            break;
         case Button3:
            if(mask == Mod1Mask) {
               GetBorderSize(&np->state, &north, &south, &east, &west);
               ResizeClient(np, BA_RESIZE | BA_RESIZE_E | BA_RESIZE_S,
                            event->x + west, event->y + north);
            } else {
               FocusClient(np);
               RaiseClient(np);
            }
            break;
         default:
            break;
         }
         JXAllowEvents(display, ReplayPointer, eventTime);
      }

   }

}
Exemple #4
0
/** Process a leave notify event. */
void HandleLeaveNotify(const XCrossingEvent *event) {

   ClientNode *np;

   SetMousePosition(event->x_root, event->y_root);

   np = FindClientByParent(event->window);
   if(np) {
      SetDefaultCursor(np->parent);
   }

}
Exemple #5
0
/** Handle a motion notify event. */
void HandleMotionNotify(const XMotionEvent *event)
{

   ClientNode *np;
   Cursor cur;

   if(event->is_hint) {
      return;
   }

   np = FindClientByParent(event->window);
   if(np) {
      BorderActionType action;
      action = GetBorderActionType(np, event->x, event->y);
      if(np->borderAction != action) {
         np->borderAction = action;
         cur = GetFrameCursor(action);
         JXDefineCursor(display, np->parent, cur);
      }
   }

}
Exemple #6
0
/** Handle a motion notify event. */
void HandleMotionNotify(const XMotionEvent *event) {

   ClientNode *np;
   Cursor cur;
   BorderActionType action;

   if(event->is_hint) {
      return;
   }

   SetMousePosition(event->x_root, event->y_root);

   np = FindClientByParent(event->window);
   if(np && (np->state.border & BORDER_OUTLINE)) {
      action = GetBorderActionType(np, event->x, event->y);
      if(np->borderAction != action) {
         np->borderAction = action;
         cur = GetFrameCursor(action);
         JXDefineCursor(display, np->parent, cur);
      }
   }

}
Exemple #7
0
/** Process a button event. */
void HandleButtonEvent(const XButtonEvent *event) {

   int x, y;
   ClientNode *np;
   int north, south, east, west;

   np = FindClientByParent(event->window);
   if(np) {
      RaiseClient(np);
      if(focusModel == FOCUS_CLICK) {
         FocusClient(np);
      }
      switch(event->button) {
      case Button1:
         DispatchBorderButtonEvent(event, np);
         break;
      case Button2:
         MoveClient(np, event->x, event->y);
         break;
      case Button3:
         GetBorderSize(np, &north, &south, &east, &west);
         x = event->x + np->x - west;
         y = event->y + np->y - north;
         ShowWindowMenu(np, x, y);
         break;
      case Button4:
         ShadeClient(np);
         break;
      case Button5:
         UnshadeClient(np);
         break;
      default:
         break;
      }
   } else if(event->window == rootWindow && event->type == ButtonPress) {
      if(!ShowRootMenu(event->button, event->x, event->y)) {
         if(event->button == 4) {
            LeftDesktop();
         } else if(event->button == 5) {
            RightDesktop();
         }
      }
   } else {
      np = FindClientByWindow(event->window);
      if(np) {
         switch(event->button) {
         case Button1:
         case Button2:
            RaiseClient(np);
            if(focusModel == FOCUS_CLICK) {
               FocusClient(np);
            }
            if(event->state & Mod1Mask) {
               GetBorderSize(np, &north, &south, &east, &west);
               MoveClient(np, event->x + west, event->y + north);
            }
            break;
         case Button3:
            if(event->state & Mod1Mask) {
               GetBorderSize(np, &north, &south, &east, &west);
               ResizeClient(np, BA_RESIZE | BA_RESIZE_E | BA_RESIZE_S,
                  event->x + west, event->y + north);
            } else {
               RaiseClient(np);
               if(focusModel == FOCUS_CLICK) {
                  FocusClient(np);
               }
            }
            break;
         default:
            break;
         }
         JXAllowEvents(display, ReplayPointer, CurrentTime);
      }
   }

   UpdatePager();
}