I forgot to say that some credits also go to this guy:
http://code.google.com/p/shortcutrecorder/issues/detail?id=31

About the compilation error at 50%, just add the following lines:
#ifdef __APPLE__
#include <arpa/nameser_compat.h>
#endif

on top of file "discovery.cpp".

Fabio



Le 6 déc. 2009 à 11:52, Fabio a écrit :

Jon Connell Said:
Anyway, now I'm stuffed:

[ 17%] Building CXX object kdeui/CMakeFiles/kdeui.dir/util/ kkeyserver_mac.o /sw64/src/fink.build/kdelibs4-mac-4.2.4-2/kdelibs-4.2.4/kdeui/util/ kkeyserver_mac.cpp:

In function ‘void KKeyServer::updateScancodes()’:
/sw64/src/fink.build/kdelibs4-mac-4.2.4-2/kdelibs-4.2.4/kdeui/util/ kkeyserver_mac.cpp:72:

error: ‘KLGetCurrentKeyboardLayout’ was not declared in this scope
/sw64/src/fink.build/kdelibs4-mac-4.2.4-2/kdelibs-4.2.4/kdeui/util/ kkeyserver_mac.cpp:78:

error: ‘KLGetKeyboardLayoutProperty’ was not declared in this scope
/sw64/src/fink.build/kdelibs4-mac-4.2.4-2/kdelibs-4.2.4/kdeui/util/ kkeyserver_mac.cpp:89:

error: ‘KeyTranslate’ was not declared in this scope

Has that been removed in 10.6?


Hello,

I faced the same problem. Apparently, this has been removed in 10.6. And using the 10.5 sdk doesn't help (for some reason). I made a patch for this, and now kkeyserver_mac.cpp is compiling. But if someone can review it, that would be great.

Anyways, at 50% of compilation we have yet another error:

discovery.cpp: In member function ‘bool KPAC::Discovery::checkDomain () const’:
discovery.cpp:96: error: ‘HEADER’ does not name a type
discovery.cpp:97: error: ‘PACKETSZ’ was not declared in this scope
discovery.cpp:99: error: ‘C_IN’ was not declared in this scope
discovery.cpp:99: error: ‘T_SOA’ was not declared in this scope
discovery.cpp:100: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘buf’ discovery.cpp:100: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘buf’ discovery.cpp:101: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘header’ discovery.cpp:102: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘header’ discovery.cpp:102: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘header’ discovery.cpp:102: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘header’ discovery.cpp:102: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘header’ discovery.cpp:103: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘buf’ discovery.cpp:103: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘header’ discovery.cpp:104: error: ‘union KPAC::Discovery::checkDomain() const::<anonymous>’ has no member named ‘buf’
discovery.cpp:106: error: ‘QFIXEDSZ’ was not declared in this scope
discovery.cpp:111: error: ‘GETSHORT’ was not declared in this scope


Fabio



******----- Patch for kkeyserver_mac.cpp ---------- *****

--- kkeyserver_mac_old.cpp      2008-05-21 13:08:51.000000000 +0200
+++ kkeyserver_mac.cpp  2009-12-06 11:46:08.000000000 +0100
@@ -30,6 +30,9 @@
 #include <QMultiMap>
 #include <Carbon/Carbon.h>

+#define MACOS105 (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= MAC_OS_X_VERSION_10_5)
+
+
 namespace KKeyServer {
     struct TransKey {
         int qt_code;
@@ -65,21 +68,63 @@

     static QMultiMap<int, uint> scancodes;
     static long lastLayoutID = -1;
+#if MACOS105
+       static TISInputSourceRef lastLayout = NULL;
+#else
     static KeyboardLayoutRef lastLayout = NULL;
-
+#endif
+       
     void updateScancodes() {
+#if MACOS105
+               TISInputSourceRef layout;
+               if (!(layout=TISCopyCurrentKeyboardLayoutInputSource())){
+            kWarning() << "Error retrieving current layout";
+        }
+#else
         KeyboardLayoutRef layout;
         if (KLGetCurrentKeyboardLayout(&layout) != noErr) {
             kWarning() << "Error retrieving current layout";
         }
+#endif
         if (layout != lastLayout) {
-#ifndef NDEBUG
+#ifndef NDEBUG && !MACOS105
             void *name;
KLGetKeyboardLayoutProperty(layout, kKLName, const_cast<const void**>(&name)); kDebug() << "Layout changed to: " << CFStringGetCStringPtr((CFStringRef) name, 0);
 #endif
             lastLayout = layout;
             scancodes.clear();
+#if MACOS105
+                       CFDataRef               uchrDataRef;
+ uchrDataRef=(CFDataRef)TISGetInputSourceProperty(layout, kTISPropertyUnicodeKeyLayoutData);
+                       if (!uchrDataRef){
+                kWarning() << "Couldn't load active keyboard layout";
+            }
+                       else {
+ UCKeyboardLayout *uchrData= (UCKeyboardLayout*) CFDataGetBytePtr(uchrDataRef);
+                               OSStatus                        err;
+                               UniCharCount            length = 4, realLength;
+                               UniChar                         chars[4];
+                               for (int i = 0; i < 128; i++) {
+                    UInt32                     tmpState = 0;
+                                       err=UCKeyTranslate(uchrData,
+                                                                          i,
+                                                                          
kUCKeyActionDisplay,
+                                                                          0,
+                                                                          
LMGetKbdType(),
+                                                                          
kUCKeyTranslateNoDeadKeysBit,
+                                                                          
&tmpState,
+                                                                          
length,
+                                                                          
&realLength,
+                                                                          chars
+                                                                          );
+                                       UInt32                  
*chr=(UInt32*)chars;
+                                       if (err==noErr && 
*chr!=kFunctionKeyCharCode) {
+                        scancodes.insert(*chr, i);
+                    }
+                               }
+                       }
+#else
             void *kchr;
if (KLGetKeyboardLayoutProperty(layout, kKLKCHRData, const_cast<const void**>(&kchr)) != noErr) {
                 kWarning() << "Couldn't load active keyboard layout";
@@ -92,6 +137,7 @@
                     }
                 }
             }
+#endif
         }
     }


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Fink-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-users

Reply via email to