Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Now using an invisible window as a temporaly parent for Skype's windows
Browse files Browse the repository at this point in the history
It's because calling anything from QtGui during a
XCreateWindow/XCreateSimpleWindow call is dangerous and leads to SIGSEGV
on some systems.
  • Loading branch information
kekekeks committed Dec 16, 2011
1 parent f097158 commit 5c95b34
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
29 changes: 19 additions & 10 deletions skypetab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void SkypeTab::init()
printf("Created main window\n");
mainWindow->show();
this->startTimer(50);
_stagingArea=(new QWidget())->winId();
}


Expand Down Expand Up @@ -113,16 +114,8 @@ WId SkypeTab::onNewWindow()

if(0==strcmp(classname, *name))
{
STabMainWindow *mw=_instance->mainWindow;
mw->show();

X11::Flush();
_returnImmediately=true;
WId id=mw->AddTab(widget)->winId();
mw->activateWindow();
_returnImmediately=false;
return id;

_instance->_pendingWindows.append(widget);
return _instance->_stagingArea;
}
name++;
}
Expand Down Expand Up @@ -165,4 +158,20 @@ void SkypeTab::onTrayIcon()
mainWindow->show();
mainWindow->activateWindow();
}

void SkypeTab::timerEvent(QTimerEvent *)
{
while(_pendingWindows.length()!=0)
{
QWidget*widget=_pendingWindows[0];
_pendingWindows.removeAt(0);

mainWindow->show();
X11::Flush();

mainWindow->AddTab(widget);
mainWindow->activateWindow();

}
}
}
3 changes: 3 additions & 0 deletions skypetab.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class SkypeTab : public QObject
QMenu*_trayMenu;
QDialog*_aboutDialog;
void onTrayIcon();
QList<QWidget*> _pendingWindows;
virtual void timerEvent(QTimerEvent *);
WId _stagingArea;
public:
explicit SkypeTab(QObject *parent = 0);
static QWidget*_mainSkypeWindow;
Expand Down
2 changes: 2 additions & 0 deletions stwindowcontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ void STWindowContainer::embedWindow(QWidget *widgetToEmbed)
_embedded=widgetToEmbed;
_embeddedAt=time(0);
connect(widgetToEmbed, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*)));
XReparentWindow(X11::XDisplay, _embedded->winId(), winId(),0,0);
X11::Flush();
QTimer::singleShot(40, this, SLOT(delayedEmbed()));

}
Expand Down

0 comments on commit 5c95b34

Please sign in to comment.