Commit 4c6fd377 authored by Robert Knight's avatar Robert Knight
Browse files

Set WINDOWID environment variable in the child process. Mainly needed so that...

Set WINDOWID environment variable in the child process.  Mainly needed so that VIM will set a useful window title depending on the file being edited.  Discovered the w3m-img package in the process which needs WINDOWID as well apparently.  Wow! What a nifty hack.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=687621
parent 6c8ef851
......@@ -74,7 +74,6 @@ Session::Session() :
, _addToUtmp(true)
, _flowControl(true)
, _fullScripting(false)
, _winId(0)
, _sessionId(0)
, _zmodemBusy(false)
, _zmodemProc(0)
......@@ -127,6 +126,35 @@ Session::Session() :
connect(_monitorTimer, SIGNAL(timeout()), this, SLOT(monitorTimerDone()));
}
WId Session::windowId() const
{
// Returns a window ID for this session which is used
// to set the WINDOWID environment variable in the shell
// process.
//
// Sessions can have multiple views or no views, which means
// that a single ID is not always going to be accurate.
//
// If there are no views, the window ID is just 0. If
// there are multiple views, then the window ID for the
// top-level window which contains the first view is
// returned
if ( _views.count() == 0 )
return 0;
else
{
QWidget* window = _views.first();
Q_ASSERT( window );
while ( window->parentWidget() != 0 )
window = window->parentWidget();
return window->winId();
}
}
void Session::setDarkBackground(bool darkBackground)
{
_hasDarkBackground = darkBackground;
......@@ -268,7 +296,7 @@ void Session::run()
int result = _shellProcess->start(QFile::encodeName(_program),
arguments,
_environment << backgroundColorHint,
_winId,
windowId(),
_addToUtmp,
dbusService,
(QLatin1String("/Sessions/") +
......
......@@ -456,6 +456,7 @@ private slots:
private:
void updateTerminalSize();
WId windowId() const;
int _uniqueIdentifier;
......@@ -491,7 +492,6 @@ private:
QStringList _arguments;
QStringList _environment;
ulong _winId;
int _sessionId;
QString _initialWorkingDir;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment