Re: Licq-compilation on Mac OS X

"Erik Johansson" <[email protected]> Thu, 28 Jun 2007 22:57:23 +0200
Newsgroups gmane.network.licq.general
Message-ID <[email protected]>
2007/6/28, mariposa <[email protected]>:
> I don't think that I can provide any patches because my knowledge
> concerning this topic is rather limited ;)

With the attached patch (it's not pretty) it compiles, links and loads
(if you use the -p argument to licq). I can't see any text in the
contact list, but still, I'm impressed that it works as much as it
actually does. And that the Properties menu item is placed in the
correct menu.

Quit doesn't work, but who ever exits licq? :)

// Erik

-- 
Erik Johansson
http://ejohansson.se/
licq_macosx.patch (application/octet-stream, 9.2 KB)
Index: src/wharf.cpp
===================================================================
--- src/wharf.cpp	(revision 4979)
+++ src/wharf.cpp	(working copy)
@@ -47,7 +47,7 @@
 #include <QtGui/QPaintEvent>
 #include <QtGui/QCloseEvent>
 #include <QtGui/QToolTip>
-#include <QtGui/QX11Info>
+//#include <QtGui/QX11Info>
 #ifdef USE_KDE
 #include <kwin.h>
 #include <kpopupmenu.h>
@@ -59,6 +59,7 @@
 #include "licq_user.h"
 #include "ewidgets.h"
 
+#if 0
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
@@ -69,6 +70,7 @@
 #undef KeyRelease
 #undef FocusIn
 #undef FocusOut
+#endif
 
 //#define DEBUG_WHARF
 #define SYSTEM_TRAY_REQUEST_DOCK    0
@@ -85,12 +87,13 @@
   mainwin = _mainwin;
   menu = _menu;
 
-  setBackgroundMode(Qt::X11ParentRelative);
+//  setBackgroundMode(Qt::X11ParentRelative);
 }
 
 
 void IconManager::X11Init()
 {
+#if 0
   // set the hints
 #ifndef USE_KDE
   Display *dsp = x11Display();  // get the display
@@ -133,6 +136,7 @@
 #ifndef USE_KDE
   XWithdrawWindow(dsp, win, XScreenNumberOfScreen(DefaultScreenOfDisplay(dsp)));
 #endif
+#endif
 }
 
 
@@ -633,8 +637,9 @@
   m_bStatusInvisible = false;
   resize(22, 22);
   setMinimumSize(22, 22);
-  setBackgroundMode(Qt::X11ParentRelative);
+//  setBackgroundMode(Qt::X11ParentRelative);
 
+#if 0
 #ifdef USE_KDE
   KWin::setSystemTrayWindowFor( winId(), _mainwin ? _mainwin->topLevelWidget()->winId() : qt_xrootwin() );
   setBackgroundMode(Qt::X11ParentRelative);
@@ -663,6 +668,7 @@
   XSync(dsp, False);
 
 #endif
+#endif
   show();
 }
 
@@ -722,6 +728,7 @@
     p.drawPixmap((width()-m_statusIcon.width())/2, (height()-m_statusIcon.height())/2, m_statusIcon);
 }
 
+#if 0
 bool IconManager_KDEStyle::x11Event(XEvent *ev)
 {
   if ((ev->type == ReparentNotify))
@@ -732,6 +739,7 @@
   }
   return QWidget::x11Event(ev);
 }
+#endif
 
 void IconManager_KDEStyle::mousePressEvent( QMouseEvent *e )
 {
Index: src/licqgui.h
===================================================================
--- src/licqgui.h	(revision 4979)
+++ src/licqgui.h	(working copy)
@@ -45,12 +45,12 @@
   ~CLicqGui(void);
   int Run(CICQDaemon *);
   void Shutdown(void);
-  virtual bool x11EventFilter(XEvent *);
+  //virtual bool x11EventFilter(XEvent *);
 
   virtual void commitData(QSessionManager& sm);
   virtual void saveState(QSessionManager& sm);
 
-  bool grabKey(QString key);
+//  bool grabKey(QString key);
 
 protected:
   char *m_szSkin, *m_szIcons, *m_szExtendedIcons;
Index: src/userbox.cpp
===================================================================
--- src/userbox.cpp	(revision 4979)
+++ src/userbox.cpp	(working copy)
@@ -30,11 +30,11 @@
 #include <QtGui/QMouseEvent>
 #include <QtGui/QPainter>
 #include <QtGui/QTreeView>
-#include <QtGui/QX11Info>
+//#include <QtGui/QX11Info>
 
 // X
-#include <X11/Xutil.h>
-#undef Status
+//#include <X11/Xutil.h>
+//#undef Status
 
 // Licq
 #include "licq_icqd.h"
@@ -517,6 +517,7 @@
   setSelectionMode(NoSelection);
   header()->hide();
 
+#if 0
   char szClass[16];
   sprintf(szClass, "Floaty%d", floaties.size() + 1);
   XClassHint classhint;
@@ -530,6 +531,7 @@
   hints->flags = WindowGroupHint;
   XSetWMHints(x11Info().display(), winId(), hints);
   XFree(hints);
+#endif
 
   floaties.append(this);
 }
