Back to index

unity  6.0.0
Public Member Functions | Public Attributes | Private Attributes
UnityDialogScreen Class Reference

#include <unitydialog.h>

Collaboration diagram for UnityDialogScreen:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 UnityDialogScreen (CompScreen *)
 ~UnityDialogScreen ()
void handleEvent (XEvent *)
void handleCompizEvent (const char *, const char *, CompOption::Vector &)
void matchExpHandlerChanged ()
CompMatch::Expression * matchInitExp (const CompString &value)
void preparePaint (int)
bool glPaintOutput (const GLScreenPaintAttrib &attrib, const GLMatrix &transform, const CompRegion &region, CompOutput *output, unsigned int mask)
void donePaint ()
void optionChanged (CompOption *, Options num)
void trackParent (CompWindow *w)
void untrackParent (CompWindow *w)
bool switchingVp ()
const GLTexture::List & tex ()

Public Attributes

CompositeScreen * cScreen
GLScreen * gScreen

Private Attributes

bool mSwitchingVp
UnityDialogShadeTexturemTex
Atom mCompizResizeAtom
Atom mUnityIsParentAtom
CompWindowList mParentWindows

Detailed Description

Definition at line 164 of file unitydialog.h.


Constructor & Destructor Documentation

Definition at line 1581 of file unitydialog.cpp.

                                                  :
  PluginClassHandler <UnityDialogScreen, CompScreen> (s),
  cScreen(CompositeScreen::get(s)),
  gScreen(GLScreen::get(s)),
  mSwitchingVp(false),
  mCompizResizeAtom(XInternAtom(screen->dpy(),
                                "_COMPIZ_RESIZE_NOTIFY", 0)),
  mUnityIsParentAtom(XInternAtom(screen->dpy(),
                                 "_UNITY_IS_PARENT", 0))
{
  ScreenInterface::setHandler(screen);
  CompositeScreenInterface::setHandler(cScreen, false);
  GLScreenInterface::setHandler(gScreen, false);

  optionSetAlphaNotify(boost::bind(&UnityDialogScreen::optionChanged, this, _1, _2));

  mTex = new UnityDialogShadeTexture();
  mTex->render(optionGetAlpha());
}

Here is the call graph for this function:

Definition at line 1601 of file unitydialog.cpp.

{
  delete mTex;
}

Member Function Documentation

Definition at line 344 of file unitydialog.cpp.

{
  CompWindowList::iterator it = mParentWindows.begin();

  cScreen->donePaint();

  while (it != mParentWindows.end())
  {
    CompWindow* w = (*it);
    UnityDialogWindow* udw = UnityDialogWindow::get(w);

    if (udw->animate(0, optionGetFadeTime()))
    {
      CompRegion damage = udw->getDamageRegion();
      cScreen->damageRegion(damage);
    }
    else if (!udw->hasTransients())
    {
      untrackParent(w);
      udw->gWindow->glDrawSetEnabled(udw, false);
      udw->gWindow->glPaintSetEnabled(udw, false);

      it = mParentWindows.begin();
      continue;
    }

    it++;
  }
}

Here is the call graph for this function:

bool UnityDialogScreen::glPaintOutput ( const GLScreenPaintAttrib &  attrib,
const GLMatrix &  transform,
const CompRegion &  region,
CompOutput *  output,
unsigned int  mask 
)

Definition at line 332 of file unitydialog.cpp.

{
  mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;

  return gScreen->glPaintOutput(attrib, transform, region, output, mask);
}
void UnityDialogScreen::handleCompizEvent ( const char *  plugin,
const char *  event,
CompOption::Vector &  o 
)

Definition at line 1443 of file unitydialog.cpp.

{
  if (strcmp(event, "start_viewport_switch") == 0)
  {
    mSwitchingVp = true;
  }
  else if (strcmp(event, "end_viewport_switch") == 0)
  {
    mSwitchingVp = false;
  }
  else if (strcmp(event, "window_animation") == 0)
  {
    CompWindow* w = screen->findWindow(CompOption::getIntOptionNamed(o, "window", 0));
    if (w)
    {
      if (UnityDialogWindow::get(w)->hasParent())
      {
        UnityDialogWindow::get(w)->setIsAnimated(CompOption::getBoolOptionNamed(o, "active", false));
        GLWindow::get(w)->glPaintSetEnabled(UnityDialogWindow::get(w), !UnityDialogWindow::get(w)->isAnimated());
      }
    }
  }

  screen->handleCompizEvent(plugin, event, o);
}
void UnityDialogScreen::handleEvent ( XEvent *  event)

Definition at line 1472 of file unitydialog.cpp.

