예제 #1
0
static Bool
cloneTerminate(CompDisplay * d,
	       CompAction * action,
	       CompActionState state, CompOption * option, int nOption)
{
	CompScreen *s;
	Window xid;

	xid = getIntOptionNamed(option, nOption, "root", 0);

	for (s = d->screens; s; s = s->next) {
		CLONE_SCREEN(s);

		if (xid && s->root != xid)
			continue;

		if (cs->grabIndex) {
			int x, y;

			removeScreenGrab(s, cs->grabIndex, NULL);
			cs->grabIndex = 0;

			x = getIntOptionNamed(option, nOption, "x", 0);
			y = getIntOptionNamed(option, nOption, "y", 0);

			cs->dst = outputDeviceForPoint(s, x, y);

			damageScreen(s);
		}
	}

	action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);

	return FALSE;
}
예제 #2
0
static Bool
waterLine(CompDisplay * d,
	  CompAction * action,
	  CompActionState state, CompOption * option, int nOption)
{
	CompScreen *s;
	int xid;

	xid = getIntOptionNamed(option, nOption, "root", 0);

	s = findScreenAtDisplay(d, xid);
	if (s) {
		XPoint p[2];
		float amp;

		p[0].x = getIntOptionNamed(option, nOption, "x0", s->width / 4);
		p[0].y =
		    getIntOptionNamed(option, nOption, "y0", s->height / 2);

		p[1].x = getIntOptionNamed(option, nOption, "x1",
					   s->width - s->width / 4);
		p[1].y =
		    getIntOptionNamed(option, nOption, "y1", s->height / 2);

		amp = getFloatOptionNamed(option, nOption, "amplitude", 0.25f);

		waterVertices(s, GL_LINES, p, 2, amp);

		damageScreen(s);
	}

	return FALSE;
}
예제 #3
0
static Bool
waterPoint(CompDisplay * d,
	   CompAction * action,
	   CompActionState state, CompOption * option, int nOption)
{
	CompScreen *s;
	int xid;

	xid = getIntOptionNamed(option, nOption, "root", 0);

	s = findScreenAtDisplay(d, xid);
	if (s) {
		XPoint p;
		float amp;

		p.x = getIntOptionNamed(option, nOption, "x", s->width / 2);
		p.y = getIntOptionNamed(option, nOption, "y", s->height / 2);

		amp = getFloatOptionNamed(option, nOption, "amplitude", 0.5f);

		waterVertices(s, GL_POINTS, &p, 1, amp);

		damageScreen(s);
	}

	return FALSE;
}
static Bool
ringDoSwitch (CompDisplay     *d,
	      CompAction      *action,
	      CompActionState state,
	      CompOption      *option,
	      int             nOption,
	      Bool            nextWindow,
	      RingType        type)
{
    CompScreen *s;
    Window     xid;
    Bool       ret = TRUE;

    xid = getIntOptionNamed (option, nOption, "root", 0);

    s = findScreenAtDisplay (d, xid);
    if (s)
    {
	RING_SCREEN (s);

	if ((rs->state == RingStateNone) || (rs->state == RingStateIn))
	{
	    if (type == RingTypeGroup)
	    {
    		CompWindow *w;
    		w = findWindowAtDisplay (d, getIntOptionNamed (option, nOption,
    							       "window", 0));
    		if (w)
    		{
    		    rs->type = RingTypeGroup;
    		    rs->clientLeader = 
			(w->clientLeader) ? w->clientLeader : w->id;
		    ret = ringInitiate (s, action, state, option, nOption);
		}
	    }
	    else
	    {
		rs->type = type;
		ret = ringInitiate (s, action, state, option, nOption);
	    }

	    if (state & CompActionStateInitKey)
		action->state |= CompActionStateTermKey;

	    if (state & CompActionStateInitEdge)
		action->state |= CompActionStateTermEdge;
	    else if (state & CompActionStateInitButton)
		action->state |= CompActionStateTermButton;
	}

	if (ret)
    	    switchToWindow (s, nextWindow);
    }

    return ret;
}
예제 #5
0
파일: scalefilter.c 프로젝트: Elive/ecomp
static Bool
scalefilterInitDisplay (CompPlugin  *p,
	    		CompDisplay *d)
{
    ScaleFilterDisplay *fd;
    CompPlugin         *scale = findActivePlugin ("scale");
    CompOption         *option;
    int                nOption;

    if (!scale || !scale->vTable->getDisplayOptions)
	return FALSE;

    option = (*scale->vTable->getDisplayOptions) (scale, d, &nOption);

    if (getIntOptionNamed (option, nOption, "abi", 0) != SCALE_ABIVERSION)
    {
	compLogMessage (d, "scalefilter", CompLogLevelError,
			"scale ABI version mismatch");
	return FALSE;
    }

    scaleDisplayPrivateIndex = getIntOptionNamed (option, nOption, "index", -1);
    if (scaleDisplayPrivateIndex < 0)
	return FALSE;

    fd = malloc (sizeof (ScaleFilterDisplay));
    if (!fd)
	return FALSE;

    fd->screenPrivateIndex = allocateScreenPrivateIndex (d);
    if (fd->screenPrivateIndex < 0)
    {
	free (fd);
	return FALSE;
    }

    fd->xim = XOpenIM (d->display, NULL, NULL, NULL);
    if (fd->xim)
	fd->xic = XCreateIC (fd->xim,
			     XNClientWindow, d->screens->root,
			     XNInputStyle,
			     XIMPreeditNothing  | XIMStatusNothing,
			     NULL);
    else
	fd->xic = NULL;

    if (fd->xic)
	setlocale (LC_CTYPE, "");

    WRAP (fd, d, handleEvent, scalefilterHandleEvent);
    WRAP (fd, d, handleEcompEvent, scalefilterHandleEcompEvent);

    d->privates[displayPrivateIndex].ptr = fd;

    return TRUE;
}
static Bool
magTerminate (CompDisplay     *d,
	      CompAction      *action,
	      CompActionState state,
	      CompOption      *option,
	      int             nOption)
{
    CompScreen *s;
    Window     xid;

    xid = getIntOptionNamed (option, nOption, "root", 0);

    s = findScreenAtDisplay (d, xid);
    if (s)
    {
	MAG_SCREEN (s);

	ms->zTarget = 1.0;
	ms->adjust  = TRUE;
	damageScreen (s);

	return TRUE;
    }
    return FALSE;
}
static Bool
magZoomOut (CompDisplay     *d,
	    CompAction      *action,
	    CompActionState state,
	    CompOption      *option,
	    int             nOption)
{
    CompScreen *s;
    Window     xid;

    xid = getIntOptionNamed (option, nOption, "root", 0);

    s = findScreenAtDisplay (d, xid);
    if (s)
    {
	MAG_SCREEN (s);

	if (ms->mode == ModeFisheye)
	    ms->zTarget = MAX (1.0, ms->zTarget - 1.0);
	else
	    ms->zTarget = MAX (1.0, ms->zTarget / 1.2);
	ms->adjust  = TRUE;
	damageScreen (s);

	return TRUE;
    }
    return FALSE;
}
예제 #8
0
static Bool
waterToggleWiper (CompDisplay     *d,
		  CompAction      *action,
		  CompActionState state,
		  CompOption      *option,
		  int	          nOption)
{
    CompScreen *s;

    s = findScreenAtDisplay (d, getIntOptionNamed (option, nOption, "root", 0));
    if (s)
    {
	WATER_SCREEN (s);

	if (!ws->wiperHandle)
	{
	    ws->wiperHandle = compAddTimeout (2000, 2400, waterWiperTimeout, s);
	}
	else
	{
	    compRemoveTimeout (ws->wiperHandle);
	    ws->wiperHandle = 0;
	}
    }

    return FALSE;
}
예제 #9
0
static Bool
scaleaddonCloseWindow(CompDisplay * d,
		      CompAction * action,
		      CompActionState state, CompOption * option, int nOption)
{
	CompScreen *s;
	Window xid;

	xid = getIntOptionNamed(option, nOption, "root", 0);

	s = findScreenAtDisplay(d, xid);
	if (s) {
		CompWindow *w;

		SCALE_SCREEN(s);
		ADDON_DISPLAY(d);

		if (!ss->grabIndex)
			return FALSE;

		w = findWindowAtDisplay(d, ad->highlightedWindow);
		if (w) {
			closeWindow(w, getCurrentTimeFromDisplay(d));
			return TRUE;
		}
	}

	return FALSE;
}
예제 #10
0
static Bool
waterToggleRain(CompDisplay * d,
		CompAction * action,
		CompActionState state, CompOption * option, int nOption)
{
	CompScreen *s;

	WATER_DISPLAY(d);

	s = findScreenAtDisplay(d,
				getIntOptionNamed(option, nOption, "root", 0));
	if (s) {
		WATER_SCREEN(s);

		if (!ws->rainHandle) {
			int delay;

			delay =
			    wd->opt[WATER_DISPLAY_OPTION_RAIN_DELAY].value.i;
			ws->rainHandle =
			    compAddTimeout(delay, (float)delay * 1.2,
					   waterRainTimeout, s);
		} else {
			compRemoveTimeout(ws->rainHandle);
			ws->rainHandle = 0;
		}
	}

	return FALSE;
}
static Bool
ringTerminate (CompDisplay     *d,
	       CompAction      *action,
	       CompActionState state,
	       CompOption      *option,
	       int	        nOption)
{
    CompScreen *s;
    Window     xid;

    xid = getIntOptionNamed (option, nOption, "root", 0);

    for (s = d->screens; s; s = s->next)
    {
	RING_SCREEN (s);

	if (xid && s->root != xid)
	    continue;

	if (rs->grabIndex)
    	{
    	    removeScreenGrab (s, rs->grabIndex, 0);
    	    rs->grabIndex = 0;
	}

	if (rs->state != RingStateNone)
    	{
    	    CompWindow *w;

    	    for (w = s->windows; w; w = w->next)
    	    {
    		RING_WINDOW (w);
    
		if (rw->slot)
		{
		    free (rw->slot);
		    rw->slot = NULL;

    		    rw->adjust = TRUE;
		}
	    }
	    rs->moreAdjust = TRUE;
    	    rs->state = RingStateIn;
    	    damageScreen (s);

	    if (!(state & CompActionStateCancel) &&
		rs->selectedWindow && !rs->selectedWindow->destroyed)
	    {
		sendWindowActivationRequest (s, rs->selectedWindow->id);
	    }
	}
    }

    if (action)
	action->state &= ~(CompActionStateTermKey |
			   CompActionStateTermButton |
			   CompActionStateTermEdge);

    return FALSE;
}
예제 #12
0
파일: zoom.c 프로젝트: zmike/compiz
static Bool
zoomTerminatePan(CompDisplay *d,
                 CompAction *action,
                 CompActionState state,
                 CompOption *option,
                 int nOption)
{
   CompScreen *s;
   Window xid;

   xid = getIntOptionNamed(option, nOption, "root", 0);

   for (s = d->screens; s; s = s->next)
     {
        ZOOM_SCREEN(s);

        if (xid && s->root != xid)
          continue;

        if (zs->panGrabIndex)
          {
             removeScreenGrab(s, zs->panGrabIndex, NULL);
             zs->panGrabIndex = 0;

             zoomInEvent(s);
          }

        return TRUE;
     }

   action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);

   return FALSE;
}
예제 #13
0
/*
 * Initially triggered keybinding.
 * Fetch the window, fetch the resize, constrain it.
 *
 */
