Back to index

unity  6.0.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | Static Private Attributes
compiz::CompizMinimizedWindowHandler< Screen, Window > Class Template Reference

#include <compizminimizedwindowhandler.h>

Inheritance diagram for compiz::CompizMinimizedWindowHandler< Screen, Window >:
Inheritance graph
[legend]
Collaboration diagram for compiz::CompizMinimizedWindowHandler< Screen, Window >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
CompizMinimizedWindowHandler
< Screen, Window > 
Type
typedef std::list< Type * > List
typedef boost::shared_ptr
< MinimizedWindowHandler
Ptr

Public Member Functions

 CompizMinimizedWindowHandler (CompWindow *w, compiz::WindowInputRemoverLockAcquireInterface *lock_acquire)
 ~CompizMinimizedWindowHandler ()
void setVisibility (bool visible)
unsigned int getPaintMask ()
void minimize ()
void unminimize ()
void updateFrameRegion (CompRegion &r)
void windowNotify (CompWindowNotify n)
void setVisibility (bool visible, Window shapeWin)
bool contains (boost::shared_ptr< MinimizedWindowHandler > mw)

Static Public Member Functions

static void setFunctions (bool keepMinimized)
static void handleCompizEvent (const char *, const char *, CompOption::Vector &)
static void handleEvent (XEvent *event)

Static Public Attributes

static std::list< CompWindow * > minimizingWindows

Protected Member Functions

std::vector< unsigned int > getTransients ()

Private Attributes

PrivateCompizMinimizedWindowHandlerpriv

Static Private Attributes

static bool handleEvents = true
static List minimizedWindows

Detailed Description

template<typename Screen, typename Window>
class compiz::CompizMinimizedWindowHandler< Screen, Window >

Definition at line 44 of file compizminimizedwindowhandler.h.


Member Typedef Documentation

template<typename Screen, typename Window>
typedef std::list<Type *> compiz::CompizMinimizedWindowHandler< Screen, Window >::List

Definition at line 68 of file compizminimizedwindowhandler.h.

typedef boost::shared_ptr<MinimizedWindowHandler> compiz::MinimizedWindowHandler::Ptr [inherited]

Definition at line 49 of file minimizedwindowhandler.h.

template<typename Screen, typename Window>
typedef CompizMinimizedWindowHandler<Screen, Window> compiz::CompizMinimizedWindowHandler< Screen, Window >::Type

Definition at line 67 of file compizminimizedwindowhandler.h.


Constructor & Destructor Documentation

template<typename Screen , typename Window >
compiz::CompizMinimizedWindowHandler< Screen, Window >::CompizMinimizedWindowHandler ( CompWindow *  w,
compiz::WindowInputRemoverLockAcquireInterface lock_acquire 
)

Definition at line 95 of file compizminimizedwindowhandler.h.

                                                                                                                                                          :
  MinimizedWindowHandler (screen->dpy(), w->id(), lock_acquire)
{
  priv = new PrivateCompizMinimizedWindowHandler();

  priv->mWindow = w;

}
template<typename Screen , typename Window >
compiz::CompizMinimizedWindowHandler< Screen, Window >::~CompizMinimizedWindowHandler ( )

Definition at line 105 of file compizminimizedwindowhandler.h.

{
  minimizingWindows.remove (priv->mWindow);
  minimizedWindows.remove (this);
}

Member Function Documentation

bool compiz::MinimizedWindowHandler::contains ( boost::shared_ptr< MinimizedWindowHandler mw) [inherited]

Definition at line 45 of file minimizedwindowhandler.cpp.

{
  for (MinimizedWindowHandler::Ptr h : priv->mTransients)
  {
    if (h->priv->mXid == mw->priv->mXid)
      return true;
  }

  return false;
}

Here is the caller graph for this function:

template<typename Screen , typename Window >
unsigned int compiz::CompizMinimizedWindowHandler< Screen, Window >::getPaintMask ( )

Definition at line 262 of file compizminimizedwindowhandler.h.

{
  bool doMask = true;

  for (CompWindow *w : minimizingWindows)
  {
    if (w->id() == priv->mWindow->id())
      doMask = false;
    break;
  }

  if (doMask)
    return PAINT_WINDOW_NO_CORE_INSTANCE_MASK;

  return 0;
}
template<typename Screen , typename Window >
std::vector< unsigned int > compiz::CompizMinimizedWindowHandler< Screen, Window >::getTransients ( ) [protected, virtual]

