Hi, thanks for the tip with the QTimer. It works now for me for tabbed chatting as well as non-tabbed.
Jon: Could you have a look, if this is ok for inclusion? thanks philipp PS: This time with the patch attached... -- A byte walks into a bar and orders a pint. Bartender asks him "What's wrong?" Byte says "Parity error." Bartender nods and says "Yeah, I thought you looked a bit off."
Index: src/mainwin.h =================================================================== --- src/mainwin.h (revision 4433) +++ src/mainwin.h (working copy) @@ -153,6 +153,10 @@ m_bSortColumnAscending, m_bAppendLineBreak, m_bFlashTaskbar, +#ifndef USE_KDE + m_bMainWinSticky, + m_bMsgWinSticky, +#endif m_bShowUserIcons; QString m_MsgAutopopupKey; @@ -383,6 +387,9 @@ const QString& filename, const QString& description); void sendChatRequest(const char* szId, unsigned long nPPID); void addUser(const char* szId, unsigned long nPPID); +#ifndef USE_KDE + void changeMainWinSticky(bool _bStick); +#endif signals: void changeDockStatus(unsigned short); Index: src/usereventdlg.h =================================================================== --- src/usereventdlg.h (revision 4433) +++ src/usereventdlg.h (working copy) @@ -108,11 +108,21 @@ void clearEvents(QWidget *tab); void flashTaskbar(bool _bFlash); +#ifndef USE_KDE + void changeMsgWinSticky(bool _bStick); +#endif + public slots: void slot_currentChanged(QWidget *tab); void moveLeft(); void moveRight(); +protected slots: +#ifndef USE_KDE + void setMsgWinSticky(); +#endif + + signals: void signal_done(); }; @@ -136,6 +146,9 @@ bool FindUserInConvo(char *); void AddEventTag(unsigned long n) { if (n) m_lnEventTag.push_back(n); } void gotTyping(unsigned short); +#ifndef USE_KDE + void changeMsgWinSticky(bool _bStick); +#endif enum type { UC_MESSAGE, @@ -186,6 +199,9 @@ void slot_usermenu() { gMainWindow->SetUserMenuUser(m_szId, m_nPPID); } void slot_security(); void slot_setEncoding(int encodingMib); +#ifndef USE_KDE + void setMsgWinSticky(); +#endif signals: void finished(const char *, unsigned long); Index: src/usereventdlg.cpp =================================================================== --- src/usereventdlg.cpp (revision 4433) +++ src/usereventdlg.cpp (working copy) @@ -217,6 +217,17 @@ mainWidget = new QWidget(this); top_lay->addWidget(mainWidget); + +#ifndef USE_KDE + // Check if we want the window sticky + if (!m->m_bTabbedChatting && m->m_bMsgWinSticky) + { + gLog.Info("Starting Timer UserEventCommon::UserEventCommon changeMsgWinSticky\n"); + QTimer *timer = new QTimer( this ); + connect( timer, SIGNAL(timeout()), this, SLOT(setMsgWinSticky()) ); + timer->start( 100, TRUE ); // 100 milliseconds single-shot timer + } +#endif } void UserEventCommon::slot_connectsignal() @@ -495,6 +506,63 @@ #endif // KDE_VERSION #endif // USE_KDE +#ifndef USE_KDE +void UserEventTabDlg::setMsgWinSticky() +{ + return changeMsgWinSticky(true); +} + +void UserEventTabDlg::changeMsgWinSticky(bool _bStick) +{ + // Philipp Kolmann: 2006-06-06 + // Code from + // http://lists.trolltech.com/qt-interest/2006-01/thread00352-0.html + // provided by Bob Shaffer II [EMAIL PROTECTED] + + gLog.Info("Setting UserEventTabDlg Window Sticky state to %d.\n", _bStick); + + // connect to display + Display *display = XOpenDisplay(""); + // work with this window + Window win = winId(); + gLog.Info("UserEventTabDlg-WinID: 0x%x\n", (unsigned int) win); + + // root window receives these events + Window rootwinid = DefaultRootWindow(display); + + // initialize necessary atoms + Atom StateAtom = XInternAtom(display, "_WIN_STATE", false); + Atom LayerAtom = XInternAtom(display, "_WIN_LAYER", false); + + // construct and send (un)stick event + XEvent xev; + xev.type = ClientMessage; + xev.xclient.type = ClientMessage; + xev.xclient.window = win; + xev.xclient.message_type = StateAtom; + xev.xclient.format = 32; + xev.xclient.data.l[0] = (1<<0); + xev.xclient.data.l[1] = (_bStick?(1<<0):0); + XSendEvent(display, rootwinid, False, SubstructureRedirectMask | + SubstructureNotifyMask, &xev); + + // construct and send layer setting event + // fyi: layers are 0=desktop 2=below 4=normal 6=above 8=dock 10=abovedock + xev.xclient.type = ClientMessage; + xev.xclient.window = win; + xev.xclient.message_type = LayerAtom; + xev.xclient.format = 32; + // Put it to 4=normal for now + xev.xclient.data.l[0] = 4; + XSendEvent(display, rootwinid, False, SubstructureRedirectMask | + SubstructureNotifyMask, &xev); + + // close display + XCloseDisplay(display); + +} +#endif + // ----------------------------------------------------------------------------- void UserEventCommon::slot_setEncoding(int encodingMib) { @@ -600,6 +668,62 @@ XFree(hints); } +#ifndef USE_KDE +void UserEventCommon::setMsgWinSticky() +{ + return changeMsgWinSticky(true); +} + +void UserEventCommon::changeMsgWinSticky(bool _bStick) +{ + // Philipp Kolmann: 2006-06-06 + // Code from + // http://lists.trolltech.com/qt-interest/2006-01/thread00352-0.html + // provided by Bob Shaffer II [EMAIL PROTECTED] + gLog.Info("Setting UserEventCommon Window Sticky state to %d.\n", _bStick); + + // connect to display + Display *display = XOpenDisplay(""); + // work with this window + Window win = winId(); + + gLog.Info("WinId: 0x%x\n", (unsigned int) win); + + // root window receives these events + Window rootwinid = DefaultRootWindow(display); + + // initialize necessary atoms + Atom StateAtom = XInternAtom(display, "_WIN_STATE", false); + Atom LayerAtom = XInternAtom(display, "_WIN_LAYER", false); + + // construct and send (un)stick event + XEvent xev; + xev.type = ClientMessage; + xev.xclient.type = ClientMessage; + xev.xclient.window = win; + xev.xclient.message_type = StateAtom; + xev.xclient.format = 32; + xev.xclient.data.l[0] = (1<<0); + xev.xclient.data.l[1] = (_bStick?(1<<0):0); + XSendEvent(display, rootwinid, False, SubstructureRedirectMask | + SubstructureNotifyMask, &xev); + + // construct and send layer setting event + // fyi: layers are 0=desktop 2=below 4=normal 6=above 8=dock 10=abovedock + xev.xclient.type = ClientMessage; + xev.xclient.window = win; + xev.xclient.message_type = LayerAtom; + xev.xclient.format = 32; + // Put it to 4=normal for now + xev.xclient.data.l[0] = 4; + XSendEvent(display, rootwinid, False, SubstructureRedirectMask | + SubstructureNotifyMask, &xev); + + // close display + XCloseDisplay(display); +} +#endif + void UserEventCommon::slot_updatetime() { QDateTime t; Index: src/optionsdlg.cpp =================================================================== --- src/optionsdlg.cpp (revision 4433) +++ src/optionsdlg.cpp (working copy) @@ -242,6 +242,10 @@ chkFlashTaskbar->setChecked(mainwin->m_bFlashTaskbar); chkAutoSendThroughServer->setChecked(mainwin->m_bAutoSendThroughServer); chkEnableMainwinMouseMovement->setChecked(mainwin->m_bEnableMainwinMouseMovement); +#ifndef USE_KDE + chkMainWinSticky->setChecked(mainwin->m_bMainWinSticky); + chkMsgWinSticky->setChecked(mainwin->m_bMsgWinSticky); +#endif popEmail->setChecked(mainwin->m_bPopEmail); popPhone->setChecked(mainwin->m_bPopPhone); popFax->setChecked(mainwin->m_bPopFax); @@ -537,6 +541,12 @@ mainwin->m_bAutoSendThroughServer = chkAutoSendThroughServer->isChecked(); mainwin->m_bEnableMainwinMouseMovement = chkEnableMainwinMouseMovement->isChecked(); +#ifndef USE_KDE + mainwin->m_bMainWinSticky = chkMainWinSticky->isChecked(); + mainwin->changeMainWinSticky(chkMainWinSticky->isChecked()); + mainwin->m_bMsgWinSticky = chkMsgWinSticky->isChecked(); +#endif + mainwin->m_bPopEmail= popEmail->isChecked(); mainwin->m_bPopPhone= popPhone->isChecked(); mainwin->m_bPopFax= popFax->isChecked(); @@ -834,6 +844,14 @@ chkSendTN = new QCheckBox(tr("Send typing notifications"), boxMainWin); QWhatsThis::add(chkSendTN, tr("Send a notification to the user so they can see when you are typing a message to them")); +#ifndef USE_KDE + chkMainWinSticky = new QCheckBox(tr("Stick Main Window to all Desktops"), boxMainWin); + QWhatsThis::add(chkMainWinSticky, tr("Sets the sticky Bit of the Main window so it will stay with you on all desktops")); + + chkMsgWinSticky = new QCheckBox(tr("Stick Msg Window to all Desktops"), boxMainWin); + QWhatsThis::add(chkMsgWinSticky, tr("Sets the sticky Bit of every new Msg window so it will stay with you on all desktops")); +#endif + l = new QVBoxLayout(l); boxLocale = new QGroupBox(1, Horizontal, tr("Localization"), w); lblDefaultEncoding = new QLabel(tr("Default Encoding:"), boxLocale); Index: src/mainwin.cpp =================================================================== --- src/mainwin.cpp (revision 4433) +++ src/mainwin.cpp (working copy) @@ -445,6 +445,10 @@ licqConf.ReadBool("ChatAppendLinebreak", m_bAppendLineBreak, false); licqConf.ReadBool("FlashTaskbar", m_bFlashTaskbar, true); licqConf.ReadBool("ShowUserIcons", m_bShowUserIcons, true); +#ifndef USE_KDE + licqConf.ReadBool("MainWinSticky", m_bMainWinSticky, false); + licqConf.ReadBool("MsgWinSticky", m_bMsgWinSticky, false); +#endif licqConf.ReadStr("ReceiveMessageColor", szTemp, "red"); m_colorRcv = QColor(szTemp); @@ -817,6 +821,14 @@ slot_protocolPlugin((*_ppit)->PPID()); } FOR_EACH_PROTO_PLUGIN_END + +#ifndef USE_KDE + // Check if MainWin should be sticky + if (m_bMainWinSticky) + { + changeMainWinSticky(true); + } +#endif // automatically logon if requested in conf file if (m_nAutoLogon > 0) @@ -2898,9 +2910,19 @@ { userEventTabDlg->addTab(e); userEventTabDlg->show(); +#ifndef USE_KDE + // Check if we want the window sticky + if (m_bMsgWinSticky) + { + gLog.Info("Starting Timer CMainWindow::callFunction setMsgWinSticky\n"); + QTimer *timer = new QTimer( userEventTabDlg ); + connect( timer, SIGNAL(timeout()), userEventTabDlg, SLOT(setMsgWinSticky())); + timer->start( 100, TRUE ); // 100 milliseconds single-shot timer + } +#endif // USE_KDE } else -#endif +#endif //QT_VERSION e->show(); // there might be more than one send window open @@ -3621,6 +3643,10 @@ licqConf.WriteBool("EnableMainwinMouseMovement", m_bEnableMainwinMouseMovement); licqConf.WriteBool("FlashTaskbar", m_bFlashTaskbar); licqConf.WriteBool("ShowUserIcons", m_bShowUserIcons); +#ifndef USE_KDE + licqConf.WriteBool("MainWinSticky", m_bMainWinSticky); + licqConf.WriteBool("MsgWinSticky", m_bMsgWinSticky); +#endif licqConf.WriteNum("ChatMessageStyle", m_nMsgStyle); licqConf.WriteBool("ChatAppendLinebreak", m_bAppendLineBreak); @@ -5077,4 +5103,57 @@ // ----------------------------------------------------------------------------- +#ifndef USE_KDE +void CMainWindow::changeMainWinSticky(bool _bStick) +{ + // Philipp Kolmann: 2006-06-06 + // Code from + // http://lists.trolltech.com/qt-interest/2006-01/thread00352-0.html + // provided by Bob Shaffer II [EMAIL PROTECTED] + + gLog.Info("Setting Main Window Sticky state to %d.\n", _bStick); + + // connect to display + Display *display = XOpenDisplay(""); + // work with this window + Window win = winId(); + gLog.Info("MainWinId: 0x%x\n", (unsigned int) win); + + // root window receives these events + Window rootwinid = DefaultRootWindow(display); + + // initialize necessary atoms + Atom StateAtom = XInternAtom(display, "_WIN_STATE", false); + Atom LayerAtom = XInternAtom(display, "_WIN_LAYER", false); + + // construct and send (un)stick event + XEvent xev; + xev.type = ClientMessage; + xev.xclient.type = ClientMessage; + xev.xclient.window = win; + xev.xclient.message_type = StateAtom; + xev.xclient.format = 32; + xev.xclient.data.l[0] = (1<<0); + xev.xclient.data.l[1] = (_bStick?(1<<0):0); + XSendEvent(display, rootwinid, False, SubstructureRedirectMask | + SubstructureNotifyMask, &xev); + + // construct and send layer setting event + // fyi: layers are 0=desktop 2=below 4=normal 6=above 8=dock 10=abovedock + xev.xclient.type = ClientMessage; + xev.xclient.window = win; + xev.xclient.message_type = LayerAtom; + xev.xclient.format = 32; + // Put it to 4=normal for now + xev.xclient.data.l[0] = 4; + XSendEvent(display, rootwinid, False, SubstructureRedirectMask | + SubstructureNotifyMask, &xev); + + // close display + XCloseDisplay(display); +} +#endif + +// ----------------------------------------------------------------------------- + #include "mainwin.moc" Index: src/optionsdlg.h =================================================================== --- src/optionsdlg.h (revision 4433) +++ src/optionsdlg.h (working copy) @@ -92,6 +92,9 @@ *chkAlwaysShowONU, *chkScrollBar, *chkShowExtIcons, *chkSysBack, *chkSendFromClipboard, *chkMsgChatView, *chkAutoPosReplyWin, *chkFlashTaskbar, *chkAutoSendThroughServer, *chkTabbedChatting, +#ifndef USE_KDE + *chkMainWinSticky, *chkMsgWinSticky, +#endif *chkEnableMainwinMouseMovement, *chkShowHistory, *chkSendTN; QRadioButton *rdbDockDefault, *rdbDockThemed, *rdbDockSmall; QComboBox *cmbDockTheme, *cmbSortBy;
_______________________________________________ Licq-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/licq-devel