Beispiel #1
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;
	    }
	}
    }
}
Beispiel #2
0
static void
scaleaddonHandleCompizEvent(CompDisplay * d,
			    const char *pluginName,
			    const char *eventName,
			    CompOption * option, int nOption)
{
	ADDON_DISPLAY(d);

	UNWRAP(ad, d, handleCompizEvent);
	(*d->handleCompizEvent) (d, pluginName, eventName, option, nOption);
	WRAP(ad, d, handleCompizEvent, scaleaddonHandleCompizEvent);

	if ((strcmp(pluginName, "scale") == 0) &&
	    (strcmp(eventName, "activate") == 0)) {
		Window xid;
		Bool activated;
		CompScreen *s;

		xid = getIntOptionNamed(option, nOption, "root", 0);
		activated =
		    getBoolOptionNamed(option, nOption, "active", FALSE);
		s = findScreenAtDisplay(d, xid);

		if (s) {
			if (activated) {
				addScreenAction(s, scaleaddonGetCloseKey(d));
				addScreenAction(s, scaleaddonGetZoomKey(d));
				addScreenAction(s, scaleaddonGetPullKey(d));
				addScreenAction(s, scaleaddonGetCloseButton(d));
				addScreenAction(s, scaleaddonGetZoomButton(d));
				addScreenAction(s, scaleaddonGetPullButton(d));

				/* TODO: or better
				   ad->highlightedWindow     = sd->selectedWindow;
				   here? do we want to show up the highlight without
				   mouse move initially? */

				ad->highlightedWindow = None;
				ad->lastHighlightedWindow = None;
				scaleaddonCheckWindowHighlight(s);
			} else {
				CompWindow *w;

				for (w = s->windows; w; w = w->next) {
					ADDON_WINDOW(w);
					aw->rescaled = FALSE;
				}

				removeScreenAction(s, scaleaddonGetCloseKey(d));
				removeScreenAction(s, scaleaddonGetZoomKey(d));
				removeScreenAction(s, scaleaddonGetPullKey(d));
				removeScreenAction(s,
						   scaleaddonGetCloseButton(d));
				removeScreenAction(s,
						   scaleaddonGetZoomButton(d));
				removeScreenAction(s,
						   scaleaddonGetPullButton(d));
			}
		}
	}
}
static void
sessionSessionEvent (CompCore         *c,
		     CompSessionEvent event,
		     CompOption       *arguments,
		     unsigned int     nArguments)
{
    SESSION_CORE (c);

    if (event == CompSessionEventSaveYourself)
    {
	Bool shutdown, fast, saveSession;
	int  saveType, interactStyle;
	char *clientId;

	shutdown = getBoolOptionNamed (arguments, nArguments,
				       "shutdown", FALSE);
	saveType = getIntOptionNamed (arguments, nArguments,
				      "save_type", SmSaveLocal);
	interactStyle = getIntOptionNamed (arguments, nArguments,
					   "interact_style",
					   SmInteractStyleNone);
	fast = getBoolOptionNamed (arguments, nArguments, "fast", FALSE);

	if (saveType == SmSaveGlobal)
	{
	    /* ignore global saves, which are used only to make e.g. word
	       processors show a 'do you want to save' dialog on session
	       shutdown */
	    saveSession = FALSE;
	} else if (!shutdown && !fast && saveType == SmSaveLocal &&
		   interactStyle == SmInteractStyleNone)
	{
	    /* ignore saveYourself after registering for the first time
	       (SM specification 7.2) */
	    saveSession = FALSE;
	}
	else
	{
	    saveSession = TRUE;
	}

	clientId = getSessionClientId (CompSessionClientId);

	if (saveSession && clientId)
	{
	    CompObject *object;

	    object = compObjectFind (&c->base, COMP_OBJECT_TYPE_DISPLAY, NULL);
	    if (object)
	    {
		CompDisplay *d = (CompDisplay *) object;
		saveState (d, clientId);
	    }
	}

	if (clientId)
	    free (clientId);
    }

    UNWRAP (sc, c, sessionEvent);
    (*c->sessionEvent) (c, event, arguments, nArguments);
    WRAP (sc, c, sessionEvent, sessionSessionEvent);
}