File: no_jintellitype.diff

package info (click to toggle)
zekr 1.1.0%2Brepack-2.1
  • links: PTS, VCS
  • area: non-free
  • in suites: stretch
  • size: 8,544 kB
  • ctags: 4,170
  • sloc: java: 24,442; xml: 12,606; sh: 205; makefile: 13
file content (120 lines) | stat: -rw-r--r-- 4,692 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Description: JIntellitype API only works on Windows.
Author: أحمد المحمودي (Ahmed El-Mahmoudy) <aelmahmoudy@sabily.org>
Forwarded: not-needed
--- a/src/net/sf/zekr/ui/WindowsNativeKeyboardListener.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *               In the name of Allah
- * This file is part of The Zekr Project. Use is subject to
- * license terms.
- *
- * Author:         Mohsen Saboorian
- * Start Date:     July 5, 2012
- */
-package net.sf.zekr.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-
-import net.sf.zekr.common.config.KeyboardAction;
-import net.sf.zekr.common.config.KeyboardShortcut;
-import net.sf.zekr.engine.log.Logger;
-
-import org.eclipse.swt.widgets.Display;
-
-import com.melloware.jintellitype.HotkeyListener;
-import com.melloware.jintellitype.IntellitypeListener;
-import com.melloware.jintellitype.JIntellitype;
-
-/**
- * @author Mohsen Saboorian
- */
-public class WindowsNativeKeyboardListener implements NativeKeyboardListener {
-   private Logger logger = Logger.getLogger(WindowsNativeKeyboardListener.class);
-
-   private List<KeyboardAction> superGlobalActionList = new ArrayList<KeyboardAction>();
-
-   @Override
-   public void install(final Display display, final QuranFormController qfc, KeyboardShortcut shortcut) {
-      JIntellitype jIntellitype = null;
-      try {
-         jIntellitype = JIntellitype.getInstance();
-      } catch (Exception e) {
-         logger.error("Error instantiating JIntellitype: " + e.toString());
-         return;
-      }
-
-      for (Entry<String, Integer> e : shortcut.getActionToKey().entrySet()) {
-         List<KeyboardAction> al = shortcut.getKeyActionList(e.getValue());
-         for (KeyboardAction keyboardAction : al) {
-            if (keyboardAction.superGlobal) {
-               String keyStr = KeyboardShortcut.keyCodeToString(keyboardAction.key);
-               logger.debug(String.format("Registering super global shortcut for %s: %s", keyboardAction, keyStr));
-               jIntellitype.registerHotKey(superGlobalActionList.size(), keyStr);
-               superGlobalActionList.add(keyboardAction);
-            }
-         }
-      }
-
-      // install super global listeners
-      jIntellitype.addHotKeyListener(new HotkeyListener() {
-         @Override
-         public void onHotKey(int identifier) {
-            if (identifier < superGlobalActionList.size()) {
-               KeyboardAction action = superGlobalActionList.get(identifier);
-               logger.debug(String.format("Hotkey detected. id: %s, action: ", identifier, action.action));
-               qfc.executeAction(action.action);
-            }
-         }
-      });
-
-      // install media player listeners
-      jIntellitype.addIntellitypeListener(new IntellitypeListener() {
-         @Override
-         public void onIntellitype(final int command) {
-            switch (command) {
-            // volume is usually handled by OS, so better not to handle it again inside Zekr
-            /*case JIntellitype.APPCOMMAND_VOLUME_UP:
-            case JIntellitype.APPCOMMAND_VOLUME_DOWN:
-            case JIntellitype.APPCOMMAND_VOLUME_MUTE:*/
-
-            case JIntellitype.APPCOMMAND_MEDIA_PREVIOUSTRACK:
-            case JIntellitype.APPCOMMAND_MEDIA_NEXTTRACK:
-            case JIntellitype.APPCOMMAND_MEDIA_STOP:
-            case JIntellitype.APPCOMMAND_MEDIA_PLAY_PAUSE:
-               display.asyncExec(new Runnable() {
-                  @Override
-                  public void run() {
-                     if (command == JIntellitype.APPCOMMAND_MEDIA_PREVIOUSTRACK) {
-                        qfc.playerPrev();
-                     } else if (command == JIntellitype.APPCOMMAND_MEDIA_NEXTTRACK) {
-                        qfc.playerNext();
-                     } else if (command == JIntellitype.APPCOMMAND_MEDIA_STOP) {
-                        qfc.playerStop();
-                     } else if (command == JIntellitype.APPCOMMAND_MEDIA_PLAY_PAUSE) {
-                        qfc.playerTogglePlayPause();
-                     }
-                  }
-               });
-               break;
-            default:
-               break;
-            }
-         }
-      });
-   }
-
-   @Override
-   public void uninstall() {
-      JIntellitype jIntellitype;
-      try {
-         jIntellitype = JIntellitype.getInstance();
-         jIntellitype.cleanUp();
-      } catch (Exception e) {
-         logger.error("Error instanciating JIntellitype: " + e.toString());
-         return;
-      }
-   }
-}