Example #1
0
File: hint.c Project: Miteam/jwm
/** Write the net state hint for a client. */
void WriteNetState(ClientNode *np)
{

   unsigned long values[16];
   int index;

   Assert(np);

   /* We remove the _NET_WM_STATE and _NET_WM_DESKTOP for withdrawn windows. */
   if(!(np->state.status & (STAT_MAPPED | STAT_MINIMIZED | STAT_SHADED))) {
      JXDeleteProperty(display, np->window, atoms[ATOM_NET_WM_STATE]);
      JXDeleteProperty(display, np->window, atoms[ATOM_NET_WM_DESKTOP]);
      return;
   } 

   index = 0;
   if(np->state.status & STAT_MINIMIZED) {
      values[index++] = atoms[ATOM_NET_WM_STATE_HIDDEN];
   }

   if(np->state.maxFlags & MAX_HORIZ) {
      values[index++] = atoms[ATOM_NET_WM_STATE_MAXIMIZED_HORZ];
   }
   if(np->state.maxFlags & MAX_VERT) {
      values[index++] = atoms[ATOM_NET_WM_STATE_MAXIMIZED_VERT];
   }
   if(np->state.maxFlags & MAX_TOP) {
      values[index++] = atoms[ATOM_JWM_WM_STATE_MAXIMIZED_TOP];
   }
   if(np->state.maxFlags & MAX_BOTTOM) {
      values[index++] = atoms[ATOM_JWM_WM_STATE_MAXIMIZED_BOTTOM];
   }
   if(np->state.maxFlags & MAX_LEFT) {
      values[index++] = atoms[ATOM_JWM_WM_STATE_MAXIMIZED_LEFT];
   }
   if(np->state.maxFlags & MAX_RIGHT) {
      values[index++] = atoms[ATOM_JWM_WM_STATE_MAXIMIZED_RIGHT];
   }

   if(np->state.status & STAT_SHADED) {
      values[index++] = atoms[ATOM_NET_WM_STATE_SHADED];
   }

   if(np->state.status & STAT_STICKY) {
      values[index++] = atoms[ATOM_NET_WM_STATE_STICKY];
   }

   if(np->state.status & STAT_FULLSCREEN) {
      values[index++] = atoms[ATOM_NET_WM_STATE_FULLSCREEN];
   }

   if(np->state.status & STAT_NOLIST) {
      values[index++] = atoms[ATOM_NET_WM_STATE_SKIP_TASKBAR];
   }

   if(np->state.status & STAT_NOPAGER) {
      values[index++] = atoms[ATOM_NET_WM_STATE_SKIP_PAGER];
   }

   if(np->state.layer != np->state.defaultLayer) {
      if(np->state.layer == LAYER_BELOW) {
         values[index++] = atoms[ATOM_NET_WM_STATE_BELOW];
      } else if(np->state.layer == LAYER_ABOVE) {
         values[index++] = atoms[ATOM_NET_WM_STATE_ABOVE];
      }
   }

   if(np->state.status & STAT_URGENT) {
      values[index++] = atoms[ATOM_NET_WM_STATE_DEMANDS_ATTENTION];
   }

   JXChangeProperty(display, np->window, atoms[ATOM_NET_WM_STATE],
                    XA_ATOM, 32, PropModeReplace,
                    (unsigned char*)values, index);

   WriteFrameExtents(np->window, &np->state);

}
Example #2
0
/** Handle a _NET_REQUEST_FRAME_EXTENTS request. */
void HandleFrameExtentsRequest(const XClientMessageEvent *event)
{
   ClientState state;
   state = ReadWindowState(event->window, 0);
   WriteFrameExtents(event->window, &state);
}