Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37038348
en ru br
Репозитории ALT
S:4.8.7-alt25
5.1: 4.6.3-alt1.M51.1
4.1: 4.4.3-alt1.M41.1
4.0: 4.3.4-alt5.M40.1
3.0: 4.0.1-alt1
+updates:4.0.1-alt2
+backports:4.2.3-alt7.1.M30
www.altlinux.org/Changes

Группа :: Система/Библиотеки
Пакет: qt4

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: 9103-qt-gui-fix_shortcuts.patch
Скачать


diff -Naur qt-orig/src/gui/kernel/qkeymapper_x11.cpp qt/src/gui/kernel/qkeymapper_x11.cpp
--- qt-orig/src/gui/kernel/qkeymapper_x11.cpp	2010-07-01 07:13:35 +0400
+++ qt/src/gui/kernel/qkeymapper_x11.cpp	2010-07-01 07:19:35 +0400
@@ -290,6 +290,7 @@
         return QList<int>();
 
     QList<int> result;
+    QList<int> codes;
 
     // translate sym -> code
     Qt::KeyboardModifiers baseModifiers = 0;
@@ -306,6 +307,7 @@
     if (baseCode && baseCode < 0xfffe)
         baseCode = QChar(baseCode).toUpper().unicode();
     result += (baseCode | baseModifiers);
+    codes += baseCode;
 
     int pos1Bits[MaxBits];
     int num1Bits = 0;
@@ -355,11 +357,41 @@
             text = QString();
         }
 
-        if (code == baseCode)
+        if (codes.contains(code))
+            continue;
+
+        result += (code | modifiers);
+        codes += code;
+    }
+
+    XkbDescRec *xkb = XkbGetMap(X11->display, XkbKeySymsMask|XkbKeyTypesMask, XkbUseCoreKbd);
+    KeySym *entry = XkbKeySymsPtr(xkb, xkeycode);
+    int total_syms = XkbKeyNumSyms (xkb, xkeycode);
+    int i = 0;
+
+    for (i=0; i < total_syms; i++) {
+        // translate sym -> code
+        Qt::KeyboardModifiers modifiers = 0;
+        int code = -1;
+        chars.clear();
+        count = 0;
+        // mask out the modifiers needed to translate keycode
+        text = translateKeySym(entry[i], xmodifiers, code, modifiers, chars, count);
+        if (code == -1) {
+            if (text.isEmpty())
+                continue;
+            code = text.at(0).unicode();
+        }
+
+        if (code && code < 0xfffe)
+            code = QChar(code).toUpper().unicode();
+        if (codes.contains(code) || !QChar(code).isLetter())
             continue;
 
         result += (code | modifiers);
+        codes += code;
     }
+    XkbFreeKeyboard(xkb, XkbAllComponentsMask, True);
 
 #if 0
     qDebug() << "possibleKeysXKB()" << hex << result;
diff -Naur qt-orig/src/gui/widgets/qmenubar.cpp qt/src/gui/widgets/qmenubar.cpp
--- qt-orig/src/gui/widgets/qmenubar.cpp	2010-05-22 18:12:50 +0400
+++ qt/src/gui/widgets/qmenubar.cpp	2010-07-01 07:19:35 +0400
@@ -522,6 +522,8 @@
 //         emit q->highlighted(action);
 }
 
+#include <private/qkeymapper_p.h>
+
 
 void QMenuBarPrivate::_q_actionTriggered()
 {
@@ -1201,6 +1203,10 @@
         QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0;
         {
             QChar c = e->text()[0].toUpper();
+            QList<int> possibleKeys = qt_keymapper_private()->possibleKeys(e);
+            if(!possibleKeys.contains(c.unicode()))
+                possibleKeys += c.unicode();
+
             for(int i = 0; i < d->actions.size(); ++i) {
                 if (d->actionRects.at(i).isNull())
                     continue;
@@ -1209,14 +1215,20 @@
                 if(!s.isEmpty()) {
                     int ampersand = s.indexOf(QLatin1Char('&'));
                     if(ampersand >= 0) {
-                        if(s[ampersand+1].toUpper() == c) {
-                            clashCount++;
-                            if(!first)
-                                first = act;
-                            if(act == d->currentAction)
-                                currentSelected = act;
-                            else if (!firstAfterCurrent && currentSelected)
-                                firstAfterCurrent = act;
+                        QListIterator<int> k(possibleKeys);
+                        while (k.hasNext()) {
+                            int key_e = k.next();
+
+                            if(s[ampersand+1].toUpper().unicode() == key_e) {
+                                clashCount++;
+                                if(!first)
+                                    first = act;
+                                if(act == d->currentAction)
+                                    currentSelected = act;
+                                else if (!firstAfterCurrent && currentSelected)
+                                    firstAfterCurrent = act;
+                                break;
+                            }
                         }
                     }
                 }
diff -Naur qt-orig/src/gui/widgets/qmenu.cpp qt/src/gui/widgets/qmenu.cpp
--- qt-orig/src/gui/widgets/qmenu.cpp	2010-07-01 07:13:35 +0400
+++ qt/src/gui/widgets/qmenu.cpp	2010-07-01 07:19:35 +0400
@@ -82,6 +82,7 @@
 #   include <private/qt_cocoa_helpers_mac_p.h>
 #endif
 
+#include <private/qkeymapper_p.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -2719,20 +2720,31 @@
                 int clashCount = 0;
                 QAction *first = 0, *currentSelected = 0, *firstAfterCurrent = 0;
                 QChar c = e->text().at(0).toUpper();
+
+                QList<int> possibleKeys = qt_keymapper_private()->possibleKeys(e);
+                if(!possibleKeys.contains(c.unicode()))
+                    possibleKeys += c.unicode(); 
+
                 for(int i = 0; i < d->actions.size(); ++i) {
                     if (d->actionRects.at(i).isNull())
                         continue;
                     QAction *act = d->actions.at(i);
                     QKeySequence sequence = QKeySequence::mnemonic(act->text());
                     int key = sequence[0] & 0xffff;
-                    if (key == c.unicode()) {
-                        clashCount++;
-                        if (!first)
-                            first = act;
-                        if (act == d->currentAction)
-                            currentSelected = act;
-                        else if (!firstAfterCurrent && currentSelected)
-                            firstAfterCurrent = act;
+
+                    QListIterator<int> k(possibleKeys);
+                    while (k.hasNext()) {
+                        int key_e = k.next();
+                        if (key == key_e) {
+                            clashCount++;
+                            if (!first)
+                                first = act;
+                            if (act == d->currentAction)
+                                currentSelected = act;
+                            else if (!firstAfterCurrent && currentSelected)
+                                firstAfterCurrent = act;
+                            break;
+                        }
                     }
                 }
                 if (clashCount == 1)
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin