Exemplo n.º 1
0
/** Raise the client. This will affect transients. */
void RaiseClient(ClientNode *np)
{

   Assert(np);

   if(nodes[np->state.layer] != np) {

      /* Raise the window */
      Assert(np->prev);
      np->prev->next = np->next;
      if(np->next) {
         np->next->prev = np->prev;
      } else {
         nodeTail[np->state.layer] = np->prev;
      }
      np->next = nodes[np->state.layer];
      nodes[np->state.layer]->prev = np;
      np->prev = NULL;
      nodes[np->state.layer] = np;

   }

   RestackTransients(np);
   RequireRestack();

}
Exemplo n.º 2
0
/** Minimize a client window and all of its transients. */
void MinimizeClient(ClientNode *np, char lower)
{
   Assert(np);
   MinimizeTransients(np, lower);
   RequireRestack();
   RequireTaskUpdate();
}
Exemplo n.º 3
0
Arquivo: tray.c Projeto: Nehamkin/jwm
/** Lower tray windows. */
void LowerTrays(void)
{
   TrayType *tp;
   for(tp = trays; tp; tp = tp->next) {
      tp->autoHide &= ~THIDE_RAISED;
   }
   RequireRestack();
}
Exemplo n.º 4
0
/** Set the client layer. This will affect transients. */
void SetClientLayer(ClientNode *np, unsigned int layer)
{

   ClientNode *tp, *next;

   Assert(np);
   Assert(layer <= LAST_LAYER);

   if(np->state.layer != layer) {
      int x;

      /* Loop through all clients so we get transients. */
      for(x = FIRST_LAYER; x <= LAST_LAYER; x++) {
         tp = nodes[x];
         while(tp) {
            next = tp->next;
            if(tp == np || tp->owner == np->window) {

               /* Remove from the old node list */
               if(next) {
                  next->prev = tp->prev;
               } else {
                  nodeTail[tp->state.layer] = tp->prev;
               }
               if(tp->prev) {
                  tp->prev->next = next;
               } else {
                  nodes[tp->state.layer] = next;
               }

               /* Insert into the new node list */
               tp->prev = NULL;
               tp->next = nodes[layer];
               if(nodes[layer]) {
                  nodes[layer]->prev = tp;
               } else {
                  nodeTail[layer] = tp;
               }
               nodes[layer] = tp;

               /* Set the new layer */
               tp->state.layer = layer;
               WriteState(tp);

            }
            tp = next;
         }
      }

      RequireRestack();

   }

}
Exemplo n.º 5
0
Arquivo: move.c Projeto: Nehamkin/jwm
/** Switch to the specified desktop. */
void UpdateDesktop(const TimeType *now)
{
   if(settings.desktopDelay == 0) {
      return;
   }
   if(GetTimeDifference(now, &moveTime) < settings.desktopDelay) {
      return;
   }
   moveTime = *now;

   if(atLeft && LeftDesktop()) {
      SetClientDesktop(currentClient, currentDesktop);
      RequireRestack();
   } else if(atRight && RightDesktop()) {
      SetClientDesktop(currentClient, currentDesktop);
      RequireRestack();
   } else if(atTop && AboveDesktop()) {
      SetClientDesktop(currentClient, currentDesktop);
      RequireRestack();
   } else if(atBottom && BelowDesktop()) {
      SetClientDesktop(currentClient, currentDesktop);
      RequireRestack();
   }
}
Exemplo n.º 6
0
/** Handle a map request. */
void HandleMapRequest(const XMapEvent *event)
{
   ClientNode *np;
   Assert(event);
   if(CheckSwallowMap(event->window)) {
      return;
   }
   np = FindClientByWindow(event->window);
   if(!np) {
      GrabServer();
      np = AddClientWindow(event->window, 0, 1);
      if(np) {
         if(!(np->state.status & STAT_NOFOCUS)) {
            FocusClient(np);
         }
      } else {
         JXMapWindow(display, event->window);
      }
      UngrabServer();
   } else {
      if(!(np->state.status & STAT_MAPPED)) {
         UpdateState(np);
         np->state.status |= STAT_MAPPED;
         XMapWindow(display, np->window);
         if(np->parent != None) {
            XMapWindow(display, np->parent);
         }
         if(!(np->state.status & STAT_STICKY)) {
            np->state.desktop = currentDesktop;
         }
         if(!(np->state.status & STAT_NOFOCUS)) {
            FocusClient(np);
            RaiseClient(np);
         }
         WriteState(np);
         RequireTaskUpdate();
         RequirePagerUpdate();
      }
   }
   RequireRestack();
}
Exemplo n.º 7
0
Arquivo: main.c Projeto: kuailexs/jwm
/** Startup the various JWM components.
 * This is called after the X connection is opened.
 */
void Startup(void)
{

   /* This order is important. */

   /* First we grab the server to prevent clients from changing things
    * while we're still loading. */
   GrabServer();

   StartupSettings();
   StartupScreens();

   StartupGroups();
   StartupColors();
   StartupIcons();
   StartupBackgrounds();
   StartupFonts();
   StartupCursors();

   StartupPager();
   StartupClock();
   StartupTaskBar();
   StartupTrayButtons();
   StartupDesktops();
   StartupHints();
   StartupDock();
   StartupTray();
   StartupKeys();
   StartupBorders();
   StartupPlacement();
   StartupClients();

#  ifndef DISABLE_CONFIRM
      StartupDialogs();
#  endif
   StartupPopup();

   StartupRootMenu();

   SetDefaultCursor(rootWindow);
   ReadCurrentDesktop();
   JXFlush(display);

   RequireRestack();

   /* Allow clients to do their thing. */
   JXSync(display, True);
   UngrabServer();

   StartupSwallow();

   DrawTray();

   /* Send expose events. */
   ExposeCurrentDesktop();

   /* Draw the background (if backgrounds are used). */
   LoadBackground(currentDesktop);

   /* Run any startup commands. */
   StartupCommands();

}
Exemplo n.º 8
0
/** Restack a client window. This will not affect transients. */
void RestackClient(ClientNode *np, Window above, int detail)
{

   ClientNode *tp;
   char inserted = 0;

   /* Remove from the window list. */
   if(np->prev) {
      np->prev->next = np->next;
   } else {
      nodes[np->state.layer] = np->next;
   }
   if(np->next) {
      np->next->prev = np->prev;
   } else {
      nodeTail[np->state.layer] = np->prev;
   }

   /* Insert back into the window list. */
   if(above != None && above != np->window) {

      /* Insert relative to some other window. */
      char found = 0;
      for(tp = nodes[np->state.layer]; tp; tp = tp->next) {
         if(tp == np) {
            found = 1;
         } else if(tp->window == above) {
            char insert_before = 0;
            inserted = 1;
            switch(detail) {
            case Above:
            case TopIf:
               insert_before = 1;
               break;
            case Below:
            case BottomIf:
               insert_before = 0;
               break;
            case Opposite:
               insert_before = !found;
               break;
            }
            if(insert_before) {

               /* Insert before this window. */
               np->prev = tp->prev;
               np->next = tp;
               if(tp->prev) {
                  tp->prev->next = np;
               } else {
                  nodes[np->state.layer] = np;
               }
               tp->prev = np;

            } else {

               /* Insert after this window. */
               np->prev = tp;
               np->next = tp->next;
               if(tp->next) {
                  tp->next->prev = np;
               } else {
                  nodeTail[np->state.layer] = np;
               }
               tp->next = np;

            }
            break;
         }
      }
   }
   if(!inserted) {

      /* Insert absolute for the layer. */
      if(detail == Below || detail == BottomIf) {

         /* Insert to the bottom of the stack. */
         np->next = NULL;
         np->prev = nodeTail[np->state.layer];
         if(nodeTail[np->state.layer]) {
            nodeTail[np->state.layer]->next = np;
         } else {
            nodes[np->state.layer] = np;
         }
         nodeTail[np->state.layer] = np;

      } else {

         /* Insert at the top of the stack. */
         np->next = nodes[np->state.layer];
         np->prev = NULL;
         if(nodes[np->state.layer]) {
            nodes[np->state.layer]->prev = np;
         } else {
            nodeTail[np->state.layer] = np;
         }
         nodes[np->state.layer] = np;

      }
   }

   RestackTransients(np);
   RequireRestack();

}
Exemplo n.º 9
0
/** Set a client's full screen state. */
void SetClientFullScreen(ClientNode *np, char fullScreen)
{

   XEvent event;
   int north, south, east, west;
   BoundingBox box;
   const ScreenType *sp;

   Assert(np);

   /* Make sure there's something to do. */
   if(!fullScreen == !(np->state.status & STAT_FULLSCREEN)) {
      return;
   }
   if(!(np->state.border & BORDER_FULLSCREEN)) {
      return;
   }

   if(np->state.status & STAT_SHADED) {
      UnshadeClient(np);
   }

   if(fullScreen) {

      np->state.status |= STAT_FULLSCREEN;

      if(!(np->state.maxFlags)) {
         np->oldx = np->x;
         np->oldy = np->y;
         np->oldWidth = np->width;
         np->oldHeight = np->height;
      }

      sp = GetCurrentScreen(np->x, np->y);
      GetScreenBounds(sp, &box);

      GetBorderSize(&np->state, &north, &south, &east, &west);
      box.x += west;
      box.y += north;
      box.width -= east + west;
      box.height -= north + south;

      np->x = box.x;
      np->y = box.y;
      np->width = box.width;
      np->height = box.height;
      ResetBorder(np);

   } else {

      np->state.status &= ~STAT_FULLSCREEN;

      np->x = np->oldx;
      np->y = np->oldy;
      np->width = np->oldWidth;   
      np->height = np->oldHeight;
      ConstrainSize(np);
      ConstrainPosition(np);

      if(np->state.maxFlags != MAX_NONE) {
         PlaceMaximizedClient(np, np->state.maxFlags);
      }

      ResetBorder(np);

      event.type = MapRequest;
      event.xmaprequest.send_event = True;
      event.xmaprequest.display = display;
      event.xmaprequest.parent = np->parent;
      event.xmaprequest.window = np->window;
      JXSendEvent(display, rootWindow, False,
                  SubstructureRedirectMask, &event);

   }

   WriteState(np);
   SendConfigureEvent(np);
   RequireRestack();

}
Exemplo n.º 10
0
/** Restore a client window and its transients. */
void RestoreClient(ClientNode *np, char raise)
{
   RestoreTransients(np, raise);
   RequireRestack();
   RequireTaskUpdate();
}
Exemplo n.º 11
0
/** Remove a client window from management. */
void RemoveClient(ClientNode *np)
{

   ColormapNode *cp;

   Assert(np);
   Assert(np->window != None);

   /* Remove this client from the client list */
   if(np->next) {
      np->next->prev = np->prev;
   } else {
      nodeTail[np->state.layer] = np->prev;
   }
   if(np->prev) {
      np->prev->next = np->next;
   } else {
      nodes[np->state.layer] = np->next;
   }
   clientCount -= 1;
   XDeleteContext(display, np->window, clientContext);
   if(np->parent != None) {
      XDeleteContext(display, np->parent, frameContext);
   }

   if(np->state.status & STAT_URGENT) {
      UnregisterCallback(SignalUrgent, np);
   }

   /* Make sure this client isn't active */
   if(activeClient == np && !shouldExit) {
      FocusNextStacked(np);
   }
   if(activeClient == np) {

      /* Must be the last client. */
      SetWindowAtom(rootWindow, ATOM_NET_ACTIVE_WINDOW, None);
      activeClient = NULL;
      JXSetInputFocus(display, rootWindow, RevertToParent, eventTime);

   }

   /* If the window manager is exiting (ie, not the client), then
    * reparent etc. */
   if(shouldExit && !(np->state.status & STAT_WMDIALOG)) {
      if(np->state.maxFlags) {
         np->x = np->oldx;
         np->y = np->oldy;
         np->width = np->oldWidth;
         np->height = np->oldHeight;
         JXMoveResizeWindow(display, np->window,
                            np->x, np->y, np->width, np->height);
      }
      GravitateClient(np, 1);
      if(!(np->state.status & STAT_MAPPED)
         && (np->state.status & (STAT_MINIMIZED | STAT_SHADED))) {
         JXMapWindow(display, np->window);
      }
      JXUngrabButton(display, AnyButton, AnyModifier, np->window);
      JXReparentWindow(display, np->window, rootWindow, np->x, np->y);
      JXRemoveFromSaveSet(display, np->window);
   }

   /* Destroy the parent */
   if(np->parent) {
      JXDestroyWindow(display, np->parent);
   }

   if(np->name) {
      Release(np->name);
   }
   if(np->instanceName) {
      JXFree(np->instanceName);
   }
   if(np->className) {
      JXFree(np->className);
   }

   RemoveClientFromTaskBar(np);
   RemoveClientStrut(np);

   while(np->colormaps) {
      cp = np->colormaps->next;
      Release(np->colormaps);
      np->colormaps = cp;
   }

   DestroyIcon(np->icon);

   Release(np);

   RequireRestack();

}