static Bool
smartputTrigger (CompDisplay     *d,
		 CompAction      *action,
		 CompActionState state,
		 CompOption      *option,
		 int             nOption)
{
    Window     xid;
    CompWindow *w;

    xid = getIntOptionNamed (option, nOption, "window", 0);
    if(!xid)
	xid = d->activeWindow;

    w   = findWindowAtDisplay (d, xid);

    if (w)
    {
	if (w->invisible || w->hidden || w->minimized)
	    return FALSE;

	if (w->wmType & CompWindowTypeDesktopMask)
	    return FALSE;

	if (w->wmType & CompWindowTypeDockMask)
	    return FALSE;
	return smartputInitiate (w, action, state,
				 option, nOption,FALSE);

    }
    return FALSE;
}
예제 #14
0
static Bool
waterTitleWave(CompDisplay * d,
	       CompAction * action,
	       CompActionState state, CompOption * option, int nOption)
{
	CompWindow *w;
	int xid;

	xid = getIntOptionNamed(option, nOption, "window", d->activeWindow);

	w = findWindowAtDisplay(d, xid);
	if (w) {
		XPoint p[2];

		p[0].x = w->attrib.x - w->input.left;
		p[0].y = w->attrib.y - w->input.top / 2;

		p[1].x = w->attrib.x + w->width + w->input.right;
		p[1].y = p[0].y;

		waterVertices(w->screen, GL_LINES, p, 2, 0.15f);

		damageScreen(w->screen);
	}

	return FALSE;
}
/*
 * Initially triggered keybinding.
 * Fetch the every window and toggles its decoration.
 */
static Bool
toggledecoAllTrigger(CompDisplay     *d,
		     CompAction      *action,
		     CompActionState state,
		     CompOption      *option,
		     int             nOption)
{
    Window     xid;
    CompWindow *w;

    xid = getIntOptionNamed (option, nOption, "window", 0);
    w   = findWindowAtDisplay (d, xid);
    if (w)
    {
	CompScreen *s = w->screen;
	CompWindow *window;
	for (window = s->windows; window; window = window->next)
	{
	    if(!toggledecoSameViewport (window,w)) continue;
	       window->mwmDecor = window->mwmDecor ^ MwmDecorAll;
	       (*window->screen->windowStateChangeNotify) (window, window->state);
	}
    }

    return TRUE;
}
예제 #16
0
파일: zoom.c 프로젝트: zmike/compiz
static Bool
zoomIn(CompDisplay *d,
       CompAction *action,
       CompActionState state,
       CompOption *option,
       int nOption)
{
   CompScreen *s;
   Window xid;

   xid = getIntOptionNamed(option, nOption, "root", 0);

   s = findScreenAtDisplay(d, xid);
   if (s)
     {
        float w, h, x0, y0;
        int output;
        ZoomBox box;

        ZOOM_SCREEN(s);

        output = outputDeviceForPoint(s, pointerX, pointerY);

        if (!zs->grabIndex)
          zs->grabIndex = pushScreenGrab(s, None, "zoom");

        if (zs->zoomed & (1 << output))
          {
             zoomGetCurrentZoom(s, output, &box);
          }
        else
          {
             box.x1 = s->outputDev[output].region.extents.x1;
             box.y1 = s->outputDev[output].region.extents.y1;
             box.x2 = s->outputDev[output].region.extents.x2;
             box.y2 = s->outputDev[output].region.extents.y2;
          }

        w = (box.x2 - box.x1) /
          zs->opt[ZOOM_SCREEN_OPTION_ZOOM_FACTOR].value.f;
        h = (box.y2 - box.y1) /
          zs->opt[ZOOM_SCREEN_OPTION_ZOOM_FACTOR].value.f;

        x0 = (pointerX - s->outputDev[output].region.extents.x1) / (float)
          s->outputDev[output].width;
        y0 = (pointerY - s->outputDev[output].region.extents.y1) / (float)
          s->outputDev[output].height;

        zs->x1 = box.x1 + (x0 * (box.x2 - box.x1) - x0 * w + 0.5f);
        zs->y1 = box.y1 + (y0 * (box.y2 - box.y1) - y0 * h + 0.5f);
        zs->x2 = zs->x1 + w;
        zs->y2 = zs->y1 + h;

        zoomInitiateForSelection(s, output);

        return TRUE;
     }

   return FALSE;
}
static Bool
wizardInitiate (CompDisplay     *d,
		CompAction      *action,
		CompActionState state,
		CompOption      *option,
		int             nOption)
{
    CompScreen *s;
    Window     xid;

    xid    = getIntOptionNamed (option, nOption, "root", 0);

    s = findScreenAtDisplay (d, xid);
    if (s)
    {
	WIZARD_SCREEN (s);

	if (ws->active)
	    return wizardTerminate (d, action, state, option, nOption);

	ws->active = TRUE;

	return TRUE;
    }
    return FALSE;
}
예제 #18
0
static Bool
cloneInitiate(CompDisplay * d,
	      CompAction * action,
	      CompActionState state, CompOption * option, int nOption)
{
	CompScreen *s;
	Window xid;

	xid = getIntOptionNamed(option, nOption, "root", 0);

	s = findScreenAtDisplay(d, xid);
	if (s) {
		int i;

		CLONE_SCREEN(s);

		if (cs->grab || otherScreenGrabExist(s, "clone", NULL))
			return FALSE;

		if (!cs->grabIndex)
			cs->grabIndex = pushScreenGrab(s, None, "clone");

		cs->grab = TRUE;

		cs->x = getIntOptionNamed(option, nOption, "x", 0);
		cs->y = getIntOptionNamed(option, nOption, "y", 0);

		cs->src = cs->grabbedOutput =
		    outputDeviceForPoint(s, cs->x, cs->y);

		/* trace source */
		i = 0;
		while (i < cs->nClone) {
			if (cs->clone[i].dst == cs->src) {
				cs->src = cs->clone[i].src;
				i = 0;
			} else {
				i++;
			}
		}

		if (state & CompActionStateInitButton)
			action->state |= CompActionStateTermButton;
	}

	return FALSE;
}
예제 #19
0
파일: move.c 프로젝트: JeffHoogland/ecomp
static Bool
moveInitiate(CompDisplay    *d,
             CompAction     *action,
             CompActionState state,
             CompOption     *option,
             int             nOption)
{
   CompWindow *w;
   Window xid;
   int i, x, y;
   unsigned int ui;
   unsigned int mods = 0;

   MOVE_DISPLAY (d);
   xid = getIntOptionNamed (option, nOption, "window", 0);

   w = findWindowAtDisplay (d, xid);
   if (!w) return FALSE;

   if (otherScreenGrabExist (w->screen, "move", 0))
     return FALSE;

   MOVE_SCREEN (w->screen);

   XQueryPointer (d->display, w->screen->root,
                  &xid, &xid, &x, &y, &i, &i, &ui);

   if (md->w)
     return FALSE;

   lastPointerX = x;
   lastPointerY = y;

   ms->origState = w->state;

   if (!ms->grabIndex)
     ms->grabIndex = pushScreenGrab (w->screen, 0, "move");

   if (ms->grabIndex)
     {
        md->w = w;

        (w->screen->windowGrabNotify)(w, x, y, mods,
                                      CompWindowGrabMoveMask |
                                      CompWindowGrabButtonMask);

        if (md->moveOpacity != OPAQUE)
          addWindowDamage (w);
     }

   return FALSE;
}
예제 #20
0
파일: zoom.c 프로젝트: zmike/compiz
static Bool
zoomTerminate(CompDisplay *d,
              CompAction *action,
              CompActionState state,
              CompOption *option,
              int nOption)
{
   CompScreen *s;
   Window xid;

   xid = getIntOptionNamed(option, nOption, "root", 0);

   for (s = d->screens; s; s = s->next)
     {
        ZOOM_SCREEN(s);

        if (xid && s->root != xid)
          continue;

        if (zs->grab)
          {
             int output;

             output = outputDeviceForPoint(s, zs->x1, zs->y1);

             if (zs->x2 > s->outputDev[output].region.extents.x2)
               zs->x2 = s->outputDev[output].region.extents.x2;

             if (zs->y2 > s->outputDev[output].region.extents.y2)
               zs->y2 = s->outputDev[output].region.extents.y2;

             zoomInitiateForSelection(s, output);

             zs->grab = FALSE;
          }
        else
          {
             CompOption o;

             o.type = CompOptionTypeInt;
             o.name = "root";
             o.value.i = s->root;

             zoomOut(d, action, state, &o, 1);
          }
     }

   action->state &= ~(CompActionStateTermKey | CompActionStateTermButton);

   return FALSE;
}
/*
 * Filter switching action
 */