{
  CompWindow* w;

  screen->handleEvent(event);

  switch (event->type)
  {
    case ClientMessage:

      w = screen->findWindow(event->xclient.window);

      if (event->xclient.message_type == mCompizResizeAtom && w)
      {
        CompRect currentRect(event->xclient.data.l[0] - w->border().left,
                             event->xclient.data.l[1] - w->border().top ,
                             event->xclient.data.l[2] + w->border().left + w->border().right,
                             event->xclient.data.l[3] + w->border().top + w->border().bottom);
        UnityDialogWindow* udw = UnityDialogWindow::get(w);

        udw->moveTransientsToRect(NULL, currentRect, false);

      }
      break;
    case PropertyNotify:

      if (event->xproperty.type == XA_WM_TRANSIENT_FOR)
      {
        CompWindow* w = screen->findWindow(event->xproperty.window);

        if (w)
        {
          CompWindow* parent = screen->findWindow(w->transientFor());
          UnityDialogWindow* udw = UnityDialogWindow::get(parent);

          if (!udw->hasTransient(w))
          {
            /* This window got it's transient status updated
             * probably because the app was buggy and decided
             * to do so after it was mapped. Work around it
             */
            if (udw->addTransient(w))
              trackParent(parent);

            /* re-center all the transients */

            udw->moveTransientsToRect(w, parent->serverBorderRect(), true);
          }
        }
      }
      break;
    default:
      break;
  }
}

Here is the call graph for this function:

Definition at line 63 of file unitydialog.cpp.

{
  screen->matchExpHandlerChanged();

  for (CompWindow* w : screen->windows())
  {
    if (UnityDialogWindow::get(w)->hasParent() ||
        UnityDialogWindow::get(w)->hasTransients())
      screen->matchPropertyChanged(w);
  }
}
CompMatch::Expression * UnityDialogScreen::matchInitExp ( const CompString &  value)

Definition at line 51 of file unitydialog.cpp.

{
  CompString matchString("transient-dialog=");
  /* Create a new match object */

  if (str.find(matchString) == 0)
    return new UnityDialogExp(str.substr(matchString.size()));

  return screen->matchInitExp(str);
}
void UnityDialogScreen::optionChanged ( CompOption *  option,
Options  num 
)

Definition at line 1529 of file unitydialog.cpp.

{
  mTex->render(optionGetAlpha());
}

Here is the caller graph for this function:

Definition at line 322 of file unitydialog.cpp.

{
  cScreen->preparePaint(ms);

  for (CompWindow* w : mParentWindows)
    UnityDialogWindow::get(w)->animate(ms, optionGetFadeTime());

}
bool UnityDialogScreen::switchingVp ( ) [inline]

Definition at line 215 of file unitydialog.h.

  {
    return mSwitchingVp;
  }
const GLTexture::List& UnityDialogScreen::tex ( ) [inline]

Definition at line 219 of file unitydialog.h.

  {
    return mTex->texture();
  }

Here is the call graph for this function:

void UnityDialogScreen::trackParent ( CompWindow *  w)

Definition at line 925 of file unitydialog.cpp.

{
  unsigned long* data = new unsigned long;

  *data = 1;

  if (!mParentWindows.size())
  {
    cScreen->preparePaintSetEnabled(this, true);
    gScreen->glPaintOutputSetEnabled(this, true);
    cScreen->donePaintSetEnabled(this, true);
  }

  /* Set the _UNITY_IS_PARENT property */
  XChangeProperty(screen->dpy(), w->id(), mUnityIsParentAtom, XA_CARDINAL,
                  32, PropModeReplace, (const unsigned char*) data, 1);

  delete data;

  mParentWindows.push_back(w);
}
void UnityDialogScreen::untrackParent ( CompWindow *  w)

Definition at line 948 of file unitydialog.cpp.

{
  CompWindowList::iterator it = std::find(mParentWindows.begin(), mParentWindows.end(), w);

  if (it != mParentWindows.end())
  {
    mParentWindows.erase(it);

    /* Unset the _UNITY_IS_PARENT property */
    XDeleteProperty(screen->dpy(), w->id(), mUnityIsParentAtom);

    if (!mParentWindows.size())
    {
      cScreen->preparePaintSetEnabled(this, false);
      gScreen->glPaintOutputSetEnabled(this, false);
      cScreen->donePaintSetEnabled(this, false);
    }
  }
}

Here is the caller graph for this function:


Member Data Documentation

CompositeScreen* UnityDialogScreen::cScreen

Definition at line 212 of file unitydialog.h.

Definition at line 213 of file unitydialog.h.

Definition at line 229 of file unitydialog.h.

CompWindowList UnityDialogScreen::mParentWindows [private]

Definition at line 232 of file unitydialog.h.

Definition at line 226 of file unitydialog.h.

Definition at line 227 of file unitydialog.h.

Definition at line 230 of file unitydialog.h.


The documentation for this class was generated from the following files: