示例#1
0
static Bool
colorFilterInitScreen (CompPlugin *p,
                       CompScreen *s)
{
	ColorFilterScreen *cfs;

	FILTER_DISPLAY (&display);

	if (!s->fragmentProgram)
	{
		compLogMessage ("colorfilter", CompLogLevelFatal,
		                "Fragment program support missing.");
		return TRUE;
	}

	cfs = malloc (sizeof (ColorFilterScreen));
	if (!cfs)
		return FALSE;

	cfs->windowPrivateIndex = allocateWindowPrivateIndex (s);
	if (cfs->windowPrivateIndex < 0)
	{
		free (cfs);
		return FALSE;
	}

	cfs->isFiltered = FALSE;
	cfs->currentFilter = 0;

	cfs->filtersLoaded = FALSE;
	cfs->filtersFunctions = NULL;
	cfs->filtersCount = 0;	

	WRAP (cfs, s, drawWindowTexture, colorFilterDrawWindowTexture);
	WRAP (cfs, s, windowAddNotify, colorFilterWindowAddNotify);

	s->privates[cfd->screenPrivateIndex].ptr = cfs;

	const BananaValue *
	option_filter_match = bananaGetOption (bananaIndex,
	                                       "filter_match",
	                                       s->screenNum);

	matchInit (&cfs->filter_match);
	matchAddFromString (&cfs->filter_match, option_filter_match->s);
	matchUpdate (&cfs->filter_match);

	const BananaValue *
	option_exclude_match = bananaGetOption (bananaIndex,
	                                        "exclude_match",
	                                        s->screenNum);

	matchInit (&cfs->exclude_match);
	matchAddFromString (&cfs->exclude_match, option_exclude_match->s);
	matchUpdate (&cfs->exclude_match);

	return TRUE;
}
示例#2
0
文件: opacify.c 项目: jordigh/fusilli
static void
opacifyChangeNotify (const char        *optionName,
                     BananaType        optionType,
                     const BananaValue *optionValue,
                     int               screenNum)
{
	OPACIFY_DISPLAY (&display);

	if (strcasecmp (optionName, "toggle_key") == 0)
		updateKey (optionValue->s, &od->toggle_key);

	else if (strcasecmp (optionName, "init_toggle") == 0)
		od->toggle = optionValue->b;

	else if (strcasecmp (optionName, "window_match") == 0)
	{
		CompScreen *s = getScreenFromScreenNum (screenNum);
		OPACIFY_SCREEN (s);

		matchFini (&os->window_match);
		matchInit (&os->window_match);
		matchAddFromString (&os->window_match, optionValue->s);
		matchUpdate (&os->window_match);
	}
}
示例#3
0
void Desktopwidget::findClicked (void)
   {
   if (_global->isChecked ())
      matchUpdate (_match->text (), _global->isChecked ());
   else
      emit tr ("To filter, just type into the filter field. To search all subdirectories, select global, enter filter and click this 'find' button");
   }
示例#4
0
文件: scalefilter.c 项目: Elive/ecomp
static void
scalefilterUpdateFilter (CompScreen *s,
	   		 CompMatch  *match)
{
    char         filterMatch[2 * MAX_FILTER_TEXT_LEN];
    unsigned int offset;

    FILTER_SCREEN (s);

    matchFini (match);
    matchInit (match);

    if (scalefilterGetFilterCaseInsensitive (s))
    {
	strncpy (filterMatch, "ititle=", MAX_FILTER_TEXT_LEN);
	offset = 7;
    }
    else
    {
    	strncpy (filterMatch, "title=", MAX_FILTER_TEXT_LEN);
	offset = 6;
    }

    wcstombs (filterMatch + offset, fs->filterInfo->filterString,
	      MAX_FILTER_STRING_LEN);
    matchAddExp (match, 0, filterMatch);
    matchAddGroup (match, MATCH_OP_AND_MASK, &fs->scaleMatch);
    matchUpdate (s->display, match);
}
示例#5
0
void Desktopwidget::resetFilter (void)
   {
   qDebug () << "resetFilter";
   _match->setText ("");
   _global->setChecked (false);
   matchUpdate ("", false, true);
   }