static Bool
colorFilterSwitch (CompDisplay * d, CompAction * action,
		   CompActionState state, CompOption * option, int nOption)
{
    CompScreen *s;
    Window xid;

    xid = getIntOptionNamed (option, nOption, "root", 0);

    s = findScreenAtDisplay(d, xid);

    if (s && s->fragmentProgram)
	colorFilterSwitchFilter (s);

    return TRUE;
}
예제 #22
0
int
getPluginABI (const char *name)
{
    CompPlugin *p = findActivePlugin (name);
    CompOption	*option;
    int		nOption;

    if (!p || !p->vTable->getObjectOptions)
	return 0;

    /* MULTIDPYERROR: ABI options should be moved into core */
    option = (*p->vTable->getObjectOptions) (p, &core.displays->base,
					     &nOption);

    return getIntOptionNamed (option, nOption, "abi", 0);
}
/*
 * Window filtering toggle action
 */
static Bool
colorFilterToggle (CompDisplay * d, CompAction * action,
		   CompActionState state, CompOption * option, int nOption)
{
    CompWindow *w;
    Window xid;

    xid = getIntOptionNamed (option, nOption, "window", 0);

    w = findWindowAtDisplay (d, xid);

    if (w && w->screen->fragmentProgram)
	colorFilterToggleWindow (w);

    return TRUE;
}
예제 #24
0
파일: scalefilter.c 프로젝트: Elive/ecomp
static void
scalefilterHandleEcompEvent (CompDisplay *d,
	 		      char        *pluginName,
	 		      char        *eventName,
	 		      CompOption  *option,
	 		      int         nOption)
{
    FILTER_DISPLAY (d);

    UNWRAP (fd, d, handleEcompEvent);
    (*d->handleEcompEvent) (d, pluginName, eventName, option, nOption);
    WRAP (fd, d, handleEcompEvent, scalefilterHandleEcompEvent);

    if ((strcmp (pluginName, "scale") == 0) &&
	(strcmp (eventName, "activate") == 0))
    {
	Window xid = getIntOptionNamed (option, nOption, "root", 0);
	Bool activated = getBoolOptionNamed (option, nOption, "active", FALSE);
	CompScreen *s = findScreenAtDisplay (d, xid);

	if (s)
	{
	    FILTER_SCREEN (s);
	    SCALE_SCREEN (s);

	    if (activated)
	    {
		matchFini (&fs->scaleMatch);
		matchInit (&fs->scaleMatch);
		matchCopy (&fs->scaleMatch, ss->currentMatch);
		matchUpdate (d, &fs->scaleMatch);
		fs->matchApplied = FALSE;
	    }

	    if (!activated)
	    {
		if (fs->filterInfo)
		{
		    ss->currentMatch = fs->filterInfo->origMatch;
		    scalefilterFiniFilterInfo (s, TRUE);
		}
		fs->matchApplied = FALSE;
	    }
	}
    }
}
예제 #25
0
파일: zoom.c 프로젝트: zmike/compiz
static Bool
zoomOut(CompDisplay *d,
        CompAction *action,
        CompActionState state,
        CompOption *option,
        int nOption)
{
   CompScreen *s;
   Window xid;

   xid = getIntOptionNamed(option, nOption, "root", 0);

   s = findScreenAtDisplay(d, xid);
   if (s)
     {
        int output;

        ZOOM_SCREEN(s);

        output = outputDeviceForPoint(s, pointerX, pointerY);

        zoomGetCurrentZoom(s, output, &zs->last[output]);

        zs->current[output].x1 = s->outputDev[output].region.extents.x1;
        zs->current[output].y1 = s->outputDev[output].region.extents.y1;
        zs->current[output].x2 = s->outputDev[output].region.extents.x2;
        zs->current[output].y2 = s->outputDev[output].region.extents.y2;

        zs->zoomOutput = output;
        zs->scale = 0.0f;
        zs->adjust = TRUE;
        zs->grab = FALSE;

        if (zs->grabIndex)
          {
             removeScreenGrab(s, zs->grabIndex, NULL);
             zs->grabIndex = 0;
          }

        damageScreen(s);

        return TRUE;
     }

   return FALSE;
}
static Bool
negToggle (CompDisplay     *d,
	   CompAction      *action,
	   CompActionState state,
 	   CompOption      *option,
	   int             nOption)
{
    CompWindow *w;
    Window     xid;

    xid = getIntOptionNamed (option, nOption, "window", 0);
    w = findWindowAtDisplay (d, xid);

    if (w)
	NEGToggle (w);

    return TRUE;
}
static Bool
negToggleAll (CompDisplay     *d,
	      CompAction      *action,
	      CompActionState state,
	      CompOption      *option,
	      int             nOption)
{
    CompScreen *s;
    Window     xid;

    xid = getIntOptionNamed (option, nOption, "root", 0);
    s = findScreenAtDisplay (d, xid);

    if (s)
	NEGToggleScreen (s);

    return TRUE;
}
예제 #28
0
static Bool
gridCommon (CompDisplay	    *d,
            CompAction	    *action,
            CompActionState state,
            CompOption	    *option,
            int		    nOption,
            GridType	    where)
{
    Window     xid;
    CompWindow *cw;

    xid = getIntOptionNamed (option, nOption, "window", 0);
    cw  = findWindowAtDisplay (d, xid);

    gridCommonWindow(cw, where);

    return TRUE;
}
static Bool
magInitiate (CompDisplay     *d,
	     CompAction      *action,
	     CompActionState state,
	     CompOption      *option,
	     int             nOption)
{
    CompScreen *s;
    Window     xid;
    float      factor;

    xid    = getIntOptionNamed (option, nOption, "root", 0);
    factor = getFloatOptionNamed (option, nOption, "factor", 0.0);

    s = findScreenAtDisplay (d, xid);
    if (s)
    {
	MAG_SCREEN (s);

	if (factor == 0.0 && ms->zTarget != 1.0)
	    return magTerminate (d, action, state, option, nOption);

	if (ms->mode == ModeFisheye)
	{
	    if (factor != 1.0)
		factor = magGetZoomFactor (s) * 3;

	    ms->zTarget = MAX (1.0, MIN (10.0, factor));
	}
	else
	{
	    if (factor != 1.0)
		factor = magGetZoomFactor (s);

	    ms->zTarget = MAX (1.0, MIN (64.0, factor));
	}
	ms->adjust  = TRUE;
	damageScreen (s);

	return TRUE;
    }
    return FALSE;
}
/*
 * Initially triggered keybinding.
 * Fetch the window and toggles its decoration.
 */
static Bool
toggledecoTrigger(CompDisplay     *d,
		  CompAction      *action,
		  CompActionState state,
		  CompOption      *option,
		  int             nOption)
{
    Window     xid;
    CompWindow *w;

    xid = getIntOptionNamed (option, nOption, "window", 0);
    w   = findWindowAtDisplay (d, xid);
    if (w)
    {
	w->mwmDecor = w->mwmDecor ^ MwmDecorAll;
	(*w->screen->windowStateChangeNotify) (w, w->state);
    }

    return TRUE;
}