bring integration windows to foreground on Windows using ctypes
This commit is contained in:
parent
04f5f79afb
commit
6124e1571c
1 changed files with 22 additions and 0 deletions
|
@ -38,6 +38,7 @@ Zotero.Integration = new function() {
|
||||||
var _osascriptFile;
|
var _osascriptFile;
|
||||||
var _inProgress = false;
|
var _inProgress = false;
|
||||||
var _integrationVersionsOK = null;
|
var _integrationVersionsOK = null;
|
||||||
|
var _winUser32;
|
||||||
|
|
||||||
this.sessions = {};
|
this.sessions = {};
|
||||||
|
|
||||||
|
@ -443,6 +444,27 @@ Zotero.Integration = new function() {
|
||||||
} else {
|
} else {
|
||||||
_executeAppleScript('tell application id "'+BUNDLE_IDS[Zotero.appName]+'" to activate');
|
_executeAppleScript('tell application id "'+BUNDLE_IDS[Zotero.appName]+'" to activate');
|
||||||
}
|
}
|
||||||
|
} else if(Zotero.isWin) {
|
||||||
|
try {
|
||||||
|
if(!_winUser32) {
|
||||||
|
Components.utils.import("resource://gre/modules/ctypes.jsm");
|
||||||
|
var lib = ctypes.open("user32.dll");
|
||||||
|
Zotero.debug([i for(i in ctypes)]);
|
||||||
|
_winUser32 = new function() {
|
||||||
|
this.FindWindow = lib.declare("FindWindowW", ctypes.default_abi, ctypes.int32_t,
|
||||||
|
ctypes.ustring, ctypes.ustring);
|
||||||
|
this.SetForegroundWindow = lib.declare("SetForegroundWindow", ctypes.default_abi, ctypes.bool,
|
||||||
|
ctypes.int32_t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var thWnd = _winUser32.FindWindow(Zotero.appName+"MessageWindow", null);
|
||||||
|
if(thWnd) _winUser32.SetForegroundWindow(thWnd);
|
||||||
|
} catch(e) {
|
||||||
|
// Don't throw if we don't succeed
|
||||||
|
Components.utils.reportError(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue