diff options
Diffstat (limited to 'kdecore')
-rw-r--r-- | kdecore/Makefile.am | 12 | ||||
-rw-r--r-- | kdecore/kaccel.cpp | 3 | ||||
-rw-r--r-- | kdecore/kconfigbackend.cpp | 51 | ||||
-rw-r--r-- | kdecore/kconfigbackend.h | 6 | ||||
-rw-r--r-- | kdecore/kcrash.cpp | 2 | ||||
-rw-r--r-- | kdecore/kdebug.cpp | 3 | ||||
-rw-r--r-- | kdecore/kdebugrc | 2 | ||||
-rw-r--r-- | kdecore/kdeversion.h | 4 | ||||
-rw-r--r-- | kdecore/kglobalsettings.cpp | 51 | ||||
-rw-r--r-- | kdecore/kiconeffect.cpp | 148 | ||||
-rw-r--r-- | kdecore/kiconeffect.h | 1 | ||||
-rw-r--r-- | kdecore/kicontheme.cpp | 2 | ||||
-rw-r--r-- | kdecore/klocale.cpp | 17 | ||||
-rw-r--r-- | kdecore/kpty.cpp | 192 | ||||
-rw-r--r-- | kdecore/kpty.h | 10 | ||||
-rw-r--r-- | kdecore/kstandarddirs.cpp | 12 | ||||
-rw-r--r-- | kdecore/kstartupinfo.cpp | 38 | ||||
-rw-r--r-- | kdecore/kstartupinfo.h | 24 | ||||
-rw-r--r-- | kdecore/netwm.cpp | 17 | ||||
-rw-r--r-- | kdecore/netwm_def.h | 1 | ||||
-rw-r--r-- | kdecore/network/kresolverworkerbase.cpp | 3 |
21 files changed, 483 insertions, 116 deletions
diff --git a/kdecore/Makefile.am b/kdecore/Makefile.am index b312a0e24..b5a9c5a80 100644 --- a/kdecore/Makefile.am +++ b/kdecore/Makefile.am @@ -34,7 +34,7 @@ SUBDIRS = malloc network $(SVGICONS) . kconfig_compiler tests AM_LDFLAGS = $(LDFLAGS_AS_NEEDED) $(LDFLAGS_NEW_DTAGS) lib_LTLIBRARIES = libkdefakes.la libkdecore.la -lib_LIBRARIES = libkdefakes_nonpic.a +lib_LIBRARIES = libkdefakes_nonpic.a libkdefakes_pic.a include_HEADERS = kconfig.h kconfigskeleton.h \ kconfigdata.h ksimpleconfig.h kconfigdialogmanager.h \ @@ -75,6 +75,12 @@ vsnprintf_nonpic.c: $(srcdir)/vsnprintf.c -rm -f vsnprintf_nonpic.c $(LN_S) $(srcdir)/vsnprintf.c vsnprintf_nonpic.c +libkdefakes_pic.a: libkdefakes.la + -rm -f libkdefakes_pic.a fakes_pic.o vsnprintf_pic.o + cp -f .libs/fakes.o fakes_pic.o; cp -f .libs/vsnprintf.o vsnprintf_pic.o + ar cru libkdefakes_pic.a fakes_pic.o vsnprintf_pic.o + ranlib libkdefakes_pic.a + noinst_HEADERS = kaccelaction.h kaccelbase.h kaccelprivate.h kckey.h \ kcompletion_private.h netwm_p.h \ kglobalaccel_x11.h kglobalaccel_win.h kkeyserver_x11.h kkeyserver.h \ @@ -116,7 +122,8 @@ libkdecore_la_SOURCES = libintl.cpp kapplication.cpp \ kqiodevicegzip_p.cpp ktimezones.cpp libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) -version-info 6:0:2 -no-undefined -libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la +libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la \ + $(LIBART_LIBS) $(LIB_IDN) $(top_builddir)/kdefx/libkdefx.la $(LIB_QT) $(LIBSM) $(LIB_X11) $(LIBZ) $(LIBDL) libkdecore_la_NMCHECK = $(srcdir)/libkdecore.nmcheck libkdecore_la_NMCHECKWEAK = $(srcdir)/libkdecore_weak.nmcheck $(srcdir)/libqt-mt_weak.nmcheck \ $(top_srcdir)/dcop/libDCOP_weak.nmcheck $(top_srcdir)/kdecore/standard_weak.nmcheck @@ -170,7 +177,6 @@ kde_config_LDFLAGS = $(KDE_RPATH) $(KDE_MT_LDFLAGS) kgrantpty_SOURCES = kgrantpty.c kgrantpty_CFLAGS= $(KDE_USE_FPIE) kgrantpty_LDFLAGS = $(KDE_USE_PIE) $(KDE_RPATH) $(all_libraries) -kgrantpty_LDADD = ./libkdefakes.la # kgrantpty needs to be installed setuid root install-exec-hook: diff --git a/kdecore/kaccel.cpp b/kdecore/kaccel.cpp index 461666d31..fc984021a 100644 --- a/kdecore/kaccel.cpp +++ b/kdecore/kaccel.cpp @@ -127,7 +127,10 @@ bool KAccelEventHandler::x11Event( XEvent* pEvent ) return false; if( pEvent->type == XKeyPress ) { + unsigned int tmp = pEvent->xkey.state; + pEvent->xkey.state &= ~0x2000; KKeyNative keyNative( pEvent ); + pEvent->xkey.state = tmp; KKey key( keyNative ); key.simplify(); int keyCodeQt = key.keyCodeQt(); diff --git a/kdecore/kconfigbackend.cpp b/kdecore/kconfigbackend.cpp index 37bafdced..153b9aa1a 100644 --- a/kdecore/kconfigbackend.cpp +++ b/kdecore/kconfigbackend.cpp @@ -505,6 +505,8 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1()); bool fileOptionImmutable = false; bool groupOptionImmutable = false; bool groupSkip = false; + bool foundGettextDomain = false; + QCString gettextDomain; int line = 0; for(; s < eof; s++) @@ -596,6 +598,7 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1()); if (groupSkip && !bDefault) goto sktoeol; // Skip entry + bool optionImmutable = groupOptionImmutable; bool optionDeleted = false; bool optionExpand = false; @@ -695,6 +698,11 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1()); QCString val = printableToString(st, s - st); //qDebug("found key '%s' with value '%s'", key.data(), val.data()); + if (QString(key.data()) == "X-Ubuntu-Gettext-Domain") { + gettextDomain = val.data(); + foundGettextDomain = true; + } + KEntryKey aEntryKey(aCurrentGroup, decodeKey(key)); aEntryKey.bLocal = (locale != 0); aEntryKey.bDefault = bDefault; @@ -718,6 +726,34 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1()); pConfig->putData(aEntryKey, aEntry, false); } } + // Look up translations using KLocale + // https://launchpad.net/distros/ubuntu/+spec/langpacks-desktopfiles-kde + // This calls KLocale up to 10 times for each config file (and each KConfig has up to 4 files) + // so I'll see how much of a performance hit it is + // it also only acts on the last group in a file + // Ideas: only translate most important fields, only translate "Desktop Entry" files, + // do translation per KConfig not per single file + if (!pWriteBackMap) { + QFile file("file.txt"); + if (foundGettextDomain) { + + KLocale locale(gettextDomain); + + QString language = locale.language(); + translateKey(locale, aCurrentGroup, QCString("Name")); + translateKey(locale, aCurrentGroup, QCString("Comment")); + translateKey(locale, aCurrentGroup, QCString("Language")); + translateKey(locale, aCurrentGroup, QCString("Keywords")); + translateKey(locale, aCurrentGroup, QCString("About")); + translateKey(locale, aCurrentGroup, QCString("Description")); + translateKey(locale, aCurrentGroup, QCString("GenericName")); + translateKey(locale, aCurrentGroup, QCString("Query")); + translateKey(locale, aCurrentGroup, QCString("ExtraNames")); + translateKey(locale, aCurrentGroup, QCString("X-KDE-Submenu")); + } + } + + if (fileOptionImmutable) bFileImmutable = true; @@ -732,6 +768,21 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1()); #endif } +void KConfigINIBackEnd::translateKey(KLocale& locale, QCString currentGroup, QCString key) { + KEntryKey entryKey = KEntryKey(currentGroup, key); + KEntry entry = pConfig->lookupData(entryKey); + if (QString(entry.mValue) != "") { + QString orig = key + "=" + entry.mValue; + QString translate = locale.translate(key + "=" + entry.mValue); + if (QString::compare(orig, translate) != 0) { + translate = translate.mid(key.length() + 1); + entry.mValue = translate.utf8(); + entryKey.bLocal = true; + entry.bNLS = true; + pConfig->putData(entryKey, entry, false); + } + } +} void KConfigINIBackEnd::sync(bool bMerge) { diff --git a/kdecore/kconfigbackend.h b/kdecore/kconfigbackend.h index 49e0e3e49..696062bf4 100644 --- a/kdecore/kconfigbackend.h +++ b/kdecore/kconfigbackend.h @@ -25,6 +25,7 @@ #include "kconfigdata.h" #include <kconfigbase.h> #include <klockfile.h> +#include <klocale.h> #include "kdelibs_export.h" class QFile; @@ -250,6 +251,11 @@ protected: void parseSingleConfigFile(QFile& rFile, KEntryMap *pWriteBackMap = 0L, bool bGlobal = false, bool bDefault = false); + // Kubuntu patch, 2006-08-03 + // looks up a key in with KLocale + // see https://launchpad.net/distros/ubuntu/+spec/langpacks-desktopfiles-kde + void translateKey(KLocale& locale, QCString currentGroup, QCString key); + /** * Writes configuration file back. * diff --git a/kdecore/kcrash.cpp b/kdecore/kcrash.cpp index 61ba5f796..8fb8ed308 100644 --- a/kdecore/kcrash.cpp +++ b/kdecore/kcrash.cpp @@ -441,7 +441,7 @@ static int openSocket() if (!kde_home || !kde_home[0]) { - kde_home = "~/.kde/"; + kde_home = "~/.kde3/"; } if (kde_home[0] == '~') diff --git a/kdecore/kdebug.cpp b/kdecore/kdebug.cpp index 575f00e37..4c9c7cf14 100644 --- a/kdecore/kdebug.cpp +++ b/kdecore/kdebug.cpp @@ -238,7 +238,8 @@ static void kDebugBackend( unsigned short nLevel, unsigned int nArea, const char break; } - short nOutput = kDebug_data->config ? kDebug_data->config->readNumEntry(key, 2) : 2; + // if no output mode is specified default to no debug output + short nOutput = kDebug_data->config ? kDebug_data->config->readNumEntry(key, 4) : 4; // If the application doesn't have a QApplication object it can't use // a messagebox. diff --git a/kdecore/kdebugrc b/kdecore/kdebugrc index dc8deb29d..58b09ae7a 100644 --- a/kdecore/kdebugrc +++ b/kdecore/kdebugrc @@ -86,7 +86,7 @@ InfoOutput=4 # KMail [5006] -InfoOutput=2 +InfoOutput=4 # KitchenSync (Syncing Algorithm) [5250] diff --git a/kdecore/kdeversion.h b/kdecore/kdeversion.h index dbe094633..3e5b1b7a1 100644 --- a/kdecore/kdeversion.h +++ b/kdecore/kdeversion.h @@ -22,10 +22,10 @@ #include "kdelibs_export.h" -#define KDE_VERSION_STRING "3.5.10" +#define KDE_VERSION_STRING "3.5.11 [Trinity]" #define KDE_VERSION_MAJOR 3 #define KDE_VERSION_MINOR 5 -#define KDE_VERSION_RELEASE 10 +#define KDE_VERSION_RELEASE 11 #define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c)) #define KDE_VERSION \ diff --git a/kdecore/kglobalsettings.cpp b/kdecore/kglobalsettings.cpp index b5539fb22..25e95f5c6 100644 --- a/kdecore/kglobalsettings.cpp +++ b/kdecore/kglobalsettings.cpp @@ -50,6 +50,10 @@ static QRgb qt_colorref2qrgb(COLORREF col) #include <stdlib.h> #include <kprotocolinfo.h> +#include <qtextcodec.h> +#include <qtextstream.h> +#include <qfile.h> + #ifdef Q_WS_X11 #include <X11/Xlib.h> #endif @@ -77,6 +81,31 @@ QColor *KGlobalSettings::alternateColor = 0; KGlobalSettings::KMouseSettings *KGlobalSettings::s_mouseSettings = 0; +// helper function for reading xdg user dirs: it is required in order to take +// care of locale stuff +void readXdgUserDirs(QString *desktop, QString *documents) +{ + QFile f( QDir::homeDirPath() + "/.config/user-dirs.dirs" ); + + if (!f.open(IO_ReadOnly)) + return; + + // set the codec for the current locale + QTextStream s(&f); + s.setCodec( QTextCodec::codecForLocale() ); + + QString line = s.readLine(); + while (!line.isNull()) + { + if (line.startsWith("XDG_DESKTOP_DIR=")) + *desktop = line.remove("XDG_DESKTOP_DIR=").remove("\"").replace("$HOME", QDir::homeDirPath()); + else if (line.startsWith("XDG_DOCUMENTS_DIR=")) + *documents = line.remove("XDG_DOCUMENTS_DIR=").remove("\"").replace("$HOME", QDir::homeDirPath()); + + line = s.readLine(); + } +} + int KGlobalSettings::dndEventDelay() { KConfigGroup g( KGlobal::config(), "General" ); @@ -483,13 +512,17 @@ void KGlobalSettings::initStatic() // should be called initPaths(). Don't put an KConfigGroup g( KGlobal::config(), "Paths" ); - // Desktop Path - *s_desktopPath = QDir::homeDirPath() + "/Desktop/"; - *s_desktopPath = g.readPathEntry( "Desktop", *s_desktopPath); + // Read desktop and documents path using XDG_USER_DIRS + readXdgUserDirs(s_desktopPath, s_documentPath); + *s_desktopPath = QDir::cleanDirPath( *s_desktopPath ); if ( !s_desktopPath->endsWith("/") ) s_desktopPath->append('/'); + *s_documentPath = QDir::cleanDirPath( *s_documentPath ); + if ( !s_documentPath->endsWith("/")) + s_documentPath->append('/'); + // Trash Path - TODO remove in KDE4 (kio_trash can't use it for interoperability reasons) *s_trashPath = *s_desktopPath + i18n("Trash") + "/"; *s_trashPath = g.readPathEntry( "Trash" , *s_trashPath); @@ -510,18 +543,6 @@ void KGlobalSettings::initStatic() // should be called initPaths(). Don't put an if ( !s_autostartPath->endsWith("/") ) s_autostartPath->append('/'); - // Document Path - *s_documentPath = g.readPathEntry( "Documents", -#ifdef Q_WS_WIN - getWin32ShellFoldersPath("Personal") -#else - QDir::homeDirPath() -#endif - ); - *s_documentPath = QDir::cleanDirPath( *s_documentPath ); - if ( !s_documentPath->endsWith("/")) - s_documentPath->append('/'); - // Make sure this app gets the notifications about those paths if (kapp) kapp->addKipcEventMask(KIPC::SettingsChanged); diff --git a/kdecore/kiconeffect.cpp b/kdecore/kiconeffect.cpp index 7746e679e..780bea576 100644 --- a/kdecore/kiconeffect.cpp +++ b/kdecore/kiconeffect.cpp @@ -24,6 +24,9 @@ #include <qwidget.h> #include <qpainter.h> #include <qpen.h> +#include <qapplication.h> +#include <qpoint.h> +#include <qrect.h> #include <kdebug.h> #include <kglobal.h> @@ -768,3 +771,148 @@ KIconEffect::visualActivate(QWidget * widget, QRect rect) } } +void +KIconEffect::visualActivate(QWidget * widget, QRect rect, QPixmap *pixmap) +{ + if (!KGlobalSettings::visualActivate()) + return; + + // Image too big to display smoothly + if ((rect.width() > 160) || (rect.height() > 160)) { + visualActivate(widget, rect); // call old effect + return; + } + + uint actSpeed = KGlobalSettings::visualActivateSpeed(); + uint actCount = QMIN(rect.width(), rect.height()) / 4; + + + // Clip actCount to range 1..10. + if (actCount < 1) + actCount = 1; + + else if (actCount > 10) + actCount = 10; + + // Clip actSpeed to range 1..100. + if (actSpeed < 1) + actSpeed = 1; + + else if (actSpeed > 100) + actSpeed = 100; + + // actSpeed needs to be converted to actDelay. + // actDelay is inversely proportional to actSpeed and needs to be + // divided up into actCount portions. + // We also convert the us value to ms. + + unsigned int actDelay = (1000 * (100 - actSpeed)) / actCount; + + unsigned int deltaX = rect.width() / actCount * 1.5; + unsigned int deltaY = rect.height() / actCount * 1.5; + + QPoint c = rect.center(); + QRect maxRect(c.x() - (actCount * 2) * deltaX /2, + c.y() - (actCount * 2) * deltaY /2, + actCount * 2 * deltaX, + actCount * 2 * deltaY); + + // convert rect to global coordinates if needed + if ((widget->rect().width() <= maxRect.width()) + || (widget->rect().height() <= maxRect.height())) + { + QPoint topLeft(rect.x(), rect.y()); + rect.moveLeft(widget->mapToGlobal(topLeft).x()); + rect.moveTop(widget->mapToGlobal(topLeft).y()); + c = rect.center(); + maxRect.setRect(c.x() - (actCount * 2) * deltaX /2, + c.y() - (actCount * 2) * deltaY /2, + actCount * 2 * deltaX, + actCount * 2 * deltaY); + } + + QPainter *p; + QImage img = pixmap->convertToImage(); + QPixmap pix; + QPixmap composite(maxRect.width(), maxRect.height(), -1, QPixmap::BestOptim); + QPainter cPainter(&composite); + QPoint cComposite = composite.rect().center(); + + // enable alpha blending + img.setAlphaBuffer(true); + + // Ugly hack... Get "Screenshot" to blt into and even do that on the + // root window if the display area of <widget> is too small + if ((widget->rect().width() <= maxRect.width()) + || (widget->rect().height() <= maxRect.height())) + { + p = new QPainter(QApplication::desktop()->screen( -1 ), TRUE); + pix = QPixmap::grabWindow((QApplication::desktop()->screen( -1 ))->winId(), + maxRect.x(), + maxRect.y(), + maxRect.width(), + maxRect.height()); + } else + { + // not as ugly as drawing directly to the screen + p = new QPainter(widget); + pix = QPixmap::grabWidget(widget, + maxRect.x(), + maxRect.y(), + maxRect.width(), + maxRect.height()); + } + uchar deltaAlpha = 255 / (actCount * 1.2); + + // Activate effect like MacOS X + for (unsigned int i = actCount; i < actCount * 2; i++) { + + int w = i * deltaX; + int h = i * deltaY; + + rect.setRect(cComposite.x() - w / 2, cComposite.y() - h / 2, w, h); + + // draw offscreen + cPainter.drawPixmap(0, 0, pix, 0, 0, pix.width(), pix.height()); + cPainter.drawImage(rect, img); + cPainter.flush(); + + // put onscreen + p->drawPixmap(maxRect, composite); + p->flush(); + + // Fade out Icon a bit more + int x, y; + if ((img.depth() == 32) && qt_use_xrender && qt_has_xft) + { + int width = img.width(); + int height = img.height(); + + for (y=0; y<height; y++) + { +#ifdef WORDS_BIGENDIAN + uchar *line = (uchar*) img.scanLine(y); +#else + uchar *line = (uchar*) img.scanLine(y) + 3; +#endif + for (x=0; x<width; x++) + { + *line = (*line < deltaAlpha) ? 0 : *line - deltaAlpha; + line += 4; + } + } + } + usleep(actDelay*3); + } + + // remove traces of the effect + if ((widget->rect().width() <= maxRect.width()) + || (widget->rect().height() <= maxRect.height())) + p->drawPixmap(maxRect, pix); + else { + p->drawPixmap(maxRect, pix); + widget->update(rect); + } + + delete p; +} diff --git a/kdecore/kiconeffect.h b/kdecore/kiconeffect.h index 6cc568ac2..de698f4ab 100644 --- a/kdecore/kiconeffect.h +++ b/kdecore/kiconeffect.h @@ -152,6 +152,7 @@ public: * @param rect This rectangle defines the effect's borders */ static void visualActivate(QWidget *widget, QRect rect); + static void visualActivate(QWidget *widget, QRect rect, QPixmap *pixmap); /** * Tints an image gray. diff --git a/kdecore/kicontheme.cpp b/kdecore/kicontheme.cpp index f695052fe..62044d27e 100644 --- a/kdecore/kicontheme.cpp +++ b/kdecore/kicontheme.cpp @@ -408,7 +408,7 @@ KIcon KIconTheme::iconPath(const QString& name, int size, KIcon::MatchType match it's a downscale, and we only had upscales befores. This is to avoid scaling up unless we have to, since that looks very ugly */ - if ((abs(dw) >= abs(delta)) || + if (/*(abs(dw) >= abs(delta)) ||*/ (delta > 0 && dw < 0)) continue; } diff --git a/kdecore/klocale.cpp b/kdecore/klocale.cpp index 1ca1f035e..59981d4b1 100644 --- a/kdecore/klocale.cpp +++ b/kdecore/klocale.cpp @@ -76,6 +76,7 @@ public: #ifdef Q_WS_WIN char win32SystemEncoding[3+7]; //"cp " + lang ID #endif + bool useMainCatalogue; }; static KLocale *this_klocale = 0; @@ -118,8 +119,13 @@ void KLocale::initMainCatalogues(const QString & catalog) { // Use the first non-null string. QString mainCatalogue = catalog; - if (maincatalogue) - mainCatalogue = QString::fromLatin1(maincatalogue); + + // don't use main catalogue if we're looking up .desktop translations + if (mainCatalogue.contains("desktop") == 0 || mainCatalogue.contains("kdesktop") == 1) { + if (maincatalogue) { + mainCatalogue = QString::fromLatin1(maincatalogue); + } + } if (mainCatalogue.isEmpty()) { kdDebug(173) << "KLocale instance created called without valid " @@ -129,8 +135,11 @@ void KLocale::initMainCatalogues(const QString & catalog) else { // do not use insertCatalogue here, that would already trigger updateCatalogs d->catalogNames.append( mainCatalogue ); // application catalog - d->catalogNames.append( SYSTEM_MESSAGES ); // always include kdelibs.mo - d->catalogNames.append( "kio" ); // always include kio.mo + if (mainCatalogue.contains("desktop") == 0 || mainCatalogue.contains("kdesktop") == 1) { //don't bother if we're looking up desktop translations + d->catalogNames.append( SYSTEM_MESSAGES ); // always include kdelibs.mo + d->catalogNames.append( "kio" ); // always include kio.mo + d->catalogNames.append( "xdg-user-dirs" ); + } updateCatalogues(); // evaluate this for all languages } } diff --git a/kdecore/kpty.cpp b/kdecore/kpty.cpp index 27cc3c51b..af83e9eab 100644 --- a/kdecore/kpty.cpp +++ b/kdecore/kpty.cpp @@ -95,24 +95,24 @@ extern "C" { # endif #endif -#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +#if defined(HAVE_TCGETATTR) +# define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode) +#elif defined(TIOCGETA) # define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode) +#elif defined(TCGETS) +# define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode) #else -# if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) -# define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode) -# else -# define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode) -# endif +# error #endif -#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +#if defined(HAVE_TCSETATTR) && defined(TCSANOW) +# define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode) +#elif defined(TIOCSETA) # define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode) +#elif defined(TCSETS) +# define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode) #else -# if defined(_HPUX_SOURCE) || defined(__CYGWIN__) -# define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode) -# else -# define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode) -# endif +# error #endif #if defined (_HPUX_SOURCE) @@ -201,87 +201,37 @@ KPty::~KPty() delete d; } -bool KPty::open() +bool KPty::setPty(int pty_master) { - if (d->masterFd >= 0) - return true; + kdWarning(175) + << "setPty()" << endl; + // a pty is already open + if(d->masterFd >= 0) { + kdWarning(175) + << "d->masterFd >= 0" << endl; + return false; + } + d->masterFd = pty_master; + return _attachPty(pty_master); +} +bool KPty::_attachPty(int pty_master) +{ QCString ptyName; - // Find a master pty that we can open //////////////////////////////// - - // Because not all the pty animals are created equal, they want to - // be opened by several different methods. - - // We try, as we know them, one by one. - + kdWarning(175) + << "_attachPty() " << pty_master << endl; #if defined(HAVE_PTSNAME) && defined(HAVE_GRANTPT) -#ifdef _AIX - d->masterFd = ::open("/dev/ptc",O_RDWR); -#else - d->masterFd = ::open("/dev/ptmx",O_RDWR); -#endif - if (d->masterFd >= 0) - { char *ptsn = ptsname(d->masterFd); if (ptsn) { grantpt(d->masterFd); d->ttyName = ptsn; - goto gotpty; } else { ::close(d->masterFd); d->masterFd = -1; } - } #endif - // Linux device names, FIXME: Trouble on other systems? - for (const char* s3 = "pqrstuvwxyzabcdefghijklmno"; *s3; s3++) - { - for (const char* s4 = "0123456789abcdefghijklmnopqrstuvwxyz"; *s4; s4++) - { - ptyName.sprintf("/dev/pty%c%c", *s3, *s4); - d->ttyName.sprintf("/dev/tty%c%c", *s3, *s4); - - d->masterFd = ::open(ptyName.data(), O_RDWR); - if (d->masterFd >= 0) - { -#ifdef __sun - /* Need to check the process group of the pty. - * If it exists, then the slave pty is in use, - * and we need to get another one. - */ - int pgrp_rtn; - if (ioctl(d->masterFd, TIOCGPGRP, &pgrp_rtn) == 0 || errno != EIO) { - ::close(d->masterFd); - d->masterFd = -1; - continue; - } -#endif /* sun */ - if (!access(d->ttyName.data(),R_OK|W_OK)) // checks availability based on permission bits - { - if (!geteuid()) - { - struct group* p = getgrnam(TTY_GROUP); - if (!p) - p = getgrnam("wheel"); - gid_t gid = p ? p->gr_gid : getgid (); - - chown(d->ttyName.data(), getuid(), gid); - chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IWGRP); - } - goto gotpty; - } - ::close(d->masterFd); - d->masterFd = -1; - } - } - } - - kdWarning(175) << "Can't open a pseudo teletype" << endl; - return false; - - gotpty: struct stat st; if (stat(d->ttyName.data(), &st)) return false; // this just cannot happen ... *cough* Yeah right, I just @@ -354,6 +304,92 @@ bool KPty::open() return true; } +bool KPty::open() +{ + if (d->masterFd >= 0) + return true; + + QCString ptyName; + + // Find a master pty that we can open //////////////////////////////// + + // Because not all the pty animals are created equal, they want to + // be opened by several different methods. + + // We try, as we know them, one by one. + +#if defined(HAVE_PTSNAME) && defined(HAVE_GRANTPT) +#ifdef _AIX + d->masterFd = ::open("/dev/ptc",O_RDWR); +#else + d->masterFd = ::open("/dev/ptmx",O_RDWR); +#endif + if (d->masterFd >= 0) + { + char *ptsn = ptsname(d->masterFd); + if (ptsn) { + grantpt(d->masterFd); + d->ttyName = ptsn; + goto gotpty; + } else { + ::close(d->masterFd); + d->masterFd = -1; + } + } +#endif + + // Linux device names, FIXME: Trouble on other systems? + for (const char* s3 = "pqrstuvwxyzabcdefghijklmno"; *s3; s3++) + { + for (const char* s4 = "0123456789abcdefghijklmnopqrstuvwxyz"; *s4; s4++) + { + ptyName.sprintf("/dev/pty%c%c", *s3, *s4); + d->ttyName.sprintf("/dev/tty%c%c", *s3, *s4); + + d->masterFd = ::open(ptyName.data(), O_RDWR); + if (d->masterFd >= 0) + { +#ifdef __sun + /* Need to check the process group of the pty. + * If it exists, then the slave pty is in use, + * and we need to get another one. + */ + int pgrp_rtn; + if (ioctl(d->masterFd, TIOCGPGRP, &pgrp_rtn) == 0 || errno != EIO) { + ::close(d->masterFd); + d->masterFd = -1; + continue; + } +#endif /* sun */ + if (!access(d->ttyName.data(),R_OK|W_OK)) // checks availability based on permission bits + { + if (!geteuid()) + { + struct group* p = getgrnam(TTY_GROUP); + if (!p) + p = getgrnam("wheel"); + gid_t gid = p ? p->gr_gid : getgid (); + + chown(d->ttyName.data(), getuid(), gid); + chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IWGRP); + } + goto gotpty; + } + ::close(d->masterFd); + d->masterFd = -1; + } + } + } + + kdWarning(175) << "Can't open a pseudo teletype" << endl; + return false; + + gotpty: + return _attachPty(d->masterFd); + + return true; +} + void KPty::close() { if (d->masterFd < 0) diff --git a/kdecore/kpty.h b/kdecore/kpty.h index 51d069ac0..a2ae33b28 100644 --- a/kdecore/kpty.h +++ b/kdecore/kpty.h @@ -61,6 +61,13 @@ public: */ bool open(); + /** + * Attach a existing pty master + * + * @return true if the pty was successfully added + */ + bool setPty(int pty_master); + /** * Close the pty master/slave pair. */ @@ -138,6 +145,9 @@ public: */ int slaveFd() const; +protected: + bool _attachPty(int pty_master); + private: bool chownpty(bool grant); diff --git a/kdecore/kstandarddirs.cpp b/kdecore/kstandarddirs.cpp index 015590c2d..28568b74e 100644 --- a/kdecore/kstandarddirs.cpp +++ b/kdecore/kstandarddirs.cpp @@ -834,6 +834,10 @@ QStringList KStandardDirs::resourceDirs(const char *type) const if ((local || testdir.exists()) && !candidates->contains(path)) candidates->append(path); } + // UGLY HACK - Chris CHeney + if (local && (!strcmp("config", type))) + candidates->append("/etc/kde3/"); + // local = false; } } @@ -1021,7 +1025,7 @@ QString KStandardDirs::kde_default(const char *type) { if (!strcmp(type, "data")) return "share/apps/"; if (!strcmp(type, "html")) - return "share/doc/HTML/"; + return "share/doc/kde/HTML/"; if (!strcmp(type, "icon")) return "share/icons/"; if (!strcmp(type, "config")) @@ -1041,7 +1045,7 @@ QString KStandardDirs::kde_default(const char *type) { if (!strcmp(type, "mime")) return "share/mimelnk/"; if (!strcmp(type, "cgi")) - return "cgi-bin/"; + return "lib/cgi-bin/"; if (!strcmp(type, "wallpaper")) return "share/wallpapers/"; if (!strcmp(type, "templates")) @@ -1315,7 +1319,7 @@ void KStandardDirs::addKDEDefaults() } else { - localKdeDir = QDir::homeDirPath() + "/.kde/"; + localKdeDir = QDir::homeDirPath() + "/.kde3/"; } if (localKdeDir != "-/") @@ -1425,6 +1429,8 @@ void KStandardDirs::addKDEDefaults() } addResourceDir("home", QDir::homeDirPath()); + + addResourceDir("locale", "/usr/share/locale-langpack/", true); } void KStandardDirs::checkConfig() const diff --git a/kdecore/kstartupinfo.cpp b/kdecore/kstartupinfo.cpp index 3de0cb288..93107c128 100644 --- a/kdecore/kstartupinfo.cpp +++ b/kdecore/kstartupinfo.cpp @@ -1109,7 +1109,7 @@ unsigned long KStartupInfoId::timestamp() const struct KStartupInfoDataPrivate { KStartupInfoDataPrivate() : desktop( 0 ), wmclass( "" ), hostname( "" ), - silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ) {} + silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ), xinerama( -1 ), launched_by( 0 ) {} QString bin; QString name; QString description; @@ -1121,6 +1121,8 @@ struct KStartupInfoDataPrivate KStartupInfoData::TriState silent; unsigned long timestamp; int screen; + int xinerama; + WId launched_by; }; QString KStartupInfoData::to_text() const @@ -1151,6 +1153,10 @@ QString KStartupInfoData::to_text() const ret += QString::fromLatin1( " TIMESTAMP=%1" ).arg( d->timestamp ); if( d->screen != -1 ) ret += QString::fromLatin1( " SCREEN=%1" ).arg( d->screen ); + if( d->xinerama != -1 ) + ret += QString::fromLatin1( " XINERAMA=%1" ).arg( d->xinerama ); + if( d->launched_by != 0 ) + ret += QString::fromLatin1( " LAUNCHED_BY=%1" ).arg( d->launched_by ); return ret; } @@ -1169,6 +1175,8 @@ KStartupInfoData::KStartupInfoData( const QString& txt_P ) const QString silent_str = QString::fromLatin1( "SILENT=" ); const QString timestamp_str = QString::fromLatin1( "TIMESTAMP=" ); const QString screen_str = QString::fromLatin1( "SCREEN=" ); + const QString xinerama_str = QString::fromLatin1( "XINERAMA=" ); + const QString launched_by_str = QString::fromLatin1( "LAUNCHED_BY=" ); for( QStringList::Iterator it = items.begin(); it != items.end(); ++it ) @@ -1199,6 +1207,10 @@ KStartupInfoData::KStartupInfoData( const QString& txt_P ) d->timestamp = get_unum( *it ); else if( ( *it ).startsWith( screen_str )) d->screen = get_num( *it ); + else if( ( *it ).startsWith( xinerama_str )) + d->xinerama = get_num( *it ); + else if( ( *it ).startsWith( launched_by_str )) + d->launched_by = get_num( *it ); } } @@ -1242,6 +1254,10 @@ void KStartupInfoData::update( const KStartupInfoData& data_P ) d->timestamp = data_P.timestamp(); if( data_P.screen() != -1 ) d->screen = data_P.screen(); + if( data_P.xinerama() != -1 && xinerama() != -1 ) // don't overwrite + d->xinerama = data_P.xinerama(); + if( data_P.launchedBy() != 0 && launchedBy() != 0 ) // don't overwrite + d->launched_by = data_P.launchedBy(); } KStartupInfoData::KStartupInfoData() @@ -1412,6 +1428,26 @@ int KStartupInfoData::screen() const return d->screen; } +void KStartupInfoData::setXinerama( int xinerama ) + { + d->xinerama = xinerama; + } + +int KStartupInfoData::xinerama() const + { + return d->xinerama; + } + +void KStartupInfoData::setLaunchedBy( WId window ) + { + d->launched_by = window; + } + +WId KStartupInfoData::launchedBy() const + { + return d->launched_by; + } + static long get_num( const QString& item_P ) { diff --git a/kdecore/kstartupinfo.h b/kdecore/kstartupinfo.h index e77944dd3..ca8b21c66 100644 --- a/kdecore/kstartupinfo.h +++ b/kdecore/kstartupinfo.h @@ -635,6 +635,30 @@ class KDECORE_EXPORT KStartupInfoData * This is usually not necessary to set, as it's set by default to qt_xscreen(). */ void setScreen( int screen ); + + /** + * The Xinerama screen for the startup notification, -1 if unknown. + */ + int xinerama() const; + + /** + * Sets the Xinerama screen for the startup notification ( i.e. the screeen on which + * the starting application should appear ). + * @param xinerama the Xinerama screen for the startup notification + */ + void setXinerama( int xinerama ); + + /** + * The toplevel window of the application that caused this startup notification, + * 0 if unknown. + */ + WId launchedBy() const; + + /** + * Sets the toplevel window of the application that caused this startup notification. + * @param window window ID of the toplevel window that is responsible for this startup + */ + void setLaunchedBy( WId window ); /** * Updates the notification data from the given data. Some data, such as the desktop diff --git a/kdecore/netwm.cpp b/kdecore/netwm.cpp index e0685abc7..9e7d4580e 100644 --- a/kdecore/netwm.cpp +++ b/kdecore/netwm.cpp @@ -145,6 +145,9 @@ static Atom net_wm_state_stays_on_top = 0; // used to determine whether application window is managed or not static Atom xa_wm_state = 0; +// ability flags +static Atom net_wm_full_placement = 0; + static Bool netwm_atoms_created = False; const unsigned long netwm_sendevent_mask = (SubstructureRedirectMask| SubstructureNotifyMask); @@ -236,7 +239,7 @@ static int wcmp(const void *a, const void *b) { } -static const int netAtomCount = 84; +static const int netAtomCount = 85; static void create_atoms(Display *d) { static const char * const names[netAtomCount] = { @@ -330,7 +333,9 @@ static void create_atoms(Display *d) { "_KDE_NET_WM_TEMPORARY_RULES", "WM_STATE", - "WM_PROTOCOLS" + "WM_PROTOCOLS", + + "_NET_WM_FULL_PLACEMENT" }; Atom atoms[netAtomCount], *atomsp[netAtomCount] = @@ -425,7 +430,9 @@ static void create_atoms(Display *d) { &kde_net_wm_temporary_rules, &xa_wm_state, - &wm_protocols + &wm_protocols, + + &net_wm_full_placement }; assert( !netwm_atoms_created ); @@ -1355,6 +1362,8 @@ void NETRootInfo::setSupported() { if (p->properties[ PROTOCOLS2 ] & WM2KDETemporaryRules) atoms[pnum++] = kde_net_wm_temporary_rules; + if (p->properties[ PROTOCOLS2 ] & WM2FullPlacement) + atoms[pnum++] = net_wm_full_placement; XChangeProperty(p->display, p->root, net_supported, XA_ATOM, 32, PropModeReplace, (unsigned char *) atoms, pnum); @@ -1587,6 +1596,8 @@ void NETRootInfo::updateSupportedProperties( Atom atom ) else if( atom == kde_net_wm_temporary_rules ) p->properties[ PROTOCOLS2 ] |= WM2KDETemporaryRules; + else if( atom == net_wm_full_placement ) + p->properties[ PROTOCOLS2 ] |= WM2FullPlacement; } extern Time qt_x_user_time; diff --git a/kdecore/netwm_def.h b/kdecore/netwm_def.h index f2e11505d..94042cf1c 100644 --- a/kdecore/netwm_def.h +++ b/kdecore/netwm_def.h @@ -610,6 +610,7 @@ public: WM2WindowRole = 1<<11, ///< @since 3.3 WM2ClientMachine = 1<<12, ///< @since 3.3 WM2ShowingDesktop = 1<<13, ///< @since 3.5 + WM2FullPlacement = 1<<14, WM2DesktopLayout = 1<<15 ///< @since 3.5.8 }; diff --git a/kdecore/network/kresolverworkerbase.cpp b/kdecore/network/kresolverworkerbase.cpp index 32a32da2a..5d8cdaa9b 100644 --- a/kdecore/network/kresolverworkerbase.cpp +++ b/kdecore/network/kresolverworkerbase.cpp @@ -127,19 +127,16 @@ bool KResolverWorkerBase::enqueue(KResolverWorkerBase* worker) bool KResolverWorkerBase::checkResolver() { - assert(th != 0L); return th->checkResolver(); } void KResolverWorkerBase::acquireResolver() { - assert(th != 0L); th->acquireResolver(); } void KResolverWorkerBase::releaseResolver() { - assert(th != 0L); th->releaseResolver(); } |