Пример #1
0
bool TrayApplet::init()
{
	m_initialized = X11Support::makeSystemTray(m_panelWindow->winId());

	if(!m_initialized)
	{
		// Another tray is active.
		return false;
	}

	connect(X11Support::instance(), SIGNAL(windowClosed(ulong)), this, SLOT(windowClosed(ulong)));
	connect(X11Support::instance(), SIGNAL(windowReconfigured(ulong,int,int,int,int)), this, SLOT(windowReconfigured(ulong,int,int,int,int)));
	connect(X11Support::instance(), SIGNAL(windowDamaged(ulong)), this, SLOT(windowDamaged(ulong)));
	connect(X11Support::instance(), SIGNAL(clientMessageReceived(ulong,ulong,void*)), this, SLOT(clientMessageReceived(ulong,ulong,void*)));

	return true;
}
Пример #2
0
void X11Support::onX11Event(XEvent* event)
{
	if(event->type == m_damageEventBase + XDamageNotify)
	{
		// Repair damaged area.
		XDamageNotifyEvent* damageEvent = reinterpret_cast<XDamageNotifyEvent*>(event);
		XDamageSubtract(QX11Info::display(), damageEvent->damage, None, None);

		emit windowDamaged(event->xany.window);
	}
	if(event->type == DestroyNotify)
		emit windowClosed(event->xdestroywindow.window);
	if(event->type == PropertyNotify)
		emit windowPropertyChanged(event->xproperty.window, event->xproperty.atom);
	if(event->type == ClientMessage)
		emit clientMessageReceived(event->xclient.window, event->xclient.message_type, event->xclient.data.b);
}
Пример #3
0
CWindowIcon::CWindowIcon(WId window, QWidget* parent)
  : QWidget(parent),
    m_window(window)
{
  QBoxLayout* box = qobject_cast<QBoxLayout*>(parent->layout());
  Q_ASSERT(box);

  m_size = box->direction() <= QBoxLayout::RightToLeft ? parentWidget()->height() : parentWidget()->width();

  X11Core::registerForTrayIconUpdates(window);
  X11Core::reparentWindow(window, parentWidget()->winId());
  X11Core::resizeWindow(window, m_size, m_size);
  X11Core::redirectWindow(window);
  X11Core::mapWindow(window);
  X11Core::registerForTrayIconUpdates(window);

  connect(X11Core::instance(), SIGNAL(windowDamaged(WId)),
          this               , SLOT(onWindowDamaged(WId)));

  connect(X11Core::instance(), SIGNAL(windowReconfigured(WId,int,int,int,int)),
          this               , SLOT(onWindowReconfigured(WId,int,int,int,int)));
}