예제 #1
0
파일: dock.c 프로젝트: JamesLinus/jwm
/** Create a dock component. */
TrayComponentType *CreateDock(int width)
{
   TrayComponentType *cp;

   if(JUNLIKELY(dock != NULL && dock->cp != NULL)) {
      Warning(_("only one Dock allowed"));
      return NULL;
   } else if(dock == NULL) {
      dock = Allocate(sizeof(DockType));
      dock->nodes = NULL;
      dock->window = None;
   }

   cp = CreateTrayComponent();
   cp->object = dock;
   cp->requestedWidth = 1;
   cp->requestedHeight = 1;
   dock->cp = cp;
   dock->itemSize = width;

   cp->SetSize = SetSize;
   cp->Create = Create;
   cp->Resize = Resize;

   return cp;

}
예제 #2
0
파일: taskbar.c 프로젝트: JamesLinus/jwm
/** Create a new task bar tray component. */
TrayComponentType *CreateTaskBar()
{

   TrayComponentType *cp;
   TaskBarType *tp;

   tp = Allocate(sizeof(TaskBarType));
   tp->next = bars;
   bars = tp;
   tp->itemHeight = 0;
   tp->itemWidth = 0;
   tp->userHeight = 0;
   tp->maxItemWidth = 0;
   tp->layout = LAYOUT_HORIZONTAL;
   tp->mousex = -settings.doubleClickDelta;
   tp->mousey = -settings.doubleClickDelta;
   tp->mouseTime.seconds = 0;
   tp->mouseTime.ms = 0;

   cp = CreateTrayComponent();
   cp->object = tp;
   tp->cp = cp;

   cp->SetSize = SetSize;
   cp->Create = Create;
   cp->Resize = Resize;
   cp->ProcessButtonPress = ProcessTaskButtonEvent;
   cp->ProcessMotionEvent = ProcessTaskMotionEvent;

   RegisterCallback(settings.popupDelay / 2, SignalTaskbar, tp);

   return cp;

}
예제 #3
0
/** Create a button tray component. */
TrayComponentType *CreateTrayButton(const char *iconName,
   const char *label, const char *action,
   const char *popup, int width, int height) {

   TrayButtonType *bp;
   TrayComponentType *cp;

   if(JUNLIKELY((label == NULL || strlen(label) == 0)
      && (iconName == NULL || strlen(iconName) == 0))) {
      Warning(_("no icon or label for TrayButton"));
      return NULL;
   }

   if(JUNLIKELY(width < 0)) {
      Warning(_("invalid TrayButton width: %d"), width);
      width = 0;
   }
   if(JUNLIKELY(height < 0)) {
      Warning(_("invalid TrayButton height: %d"), height);
      height = 0;
   }

   bp = Allocate(sizeof(TrayButtonType));
   bp->next = buttons;
   buttons = bp;

   bp->icon = NULL;
   bp->iconName = CopyString(iconName);
   bp->label = CopyString(label);
   bp->action = CopyString(action);
   bp->popup = CopyString(popup);

   cp = CreateTrayComponent();
   cp->object = bp;
   bp->cp = cp;
   cp->requestedWidth = width;
   cp->requestedHeight = height;

   bp->mousex = -POPUP_DELTA;
   bp->mousey = -POPUP_DELTA;

   cp->Create = Create;
   cp->Destroy = Destroy;
   cp->SetSize = SetSize;
   cp->Resize = Resize;

   cp->ProcessButtonPress = ProcessButtonPress;
   cp->ProcessButtonRelease = ProcessButtonRelease;
   if(popup || label) {
      cp->ProcessMotionEvent = ProcessMotionEvent;
   }

   return cp;

}
예제 #4
0
파일: traybutton.c 프로젝트: kuailexs/jwm
/** Create a button tray component. */
TrayComponentType *CreateTrayButton(const char *iconName,
                                    const char *label,
                                    const char *popup,
                                    unsigned int width,
                                    unsigned int height)
{

   TrayButtonType *bp;
   TrayComponentType *cp;

   if(JUNLIKELY((label == NULL || strlen(label) == 0)
      && (iconName == NULL || strlen(iconName) == 0))) {
      Warning(_("no icon or label for TrayButton"));
      return NULL;
   }

   bp = Allocate(sizeof(TrayButtonType));
   bp->next = buttons;
   buttons = bp;

   bp->icon = NULL;
   bp->iconName = CopyString(iconName);
   bp->label = CopyString(label);
   bp->actions = NULL;
   bp->popup = CopyString(popup);

   cp = CreateTrayComponent();
   cp->object = bp;
   bp->cp = cp;
   cp->requestedWidth = width;
   cp->requestedHeight = height;

   bp->mousex = -settings.doubleClickDelta;
   bp->mousey = -settings.doubleClickDelta;

   cp->Create = Create;
   cp->Destroy = Destroy;
   cp->SetSize = SetSize;
   cp->Resize = Resize;
   cp->Redraw = Draw;

   cp->ProcessButtonPress = ProcessButtonPress;
   cp->ProcessButtonRelease = ProcessButtonRelease;
   if(popup || label) {
      cp->ProcessMotionEvent = ProcessMotionEvent;
   }

   RegisterCallback(settings.popupDelay / 2, SignalTrayButton, bp);

   return cp;

}
예제 #5
0
파일: swallow.c 프로젝트: GustavoMOG/JWM
/** Create a swallowed application tray component. */
TrayComponentType *CreateSwallow(const char *name, const char *command,
   int width, int height) {

   TrayComponentType *cp;
   SwallowNode *np;

   if(!name) {
      Warning("cannot swallow a client with no name");
      return NULL;
   }

   /* Make sure this name isn't already used. */
   for(np = swallowNodes; np; np = np->next) {
      if(!strcmp(np->name, name)) {
         Warning("cannot swallow the same client multiple times");
         return NULL;
      }
   }

   np = Allocate(sizeof(SwallowNode));
   np->name = CopyString(name);
   np->command = CopyString(command);

   np->next = swallowNodes;
   swallowNodes = np;

   cp = CreateTrayComponent();
   np->cp = cp;
   cp->object = np;
   cp->Destroy = Destroy;
   cp->Resize = Resize;

   if(width) {
      cp->requestedWidth = width;
      np->userWidth = 1;
   } else {
      cp->requestedWidth = 1;
      np->userWidth = 0;
   }
   if(height) {
      cp->requestedHeight = height;
      np->userHeight = 1;
   } else {
      cp->requestedHeight = 1;
      np->userHeight = 0;
   }

   return cp;

}
예제 #6
0
파일: clock.c 프로젝트: JamesLinus/jwm
/** Create a clock tray component. */
TrayComponentType *CreateClock(const char *format, const char *zone,
                               int width, int height)
{

   TrayComponentType *cp;
   ClockType *clk;

   clk = Allocate(sizeof(ClockType));
   clk->next = clocks;
   clocks = clk;

   clk->mousex = -settings.doubleClickDelta;
   clk->mousey = -settings.doubleClickDelta;
   clk->mouseTime.seconds = 0;
   clk->mouseTime.ms = 0;
   clk->userWidth = 0;

   if(!format) {
      format = DEFAULT_FORMAT;
   }
   clk->format = CopyString(format);
   clk->zone = CopyString(zone);
   clk->actions = NULL;
   memset(&clk->lastTime, 0, sizeof(clk->lastTime));

   cp = CreateTrayComponent();
   cp->object = clk;
   clk->cp = cp;
   if(width > 0) {
      cp->requestedWidth = width;
      clk->userWidth = 1;
   } else {
      cp->requestedWidth = 0;
      clk->userWidth = 0;
   }
   cp->requestedHeight = height;

   cp->Create = Create;
   cp->Resize = Resize;
   cp->Destroy = Destroy;
   cp->ProcessButtonPress = ProcessClockButtonPress;
   cp->ProcessButtonRelease = ProcessClockButtonRelease;
   cp->ProcessMotionEvent = ProcessClockMotionEvent;

   RegisterCallback(Min(900, settings.popupDelay / 2), SignalClock, clk);

   return cp;
}
예제 #7
0
파일: spacer.c 프로젝트: George-Shaw/jwm
/** Create a spacer tray component. */
TrayComponentType *CreateSpacer(int width, int height)
{

   TrayComponentType *cp;

   if(JUNLIKELY(width < 0)) {
      width = 0;
   }
   if(JUNLIKELY(height < 0)) {
      height = 0;
   }

   cp = CreateTrayComponent();
   cp->requestedWidth = width;
   cp->requestedHeight = height;

   cp->Create = Create;
   cp->Destroy = Destroy;
   cp->SetSize = SetSize;
   cp->Resize = Resize;

   return cp;

}