Changeset View
Changeset View
Standalone View
Standalone View
src/kstartupinfo.cpp
Show All 32 Lines | |||||
33 | #ifdef QT_NO_CAST_FROM_ASCII | 33 | #ifdef QT_NO_CAST_FROM_ASCII | ||
34 | #undef QT_NO_CAST_FROM_ASCII | 34 | #undef QT_NO_CAST_FROM_ASCII | ||
35 | #endif | 35 | #endif | ||
36 | 36 | | |||
37 | #include "kstartupinfo.h" | 37 | #include "kstartupinfo.h" | ||
38 | #include "netwm_def.h" | 38 | #include "netwm_def.h" | ||
39 | #include "kwindowsystem_debug.h" | 39 | #include "kwindowsystem_debug.h" | ||
40 | 40 | | |||
41 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | ||||
41 | #include <QWidget> | 42 | #include <QWidget> | ||
43 | #endif | ||||
42 | #include <QDateTime> | 44 | #include <QDateTime> | ||
43 | 45 | | |||
44 | #include <config-kwindowsystem.h> // KWINDOWSYSTEM_HAVE_X11 | 46 | #include <config-kwindowsystem.h> // KWINDOWSYSTEM_HAVE_X11 | ||
45 | 47 | | |||
46 | // need to resolve INT32(qglobal.h)<>INT32(Xlibint.h) conflict | 48 | // need to resolve INT32(qglobal.h)<>INT32(Xlibint.h) conflict | ||
47 | #ifndef QT_CLEAN_NAMESPACE | 49 | #ifndef QT_CLEAN_NAMESPACE | ||
48 | #define QT_CLEAN_NAMESPACE | 50 | #define QT_CLEAN_NAMESPACE | ||
49 | #endif | 51 | #endif | ||
50 | 52 | | |||
51 | #ifndef Q_OS_WIN | 53 | #ifndef Q_OS_WIN | ||
52 | #include <unistd.h> | 54 | #include <unistd.h> | ||
53 | #include <sys/time.h> | 55 | #include <sys/time.h> | ||
54 | #else | 56 | #else | ||
55 | #include <winsock2.h> | 57 | #include <winsock2.h> | ||
56 | #include <process.h> | 58 | #include <process.h> | ||
57 | #endif | 59 | #endif | ||
58 | #include <stdlib.h> | 60 | #include <stdlib.h> | ||
59 | #include <QTimer> | 61 | #include <QTimer> | ||
60 | #include <QActionEvent> | 62 | #include <QActionEvent> | ||
61 | #if KWINDOWSYSTEM_HAVE_X11 | 63 | #if KWINDOWSYSTEM_HAVE_X11 | ||
62 | #include <qx11info_x11.h> | 64 | #include <qx11info_x11.h> | ||
63 | #include <netwm.h> | 65 | #include <netwm.h> | ||
64 | #endif | 66 | #endif | ||
65 | #include <QApplication> | 67 | #include <QCoreApplication> | ||
66 | #include <QDebug> | 68 | #include <QDebug> | ||
67 | #include <signal.h> | 69 | #include <signal.h> | ||
68 | #include <qstandardpaths.h> | 70 | #include <qstandardpaths.h> | ||
69 | #if KWINDOWSYSTEM_HAVE_X11 | 71 | #if KWINDOWSYSTEM_HAVE_X11 | ||
70 | #include <kwindowsystem.h> | 72 | #include <kwindowsystem.h> | ||
71 | #include <kxmessages.h> | 73 | #include <kxmessages.h> | ||
72 | #include <X11/Xlib.h> | 74 | #include <X11/Xlib.h> | ||
73 | #include <fixx11h.h> | 75 | #include <fixx11h.h> | ||
▲ Show 20 Lines • Show All 635 Lines • ▼ Show 20 Line(s) | |||||
709 | { | 711 | { | ||
710 | KStartupInfoId id; | 712 | KStartupInfoId id; | ||
711 | id.initId(startup_id); | 713 | id.initId(startup_id); | ||
712 | if (id.isNull()) { | 714 | if (id.isNull()) { | ||
713 | return; | 715 | return; | ||
714 | } | 716 | } | ||
715 | #if KWINDOWSYSTEM_HAVE_X11 | 717 | #if KWINDOWSYSTEM_HAVE_X11 | ||
716 | if (QX11Info::isPlatformX11() && !qEnvironmentVariableIsEmpty("DISPLAY")) { // don't rely on QX11Info::display() | 718 | if (QX11Info::isPlatformX11() && !qEnvironmentVariableIsEmpty("DISPLAY")) { // don't rely on QX11Info::display() | ||
717 | Display *disp = XOpenDisplay(nullptr); | 719 | KStartupInfo::sendFinish(id); | ||
dfaure: Similar code in kuniqueapplication.cpp has the comment "// use extra X connection".
Any idea… | |||||
Ah, I think I know why. That's because in kuniqueapplication, this happens right after fork(), and we're in the child, so we better use a different connection to X. I bet this got copy/pasted here for no good reason. dfaure: Ah, I think I know why. That's because in kuniqueapplication, this happens right after fork()… | |||||
718 | if (disp != nullptr) { | | |||
719 | KStartupInfo::sendFinishX(disp, id); | | |||
720 | XCloseDisplay(disp); | | |||
721 | } | | |||
722 | } | 720 | } | ||
723 | #endif | 721 | #endif | ||
724 | } | 722 | } | ||
725 | 723 | | |||
726 | void KStartupInfo::silenceStartup(bool silence) | 724 | void KStartupInfo::silenceStartup(bool silence) | ||
727 | { | 725 | { | ||
728 | KStartupInfoId id; | 726 | KStartupInfoId id; | ||
729 | id.initId(startupId()); | 727 | id.initId(startupId()); | ||
Show All 40 Lines | 766 | if (QX11Info::appTime() == 0 | |||
770 | QX11Info::setAppTime(timestamp); | 768 | QX11Info::setAppTime(timestamp); | ||
771 | } | 769 | } | ||
772 | } | 770 | } | ||
773 | } | 771 | } | ||
774 | #endif | 772 | #endif | ||
775 | } | 773 | } | ||
776 | } | 774 | } | ||
777 | 775 | | |||
776 | #ifndef KWINDOWSYSTEM_NO_DEPRECATED | ||||
778 | void KStartupInfo::setNewStartupId(QWidget *window, const QByteArray &startup_id) | 777 | void KStartupInfo::setNewStartupId(QWidget *window, const QByteArray &startup_id) | ||
779 | { | 778 | { | ||
780 | // Set the WA_NativeWindow attribute to force the creation of the QWindow. | 779 | // Set the WA_NativeWindow attribute to force the creation of the QWindow. | ||
781 | // Without this QWidget::windowHandle() returns 0. | 780 | // Without this QWidget::windowHandle() returns 0. | ||
782 | window->setAttribute(Qt::WA_NativeWindow, true); | 781 | window->setAttribute(Qt::WA_NativeWindow, true); | ||
783 | setNewStartupId(window->window()->windowHandle(), startup_id); | 782 | setNewStartupId(window->window()->windowHandle(), startup_id); | ||
784 | } | 783 | } | ||
784 | #endif | ||||
785 | 785 | | |||
786 | void KStartupInfo::setNewStartupId(QWindow *window, const QByteArray &startup_id) | 786 | void KStartupInfo::setNewStartupId(QWindow *window, const QByteArray &startup_id) | ||
787 | { | 787 | { | ||
788 | Q_ASSERT(window); | 788 | Q_ASSERT(window); | ||
789 | setStartupId(startup_id); | 789 | setStartupId(startup_id); | ||
790 | #if KWINDOWSYSTEM_HAVE_X11 | 790 | #if KWINDOWSYSTEM_HAVE_X11 | ||
791 | bool activate = true; | 791 | bool activate = true; | ||
792 | if (window != nullptr && QX11Info::isPlatformX11()) { | 792 | if (window != nullptr && QX11Info::isPlatformX11()) { | ||
▲ Show 20 Lines • Show All 882 Lines • Show Last 20 Lines |
Similar code in kuniqueapplication.cpp has the comment "// use extra X connection".
Any idea why? (git log doesn't help, commit e5b75f8409e7f in 2001)
Do we need to do that with xcb too?