示例#6
0
static void
minChangeNotify (const char        *optionName,
                 BananaType        optionType,
                 const BananaValue *optionValue,
                 int               screenNum)
{
	CompScreen *screen = getScreenFromScreenNum (screenNum);

	MIN_SCREEN (screen);

	if (strcasecmp (optionName, "shade_resistance") == 0)
	{
		if (optionValue->i)
			ms->shadeStep = 100 - optionValue->i + 1;
		else
			ms->shadeStep = 0;
	}
	else if (strcasecmp (optionName, "window_match") == 0)
	{
		matchFini (&ms->match);
		matchInit (&ms->match);
		matchAddFromString (&ms->match, optionValue->s);
		matchUpdate (&ms->match);
	}
}
示例#7
0
文件: fade.c 项目: zmike/compiz
static void
fadeUpdateWindowFadeMatch(CompDisplay *display,
                          CompOptionValue *value,
                          CompMatch *match)
{
   matchFini(match);
   matchInit(match);
   matchAddFromString(match, "!type=desktop");
   matchAddGroup(match, MATCH_OP_AND_MASK, &value->match);
   matchUpdate(display, match);
}
示例#8
0
文件: fade.c 项目: zmike/compiz
static void
fadeMatchExpHandlerChanged(CompDisplay *d)
{
   CompScreen *s;

   FADE_DISPLAY(d);

   for (s = d->screens; s; s = s->next)
     matchUpdate(d, &GET_FADE_SCREEN(s, fd)->match);

   UNWRAP(fd, d, matchExpHandlerChanged);
   (*d->matchExpHandlerChanged)(d);
   WRAP(fd, d, matchExpHandlerChanged, fadeMatchExpHandlerChanged);
}
示例#9
0
static Bool
minInitScreen (CompPlugin *p,
               CompScreen *s)
{
	MinScreen *ms;

	MIN_DISPLAY (&display);

	ms = malloc (sizeof (MinScreen));
	if (!ms)
		return FALSE;

	ms->windowPrivateIndex = allocateWindowPrivateIndex (s);
	if (ms->windowPrivateIndex < 0)
	{
		free (ms);
		return FALSE;
	}

	ms->moreAdjust = FALSE;

	const BananaValue *
	option_shade_resistance = bananaGetOption (bananaIndex,
	                                           "shade_resistance",
	                                           s->screenNum);

	ms->shadeStep  = 100 - option_shade_resistance->i + 1;

	const BananaValue *
	option_window_match = bananaGetOption (bananaIndex,
	                                       "window_match",
	                                       s->screenNum);

	matchInit (&ms->match);
	matchAddFromString (&ms->match, option_window_match->s);
	matchUpdate (&ms->match);

	WRAP (ms, s, preparePaintScreen, minPreparePaintScreen);
	WRAP (ms, s, donePaintScreen, minDonePaintScreen);
	WRAP (ms, s, paintOutput, minPaintOutput);
	WRAP (ms, s, paintWindow, minPaintWindow);
	WRAP (ms, s, damageWindowRect, minDamageWindowRect);
	WRAP (ms, s, focusWindow, minFocusWindow);

	s->privates[md->screenPrivateIndex].ptr = ms;

	return TRUE;
}
示例#10
0
void Desktopwidget::slotUpdateDone ()
   {
   QString str;

   emit updateDone ();

//   printf ("update done\n");
   // start a pending search if there is one
   _updating = false;
   if (_pendingMatch.length ())
      {
      str = _pendingMatch;
      _pendingMatch = QString::null;
      matchUpdate (str, false);
      }
   }
示例#11
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;
	    }
	}
    }
}
示例#12
0
文件: opacify.c 项目: jordigh/fusilli
static Bool
opacifyInitScreen (CompPlugin *p,
                   CompScreen *s)
{
	OpacifyScreen *os;

	OPACIFY_DISPLAY (&display);

	os = malloc (sizeof (OpacifyScreen));
	if (!os)
		return FALSE;

	os->windowPrivateIndex = allocateWindowPrivateIndex (s);
	if (os->windowPrivateIndex < 0)
	{
		free (os);
		return FALSE;
	}

	WRAP (os, s, paintWindow, opacifyPaintWindow);

	const BananaValue *
	option_window_match = bananaGetOption (bananaIndex,
	                                       "window_match",
	                                       s->screenNum);

	matchInit (&os->window_match);
	matchAddFromString (&os->window_match, option_window_match->s);
	matchUpdate (&os->window_match);

	s->privates[od->screenPrivateIndex].ptr = os;

	os->intersect = XCreateRegion ();

	os->justMoved = FALSE;

	os->passiveNum = 0;

	os->active = 0;

	return TRUE;
}
示例#13
0
Bool compSetMatchOption(CompOption * option, CompOptionValue * value)
{
	CompDisplay *display = option->value.match.display;
	CompMatch match;

	if (matchEqual(&option->value.match, &value->match))
		return FALSE;

	if (!matchCopy(&match, &value->match))
		return FALSE;

	matchFini(&option->value.match);

	option->value.match.op = match.op;
	option->value.match.nOp = match.nOp;

	if (display)
		matchUpdate(display, &option->value.match);

	return TRUE;
}
示例#14
0
文件: fade.c 项目: zmike/compiz
static Bool
fadeInitDisplay(CompPlugin *p,
                CompDisplay *d)
{
   FadeDisplay *fd;

   if (!checkPluginABI("core", CORE_ABIVERSION))
     return FALSE;

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

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

   fd->displayModals = 0;

   fd->suppressMinimizeOpenClose = (findActivePlugin("animation") != NULL);

   /* Always fade opening and closing of screen-dimming layer of
      logout window and gksu. */
   matchInit(&fd->alwaysFadeWindowMatch);
   matchAddExp(&fd->alwaysFadeWindowMatch, 0, "title=gksu");
   matchAddExp(&fd->alwaysFadeWindowMatch, 0, "title=x-session-manager");
   matchAddExp(&fd->alwaysFadeWindowMatch, 0, "title=mate-session");
   matchUpdate(d, &fd->alwaysFadeWindowMatch);

   WRAP(fd, d, handleEvent, fadeHandleEvent);
   WRAP(fd, d, matchExpHandlerChanged, fadeMatchExpHandlerChanged);

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

   return TRUE;
}
示例#15
0
static void
initMatchValue (CompDisplay     *d,
		CompOptionValue *v,
		Bool		helper,
		xmlDocPtr       doc,
		xmlNodePtr      node)
{
    xmlChar *value;

    matchInit (&v->match);

    if (!doc)
	return;

    value = xmlNodeListGetString (doc, node->xmlChildrenNode, 1);
    if (value)
    {
	matchAddFromString (&v->match, (char *) value);
	xmlFree (value);
    }

    if (!helper)
	matchUpdate (d, &v->match);
}
static Bool
ringInitiate (CompScreen      *s,
 	      CompAction      *action,
	      CompActionState state,
	      CompOption      *option,
	      int	      nOption)
{
    CompMatch *match;
    int       count; 

    RING_SCREEN (s);

    if (otherScreenGrabExist (s, "ring", NULL))
	return FALSE;
	   
    rs->currentMatch = ringGetWindowMatch (s);

    match = getMatchOptionNamed (option, nOption, "match", NULL);
    if (match)
    {
	matchFini (&rs->match);
	matchInit (&rs->match);
	if (matchCopy (&rs->match, match))
	{
	    matchUpdate (s->display, &rs->match);
	    rs->currentMatch = &rs->match;
	}
    }

    count = ringCountWindows (s);

    if (count < 1)
	return FALSE;

    if (!rs->grabIndex)
    {
	if (ringGetSelectWithMouse (s))
	    rs->grabIndex = pushScreenGrab (s, s->normalCursor, "ring");
	else
	    rs->grabIndex = pushScreenGrab (s, s->invisibleCursor, "ring");
    }

    if (rs->grabIndex)
    {
	rs->state = RingStateOut;

	if (!ringCreateWindowList (s))
	    return FALSE;

	rs->selectedWindow = rs->windows[0];
	ringRenderWindowTitle (s);
	rs->rotTarget = 0;

    	rs->moreAdjust = TRUE;
	damageScreen (s);

	switchActivateEvent (s, TRUE);
    }

    return TRUE;
}
示例#17
0
QWidget *Desktopwidget::createToolbar(void)
   {
   QWidget *group = new QWidget (this);

   //TODO: Move this to use the designer
   /* create the desktop toolbar. We are doing this manually since we can't
      seem to get Qt to insert a QLineEdit into a toolbar */
   _toolbar = new QToolBar (group);
//   _toolbar = new QWidget (group);
//   _toolbar = group;
   addAction (_actionPprev, "Previous page", SLOT(pageLeft ()), "", _toolbar, "pprev.xpm");
   addAction (_actionPprev, "Next page", SLOT(pageRight ()), "", _toolbar, "pnext.xpm");
   addAction (_actionPprev, "Previous stack", SLOT(stackLeft ()), "", _toolbar, "prev.xpm");
   addAction (_actionPprev, "Next stack", SLOT(stackRight ()), "", _toolbar, "next.xpm");

   QWidget *findgroup = new QWidget (_toolbar);

   QHBoxLayout *hboxLayout2 = new QHBoxLayout();
   hboxLayout2->setSpacing(0);
   hboxLayout2->setContentsMargins (0, 0, 0, 0);
   hboxLayout2->setObjectName(QString::fromUtf8("hboxLayout2"));
   findgroup->setLayout (hboxLayout2);

   QLabel *label = new QLabel (findgroup);
   label->setText(QApplication::translate("Mainwindow", "Filter:", 0));
   label->setObjectName(QString::fromUtf8("label"));

   hboxLayout2->addWidget(label);

   _match = new QLineEdit (findgroup);
   _match->setObjectName ("match");
   QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Fixed);
   sizePolicy2.setHorizontalStretch(1);
   sizePolicy2.setVerticalStretch(0);
   sizePolicy2.setHeightForWidth(_match->sizePolicy().hasHeightForWidth());
   _match->setSizePolicy(sizePolicy2);
   _match->setMinimumSize(QSize(50, 0));
   //_match->setDragEnabled(true);

   connect (_match, SIGNAL (returnPressed()),
        this, SLOT (matchUpdate ()));
   connect (_match, SIGNAL (textChanged(const QString&)),
        this, SLOT (matchChange (const QString &)));
   //_reset_filter = new QAction (this);
   //_reset_filter->setShortcut (Qt::Key_Escape);
   //connect (_reset_filter, SIGNAL (triggered()), this, SLOT (resetFilter()));
   //_match->addAction (_reset_filter);
   //_match->installEventFilter (this);

   // When ESC is pressed, clear the field
   QStateMachine *machine = new QStateMachine (this);
   QState *s1 = new QState (machine);

//   QSignalTransition *pressed_esc = new QSignalTransition(_match,
//                                       SIGNAL(textChanged(const QString&)));
   QKeyEventTransition *pressed_esc = new QKeyEventTransition(_match,
                           QEvent::KeyPress, Qt::Key_Escape);
   s1->addTransition (pressed_esc);
   connect(pressed_esc, SIGNAL(triggered()), this, SLOT(resetFilter()));
   machine->setInitialState (s1);
   machine->start ();