Reimplemented from compiz::MinimizedWindowHandler.

Definition at line 113 of file compizminimizedwindowhandler.h.

{
  std::vector <unsigned int> transients;

  for (CompWindow *w : screen->windows())
  {
    compiz::CompTransientForReader reader (w);

    if (reader.isTransientFor (priv->mWindow->id()) ||
        reader.isGroupTransientFor (priv->mWindow->id()))
      transients.push_back (w->id());
  }

  return transients;
}

Here is the call graph for this function:

template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::handleCompizEvent ( const char *  pluginName,
const char *  eventName,
CompOption::Vector &  o 
) [static]

Definition at line 281 of file compizminimizedwindowhandler.h.

{
  if (!handleEvents)
    return;

  if (strncmp (pluginName, "animation", 9) == 0 &&
      strncmp (eventName, "window_animation", 16) == 0)
  {
    if (CompOption::getStringOptionNamed (o, "type", "") == "minimize")
    {
      CompWindow *w = screen->findWindow (CompOption::getIntOptionNamed (
                                            o, "window", 0));
      if (w)
      {
        if (CompOption::getBoolOptionNamed (o, "active", false))
          minimizingWindows.push_back (w);
        else
        {
          /* Ugly hack for LP#977189 */
         CompositeWindow::get (w)->release();
         GLWindow::get (w)->release();
          minimizingWindows.remove (w);
        }
      }
    }
  }

  if (!CompOption::getBoolOptionNamed (o, "active", false) &&
      minimizingWindows.empty())
  {
    handleEvents = false;
  }
}
template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::handleEvent ( XEvent *  event) [static]

Definition at line 319 of file compizminimizedwindowhandler.h.

{
  /* Ignore sent events from the InputRemover */
  if (screen->XShape() && event->type ==
      screen->shapeEvent() + ShapeNotify &&
      !event->xany.send_event)
  {
    CompWindow *w = screen->findWindow (((XShapeEvent *) event)->window);

    if (w)
    {
      Window *pw = Window::get (w);
      Type *compizMinimizeHandler = pw->mMinimizeHandler.get();

      /* Restore and re-save input shape and remove */
      if (compizMinimizeHandler)
      {
        compizMinimizeHandler->setVisibility (true);
        compizMinimizeHandler->setVisibility (false);
      }
    }
  }
}

Here is the call graph for this function:

template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::minimize ( ) [virtual]

Reimplemented from compiz::MinimizedWindowHandler.

Definition at line 140 of file compizminimizedwindowhandler.h.

{
  Atom          wmState = XInternAtom (screen->dpy(), "WM_STATE", 0);
  unsigned long data[2];

  std::vector<unsigned int> transients = getTransients();

  handleEvents = true;
  priv->mWindow->windowNotify (CompWindowNotifyMinimize);
  priv->mWindow->changeState (priv->mWindow->state() | CompWindowStateHiddenMask);

  minimizedWindows.push_back (this);

  for (unsigned int &w : transients)
  {
    CompWindow *win = screen->findWindow (w);

    if (win)
    {
      Window *w = Window::get (win);
      if (!w->mMinimizeHandler)
        w->mMinimizeHandler.reset (new Type (win, w));
      w->mMinimizeHandler->minimize();
    }
  }

  priv->mWindow->windowNotify (CompWindowNotifyHide);
  setVisibility (false);

  data[0] = IconicState;
  data[1] = None;

  XChangeProperty (screen->dpy(), priv->mWindow->id(), wmState, wmState,
                   32, PropModeReplace, (unsigned char *) data, 2);

  priv->mWindow->changeState (priv->mWindow->state() | CompWindowStateHiddenMask);

  /* Don't allow other windows to be focused by moveInputFocusToOtherWindow */
  for (auto mh : minimizedWindows)
    mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), false);

  priv->mWindow->moveInputFocusToOtherWindow();

  for (auto mh : minimizedWindows)
    mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), true);
}
template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::setFunctions ( bool  keepMinimized) [static]

Definition at line 345 of file compizminimizedwindowhandler.h.

{
  for (CompWindow *w : screen->windows())
  {
    bool m = w->minimized();
    bool enable = keepMinimized && w->mapNum() > 0;

    if (m)
      w->unminimize();
    w->minimizeSetEnabled (Window::get (w), enable);
    w->unminimizeSetEnabled (Window::get (w), enable);
    w->minimizedSetEnabled (Window::get (w), enable);
    if (m)
      Window::get (w)->window->minimize();
  }
}

Here is the call graph for this function:

void compiz::MinimizedWindowHandler::setVisibility ( bool  visible,
Window  shapeWin 
) [inherited]

Definition at line 57 of file minimizedwindowhandler.cpp.

{
  if (!visible && !priv->mRemover)
  {
    priv->mRemover = priv->mLockAcquire->InputRemover();
    if (!priv->mRemover)
      return;
  }
  else if (visible && priv->mRemover)
  {
    priv->mRemover.reset();
  }
}

Here is the caller graph for this function:

template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::setVisibility ( bool  visible)

Definition at line 131 of file compizminimizedwindowhandler.h.

{
  MinimizedWindowHandler::setVisibility (visible, priv->mWindow->id());

  CompositeWindow::get (priv->mWindow)->addDamage();
}

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::unminimize ( ) [virtual]

Reimplemented from compiz::MinimizedWindowHandler.

Definition at line 219 of file compizminimizedwindowhandler.h.

{
  Atom          wmState = XInternAtom (screen->dpy(), "WM_STATE", 0);
  unsigned long data[2];

  std::vector<unsigned int> transients = getTransients();

  minimizedWindows.remove (this);

  priv->mWindow->focusSetEnabled (Window::get (priv->mWindow), true);

  priv->mWindow->windowNotify (CompWindowNotifyUnminimize);
  priv->mWindow->changeState (priv->mWindow->state() & ~CompWindowStateHiddenMask);
  priv->mWindow->windowNotify (CompWindowNotifyShow);

  for (unsigned int &w : transients)
  {
    CompWindow *win = screen->findWindow (w);

    if (win)
    {
      Window *w = Window::get (win);
      if (w && w->mMinimizeHandler)
      {
       w->mMinimizeHandler->unminimize();
       w->mMinimizeHandler.reset();
      }
    }
  }

  setVisibility (true);

  priv->mWindow->changeState (priv->mWindow->state() & ~CompWindowStateHiddenMask);

  data[0] = NormalState;
  data[1] = None;

  XChangeProperty (screen->dpy(), priv->mWindow->id(), wmState, wmState,
                   32, PropModeReplace, (unsigned char *) data, 2);
}

Here is the caller graph for this function:

template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::updateFrameRegion ( CompRegion &  r)

Definition at line 205 of file compizminimizedwindowhandler.h.

{
  unsigned int oldUpdateFrameRegionIndex;
  r = CompRegion();

  /* Ensure no other plugins can touch this frame region */
  oldUpdateFrameRegionIndex = priv->mWindow->updateFrameRegionGetCurrentIndex();
  priv->mWindow->updateFrameRegionSetCurrentIndex (MAXSHORT);
  priv->mWindow->updateFrameRegion (r);
  priv->mWindow->updateFrameRegionSetCurrentIndex (oldUpdateFrameRegionIndex);
}
template<typename Screen , typename Window >
void compiz::CompizMinimizedWindowHandler< Screen, Window >::windowNotify ( CompWindowNotify  n)

Definition at line 189 of file compizminimizedwindowhandler.h.

{
  if (n == CompWindowNotifyFocusChange && priv->mWindow->minimized())
  {
    for (auto mh : minimizedWindows)
      mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), false);

    priv->mWindow->moveInputFocusToOtherWindow();

    for (auto mh : minimizedWindows)
      mh->priv->mWindow->focusSetEnabled (Window::get (mh->priv->mWindow), true);
  }
}

Member Data Documentation

template<typename Screen, typename Window>
bool compiz::CompizMinimizedWindowHandler< Screen, Window >::handleEvents = true [static, private]

Definition at line 76 of file compizminimizedwindowhandler.h.

template<typename Screen, typename Window>
compiz::CompizMinimizedWindowHandler< Screen, Window >::List compiz::CompizMinimizedWindowHandler< Screen, Window >::minimizedWindows [static, private]

Definition at line 77 of file compizminimizedwindowhandler.h.

template<typename Screen, typename Window>
CompWindowList compiz::CompizMinimizedWindowHandler< Screen, Window >::minimizingWindows [static]

Definition at line 65 of file compizminimizedwindowhandler.h.

template<typename Screen, typename Window>
PrivateCompizMinimizedWindowHandler* compiz::CompizMinimizedWindowHandler< Screen, Window >::priv [private]

Reimplemented from compiz::MinimizedWindowHandler.

Definition at line 75 of file compizminimizedwindowhandler.h.


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