Пример #1
0
static void
zoomHandleEvent(CompDisplay *d,
                XEvent *event)
{
   CompScreen *s;

   ZOOM_DISPLAY(d);

   switch (event->type)
     {
      case MotionNotify:
        s = findScreenAtDisplay(d, event->xmotion.root);
        if (s)
          zoomHandleMotionEvent(s, pointerX, pointerY);
        break;

      case EnterNotify:
      case LeaveNotify:
        s = findScreenAtDisplay(d, event->xcrossing.root);
        if (s)
          zoomHandleMotionEvent(s, pointerX, pointerY);

      default:
        break;
     }

   UNWRAP(zd, d, handleEvent);
   (*d->handleEvent)(d, event);
   WRAP(zd, d, handleEvent, zoomHandleEvent);
}
Пример #2
0
static void
shotHandleEvent (XEvent      *event)
{
	CompScreen *s;

	SHOT_DISPLAY (&display);

	switch (event->type) {
	case ButtonPress:
		if (isButtonPressEvent (event, &initiate_button))
		{
			BananaArgument arg;

			arg.name = "root";
			arg.type = BananaInt;
			arg.value.i = event->xbutton.root;

			shotInitiate (&arg, 1);
		}
		break;
	case ButtonRelease:
		if (initiate_button.button == event->xbutton.button)
		{
			BananaArgument arg;

			arg.name = "root";
			arg.type = BananaInt;
			arg.value.i = event->xbutton.root;

			shotTerminate (&arg, 1);
		}
		break;
	case MotionNotify:
		s = findScreenAtDisplay (event->xmotion.root);
		if (s)
			shotHandleMotionEvent (s, pointerX, pointerY);
		break;
	case EnterNotify:
	case LeaveNotify:
		s = findScreenAtDisplay (event->xcrossing.root);
		if (s)
			shotHandleMotionEvent (s, pointerX, pointerY);
	default:
		break;
	}

	UNWRAP (sd, &display, handleEvent);
	(*display.handleEvent) (event);
	WRAP (sd, &display, handleEvent, shotHandleEvent);
}
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;
}
Пример #4
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;
}
Пример #5
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;
}
Пример #6
0
static void
waterHandleMotionEvent (CompDisplay *d,
			Window	    root)
{
    CompScreen *s;

    s = findScreenAtDisplay (d, root);
    if (s)
    {
	WATER_SCREEN (s);

	if (ws->grabIndex)
	{
	    XPoint p[2];

	    p[0].x = waterLastPointerX;
	    p[0].y = waterLastPointerY;

	    p[1].x = waterLastPointerX = pointerX;
	    p[1].y = waterLastPointerY = pointerY;

	    waterVertices (s, GL_LINES, p, 2, 0.2f);

	    damageScreen (s);
	}
    }
}
Пример #7
0
static Bool
runDispatch (BananaArgument     *arg,
             int                nArg)
{
	CompScreen *s;
	Window     xid;

	BananaValue *root = getArgNamed ("root", arg, nArg);

	if (root != NULL)
		xid = root->i;
	else
		xid = 0;

	s   = findScreenAtDisplay (xid);

	if (s)
	{
		BananaValue *command = getArgNamed ("command", arg, nArg);

		if (command != NULL && command->s != NULL)
			runCommand (s, command->s);
	}

	return TRUE;
}
Пример #8
0
static void
scalefilterHandleEvent (CompDisplay *d,
	 		XEvent      *event)
{
    FILTER_DISPLAY (d);

    switch (event->type)
    {
    case KeyPress:
    	{
	    CompScreen *s;
	    s = findScreenAtDisplay (d, event->xkey.root);
	    if (s)
	    {
	        SCALE_SCREEN (s);
		if (ss->grabIndex)
		{
		    XKeyEvent *keyEvent = (XKeyEvent *) event;
		    scalefilterHandleKeyPress (s, keyEvent);
		}
	    }
	}
	break;
    default:
	break;
    }

    UNWRAP (fd, d, handleEvent);
    (*d->handleEvent) (d, event);
    WRAP (fd, d, handleEvent, scalefilterHandleEvent);
}
Пример #9
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
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;
}
Пример #11
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;
}
Пример #12
0
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;
}
Пример #13
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;
}
Пример #14
0
static void
snowHandleEvent (XEvent      *event)
{
	CompScreen *s;

	SNOW_DISPLAY (&display);

	switch (event->type) {

	case KeyPress:
		if (isKeyPressEvent (event, &sd->toggle_key))
		{
			s = findScreenAtDisplay (event->xkey.root);

			if (s)
			{
				SNOW_SCREEN (s);
				ss->active = !ss->active;
				if (!ss->active)
					damageScreen (s);
			}
		}
		break;

	default:
		break;
	}

	UNWRAP (sd, &display, handleEvent);
	(*display.handleEvent) (event);
	WRAP (sd, &display, handleEvent, snowHandleEvent);
}
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;
}
Пример #16
0
static Bool
shotInitiate (BananaArgument     *arg,
              int                nArg)
{
	CompScreen *s;
	Window     xid;

	BananaValue *root = getArgNamed ("root", arg, nArg);

	if (root != NULL)
		xid = root->i;
	else
		xid = 0;

	s = findScreenAtDisplay (xid);
	if (s)
	{
		SHOT_SCREEN (s);

		if (otherScreenGrabExist (s, "screenshot", NULL))
			return FALSE;

		if (!ss->grabIndex)
			ss->grabIndex = pushScreenGrab (s, None, "screenshot");

		/* start selection screenshot rectangle */

		ss->x1 = ss->x2 = pointerX;
		ss->y1 = ss->y2 = pointerY;

		ss->grab = TRUE;
	}

	return TRUE;
}
Пример #17
0
static void cloneHandleEvent(CompDisplay * d, XEvent * event)
{
	CompScreen *s;

	CLONE_DISPLAY(d);

	switch (event->type) {
	case MotionNotify:
		s = findScreenAtDisplay(d, event->xmotion.root);
		if (s)
			cloneHandleMotionEvent(s, pointerX, pointerY);
		break;
	case EnterNotify:
	case LeaveNotify:
		s = findScreenAtDisplay(d, event->xcrossing.root);
		if (s)
			cloneHandleMotionEvent(s, pointerX, pointerY);
	default:
		break;
	}

	UNWRAP(cd, d, handleEvent);
	(*d->handleEvent) (d, event);
	WRAP(cd, d, handleEvent, cloneHandleEvent);

	switch (event->type) {
	case CreateNotify:
		s = findScreenAtDisplay(d, event->xcreatewindow.parent);
		if (s) {
			int i;

			CLONE_SCREEN(s);

			for (i = 0; i < cs->nClone; i++)
				if (event->xcreatewindow.window ==
				    cs->clone[i].input)
					cloneSetStrutsForCloneWindow(s,
								     &cs->
								     clone[i]);
		}
	default:
		break;
	}
}
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;
}
static void
scaleaddonHandleEvent (CompDisplay *d,
                       XEvent      *event)
{
    ADDON_DISPLAY (d);

    UNWRAP (ad, d, handleEvent);
    (*d->handleEvent) (d, event);
    WRAP (ad, d, handleEvent, scaleaddonHandleEvent);

    switch (event->type)
    {
    case PropertyNotify:
    {
        if (event->xproperty.atom == XA_WM_NAME)
        {
            CompWindow *w;

            w = findWindowAtDisplay (d, event->xproperty.window);
            if (w)
            {
                SCALE_SCREEN (w->screen);
                if (ss->grabIndex)
                {
                    scaleaddonRenderWindowTitle (w);
                    addWindowDamage (w);
                }
            }
        }
    }
    break;
    case MotionNotify:
    {
        CompScreen *s;
        s = findScreenAtDisplay (d, event->xmotion.root);

        if (s)
        {
            SCALE_SCREEN (s);
            if (ss->grabIndex)
            {
                SCALE_DISPLAY (d);

                ad->highlightedWindow = sd->hoveredWindow;
                scaleaddonCheckWindowHighlight (s);
            }
        }
    }
    break;
    default:
        break;
    }
}
Пример #20
0
static void
colorFilterHandleEvent (XEvent      *event)
{
	FILTER_DISPLAY (&display);

	switch (event->type) {
	case KeyPress:
		if (isKeyPressEvent (event, &cfd->toggle_window_key))
		{
			CompWindow *w = findWindowAtDisplay (display.activeWindow);

			if (w && w->screen->fragmentProgram)
				colorFilterToggleWindow (w);
		}
		else if (isKeyPressEvent (event, &cfd->toggle_screen_key))
		{
			CompScreen *s = findScreenAtDisplay (event->xkey.root);

			if (s && s->fragmentProgram)
				colorFilterToggleScreen (s);
		}
		else if (isKeyPressEvent (event, &cfd->switch_filter_key))
		{
			CompScreen *s = findScreenAtDisplay (event->xkey.root);

			if (s && s->fragmentProgram)
				colorFilterSwitchFilter (s);
		}
		break;
	default:
		break;
	}

	UNWRAP (cfd, &display, handleEvent);
	(*display.handleEvent) (event);
	WRAP (cfd, &display, handleEvent, colorFilterHandleEvent);
}
Пример #21
0
static void
panelAction (BananaArgument     *arg,
             int                nArg,
             Atom               actionAtom)
{
	Window     xid;
	CompScreen *s;
	XEvent     event;
	Time       time;

	MATE_DISPLAY (&display);

	BananaValue *root = getArgNamed ("root", arg, nArg);

	if (root != NULL)
		xid = root->i;
	else
		xid = 0;

	s   = findScreenAtDisplay (xid);

	if (!s)
		return;

	BananaValue *arg_time = getArgNamed ("time", arg, nArg);

	if (arg_time != NULL)
		time = CurrentTime;
	else
		time = 0;

	/* we need to ungrab the keyboard here, otherwise the panel main
	   menu won't popup as it wants to grab the keyboard itself */
	XUngrabKeyboard (display.display, time);

	event.type                 = ClientMessage;
	event.xclient.window       = s->root;
	event.xclient.message_type = md->panelActionAtom;
	event.xclient.format       = 32;
	event.xclient.data.l[0]    = actionAtom;
	event.xclient.data.l[1]    = time;
	event.xclient.data.l[2]    = 0;
	event.xclient.data.l[3]    = 0;
	event.xclient.data.l[4]    = 0;

	XSendEvent (display.display, s->root, FALSE, StructureNotifyMask,
	            &event);
}
/*
 * 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;
}
Пример #23
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;
}
Пример #24
0
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
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
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;
}
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;
}
Пример #28
0
static void
waterHandleEvent (CompDisplay *d,
		  XEvent      *event)
{
    CompScreen *s;

    WATER_DISPLAY (d);

    switch (event->type) {
    case ButtonPress:
	s = findScreenAtDisplay (d, event->xbutton.root);
	if (s)
	{
	    WATER_SCREEN (s);

	    if (ws->grabIndex)
	    {
		XPoint p;

		p.x = pointerX;
		p.y = pointerY;

		waterVertices (s, GL_POINTS, &p, 1, 0.8f);
		damageScreen (s);
	    }
	}
	break;
    case EnterNotify:
    case LeaveNotify:
	waterHandleMotionEvent (d, event->xcrossing.root);
	break;
    case MotionNotify:
	waterHandleMotionEvent (d, event->xmotion.root);
    default:
	break;
    }

    UNWRAP (wd, d, handleEvent);
    (*d->handleEvent) (d, event);
    WRAP (wd, d, handleEvent, waterHandleEvent);
}
Пример #29
0
static void
wsnamesHandleEvent (XEvent      *event)
{
	WSNAMES_DISPLAY (&display);

	UNWRAP (wd, &display, handleEvent);
	(*display.handleEvent) (event);
	WRAP (wd, &display, handleEvent, wsnamesHandleEvent);

	switch (event->type) {
	case PropertyNotify:
		if (event->xproperty.atom == display.desktopViewportAtom)
		{
			CompScreen *s;
			s = findScreenAtDisplay (event->xproperty.window);
			if (s)
			{
				int timeout;

				WSNAMES_SCREEN (s);

				ws->timer = 0;
				if (ws->timeoutHandle)
					compRemoveTimeout (ws->timeoutHandle);

				const BananaValue *
				option_display_time = bananaGetOption (bananaIndex,
				                                       "display_time",
				                                       s->screenNum);

				wsnamesRenderNameText (s);
				timeout = option_display_time->f * 1000;
				ws->timeoutHandle = compAddTimeout (timeout, timeout + 200,
				                                    wsnamesHideTimeout, s);

				damageScreen (s);
			}
		}
		break;
	}
}
static Bool
tileToggle (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;

	TILE_SCREEN (s);

	for (w = s->windows; w; w = w->next)
	{
	    TILE_WINDOW (w);
	    if (tw->isTiled)
		break;
	}

	if (w)
	{
	    ts->tileType = -1;
	    applyTiling (s);
	}
	else
	{
	    ts->tileType = tileGetTileToggleType (d);
	    applyTiling (s);
	}
    }

    return FALSE;
}