#if 0
  QPushButton *test = new QPushButton (findgroup);
  test->setText ("hello");
  hboxLayout2->addWidget (test);

   QStateMachine *test_machine = new QStateMachine (this);
   QState *test_s1 = new QState (test_machine);

   QSignalTransition *trans = new QSignalTransition(test, SIGNAL(clicked()));
   test_s1->addTransition (trans);
   connect(trans, SIGNAL(triggered()), this, SLOT(resetFilter()));
   test_machine->setInitialState (test_s1);
   test_machine->start ();
#endif
    // and change the state
   hboxLayout2->addWidget(label);

   hboxLayout2->addWidget (_match);

   addAction (_find, "Filter stacks", SLOT(findClicked ()), "", findgroup, "find.xpm");
   QToolButton *find = new QToolButton (findgroup);
   find->setDefaultAction (_find);
   hboxLayout2->addWidget (find);
//    connect (_find, SIGNAL (activated ()), this, SLOT (findClicked ()));

   QSpacerItem *spacerItem = new QSpacerItem(16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

   hboxLayout2->addItem (spacerItem);

   _global = new QCheckBox("Subdirs", findgroup);
   _global->setObjectName(QString::fromUtf8("global"));

   hboxLayout2->addWidget(_global);

   addAction (_reset, "Reset", SLOT(resetFilter ()), "", findgroup);
   QToolButton *reset = new QToolButton (findgroup);
   reset->setDefaultAction (_reset);
   hboxLayout2->addWidget (reset);

   _toolbar->addWidget (findgroup);

#ifndef QT_NO_TOOLTIP
   _match->setToolTip(QApplication::translate("Mainwindow", "Enter part of the name of the stack to search for", 0));
   _find->setToolTip(QApplication::translate("Mainwindow", "Search for the name", 0));
   _global->setToolTip(QApplication::translate("Mainwindow", "Enable this to search all subdirectories also", 0));
   _reset->setToolTip(QApplication::translate("Mainwindow", "Reset the search string", 0));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
   _match->setWhatsThis(QApplication::translate("Mainwindow", "The filter feature can be used in two ways. To filter out unwanted stacks, type a few characters from the stack name that you are looking for. Everything that does not match will be removed from view. To go back, just delete characters from the filter.\n"
"\n"
"There is also a 'global' mode which allows searching of all subdirectories. To use this, select the 'global' button, then type your filter string. Press return or click 'find' to perform the search. This might take a while.\n"
"\n"
"To reset the filter, click the 'reset' button.", 0));
   _find->setWhatsThis(QApplication::translate("Mainwindow", "Click this button to perform a search when in global mode", 0));
   _global->setWhatsThis(QApplication::translate("Mainwindow", "The filter feature can be used in two ways. To filter out unwanted stacks, type a few characters from the stack name that you are looking for. Everything that does not match will be removed from view. To go back, just delete characters from the filter.\n"
"\n"
"There is also a 'global' mode which allows searching of all subdirectories. To use this, select the 'global' button, then type your filter string. Press return or click 'find' to perform the search. This might take a while.\n"
"\n"
"To reset the filter, click the 'reset' button.", 0));
   _reset->setWhatsThis(QApplication::translate("Mainwindow", "Press this button to reset the filter string and display stacks in the current directory", 0));
#endif // QT_NO_WHATSTHIS
   return group;
   }
示例#18
0
void Desktopwidget::matchChange (const QString &)
   {
   if (!_global->isChecked ())
      matchUpdate (_match->text (), false);
   }
示例#19
0
void Desktopwidget::matchUpdate (void)
   {
   matchUpdate (_match->text (), _global->isChecked ());
   }