Index: src/licqgui.cpp
===================================================================
--- src/licqgui.cpp	(revision 4979)
+++ src/licqgui.cpp	(working copy)
@@ -29,7 +29,7 @@
 //Added by qt3to4:
 #include <Qt3Support/Q3CString>
 #include <QtCore/QTranslator>
-#include <QtGui/QX11Info>
+//#include <QtGui/QX11Info>
 #include "licqgui.h"
 #include <Qt/qtextcodec.h>
 #ifdef HAVE_LOCALE_H
@@ -360,6 +360,7 @@
 // -----------------------------------------------------------------------------
 // global accelerator stuff
 
+#if 0
 #include <X11/X.h>
 #include <X11/Xlib.h>
 #include <X11/keysym.h>
@@ -471,3 +472,4 @@
 
   return QApplication::x11EventFilter(e);
 }
+#endif
Index: src/usereventdlg.cpp
===================================================================
--- src/usereventdlg.cpp	(revision 4979)
+++ src/usereventdlg.cpp	(working copy)
@@ -105,8 +105,8 @@
 #include "support.h"
 #include "mledit.h"
 
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
+//#include <X11/Xlib.h>
+//#include <X11/Xutil.h>
 
 using std::pair;
 using std::make_pair;
@@ -453,6 +453,7 @@
 
 void UserEventTabDlg::flashTaskbar(bool _bFlash)
 {
+#if 0
   Display *dsp = x11Display();  // get the display
   WId win = winId(); // get the window
   XWMHints *hints; // hints
@@ -463,6 +464,7 @@
     hints->flags &= ~XUrgencyHint;
   XSetWMHints(dsp, win, hints); // set hints
   XFree(hints);
+#endif
 }
 
 void UserEventTabDlg::moveLeft()
@@ -588,6 +590,7 @@
 
 void UserEventCommon::FlashTaskbar(bool _bFlash)
 {
+#if 0
   Display *dsp = x11Display();  // get the display
   WId win = winId(); // get the window
   XWMHints *hints; // hints
@@ -598,6 +601,7 @@
     hints->flags &= ~XUrgencyHint;
   XSetWMHints(dsp, win, hints); // set hints
   XFree(hints);
+#endif
 }
 
 void UserEventCommon::setMsgWinSticky()
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision 4979)
+++ src/CMakeLists.txt	(working copy)
@@ -71,11 +71,12 @@
 set(LIBRARIES widgets ${LIBRARIES})
 
 if (WITH_KDE)
-  add_library(licq_kde4_gui MODULE ${Qt-GUI_SRCS})
+  add_library(licq_kde4_gui SHARED ${Qt-GUI_SRCS})
   target_link_libraries(licq_kde4_gui ${LIBRARIES})
   install(TARGETS licq_kde4_gui DESTINATION ${INSTALL_LIB_DIR}/licq)
 else (WITH_KDE)
   add_library(licq_qt4_gui MODULE ${Qt-GUI_SRCS})
   target_link_libraries(licq_qt4_gui ${LIBRARIES})
   install(TARGETS licq_qt4_gui DESTINATION ${INSTALL_LIB_DIR}/licq)
+  set_target_properties(licq_qt4_gui PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
 endif (WITH_KDE)
Index: src/mainwin.cpp
===================================================================
--- src/mainwin.cpp	(revision 4979)
+++ src/mainwin.cpp	(working copy)
@@ -53,7 +53,7 @@
 #include <QtGui/QMoveEvent>
 #include <QtGui/QResizeEvent>
 #include <QtGui/QDesktopWidget>
-#include <QtGui/QX11Info>
+//#include <QtGui/QX11Info>
 #include <Qt3Support/Q3PopupMenu>
 #include <QtGui/QHBoxLayout>
 #include <QtGui/QPixmap>
@@ -137,6 +137,7 @@
 
 #include "licq_qt-gui.conf.h"
 
+#if 0
 extern "C" {
 
 #include <X11/Xlib.h>
@@ -147,6 +148,7 @@
 #endif
 
 }
+#endif
 
 #include <map>
 #include <cctype>
@@ -341,7 +343,7 @@
   }
 }
 
-
+#if 0
 static XErrorHandler old_handler = 0;
 static int licq_xerrhandler(Display* dpy, XErrorEvent* err)
 {
@@ -355,7 +357,7 @@
 
   return (*old_handler)(dpy, err);
 }
-
+#endif 
 CMainWindow* gMainWindow = NULL;
 
 //-----CMainWindow::constructor-------------------------------------------------
@@ -375,10 +377,10 @@
   m_nProtoNum = 0;
 
   // Overwrite Qt's event handler
-  old_handler = XSetErrorHandler(licq_xerrhandler);
+  //old_handler = XSetErrorHandler(licq_xerrhandler);
 
   m_bDisableDockIcon = bDisableDockIcon;
-
+#if 0
   // set up appicon and docking, code supplied by Mark Deneed
   if (!m_bDisableDockIcon)
   {
@@ -391,7 +393,7 @@
     XSetWMHints(dsp, win, hints);  // set the window hints for WM to use.
     XFree( hints );
   }
-
+#endif
   connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(slot_aboutToQuit()));
 
   // read in info from file
@@ -544,12 +546,14 @@
   licqConf.ReadBool("AutoPopup", m_bAutoPopup, false);
   licqConf.ReadStr("MsgPopupKey", szTemp, "none");
 
+#if 0
   m_MsgAutopopupKey = QString::fromLatin1(szTemp);
   if (m_MsgAutopopupKey != "none")
   {
     if(!static_cast<CLicqGui*>(qApp)->grabKey(m_MsgAutopopupKey))
        gLog.Error("%sUnknown popup key: %s\n", L_INITxSTR, szTemp);
   }
+#endif
 
   m_nCurrentGroup = gUserManager.DefaultGroup();
   m_nGroupType = GROUPS_USER;
Index: src/support.cpp
===================================================================
--- src/support.cpp	(revision 4979)
+++ src/support.cpp	(working copy)
@@ -38,6 +38,7 @@
   gLog.Info("Setting Sticky state of window 0x%x to %d.\n",
     (unsigned int) win, _bStick);
 
+#if 0
 #ifdef USE_KDE
   KWin::setOnAllDesktops(win, _bStick);
 #else
@@ -77,4 +78,5 @@
   // close display
   XCloseDisplay(display);
 #endif //USE_KDE
+#endif
 }
Index: src/wharf.h
===================================================================
--- src/wharf.h	(revision 4979)
+++ src/wharf.h	(working copy)
@@ -133,7 +133,7 @@
   virtual void mousePressEvent (QMouseEvent *);
   virtual void timerEvent(QTimerEvent*);
   virtual void paintEvent (QPaintEvent *);
-  virtual bool x11Event(XEvent *);
+//  virtual bool x11Event(XEvent *);
 
   void updateTooltip();
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 4979)
+++ CMakeLists.txt	(working copy)
@@ -43,7 +43,7 @@
   set(X11_LIBRARIES ${X11_LIBRARIES} Xss)
   set(USE_SCRNSAVER 1)
 endif (HAVE_SCRNSAVER_H AND HAVE_LIBXSS)
-set(LIBRARIES ${LIBRARIES} ${X11_LIBRARIES})
+#set(LIBRARIES ${LIBRARIES} ${X11_LIBRARIES})
 
 
 # Check for Qt4
@@ -53,7 +53,7 @@
 find_package(Qt4 REQUIRED)
 add_definitions(${QT_DEFINITIONS} -DQT3_SUPPORT)
 include_directories(${QT_INCLUDE_DIR})
-set(LIBRARIES ${LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QT3SUPPORT_LIBRARY})
+set(LIBRARIES ${LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QT3SUPPORT_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTNETWORK_LIBRARY})
 
 
 # Optional, check for KDE4