|
1079 | 1079 | } |
1080 | 1080 | }); |
1081 | 1081 |
|
1082 | | - var hasCustomWallpaper = !!self._getCustomWallpaper(); |
1083 | | - var desktopMenu = [{ |
1084 | | - title: 'Refresh', |
1085 | | - cmd: 'refresh', |
1086 | | - uiIcon: 'ui-icon-refresh' |
1087 | | - } , { |
1088 | | - title: '----' |
1089 | | - } , { |
1090 | | - title: 'Custom Wallpaper', |
1091 | | - cmd: 'custom-wallpaper', |
1092 | | - uiIcon: 'ui-icon-image' |
1093 | | - }]; |
1094 | | - |
1095 | | - if (hasCustomWallpaper) { |
1096 | | - desktopMenu.push({ |
1097 | | - title: 'Remove Custom Wallpaper', |
1098 | | - cmd: 'remove-custom-wallpaper', |
1099 | | - uiIcon: 'ui-icon-trash' |
1100 | | - }); |
1101 | | - } |
1102 | | - |
1103 | | - desktopMenu = desktopMenu.concat([{ |
1104 | | - title: '----' |
1105 | | - } , { |
1106 | | - title: 'Themes', |
1107 | | - children: [{ |
1108 | | - title: 'Basic', |
1109 | | - cmd: 'basic' |
| 1082 | + var getDesktopMenu = function() { |
| 1083 | + var hasCustomWallpaper = !!self._getCustomWallpaper(); |
| 1084 | + var desktopMenu = [{ |
| 1085 | + title: 'Refresh', |
| 1086 | + cmd: 'refresh', |
| 1087 | + uiIcon: 'ui-icon-refresh' |
1110 | 1088 | } , { |
1111 | | - title: 'Windows 3.1', |
1112 | | - cmd: 'windows-3' |
| 1089 | + title: '----' |
1113 | 1090 | } , { |
1114 | | - title: 'Windows 95', |
1115 | | - cmd: 'windows-95' |
| 1091 | + title: 'Set Custom Wallpaper', |
| 1092 | + cmd: 'custom-wallpaper', |
| 1093 | + uiIcon: 'ui-icon-image' |
| 1094 | + }]; |
| 1095 | + |
| 1096 | + if (hasCustomWallpaper) { |
| 1097 | + desktopMenu.push({ |
| 1098 | + title: 'Remove Custom Wallpaper', |
| 1099 | + cmd: 'remove-custom-wallpaper', |
| 1100 | + uiIcon: 'ui-icon-trash' |
| 1101 | + }); |
| 1102 | + } |
| 1103 | + |
| 1104 | + desktopMenu = desktopMenu.concat([{ |
| 1105 | + title: '----' |
1116 | 1106 | } , { |
1117 | | - title: 'Windows 98', |
1118 | | - cmd: 'windows-98' |
| 1107 | + title: 'Themes', |
| 1108 | + children: [{ |
| 1109 | + title: 'Basic', |
| 1110 | + cmd: 'basic' |
| 1111 | + } , { |
| 1112 | + title: 'Windows 3.1', |
| 1113 | + cmd: 'windows-3' |
| 1114 | + } , { |
| 1115 | + title: 'Windows 95', |
| 1116 | + cmd: 'windows-95' |
| 1117 | + } , { |
| 1118 | + title: 'Windows 98', |
| 1119 | + cmd: 'windows-98' |
| 1120 | + } , { |
| 1121 | + title: 'Windows ME', |
| 1122 | + cmd: 'windows-me' |
| 1123 | + }] |
1119 | 1124 | } , { |
1120 | | - title: 'Windows ME', |
1121 | | - cmd: 'windows-me' |
1122 | | - }] |
1123 | | - } , { |
1124 | | - title: '----' |
1125 | | - } , { |
1126 | | - title: 'Use Folders', |
1127 | | - cmd: 'toggle-folders', |
1128 | | - uiIcon: self.useFolders ? 'ui-icon-check' : '' |
1129 | | - }]); |
| 1125 | + title: '----' |
| 1126 | + } , { |
| 1127 | + title: 'Use Folders', |
| 1128 | + cmd: 'toggle-folders', |
| 1129 | + uiIcon: self.useFolders ? 'ui-icon-check' : '' |
| 1130 | + }]); |
| 1131 | + |
| 1132 | + return desktopMenu; |
| 1133 | + }; |
1130 | 1134 |
|
1131 | 1135 | self.$html.contextmenu({ |
1132 | 1136 | delegate: '.emuos-desktop, .emuos-taskbar', |
1133 | | - menu: desktopMenu, |
| 1137 | + menu: getDesktopMenu(), |
1134 | 1138 | select: function(e, ui) { |
1135 | 1139 | switch (ui.cmd) { |
1136 | 1140 | case 'refresh': |
|
1232 | 1236 | } |
1233 | 1237 | }); |
1234 | 1238 |
|
| 1239 | + self.$html.off('mousedown.emuosDesktopMenu').on('mousedown.emuosDesktopMenu', '.emuos-desktop, .emuos-taskbar', function(e) { |
| 1240 | + if (e.which === 3) { |
| 1241 | + self.$html.contextmenu('option', 'menu', getDesktopMenu()); |
| 1242 | + } |
| 1243 | + }); |
| 1244 | + |
1235 | 1245 | self.$html.on('mousemove', function (e) { |
1236 | 1246 | var parentOffset = $(e.target).offset(); |
1237 | 1247 | var relX = e.pageX - parentOffset.left; |
|
0 commit comments