示例#20
0
文件: scalefilter.c 项目: Elive/ecomp
static void
scalefilterHandleKeyPress (CompScreen *s,
			   XKeyEvent  *event)
{
    ScaleFilterInfo *info;
    Bool            needRelayout = FALSE;
    Bool            dropKeyEvent = FALSE;
    int             count, timeout;
    char            buffer[10];
    wchar_t         wbuffer[10];
    KeySym          ks;

    FILTER_DISPLAY (s->display);
    FILTER_SCREEN (s);
    SCALE_SCREEN (s);

    info = fs->filterInfo;
    memset (buffer, 0, sizeof (buffer));
    memset (wbuffer, 0, sizeof (wbuffer));

    if (fd->xic)
    {
	Status status;

	XSetICFocus (fd->xic);
	count = Xutf8LookupString (fd->xic, event, buffer, 9, &ks, &status);
	XUnsetICFocus (fd->xic);
    }
    else
    {
	count = XLookupString (event, buffer, 9, &ks, NULL);
    }

    mbstowcs (wbuffer, buffer, 9);

    if (ks == XK_Escape)
    {
	if (info)
	{
	    /* Escape key - drop current filter */
	    ss->currentMatch = info->origMatch;
	    scalefilterFiniFilterInfo (s, TRUE);
	    needRelayout = TRUE;
	    dropKeyEvent = TRUE;
	}
	else if (fs->matchApplied)
	{
	    /* remove filter applied previously
	       if currently not in input mode */
	    matchFini (&ss->match);
	    matchInit (&ss->match);
	    matchCopy (&ss->match, &fs->scaleMatch);
	    matchUpdate (s->display, &ss->match);

	    ss->currentMatch = &ss->match;
	    fs->matchApplied = FALSE;
	    needRelayout = TRUE;
	    dropKeyEvent = TRUE;
	}
    }
    else if (ks == XK_Return)
    {
	if (info)
	{
	    /* Return key - apply current filter persistently */
	    matchFini (&ss->match);
	    matchInit (&ss->match);
	    matchCopy (&ss->match, &info->match);
	    matchUpdate (s->display, &ss->match);

	    ss->currentMatch = &ss->match;
	    fs->matchApplied = TRUE;
	    dropKeyEvent = TRUE;
	    needRelayout = TRUE;
	    scalefilterFiniFilterInfo (s, TRUE);
	}
    }
    else if (ks == XK_BackSpace)
    {
	if (info && info->filterStringLength > 0)
	{
	    /* remove last character in string */
	    info->filterString[--(info->filterStringLength)] = '\0';
	    needRelayout = TRUE;
	}
    }
    else if (count > 0)
    {
	if (!info)
	{
	    fs->filterInfo = info = malloc (sizeof (ScaleFilterInfo));
	    scalefilterInitFilterInfo (s);
	}
	else if (info->timeoutHandle)
	    compRemoveTimeout (info->timeoutHandle);

	timeout = scalefilterGetTimeout (s);
	if (timeout > 0)
	    info->timeoutHandle = compAddTimeout (timeout,
				     		  scalefilterFilterTimeout, s);

	if (info->filterStringLength < MAX_FILTER_SIZE)
	{
	    info->filterString[info->filterStringLength++] = wbuffer[0];
	    info->filterString[info->filterStringLength] = '\0';
	    needRelayout = TRUE;
	}
    }

    /* set the event type invalid if we
       don't want other plugins see it */
    if (dropKeyEvent)
	event->type = LASTEvent+1;

    if (needRelayout)
    {
	scalefilterRenderFilterText (s);

	if (fs->filterInfo)
	    scalefilterUpdateFilter (s, &fs->filterInfo->match);

	scalefilterRelayout (s);
    }
}
示例#21
0
/*
 * groupInitScreen
 *
 */
static Bool
groupInitScreen (CompPlugin *p,
                 CompScreen *s)
{
    GroupScreen       *gs;
    int glowType;

    GROUP_DISPLAY (&display);

    gs = malloc (sizeof (GroupScreen));
    if (!gs)
        return FALSE;

    gs->windowPrivateIndex = allocateWindowPrivateIndex (s);
    if (gs->windowPrivateIndex < 0)
    {
        free (gs);
        return FALSE;
    }

    WRAP (gs, s, windowMoveNotify, groupWindowMoveNotify);
    WRAP (gs, s, windowResizeNotify, groupWindowResizeNotify);
    WRAP (gs, s, getOutputExtentsForWindow, groupGetOutputExtentsForWindow);
    WRAP (gs, s, preparePaintScreen, groupPreparePaintScreen);
    WRAP (gs, s, paintOutput, groupPaintOutput);
    WRAP (gs, s, drawWindow, groupDrawWindow);
    WRAP (gs, s, paintWindow, groupPaintWindow);
    WRAP (gs, s, paintTransformedOutput, groupPaintTransformedOutput);
    WRAP (gs, s, donePaintScreen, groupDonePaintScreen);
    WRAP (gs, s, windowGrabNotify, groupWindowGrabNotify);
    WRAP (gs, s, windowUngrabNotify, groupWindowUngrabNotify);
    WRAP (gs, s, damageWindowRect, groupDamageWindowRect);
    WRAP (gs, s, windowStateChangeNotify, groupWindowStateChangeNotify);
    WRAP (gs, s, activateWindow, groupActivateWindow);

    s->privates[gd->screenPrivateIndex].ptr = gs;

    gs->groups = NULL;

    gs->tmpSel.windows = NULL;
    gs->tmpSel.nWins   = 0;

    gs->grabIndex = 0;
    gs->grabState = ScreenGrabNone;

    gs->lastHoveredGroup = NULL;

    gs->queued          = FALSE;
    gs->pendingMoves    = NULL;
    gs->pendingGrabs    = NULL;
    gs->pendingUngrabs  = NULL;

    gs->dequeueTimeoutHandle = 0;

    gs->draggedSlot            = NULL;
    gs->dragged                = FALSE;
    gs->dragHoverTimeoutHandle = 0;

    gs->prevX = 0;
    gs->prevY = 0;

    gs->showDelayTimeoutHandle = 0;

    /* one-shot timeout for stuff that needs to be initialized after
       all screens and windows are initialized */
    gs->initialActionsTimeoutHandle =
        compAddTimeout (0, 0, groupApplyInitialActions, (void *) s);

    initTexture (s, &gs->glowTexture);

    const BananaValue *
    option_glow_type = bananaGetOption (bananaIndex,
                                        "glow_type",
                                        s->screenNum);

    glowType = option_glow_type->i;
    imageDataToTexture (s, &gs->glowTexture,
                        glowTextureProperties[glowType].textureData,
                        glowTextureProperties[glowType].textureSize,
                        glowTextureProperties[glowType].textureSize,
                        GL_RGBA, GL_UNSIGNED_BYTE);

    const BananaValue *
    option_window_match = bananaGetOption (bananaIndex,
                                           "window_match",
                                           s->screenNum);

    matchInit (&gs->window_match);
    matchAddFromString (&gs->window_match, option_window_match->s);
    matchUpdate (&gs->window_match);

    const BananaValue *
    option_autotab_windows = bananaGetOption (bananaIndex,
                             "autotab_windows",
                             s->screenNum);

    gs->autotabCount = option_autotab_windows->list.nItem;
    gs->autotab = malloc (gs->autotabCount * sizeof (CompMatch));

    int i;
    for (i = 0; i <= gs->autotabCount - 1; i++)
    {
        matchInit (&gs->autotab[i]);
        matchAddFromString (&gs->autotab[i],
                            option_autotab_windows->list.item[i].s);
        matchUpdate (&gs->autotab[i]);
    }

    return TRUE;
}
示例#22
0
static Bool
winrulesInitScreen (CompPlugin *p,
                    CompScreen *s)
{
	WinrulesScreen *ws;

	WINRULES_DISPLAY (&display);

	ws = malloc (sizeof (WinrulesScreen));
	if (!ws)
		return FALSE;

	ws->windowPrivateIndex = allocateWindowPrivateIndex (s);
	if (ws->windowPrivateIndex < 0)
	{
		free (ws);
		return FALSE;
	}

	WRAP (ws, s, getAllowedActionsForWindow,
	      winrulesGetAllowedActionsForWindow);

	const BananaValue *
	option_skiptaskbar_match = bananaGetOption (bananaIndex,
	                                            "skiptaskbar_match",
	                                            s->screenNum);

	matchInit (&ws->skiptaskbar_match);
	matchAddFromString (&ws->skiptaskbar_match, option_skiptaskbar_match->s);
	matchUpdate (&ws->skiptaskbar_match);

	const BananaValue *
	option_skippager_match = bananaGetOption (bananaIndex,
	                                          "skippager_match",
	                                          s->screenNum);

	matchInit (&ws->skippager_match);
	matchAddFromString (&ws->skippager_match, option_skippager_match->s);
	matchUpdate (&ws->skippager_match);

	const BananaValue *
	option_above_match = bananaGetOption (bananaIndex,
	                                      "above_match",
	                                      s->screenNum);

	matchInit (&ws->above_match);
	matchAddFromString (&ws->above_match, option_above_match->s);
	matchUpdate (&ws->above_match);

	const BananaValue *
	option_below_match = bananaGetOption (bananaIndex,
	                                      "below_match",
	                                      s->screenNum);

	matchInit (&ws->below_match);
	matchAddFromString (&ws->below_match, option_below_match->s);
	matchUpdate (&ws->below_match);

	const BananaValue *
	option_sticky_match = bananaGetOption (bananaIndex,
	                                       "sticky_match",
	                                       s->screenNum);

	matchInit (&ws->sticky_match);
	matchAddFromString (&ws->sticky_match, option_sticky_match->s);
	matchUpdate (&ws->sticky_match);

	const BananaValue *
	option_fullscreen_match = bananaGetOption (bananaIndex,
	                                           "fullscreen_match",
	                                           s->screenNum);

	matchInit (&ws->fullscreen_match);
	matchAddFromString (&ws->fullscreen_match, option_fullscreen_match->s);
	matchUpdate (&ws->fullscreen_match);

	const BananaValue *
	option_maximize_match = bananaGetOption (bananaIndex,
	                                         "maximize_match",
	                                         s->screenNum);

	matchInit (&ws->maximize_match);
	matchAddFromString (&ws->maximize_match, option_maximize_match->s);
	matchUpdate (&ws->maximize_match);

	const BananaValue *
	option_no_argb_match = bananaGetOption (bananaIndex,
	                                        "no_argb_match",
	                                         s->screenNum);

	matchInit (&ws->no_argb_match);
	matchAddFromString (&ws->no_argb_match, option_no_argb_match->s);
	matchUpdate (&ws->no_argb_match);

	const BananaValue *
	option_no_move_match = bananaGetOption (bananaIndex,
	                                        "no_move_match",
	                                        s->screenNum);

	matchInit (&ws->no_move_match);
	matchAddFromString (&ws->no_move_match, option_no_move_match->s);
	matchUpdate (&ws->no_move_match);

	const BananaValue *
	option_no_resize_match = bananaGetOption (bananaIndex,
	                                          "no_resize_match",
	                                          s->screenNum);

	matchInit (&ws->no_resize_match);
	matchAddFromString (&ws->no_resize_match, option_no_resize_match->s);
	matchUpdate (&ws->no_resize_match);

	const BananaValue *
	option_no_minimize_match = bananaGetOption (bananaIndex,
	                                            "no_minimize_match",
	                                            s->screenNum);

	matchInit (&ws->no_minimize_match);
	matchAddFromString (&ws->no_minimize_match, option_no_minimize_match->s);
	matchUpdate (&ws->no_minimize_match);

	const BananaValue *
	option_no_maximize_match = bananaGetOption (bananaIndex,
	                                            "no_maximize_match",
	                                            s->screenNum);

	matchInit (&ws->no_maximize_match);
	matchAddFromString (&ws->no_maximize_match, option_no_maximize_match->s);
	matchUpdate (&ws->no_maximize_match);

	const BananaValue *
	option_no_close_match = bananaGetOption (bananaIndex,
	                                         "no_close_match",
	                                         s->screenNum);

	matchInit (&ws->no_close_match);
	matchAddFromString (&ws->no_close_match, option_no_close_match->s);
	matchUpdate (&ws->no_close_match);

	const BananaValue *
	option_no_focus_match = bananaGetOption (bananaIndex,
	                                         "no_focus_match",
	                                         s->screenNum);

	matchInit (&ws->no_focus_match);
	matchAddFromString (&ws->no_focus_match, option_no_focus_match->s);
	matchUpdate (&ws->no_focus_match);

	const BananaValue *
	option_size_matches = bananaGetOption (bananaIndex,
	                                       "size_matches",
	                                       s->screenNum);

	ws->size_matches_count = option_size_matches->list.nItem;
	int i;
	for (i = 0; i < option_size_matches->list.nItem; i++)
	{
		matchInit (&ws->size_matches[i]);
		matchAddFromString (&ws->size_matches[i],
		                    option_size_matches->list.item[i].s);
		matchUpdate (&ws->size_matches[i]);
	}

	s->privates[wd->screenPrivateIndex].ptr = ws;

	return TRUE;
}
示例#23
0
static void
winrulesChangeNotify (const char        *optionName,
                      BananaType        optionType,
                      const BananaValue *optionValue,
                      int               screenNum)
{
	unsigned int updateStateMask = 0, updateActionsMask = 0;

	CompScreen *screen = getScreenFromScreenNum (screenNum);

	WINRULES_SCREEN (screen);

	CompMatch *match;

	if (strcasecmp (optionName, "skiptaskbar_match") == 0)
	{
		match = &ws->skiptaskbar_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateSkipTaskbarMask;
	}
	else if (strcasecmp (optionName, "skippager_match") == 0)
	{
		match = &ws->skippager_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateSkipPagerMask;
	}
	else if (strcasecmp (optionName, "above_match") == 0)
	{
		match = &ws->above_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateAboveMask;
	}
	else if (strcasecmp (optionName, "below_match") == 0)
	{
		match = &ws->below_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateBelowMask;
	}
	else if (strcasecmp (optionName, "sticky_match") == 0)
	{
		match = &ws->sticky_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateStickyMask;
	}
	else if (strcasecmp (optionName, "fullscreen_match") == 0)
	{
		match = &ws->fullscreen_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateFullscreenMask;
	}
	else if (strcasecmp (optionName, "maximize_match") == 0)
	{
		match = &ws->maximize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateStateMask = CompWindowStateMaximizedHorzMask |
		                  CompWindowStateMaximizedVertMask;
	}
	else if (strcasecmp (optionName, "no_move_match") == 0)
	{
		match = &ws->no_move_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionMoveMask;
	}
	else if (strcasecmp (optionName, "no_resize_match") == 0)
	{
		match = &ws->no_resize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionResizeMask;
	}
	else if (strcasecmp (optionName, "no_minimize_match") == 0)
	{
		match = &ws->no_minimize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionMinimizeMask;
	}
	else if (strcasecmp (optionName, "no_maximize_match") == 0)
	{
		match = &ws->no_maximize_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionMaximizeVertMask |
		                    CompWindowActionMaximizeHorzMask;
	}
	else if (strcasecmp (optionName, "no_close_match") == 0)
	{
		match = &ws->no_close_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		updateActionsMask = CompWindowActionCloseMask;
	}
	else if (strcasecmp (optionName, "no_argb_match") == 0)
	{
		match = &ws->no_argb_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesSetNoAlpha (w, match);
	}
	else if (strcasecmp (optionName, "no_focus_match") == 0)
	{
		match = &ws->no_focus_match;

		matchFini (match);
		matchInit (match);
		matchAddFromString (match, optionValue->s);
		matchUpdate (match);

		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesSetNoFocus (w, match);
	}
	else if (strcasecmp (optionName, "size_matches") == 0)
	{
		int i;
		for (i = 0; i < ws->size_matches_count; i++)
			matchFini (&ws->size_matches[i]);

		ws->size_matches_count = optionValue->list.nItem;
		for (i = 0; i < ws->size_matches_count; i++)
		{
			matchInit (&ws->size_matches[i]);
			matchAddFromString (&ws->size_matches[i],
			                    optionValue->list.item[i].s);
			matchUpdate (&ws->size_matches[i]);
		}
	}

	if (strcasecmp (optionName, "size_matches") == 0 ||
	    strcasecmp (optionName, "size_width_values") == 0 ||
	    strcasecmp (optionName, "size_height_values") == 0)
	{
		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
		{
			int width, height;

			if (winrulesMatchSize (w, &width, &height))
				winrulesUpdateWindowSize (w, width, height);
		}
	}

	if (updateStateMask)
	{
		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesUpdateState (w, match, updateStateMask);
	}

	if (updateActionsMask)
	{
		CompWindow *w;

		for (w = screen->windows; w; w = w->next)
			winrulesSetAllowedActions (w, match, updateActionsMask);
	}
}
示例#24
0
static void
groupChangeNotify (const char        *optionName,
                   BananaType        optionType,
                   const BananaValue *optionValue,
                   int               screenNum)
{
    GROUP_DISPLAY (&display);

    if (strcasecmp (optionName, "window_match") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        matchFini (&gs->window_match);
        matchInit (&gs->window_match);
        matchAddFromString (&gs->window_match, optionValue->s);
        matchUpdate (&gs->window_match);
    }
    else if (strcasecmp (optionName, "tab_base_color") == 0 ||
             strcasecmp (optionName, "tab_highlight_color") == 0 ||
             strcasecmp (optionName, "tab_border_color") == 0 ||
             strcasecmp (optionName, "tab_style") == 0 ||
             strcasecmp (optionName, "border_radius") == 0 ||
             strcasecmp (optionName, "border_width") == 0)
    {
        GroupSelection *group;

        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        for (group = gs->groups; group; group = group->next)
            if (group->tabBar)
                groupRenderTabBarBackground (group);
    }
    else if (strcasecmp (optionName, "tabbar_font_size") == 0 ||
             strcasecmp (optionName, "tabbar_font_color") == 0)
    {
        GroupSelection *group;

        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        for (group = gs->groups; group; group = group->next)
            groupRenderWindowTitle (group);
    }
    else if (strcasecmp (optionName, "thumb_size") == 0 ||
             strcasecmp (optionName, "thumb_space") == 0)
    {
        GroupSelection *group;

        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        for (group = gs->groups; group; group = group->next)
            if (group->tabBar)
            {
                BoxPtr box = &group->tabBar->region->extents;
                groupRecalcTabBarPos (group, (box->x1 + box->x2 ) / 2,
                                      box->x1, box->x2);
            }
    }
    else if (strcasecmp (optionName, "glow") == 0 ||
             strcasecmp (optionName, "glow_size") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        CompWindow *w;

        for (w = s->windows; w; w = w->next)
        {
            GROUP_WINDOW (w);

            groupComputeGlowQuads (w, &gs->glowTexture.matrix);
            if (gw->glowQuads)
            {
                damageWindowOutputExtents (w);
                updateWindowOutputExtents (w);
                damageWindowOutputExtents (w);
            }
        }
    }
    else if (strcasecmp (optionName, "glow_type") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);
        GROUP_SCREEN (s);

        int glowType;
        GlowTextureProperties *glowProperty;

        GROUP_DISPLAY (&display);

        const BananaValue *
        option_glow_type = bananaGetOption (bananaIndex,
                                            "glow_type",
                                            s->screenNum);

        glowType = option_glow_type->i;
        glowProperty = &gd->glowTextureProperties[glowType];

        finiTexture (s, &gs->glowTexture);
        initTexture (s, &gs->glowTexture);

        imageDataToTexture (s, &gs->glowTexture,
                            glowProperty->textureData,
                            glowProperty->textureSize,
                            glowProperty->textureSize,
                            GL_RGBA, GL_UNSIGNED_BYTE);

        const BananaValue *
        option_glow = bananaGetOption (bananaIndex,
                                       "glow",
                                       s->screenNum);

        if (option_glow->b && gs->groups)
        {
            CompWindow *w;

            for (w = s->windows; w; w = w->next)
                groupComputeGlowQuads (w, &gs->glowTexture.matrix);

            damageScreen (s);
        }
    }
    else if (strcasecmp (optionName, "select_button") == 0)
        updateButton (optionValue->s, &gd->select_button);
    else if (strcasecmp (optionName, "select_single_key") == 0)
        updateKey (optionValue->s, &gd->select_single_key);
    else if (strcasecmp (optionName, "group_key") == 0)
        updateKey (optionValue->s, &gd->group_key);
    else if (strcasecmp (optionName, "ungroup_key") == 0)
        updateKey (optionValue->s, &gd->ungroup_key);
    else if (strcasecmp (optionName, "remove_key") == 0)
        updateKey (optionValue->s, &gd->remove_key);
    else if (strcasecmp (optionName, "close_key") == 0)
        updateKey (optionValue->s, &gd->close_key);
    else if (strcasecmp (optionName, "ignore_key") == 0)
        updateKey (optionValue->s, &gd->ignore_key);
    else if (strcasecmp (optionName, "tabmode_key") == 0)
        updateKey (optionValue->s, &gd->tabmode_key);
    else if (strcasecmp (optionName, "change_tab_left_key") == 0)
        updateKey (optionValue->s, &gd->change_tab_left_key);
    else if (strcasecmp (optionName, "change_tab_right_key") == 0)
        updateKey (optionValue->s, &gd->change_tab_right_key);
    else if (strcasecmp (optionName, "change_color_key") == 0)
        updateKey (optionValue->s, &gd->change_color_key);
    else if (strcasecmp (optionName, "autotab_windows") == 0)
    {
        CompScreen *s = getScreenFromScreenNum (screenNum);

        GROUP_SCREEN (s);

        int i;
        if (gs->autotab && gs->autotabCount != 0)
        {
            for (i = 0; i <= gs->autotabCount - 1; i++)
                matchFini (&gs->autotab[i]);

            free (gs->autotab);
        }

        gs->autotabCount = optionValue->list.nItem;
        gs->autotab = malloc (gs->autotabCount * sizeof (CompMatch));

        for (i = 0; i <= gs->autotabCount - 1; i++)
        {
            matchInit (&gs->autotab[i]);
            matchAddFromString (&gs->autotab[i], optionValue->list.item[i].s);
            matchUpdate (&gs->autotab[i]);
        }
    }
}