mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Merge mozilla-central and mozilla-inbound
This commit is contained in:
commit
baa593cf17
@ -46,23 +46,17 @@
|
|||||||
#
|
#
|
||||||
topsrcdir=$1
|
topsrcdir=$1
|
||||||
|
|
||||||
absolute_path() {
|
for _config in "$MOZCONFIG" \
|
||||||
if [ -n "${1%%/*}" ]; then
|
"$MOZ_MYCONFIG"
|
||||||
echo $topsrcdir/$1
|
do
|
||||||
else
|
if [ -n "$_config" ] && ! [ -f "$_config" ]; then
|
||||||
echo $1
|
echo "Specified MOZCONFIG \"$_config\" does not exist!"
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -n "$MOZCONFIG" ]; then
|
|
||||||
MOZCONFIG=`absolute_path "$MOZCONFIG"`
|
|
||||||
if ! [ -f "$MOZCONFIG" ]; then
|
|
||||||
echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
|
|
||||||
for _config in "$MOZCONFIG" \
|
for _config in "$MOZCONFIG" \
|
||||||
|
"$MOZ_MYCONFIG" \
|
||||||
"$topsrcdir/.mozconfig" \
|
"$topsrcdir/.mozconfig" \
|
||||||
"$topsrcdir/mozconfig" \
|
"$topsrcdir/mozconfig" \
|
||||||
"$topsrcdir/mozconfig.sh" \
|
"$topsrcdir/mozconfig.sh" \
|
||||||
|
@ -55,10 +55,10 @@ import sys
|
|||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
version = '0.5.2' # package version
|
version = '0.5.3' # package version
|
||||||
try:
|
try:
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
except ImportError:
|
except:
|
||||||
setup = None
|
setup = None
|
||||||
|
|
||||||
# we need relpath, but it is introduced in python 2.6
|
# we need relpath, but it is introduced in python 2.6
|
||||||
|
@ -4288,8 +4288,11 @@ if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
|
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
|
||||||
|
# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
|
||||||
|
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
|
||||||
|
# linking XUL.
|
||||||
_SAVE_LDFLAGS=$LDFLAGS
|
_SAVE_LDFLAGS=$LDFLAGS
|
||||||
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
|
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
|
||||||
AC_CACHE_CHECK(for __thread keyword for TLS variables,
|
AC_CACHE_CHECK(for __thread keyword for TLS variables,
|
||||||
ac_cv_thread_keyword,
|
ac_cv_thread_keyword,
|
||||||
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
|
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
|
||||||
|
@ -1289,10 +1289,6 @@ PluginInstanceChild::PluginWindowProcInternal(HWND hWnd,
|
|||||||
if ((InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
|
if ((InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
|
||||||
switch(message) {
|
switch(message) {
|
||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
case WM_MOUSEHWHEEL:
|
|
||||||
case WM_MOUSEWHEEL:
|
|
||||||
case WM_HSCROLL:
|
|
||||||
case WM_VSCROLL:
|
|
||||||
ReplyMessage(0);
|
ReplyMessage(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4202,8 +4202,11 @@ if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
|
# try harder, when checking for __thread support, see bug 521750 comment #33 and below
|
||||||
|
# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
|
||||||
|
# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
|
||||||
|
# linking XUL.
|
||||||
_SAVE_LDFLAGS=$LDFLAGS
|
_SAVE_LDFLAGS=$LDFLAGS
|
||||||
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
|
LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
|
||||||
AC_CACHE_CHECK(for __thread keyword for TLS variables,
|
AC_CACHE_CHECK(for __thread keyword for TLS variables,
|
||||||
ac_cv_thread_keyword,
|
ac_cv_thread_keyword,
|
||||||
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
|
[AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
|
||||||
|
@ -1274,10 +1274,7 @@ var SelectionHelper = {
|
|||||||
dragMove: function dragMove(dx, dy, scroller) { return false; }
|
dragMove: function dragMove(dx, dy, scroller) { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
this._start.addEventListener("TapDown", this, true);
|
|
||||||
this._start.addEventListener("TapUp", this, true);
|
this._start.addEventListener("TapUp", this, true);
|
||||||
|
|
||||||
this._end.addEventListener("TapDown", this, true);
|
|
||||||
this._end.addEventListener("TapUp", this, true);
|
this._end.addEventListener("TapUp", this, true);
|
||||||
|
|
||||||
messageManager.addMessageListener("Browser:SelectionRange", this);
|
messageManager.addMessageListener("Browser:SelectionRange", this);
|
||||||
@ -1285,9 +1282,8 @@ var SelectionHelper = {
|
|||||||
|
|
||||||
this.popupState.target.messageManager.sendAsyncMessage("Browser:SelectionStart", { x: this.popupState.x, y: this.popupState.y });
|
this.popupState.target.messageManager.sendAsyncMessage("Browser:SelectionStart", { x: this.popupState.x, y: this.popupState.y });
|
||||||
|
|
||||||
BrowserUI.pushPopup(this, [this._start, this._end]);
|
|
||||||
|
|
||||||
// Hide the selection handles
|
// Hide the selection handles
|
||||||
|
window.addEventListener("TapDown", this, true);
|
||||||
window.addEventListener("resize", this, true);
|
window.addEventListener("resize", this, true);
|
||||||
window.addEventListener("keypress", this, true);
|
window.addEventListener("keypress", this, true);
|
||||||
Elements.browsers.addEventListener("URLChanged", this, true);
|
Elements.browsers.addEventListener("URLChanged", this, true);
|
||||||
@ -1301,12 +1297,18 @@ var SelectionHelper = {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function sh_hide() {
|
hide: function sh_hide(aEvent) {
|
||||||
if (this._start.hidden)
|
if (this._start.hidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
let pos = this.popupState.target.transformClientToBrowser(aEvent.clientX || 0, aEvent.clientY || 0);
|
||||||
|
let json = {
|
||||||
|
x: pos.x,
|
||||||
|
y: pos.y
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.popupState.target.messageManager.sendAsyncMessage("Browser:SelectionEnd", {});
|
this.popupState.target.messageManager.sendAsyncMessage("Browser:SelectionEnd", json);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
}
|
}
|
||||||
@ -1316,30 +1318,30 @@ var SelectionHelper = {
|
|||||||
this._start.hidden = true;
|
this._start.hidden = true;
|
||||||
this._end.hidden = true;
|
this._end.hidden = true;
|
||||||
|
|
||||||
this._start.removeEventListener("TapDown", this, true);
|
|
||||||
this._start.removeEventListener("TapUp", this, true);
|
this._start.removeEventListener("TapUp", this, true);
|
||||||
|
|
||||||
this._end.removeEventListener("TapDown", this, true);
|
|
||||||
this._end.removeEventListener("TapUp", this, true);
|
this._end.removeEventListener("TapUp", this, true);
|
||||||
|
|
||||||
messageManager.removeMessageListener("Browser:SelectionRange", this);
|
messageManager.removeMessageListener("Browser:SelectionRange", this);
|
||||||
|
|
||||||
|
window.removeEventListener("TapDown", this, true);
|
||||||
window.removeEventListener("resize", this, true);
|
window.removeEventListener("resize", this, true);
|
||||||
window.removeEventListener("keypress", this, true);
|
window.removeEventListener("keypress", this, true);
|
||||||
Elements.browsers.removeEventListener("URLChanged", this, true);
|
Elements.browsers.removeEventListener("URLChanged", this, true);
|
||||||
Elements.browsers.removeEventListener("SizeChanged", this, true);
|
Elements.browsers.removeEventListener("SizeChanged", this, true);
|
||||||
Elements.browsers.removeEventListener("ZoomChanged", this, true);
|
Elements.browsers.removeEventListener("ZoomChanged", this, true);
|
||||||
|
|
||||||
BrowserUI.popPopup(this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function handleEvent(aEvent) {
|
handleEvent: function handleEvent(aEvent) {
|
||||||
switch (aEvent.type) {
|
switch (aEvent.type) {
|
||||||
case "TapDown":
|
case "TapDown":
|
||||||
this.target = aEvent.target;
|
if (aEvent.target == this._start || aEvent.target == this._end) {
|
||||||
this.deltaX = (aEvent.clientX - this.target.left);
|
this.target = aEvent.target;
|
||||||
this.deltaY = (aEvent.clientY - this.target.top);
|
this.deltaX = (aEvent.clientX - this.target.left);
|
||||||
window.addEventListener("TapMove", this, true);
|
this.deltaY = (aEvent.clientY - this.target.top);
|
||||||
|
window.addEventListener("TapMove", this, true);
|
||||||
|
} else {
|
||||||
|
this.hide(aEvent);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "TapUp":
|
case "TapUp":
|
||||||
window.removeEventListener("TapMove", this, true);
|
window.removeEventListener("TapMove", this, true);
|
||||||
@ -1367,7 +1369,7 @@ var SelectionHelper = {
|
|||||||
case "URLChanged":
|
case "URLChanged":
|
||||||
case "SizeChanged":
|
case "SizeChanged":
|
||||||
case "ZoomChanged":
|
case "ZoomChanged":
|
||||||
this.hide();
|
this.hide(aEvent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1334,13 +1334,13 @@ var SelectionHandler = {
|
|||||||
selectedText: "",
|
selectedText: "",
|
||||||
contentWindow: null,
|
contentWindow: null,
|
||||||
|
|
||||||
init: function() {
|
init: function sh_init() {
|
||||||
addMessageListener("Browser:SelectionStart", this);
|
addMessageListener("Browser:SelectionStart", this);
|
||||||
addMessageListener("Browser:SelectionEnd", this);
|
addMessageListener("Browser:SelectionEnd", this);
|
||||||
addMessageListener("Browser:SelectionMove", this);
|
addMessageListener("Browser:SelectionMove", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
receiveMessage: function(aMessage) {
|
receiveMessage: function sh_receiveMessage(aMessage) {
|
||||||
let scrollOffset = ContentScroll.getScrollOffset(content);
|
let scrollOffset = ContentScroll.getScrollOffset(content);
|
||||||
let utils = Util.getWindowUtils(content);
|
let utils = Util.getWindowUtils(content);
|
||||||
let json = aMessage.json;
|
let json = aMessage.json;
|
||||||
@ -1352,17 +1352,16 @@ var SelectionHandler = {
|
|||||||
// if this is an iframe, dig down to find the document that was clicked
|
// if this is an iframe, dig down to find the document that was clicked
|
||||||
let x = json.x;
|
let x = json.x;
|
||||||
let y = json.y;
|
let y = json.y;
|
||||||
let offsetX = 0;
|
let offset = scrollOffset;
|
||||||
let offsetY = 0;
|
|
||||||
let elem = utils.elementFromPoint(x, y, true, false);
|
let elem = utils.elementFromPoint(x, y, true, false);
|
||||||
while (elem && (elem instanceof HTMLIFrameElement || elem instanceof HTMLFrameElement)) {
|
while (elem && (elem instanceof HTMLIFrameElement || elem instanceof HTMLFrameElement)) {
|
||||||
// adjust client coordinates' origin to be top left of iframe viewport
|
// adjust client coordinates' origin to be top left of iframe viewport
|
||||||
let rect = elem.getBoundingClientRect();
|
let rect = elem.getBoundingClientRect();
|
||||||
scrollOffset = ContentScroll.getScrollOffset(elem.ownerDocument.defaultView);
|
scrollOffset = ContentScroll.getScrollOffset(elem.ownerDocument.defaultView);
|
||||||
offsetX += rect.left;
|
offset.x += rect.left;
|
||||||
x -= rect.left;
|
x -= rect.left;
|
||||||
|
|
||||||
offsetY += rect.top + scrollOffset.y;
|
offset.y += rect.top + scrollOffset.y;
|
||||||
y -= rect.top + scrollOffset.y;
|
y -= rect.top + scrollOffset.y;
|
||||||
utils = elem.contentDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
utils = elem.contentDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||||
elem = utils.elementFromPoint(x, y, true, false);
|
elem = utils.elementFromPoint(x, y, true, false);
|
||||||
@ -1402,23 +1401,25 @@ var SelectionHandler = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cache = { start: {}, end: {} };
|
this.cache = this._extractFromRange(range, offset);
|
||||||
let rects = range.getClientRects();
|
|
||||||
for (let i=0; i<rects.length; i++) {
|
let tap = { x: json.x - this.cache.offset.x, y: json.y - this.cache.offset.y };
|
||||||
if (i == 0) {
|
pointInSelection = (tap.x > this.cache.rect.left && tap.x < this.cache.rect.right) && (tap.y > this.cache.rect.top && tap.y < this.cache.rect.bottom);
|
||||||
this.cache.start.x = rects[i].left + offsetX;
|
if (!pointInSelection) {
|
||||||
this.cache.start.y = rects[i].bottom + offsetY;
|
selection.collapseToStart();
|
||||||
}
|
return;
|
||||||
this.cache.end.x = rects[i].right + offsetX;
|
|
||||||
this.cache.end.y = rects[i].bottom + offsetY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.contentWindow = contentWindow;
|
this.contentWindow = contentWindow;
|
||||||
|
|
||||||
sendAsyncMessage("Browser:SelectionRange", this.cache);
|
sendAsyncMessage("Browser:SelectionRange", this.cache);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "Browser:SelectionEnd": {
|
case "Browser:SelectionEnd": {
|
||||||
|
let tap = { x: json.x - this.cache.offset.x, y: json.y - this.cache.offset.y };
|
||||||
|
pointInSelection = (tap.x > this.cache.rect.left && tap.x < this.cache.rect.right) && (tap.y > this.cache.rect.top && tap.y < this.cache.rect.bottom);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// The selection might already be gone
|
// The selection might already be gone
|
||||||
if (this.contentWindow)
|
if (this.contentWindow)
|
||||||
@ -1426,7 +1427,7 @@ var SelectionHandler = {
|
|||||||
this.contentWindow = null;
|
this.contentWindow = null;
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
if (this.selectedText.length) {
|
if (pointInSelection && this.selectedText.length) {
|
||||||
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
|
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
|
||||||
clipboard.copyString(this.selectedText);
|
clipboard.copyString(this.selectedText);
|
||||||
sendAsyncMessage("Browser:SelectionCopied", { succeeded: true });
|
sendAsyncMessage("Browser:SelectionCopied", { succeeded: true });
|
||||||
@ -1439,11 +1440,16 @@ var SelectionHandler = {
|
|||||||
case "Browser:SelectionMove":
|
case "Browser:SelectionMove":
|
||||||
if (!this.contentWindow)
|
if (!this.contentWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Hack to avoid setting focus in a textbox [Bugs 654352 & 667243]
|
// Hack to avoid setting focus in a textbox [Bugs 654352 & 667243]
|
||||||
let elemUnder = elementFromPoint(json.x - scrollOffset.x, json.y - scrollOffset.y);
|
let elemUnder = elementFromPoint(json.x - scrollOffset.x, json.y - scrollOffset.y);
|
||||||
if (elemUnder && elemUnder instanceof Ci.nsIDOMHTMLInputElement || elemUnder instanceof Ci.nsIDOMHTMLTextAreaElement)
|
if (elemUnder && elemUnder instanceof Ci.nsIDOMHTMLInputElement || elemUnder instanceof Ci.nsIDOMHTMLTextAreaElement)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Limit the selection to the initial content window (don't leave or enter iframes)
|
||||||
|
if (elemUnder && elemUnder.ownerDocument.defaultView != this.contentWindow)
|
||||||
|
return;
|
||||||
|
|
||||||
if (json.type == "end") {
|
if (json.type == "end") {
|
||||||
this.cache.end.x = json.x - scrollOffset.x;
|
this.cache.end.x = json.x - scrollOffset.x;
|
||||||
this.cache.end.y = json.y - scrollOffset.y;
|
this.cache.end.y = json.y - scrollOffset.y;
|
||||||
@ -1460,9 +1466,35 @@ var SelectionHandler = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache the selected text since the selection might be gone by the time we get the "end" message
|
// Cache the selected text since the selection might be gone by the time we get the "end" message
|
||||||
this.selectedText = this.contentWindow.getSelection().toString().trim();
|
let selection = this.contentWindow.getSelection()
|
||||||
|
this.selectedText = selection.toString().trim();
|
||||||
|
|
||||||
|
// Update the rect we use to test when finishing the clipboard operation
|
||||||
|
let range = selection.getRangeAt(0).QueryInterface(Ci.nsIDOMNSRange);
|
||||||
|
this.cache.rect = this._extractFromRange(range, this.cache.offset).rect;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_extractFromRange: function sh_extractFromRange(aRange, aOffset) {
|
||||||
|
let cache = { start: {}, end: {}, rect: { left: Number.MAX_VALUE, top: Number.MAX_VALUE, right: 0, bottom: 0 } };
|
||||||
|
let rects = aRange.getClientRects();
|
||||||
|
for (let i=0; i<rects.length; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
cache.start.x = rects[i].left + aOffset.x;
|
||||||
|
cache.start.y = rects[i].bottom + aOffset.y;
|
||||||
|
}
|
||||||
|
cache.end.x = rects[i].right + aOffset.x;
|
||||||
|
cache.end.y = rects[i].bottom + aOffset.y;
|
||||||
|
}
|
||||||
|
cache.rect = aRange.getBoundingClientRect();
|
||||||
|
cache.rect.left += aOffset.x;
|
||||||
|
cache.rect.top += aOffset.y;
|
||||||
|
cache.rect.right += aOffset.x;
|
||||||
|
cache.rect.bottom += aOffset.y;
|
||||||
|
cache.offset = aOffset;
|
||||||
|
|
||||||
|
return cache;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ dialog {
|
|||||||
-moz-box-align: start;
|
-moz-box-align: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-row-button {
|
#panel-controls > .panel-row-button {
|
||||||
-moz-box-orient: horizontal;
|
-moz-box-orient: horizontal;
|
||||||
-moz-box-flex: 0;
|
-moz-box-flex: 0;
|
||||||
min-width: @tablet_panel_controls@ !important;
|
min-width: @tablet_panel_controls@ !important;
|
||||||
|
@ -750,7 +750,7 @@ dialog {
|
|||||||
-moz-box-align: start;
|
-moz-box-align: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-row-button {
|
#panel-controls > .panel-row-button {
|
||||||
-moz-box-orient: horizontal;
|
-moz-box-orient: horizontal;
|
||||||
-moz-box-flex: 0;
|
-moz-box-flex: 0;
|
||||||
min-width: @tablet_panel_controls@ !important;
|
min-width: @tablet_panel_controls@ !important;
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#include <mach/host_info.h>
|
#include <mach/host_info.h>
|
||||||
#include <mach/i386/thread_status.h>
|
#include <mach/i386/thread_status.h>
|
||||||
#include <mach/mach_vm.h>
|
#include <mach/mach_vm.h>
|
||||||
#include <mach/ppc/thread_status.h>
|
|
||||||
#include <mach/vm_statistics.h>
|
#include <mach/vm_statistics.h>
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
#include <mach-o/loader.h>
|
#include <mach-o/loader.h>
|
||||||
@ -43,6 +42,11 @@
|
|||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
#include "client/mac/handler/minidump_generator.h"
|
#include "client/mac/handler/minidump_generator.h"
|
||||||
|
|
||||||
|
#ifdef HAS_PPC_SUPPORT
|
||||||
|
#include <mach/ppc/thread_status.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "client/minidump_file_writer-inl.h"
|
#include "client/minidump_file_writer-inl.h"
|
||||||
#include "common/mac/file_id.h"
|
#include "common/mac/file_id.h"
|
||||||
#include "common/mac/string_utilities.h"
|
#include "common/mac/string_utilities.h"
|
||||||
@ -336,10 +340,12 @@ bool MinidumpGenerator::WriteStackFromStartAddress(
|
|||||||
bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state,
|
bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state,
|
||||||
MDMemoryDescriptor *stack_location) {
|
MDMemoryDescriptor *stack_location) {
|
||||||
switch (cpu_type_) {
|
switch (cpu_type_) {
|
||||||
|
#ifdef HAS_PPC_SUUPORT
|
||||||
case CPU_TYPE_POWERPC:
|
case CPU_TYPE_POWERPC:
|
||||||
return WriteStackPPC(state, stack_location);
|
return WriteStackPPC(state, stack_location);
|
||||||
case CPU_TYPE_POWERPC64:
|
case CPU_TYPE_POWERPC64:
|
||||||
return WriteStackPPC64(state, stack_location);
|
return WriteStackPPC64(state, stack_location);
|
||||||
|
#endif
|
||||||
case CPU_TYPE_I386:
|
case CPU_TYPE_I386:
|
||||||
return WriteStackX86(state, stack_location);
|
return WriteStackX86(state, stack_location);
|
||||||
case CPU_TYPE_X86_64:
|
case CPU_TYPE_X86_64:
|
||||||
@ -352,10 +358,12 @@ bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state,
|
|||||||
bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state,
|
bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state,
|
||||||
MDLocationDescriptor *register_location) {
|
MDLocationDescriptor *register_location) {
|
||||||
switch (cpu_type_) {
|
switch (cpu_type_) {
|
||||||
|
#ifdef HAS_PPC_SUPPORT
|
||||||
case CPU_TYPE_POWERPC:
|
case CPU_TYPE_POWERPC:
|
||||||
return WriteContextPPC(state, register_location);
|
return WriteContextPPC(state, register_location);
|
||||||
case CPU_TYPE_POWERPC64:
|
case CPU_TYPE_POWERPC64:
|
||||||
return WriteContextPPC64(state, register_location);
|
return WriteContextPPC64(state, register_location);
|
||||||
|
#endif
|
||||||
case CPU_TYPE_I386:
|
case CPU_TYPE_I386:
|
||||||
return WriteContextX86(state, register_location);
|
return WriteContextX86(state, register_location);
|
||||||
case CPU_TYPE_X86_64:
|
case CPU_TYPE_X86_64:
|
||||||
@ -368,10 +376,12 @@ bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state,
|
|||||||
u_int64_t MinidumpGenerator::CurrentPCForStack(
|
u_int64_t MinidumpGenerator::CurrentPCForStack(
|
||||||
breakpad_thread_state_data_t state) {
|
breakpad_thread_state_data_t state) {
|
||||||
switch (cpu_type_) {
|
switch (cpu_type_) {
|
||||||
|
#ifdef HAS_PPC_SUPPORT
|
||||||
case CPU_TYPE_POWERPC:
|
case CPU_TYPE_POWERPC:
|
||||||
return CurrentPCForStackPPC(state);
|
return CurrentPCForStackPPC(state);
|
||||||
case CPU_TYPE_POWERPC64:
|
case CPU_TYPE_POWERPC64:
|
||||||
return CurrentPCForStackPPC64(state);
|
return CurrentPCForStackPPC64(state);
|
||||||
|
#endif
|
||||||
case CPU_TYPE_I386:
|
case CPU_TYPE_I386:
|
||||||
return CurrentPCForStackX86(state);
|
return CurrentPCForStackX86(state);
|
||||||
case CPU_TYPE_X86_64:
|
case CPU_TYPE_X86_64:
|
||||||
@ -382,6 +392,7 @@ u_int64_t MinidumpGenerator::CurrentPCForStack(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAS_PCC_SUPPORT
|
||||||
bool MinidumpGenerator::WriteStackPPC(breakpad_thread_state_data_t state,
|
bool MinidumpGenerator::WriteStackPPC(breakpad_thread_state_data_t state,
|
||||||
MDMemoryDescriptor *stack_location) {
|
MDMemoryDescriptor *stack_location) {
|
||||||
ppc_thread_state_t *machine_state =
|
ppc_thread_state_t *machine_state =
|
||||||
@ -539,6 +550,8 @@ bool MinidumpGenerator::WriteContextPPC64(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
bool MinidumpGenerator::WriteStackX86(breakpad_thread_state_data_t state,
|
bool MinidumpGenerator::WriteStackX86(breakpad_thread_state_data_t state,
|
||||||
MDMemoryDescriptor *stack_location) {
|
MDMemoryDescriptor *stack_location) {
|
||||||
i386_thread_state_t *machine_state =
|
i386_thread_state_t *machine_state =
|
||||||
@ -663,12 +676,14 @@ bool MinidumpGenerator::GetThreadState(thread_act_t target_thread,
|
|||||||
mach_msg_type_number_t *count) {
|
mach_msg_type_number_t *count) {
|
||||||
thread_state_flavor_t flavor;
|
thread_state_flavor_t flavor;
|
||||||
switch (cpu_type_) {
|
switch (cpu_type_) {
|
||||||
|
#ifdef HAS_PPC_SUPPORT
|
||||||
case CPU_TYPE_POWERPC:
|
case CPU_TYPE_POWERPC:
|
||||||
flavor = PPC_THREAD_STATE;
|
flavor = PPC_THREAD_STATE;
|
||||||
break;
|
break;
|
||||||
case CPU_TYPE_POWERPC64:
|
case CPU_TYPE_POWERPC64:
|
||||||
flavor = PPC_THREAD_STATE64;
|
flavor = PPC_THREAD_STATE64;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case CPU_TYPE_I386:
|
case CPU_TYPE_I386:
|
||||||
flavor = i386_THREAD_STATE;
|
flavor = i386_THREAD_STATE;
|
||||||
break;
|
break;
|
||||||
|
@ -43,6 +43,10 @@
|
|||||||
|
|
||||||
#include "dynamic_images.h"
|
#include "dynamic_images.h"
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
|
||||||
|
#define HAS_PPC_SUPPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace google_breakpad {
|
namespace google_breakpad {
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -128,6 +132,7 @@ class MinidumpGenerator {
|
|||||||
int FindExecutableModule();
|
int FindExecutableModule();
|
||||||
|
|
||||||
// Per-CPU implementations of these methods
|
// Per-CPU implementations of these methods
|
||||||
|
#ifdef HAS_PPC_SUPPORT
|
||||||
bool WriteStackPPC(breakpad_thread_state_data_t state,
|
bool WriteStackPPC(breakpad_thread_state_data_t state,
|
||||||
MDMemoryDescriptor *stack_location);
|
MDMemoryDescriptor *stack_location);
|
||||||
bool WriteContextPPC(breakpad_thread_state_data_t state,
|
bool WriteContextPPC(breakpad_thread_state_data_t state,
|
||||||
@ -138,6 +143,7 @@ class MinidumpGenerator {
|
|||||||
bool WriteContextPPC64(breakpad_thread_state_data_t state,
|
bool WriteContextPPC64(breakpad_thread_state_data_t state,
|
||||||
MDLocationDescriptor *register_location);
|
MDLocationDescriptor *register_location);
|
||||||
u_int64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state);
|
u_int64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state);
|
||||||
|
#endif
|
||||||
bool WriteStackX86(breakpad_thread_state_data_t state,
|
bool WriteStackX86(breakpad_thread_state_data_t state,
|
||||||
MDMemoryDescriptor *stack_location);
|
MDMemoryDescriptor *stack_location);
|
||||||
bool WriteContextX86(breakpad_thread_state_data_t state,
|
bool WriteContextX86(breakpad_thread_state_data_t state,
|
||||||
|
@ -4251,11 +4251,6 @@ nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam)
|
|||||||
handled = PR_TRUE;
|
handled = PR_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Wheel events forwarded from the child.
|
|
||||||
case WM_MOUSEWHEEL:
|
|
||||||
case WM_MOUSEHWHEEL:
|
|
||||||
case WM_HSCROLL:
|
|
||||||
case WM_VSCROLL:
|
|
||||||
// Plugins taking or losing focus triggering focus app messages.
|
// Plugins taking or losing focus triggering focus app messages.
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
@ -5123,6 +5118,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||||||
result = OnScroll(msg, wParam, lParam);
|
result = OnScroll(msg, wParam, lParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MOZ_WM_HSCROLL:
|
||||||
|
case MOZ_WM_VSCROLL:
|
||||||
|
*aRetValue = 0;
|
||||||
|
OnScrollInternal(GetNativeMessage(msg), wParam, lParam);
|
||||||
|
// Doesn't need to call next wndproc for internal message.
|
||||||
|
return PR_TRUE;
|
||||||
|
|
||||||
// The WM_ACTIVATE event is fired when a window is raised or lowered,
|
// The WM_ACTIVATE event is fired when a window is raised or lowered,
|
||||||
// and the loword of wParam specifies which. But we don't want to tell
|
// and the loword of wParam specifies which. But we don't want to tell
|
||||||
// the focus system about this until the WM_SETFOCUS or WM_KILLFOCUS
|
// the focus system about this until the WM_SETFOCUS or WM_KILLFOCUS
|
||||||
@ -5285,18 +5287,26 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||||||
|
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
case WM_MOUSEHWHEEL:
|
case WM_MOUSEHWHEEL:
|
||||||
|
OnMouseWheel(msg, wParam, lParam, aRetValue);
|
||||||
|
// We don't need to call next wndproc WM_MOUSEWHEEL and WM_MOUSEHWHEEL.
|
||||||
|
// We should consume them always. If the messages would be handled by
|
||||||
|
// our window again, it causes making infinite message loop.
|
||||||
|
return PR_TRUE;
|
||||||
|
|
||||||
|
case MOZ_WM_MOUSEVWHEEL:
|
||||||
|
case MOZ_WM_MOUSEHWHEEL:
|
||||||
{
|
{
|
||||||
|
UINT nativeMessage = GetNativeMessage(msg);
|
||||||
// If OnMouseWheel returns true, the event was forwarded directly to another
|
// If OnMouseWheel returns true, the event was forwarded directly to another
|
||||||
// mozilla window message handler (ProcessMessage). In this case the return
|
// mozilla window message handler (ProcessMessage). In this case the return
|
||||||
// value of the forwarded event is in 'result' which we should return immediately.
|
// value of the forwarded event is in 'result' which we should return immediately.
|
||||||
// If OnMouseWheel returns false, OnMouseWheel processed the event internally.
|
// If OnMouseWheel returns false, OnMouseWheel processed the event internally.
|
||||||
// 'result' and 'aRetValue' will be set based on what we did with the event, so
|
// 'result' and 'aRetValue' will be set based on what we did with the event, so
|
||||||
// we should fall through.
|
// we should fall through.
|
||||||
if (OnMouseWheel(msg, wParam, lParam, result, aRetValue)) {
|
OnMouseWheelInternal(nativeMessage, wParam, lParam, aRetValue);
|
||||||
return result;
|
// Doesn't need to call next wndproc for internal message.
|
||||||
}
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
case WM_DWMCOMPOSITIONCHANGED:
|
case WM_DWMCOMPOSITIONCHANGED:
|
||||||
@ -6366,14 +6376,14 @@ static PRInt32 RoundDelta(double aDelta)
|
|||||||
return aDelta >= 0 ? (PRInt32)NS_floor(aDelta) : (PRInt32)NS_ceil(aDelta);
|
return aDelta >= 0 ? (PRInt32)NS_floor(aDelta) : (PRInt32)NS_ceil(aDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* OnMouseWheel - mouse wheel event processing. This was originally embedded
|
* OnMouseWheelInternal - mouse wheel event processing.
|
||||||
* within the message case block. If returning true result should be returned
|
* aMessage may be WM_MOUSEWHEEL or WM_MOUSEHWHEEL but this is called when
|
||||||
* immediately (no more processing).
|
* ProcessMessage() handles MOZ_WM_MOUSEVWHEEL or MOZ_WM_MOUSEHWHEEL.
|
||||||
*/
|
*/
|
||||||
PRBool
|
void
|
||||||
nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
nsWindow::OnMouseWheelInternal(UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
||||||
PRBool& aHandled, LRESULT *aRetValue)
|
LRESULT *aRetValue)
|
||||||
{
|
{
|
||||||
InitMouseWheelScrollData();
|
InitMouseWheelScrollData();
|
||||||
|
|
||||||
@ -6385,31 +6395,16 @@ nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
|||||||
// and web application may want to handle the event for non-scroll action.
|
// and web application may want to handle the event for non-scroll action.
|
||||||
ResetRemainingWheelDelta();
|
ResetRemainingWheelDelta();
|
||||||
*aRetValue = isVertical ? TRUE : FALSE; // means we don't process it
|
*aRetValue = isVertical ? TRUE : FALSE; // means we don't process it
|
||||||
aHandled = PR_FALSE;
|
return;
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The mousewheel event will be dispatched to the toplevel
|
|
||||||
// window. We need to give it to the child window.
|
|
||||||
PRBool quit;
|
|
||||||
if (!HandleScrollingPlugins(aMessage, aWParam, aLParam,
|
|
||||||
aHandled, aRetValue, quit)) {
|
|
||||||
ResetRemainingWheelDelta();
|
|
||||||
return quit; // return immediately if it's not our window
|
|
||||||
}
|
|
||||||
|
|
||||||
PRInt32 nativeDelta = (short)HIWORD(aWParam);
|
PRInt32 nativeDelta = (short)HIWORD(aWParam);
|
||||||
if (!nativeDelta) {
|
if (!nativeDelta) {
|
||||||
*aRetValue = isVertical ? TRUE : FALSE; // means we don't process it
|
*aRetValue = isVertical ? TRUE : FALSE; // means we don't process it
|
||||||
aHandled = PR_FALSE;
|
|
||||||
ResetRemainingWheelDelta();
|
ResetRemainingWheelDelta();
|
||||||
return PR_FALSE; // We cannot process this message
|
return; // We cannot process this message
|
||||||
}
|
}
|
||||||
|
|
||||||
// The event may go to a plug-in which already dispatched this message.
|
|
||||||
// Then, the event can cause deadlock. We should unlock the sender here.
|
|
||||||
::ReplyMessage(isVertical ? 0 : TRUE);
|
|
||||||
|
|
||||||
PRBool isPageScroll =
|
PRBool isPageScroll =
|
||||||
((isVertical && sMouseWheelScrollLines == WHEEL_PAGESCROLL) ||
|
((isVertical && sMouseWheelScrollLines == WHEEL_PAGESCROLL) ||
|
||||||
(!isVertical && sMouseWheelScrollChars == WHEEL_PAGESCROLL));
|
(!isVertical && sMouseWheelScrollChars == WHEEL_PAGESCROLL));
|
||||||
@ -6556,17 +6551,17 @@ nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scrollEvent.delta) {
|
if (scrollEvent.delta) {
|
||||||
aHandled = DispatchWindowEvent(&scrollEvent);
|
DispatchWindowEvent(&scrollEvent);
|
||||||
if (mOnDestroyCalled) {
|
if (mOnDestroyCalled) {
|
||||||
ResetRemainingWheelDelta();
|
ResetRemainingWheelDelta();
|
||||||
return PR_FALSE;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the query event failed, we cannot send pixel events.
|
// If the query event failed, we cannot send pixel events.
|
||||||
if (!dispatchPixelScrollEvent) {
|
if (!dispatchPixelScrollEvent) {
|
||||||
sRemainingDeltaForPixel = 0;
|
sRemainingDeltaForPixel = 0;
|
||||||
return PR_FALSE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMouseScrollEvent pixelEvent(PR_TRUE, NS_MOUSE_PIXEL_SCROLL, this);
|
nsMouseScrollEvent pixelEvent(PR_TRUE, NS_MOUSE_PIXEL_SCROLL, this);
|
||||||
@ -6596,9 +6591,9 @@ nsWindow::OnMouseWheel(UINT aMessage, WPARAM aWParam, LPARAM aLParam,
|
|||||||
(PRInt32)(pixelEvent.delta * orienterForPixel * deltaPerPixel);
|
(PRInt32)(pixelEvent.delta * orienterForPixel * deltaPerPixel);
|
||||||
sRemainingDeltaForPixel = nativeDeltaForPixel - recomputedNativeDelta;
|
sRemainingDeltaForPixel = nativeDeltaForPixel - recomputedNativeDelta;
|
||||||
if (pixelEvent.delta != 0) {
|
if (pixelEvent.delta != 0) {
|
||||||
aHandled = DispatchWindowEvent(&pixelEvent);
|
DispatchWindowEvent(&pixelEvent);
|
||||||
}
|
}
|
||||||
return PR_FALSE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRBool
|
static PRBool
|
||||||
@ -7582,28 +7577,59 @@ static PRBool IsElantechHelperWindow(HWND aHWND)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrolling helper function for handling plugins.
|
// static
|
||||||
// Return value indicates whether the calling function should handle this
|
UINT
|
||||||
// aHandled indicates whether this was handled at all
|
nsWindow::GetInternalMessage(UINT aNativeMessage)
|
||||||
// aQuitProcessing tells whether or not to continue processing the message
|
|
||||||
PRBool nsWindow::HandleScrollingPlugins(UINT aMsg, WPARAM aWParam,
|
|
||||||
LPARAM aLParam, PRBool& aHandled,
|
|
||||||
LRESULT* aRetValue,
|
|
||||||
PRBool& aQuitProcessing)
|
|
||||||
{
|
{
|
||||||
// The scroll event will be dispatched to the toplevel
|
switch (aNativeMessage) {
|
||||||
// window. We need to give it to the child window
|
case WM_MOUSEWHEEL:
|
||||||
aQuitProcessing = PR_FALSE; // default is to not stop processing
|
return MOZ_WM_MOUSEVWHEEL;
|
||||||
|
case WM_MOUSEHWHEEL:
|
||||||
|
return MOZ_WM_MOUSEHWHEEL;
|
||||||
|
case WM_VSCROLL:
|
||||||
|
return MOZ_WM_VSCROLL;
|
||||||
|
case WM_HSCROLL:
|
||||||
|
return MOZ_WM_HSCROLL;
|
||||||
|
default:
|
||||||
|
return aNativeMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
UINT
|
||||||
|
nsWindow::GetNativeMessage(UINT aInternalMessage)
|
||||||
|
{
|
||||||
|
switch (aInternalMessage) {
|
||||||
|
case MOZ_WM_MOUSEVWHEEL:
|
||||||
|
return WM_MOUSEWHEEL;
|
||||||
|
case MOZ_WM_MOUSEHWHEEL:
|
||||||
|
return WM_MOUSEHWHEEL;
|
||||||
|
case MOZ_WM_VSCROLL:
|
||||||
|
return WM_VSCROLL;
|
||||||
|
case MOZ_WM_HSCROLL:
|
||||||
|
return WM_HSCROLL;
|
||||||
|
default:
|
||||||
|
return aInternalMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnMouseWheel() is called when ProcessMessage() handles WM_MOUSEWHEEL,
|
||||||
|
* WM_MOUSEHWHEEL and also OnScroll() tries to emulate mouse wheel action for
|
||||||
|
* WM_VSCROLL or WM_HSCROLL.
|
||||||
|
* So, aMsg may be WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL or WM_HSCROLL.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
nsWindow::OnMouseWheel(UINT aMsg, WPARAM aWParam, LPARAM aLParam,
|
||||||
|
LRESULT *aRetValue)
|
||||||
|
{
|
||||||
|
*aRetValue = (aMsg != WM_MOUSEHWHEEL) ? TRUE : FALSE;
|
||||||
|
|
||||||
POINT point;
|
POINT point;
|
||||||
DWORD dwPoints = ::GetMessagePos();
|
DWORD dwPoints = ::GetMessagePos();
|
||||||
point.x = GET_X_LPARAM(dwPoints);
|
point.x = GET_X_LPARAM(dwPoints);
|
||||||
point.y = GET_Y_LPARAM(dwPoints);
|
point.y = GET_Y_LPARAM(dwPoints);
|
||||||
|
|
||||||
static PRBool sIsProcessing = PR_FALSE;
|
|
||||||
if (sIsProcessing) {
|
|
||||||
return PR_TRUE; // the caller should handle this.
|
|
||||||
}
|
|
||||||
|
|
||||||
static PRBool sMayBeUsingLogitechMouse = PR_FALSE;
|
static PRBool sMayBeUsingLogitechMouse = PR_FALSE;
|
||||||
if (aMsg == WM_MOUSEHWHEEL) {
|
if (aMsg == WM_MOUSEHWHEEL) {
|
||||||
// Logitech (Logicool) mouse driver (confirmed with 4.82.11 and MX-1100)
|
// Logitech (Logicool) mouse driver (confirmed with 4.82.11 and MX-1100)
|
||||||
@ -7630,109 +7656,86 @@ PRBool nsWindow::HandleScrollingPlugins(UINT aMsg, WPARAM aWParam,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND destWnd = ::WindowFromPoint(point);
|
HWND underCursorWnd = ::WindowFromPoint(point);
|
||||||
// Since we receive scroll events for as long as
|
if (!underCursorWnd) {
|
||||||
// we are focused, it's entirely possible that there
|
return;
|
||||||
// is another app's window or no window under the
|
}
|
||||||
// pointer.
|
|
||||||
|
|
||||||
if (sUseElantechPinchHack && IsElantechHelperWindow(destWnd)) {
|
if (sUseElantechPinchHack && IsElantechHelperWindow(underCursorWnd)) {
|
||||||
// The Elantech driver places a window right underneath the cursor
|
// The Elantech driver places a window right underneath the cursor
|
||||||
// when sending a WM_MOUSEWHEEL event to us as part of a pinch-to-zoom
|
// when sending a WM_MOUSEWHEEL event to us as part of a pinch-to-zoom
|
||||||
// gesture. We detect that here, and search for our window that would
|
// gesture. We detect that here, and search for our window that would
|
||||||
// be beneath the cursor if that window wasn't there.
|
// be beneath the cursor if that window wasn't there.
|
||||||
destWnd = FindOurWindowAtPoint(point);
|
underCursorWnd = FindOurWindowAtPoint(point);
|
||||||
}
|
if (!underCursorWnd) {
|
||||||
|
return;
|
||||||
if (!destWnd) {
|
|
||||||
// No window is under the pointer
|
|
||||||
return PR_FALSE; // break, but continue processing
|
|
||||||
}
|
|
||||||
|
|
||||||
nsWindow* destWindow;
|
|
||||||
|
|
||||||
// We don't handle the message if the found window belongs to another
|
|
||||||
// process's top window. If it belongs window, that is a plug-in's window.
|
|
||||||
// Then, we need to send the message to the plug-in window.
|
|
||||||
if (!IsOurProcessWindow(destWnd)) {
|
|
||||||
HWND ourPluginWnd = FindOurProcessWindow(destWnd);
|
|
||||||
if (!ourPluginWnd) {
|
|
||||||
// Somebody elses window
|
|
||||||
return PR_FALSE; // break, but continue processing
|
|
||||||
}
|
}
|
||||||
destWindow = GetNSWindowPtr(ourPluginWnd);
|
|
||||||
} else {
|
|
||||||
destWindow = GetNSWindowPtr(destWnd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destWindow == this && mWindowType == eWindowType_plugin) {
|
// Handle most cases first. If the window under mouse cursor is our window
|
||||||
// If this is plug-in window, the message came from the plug-in window.
|
// except plugin window (MozillaWindowClass), we should handle the message
|
||||||
// Then, the message should be processed on the parent window.
|
// on the window.
|
||||||
destWindow = static_cast<nsWindow*>(GetParent());
|
if (IsOurProcessWindow(underCursorWnd)) {
|
||||||
NS_ENSURE_TRUE(destWindow, PR_FALSE); // break, but continue processing
|
nsWindow* destWindow = GetNSWindowPtr(underCursorWnd);
|
||||||
destWnd = destWindow->mWnd;
|
if (!destWindow) {
|
||||||
NS_ENSURE_TRUE(destWnd, PR_FALSE); // break, but continue processing
|
NS_WARNING("We're not sure what cause this is.");
|
||||||
}
|
HWND wnd = ::GetParent(underCursorWnd);
|
||||||
|
for (; wnd; wnd = ::GetParent(wnd)) {
|
||||||
if (!destWindow || destWindow->mWindowType == eWindowType_plugin) {
|
destWindow = GetNSWindowPtr(wnd);
|
||||||
// Some other app, or a plugin window.
|
if (destWindow) {
|
||||||
// Windows directs scrolling messages to the focused window.
|
break;
|
||||||
// However, Mozilla does not like plugins having focus, so a
|
}
|
||||||
// Mozilla window (ie, the plugin's parent (us!) has focus.)
|
}
|
||||||
// Therefore, plugins etc _should_ get first grab at the
|
if (!wnd) {
|
||||||
// message, but this focus vaguary means the plugin misses
|
return;
|
||||||
// out. If the window is a child of ours, forward it on.
|
|
||||||
// Determine if a child by walking the parent list until
|
|
||||||
// we find a parent matching our wndproc.
|
|
||||||
HWND parentWnd = ::GetParent(destWnd);
|
|
||||||
while (parentWnd) {
|
|
||||||
nsWindow* parentWindow = GetNSWindowPtr(parentWnd);
|
|
||||||
if (parentWindow) {
|
|
||||||
// We have a child window - quite possibly a plugin window.
|
|
||||||
// However, not all plugins are created equal - some will handle this
|
|
||||||
// message themselves, some will forward directly back to us, while
|
|
||||||
// others will call DefWndProc, which itself still forwards back to us.
|
|
||||||
// So if we have sent it once, we need to handle it ourself.
|
|
||||||
|
|
||||||
// XXX The message shouldn't come from the plugin window at here.
|
|
||||||
// But the message might come from it due to some bugs. If it happens,
|
|
||||||
// SendMessage causes deadlock. For safety, we should unlock the
|
|
||||||
// sender here.
|
|
||||||
::ReplyMessage(aMsg == WM_MOUSEHWHEEL ? TRUE : 0);
|
|
||||||
|
|
||||||
// First time we have seen this message.
|
|
||||||
// Call the child - either it will consume it, or
|
|
||||||
// it will wind it's way back to us,triggering the destWnd case above
|
|
||||||
// either way,when the call returns,we are all done with the message,
|
|
||||||
sIsProcessing = PR_TRUE;
|
|
||||||
::SendMessageW(destWnd, aMsg, aWParam, aLParam);
|
|
||||||
sIsProcessing = PR_FALSE;
|
|
||||||
aHandled = PR_TRUE;
|
|
||||||
aQuitProcessing = PR_TRUE;
|
|
||||||
return PR_FALSE; // break, and stop processing
|
|
||||||
}
|
}
|
||||||
parentWnd = ::GetParent(parentWnd);
|
|
||||||
} // while parentWnd
|
|
||||||
}
|
|
||||||
if (destWnd == nsnull)
|
|
||||||
return PR_FALSE;
|
|
||||||
if (destWnd != mWnd) {
|
|
||||||
if (destWindow) {
|
|
||||||
sIsProcessing = PR_TRUE;
|
|
||||||
aHandled = destWindow->ProcessMessage(aMsg, aWParam, aLParam, aRetValue);
|
|
||||||
sIsProcessing = PR_FALSE;
|
|
||||||
aQuitProcessing = PR_TRUE;
|
|
||||||
return PR_FALSE; // break, and stop processing
|
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
else
|
NS_ASSERTION(destWindow, "destWindow must not be NULL");
|
||||||
printf("WARNING: couldn't get child window for SCROLL event\n");
|
// If the found window is our plugin window, it means that the message
|
||||||
#endif
|
// has been handled by the plugin but not consumed. We should handle the
|
||||||
|
// message on its parent window.
|
||||||
|
if (destWindow->mWindowType == eWindowType_plugin) {
|
||||||
|
destWindow = destWindow->GetParentWindow(PR_FALSE);
|
||||||
|
NS_ENSURE_TRUE(destWindow, );
|
||||||
|
}
|
||||||
|
UINT internalMessage = GetInternalMessage(aMsg);
|
||||||
|
destWindow->ProcessMessage(internalMessage, aWParam, aLParam, aRetValue);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return PR_TRUE; // caller should handle this
|
|
||||||
|
// If the window under cursor is not in our process, it means:
|
||||||
|
// 1. The window may be a plugin window (GeckoPluginWindow or its descendant).
|
||||||
|
// 2. The window may be another application's window.
|
||||||
|
HWND pluginWnd = FindOurProcessWindow(underCursorWnd);
|
||||||
|
if (!pluginWnd) {
|
||||||
|
// If there is no plugin window in ancestors of the window under cursor,
|
||||||
|
// the window is for another applications (case 2).
|
||||||
|
// We don't need to handle this message.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're a plugin window (MozillaWindowClass) and cursor in this window,
|
||||||
|
// the message shouldn't go to plugin's wndproc again. So, we should handle
|
||||||
|
// it on parent window.
|
||||||
|
if (mWindowType == eWindowType_plugin && pluginWnd == mWnd) {
|
||||||
|
nsWindow* destWindow = GetParentWindow(PR_FALSE);
|
||||||
|
NS_ENSURE_TRUE(destWindow, );
|
||||||
|
UINT internalMessage = GetInternalMessage(aMsg);
|
||||||
|
destWindow->ProcessMessage(internalMessage, aWParam, aLParam, aRetValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the window is a part of plugin, we should post the message to it.
|
||||||
|
::PostMessage(underCursorWnd, aMsg, aWParam, aLParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
/**
|
||||||
|
* OnScroll() is called when ProcessMessage() handles WM_VSCROLL or WM_HSCROLL.
|
||||||
|
* aMsg may be WM_VSCROLL or WM_HSCROLL.
|
||||||
|
*/
|
||||||
|
PRBool
|
||||||
|
nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
||||||
{
|
{
|
||||||
static PRInt8 sMouseWheelEmulation = -1;
|
static PRInt8 sMouseWheelEmulation = -1;
|
||||||
if (sMouseWheelEmulation < 0) {
|
if (sMouseWheelEmulation < 0) {
|
||||||
@ -7744,43 +7747,10 @@ PRBool nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
|||||||
if (aLParam || sMouseWheelEmulation) {
|
if (aLParam || sMouseWheelEmulation) {
|
||||||
// Scroll message generated by Thinkpad Trackpoint Driver or similar
|
// Scroll message generated by Thinkpad Trackpoint Driver or similar
|
||||||
// Treat as a mousewheel message and scroll appropriately
|
// Treat as a mousewheel message and scroll appropriately
|
||||||
PRBool quit, result;
|
|
||||||
LRESULT retVal;
|
LRESULT retVal;
|
||||||
|
OnMouseWheel(aMsg, aWParam, aLParam, &retVal);
|
||||||
if (!HandleScrollingPlugins(aMsg, aWParam, aLParam, result, &retVal, quit))
|
// Always consume the scroll message if we try to emulate mouse wheel
|
||||||
return quit; // Return if it's not our message or has been dispatched
|
// action.
|
||||||
|
|
||||||
nsMouseScrollEvent scrollevent(PR_TRUE, NS_MOUSE_SCROLL, this);
|
|
||||||
scrollevent.scrollFlags = (aMsg == WM_VSCROLL)
|
|
||||||
? nsMouseScrollEvent::kIsVertical
|
|
||||||
: nsMouseScrollEvent::kIsHorizontal;
|
|
||||||
switch (LOWORD(aWParam))
|
|
||||||
{
|
|
||||||
case SB_PAGEDOWN:
|
|
||||||
scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
|
||||||
case SB_LINEDOWN:
|
|
||||||
scrollevent.delta = 1;
|
|
||||||
break;
|
|
||||||
case SB_PAGEUP:
|
|
||||||
scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
|
||||||
case SB_LINEUP:
|
|
||||||
scrollevent.delta = -1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
// The event may go to a plug-in which already dispatched this message.
|
|
||||||
// Then, the event can cause deadlock. We should unlock the sender here.
|
|
||||||
::ReplyMessage(0);
|
|
||||||
scrollevent.isShift = IS_VK_DOWN(NS_VK_SHIFT);
|
|
||||||
scrollevent.isControl = IS_VK_DOWN(NS_VK_CONTROL);
|
|
||||||
scrollevent.isMeta = PR_FALSE;
|
|
||||||
scrollevent.isAlt = IS_VK_DOWN(NS_VK_ALT);
|
|
||||||
InitEvent(scrollevent);
|
|
||||||
if (nsnull != mEventCallback)
|
|
||||||
{
|
|
||||||
DispatchWindowEvent(&scrollevent);
|
|
||||||
}
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7818,10 +7788,49 @@ PRBool nsWindow::OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
|||||||
default:
|
default:
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
// XXX If this is a plugin window, we should dispatch the event from
|
||||||
|
// parent window.
|
||||||
DispatchWindowEvent(&command);
|
DispatchWindowEvent(&command);
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnScrollInternal() is called when ProcessMessage() handles MOZ_WM_VSCROLL or
|
||||||
|
* MOZ_WM_HSCROLL but aMsg may be WM_VSCROLL or WM_HSCROLL.
|
||||||
|
* These internal messages used only when OnScroll() tries to emulate mouse
|
||||||
|
* wheel action for the WM_VSCROLL or WM_HSCROLL message.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
nsWindow::OnScrollInternal(UINT aMsg, WPARAM aWParam, LPARAM aLParam)
|
||||||
|
{
|
||||||
|
nsMouseScrollEvent scrollevent(PR_TRUE, NS_MOUSE_SCROLL, this);
|
||||||
|
scrollevent.scrollFlags = (aMsg == WM_VSCROLL)
|
||||||
|
? nsMouseScrollEvent::kIsVertical
|
||||||
|
: nsMouseScrollEvent::kIsHorizontal;
|
||||||
|
switch (LOWORD(aWParam)) {
|
||||||
|
case SB_PAGEDOWN:
|
||||||
|
scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
||||||
|
case SB_LINEDOWN:
|
||||||
|
scrollevent.delta = 1;
|
||||||
|
break;
|
||||||
|
case SB_PAGEUP:
|
||||||
|
scrollevent.scrollFlags |= nsMouseScrollEvent::kIsFullPage;
|
||||||
|
case SB_LINEUP:
|
||||||
|
scrollevent.delta = -1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
scrollevent.isShift = IS_VK_DOWN(NS_VK_SHIFT);
|
||||||
|
scrollevent.isControl = IS_VK_DOWN(NS_VK_CONTROL);
|
||||||
|
scrollevent.isMeta = PR_FALSE;
|
||||||
|
scrollevent.isAlt = IS_VK_DOWN(NS_VK_ALT);
|
||||||
|
InitEvent(scrollevent);
|
||||||
|
if (mEventCallback) {
|
||||||
|
DispatchWindowEvent(&scrollevent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Can be overriden. Controls auto-erase of background.
|
// Can be overriden. Controls auto-erase of background.
|
||||||
PRBool nsWindow::AutoErase(HDC dc)
|
PRBool nsWindow::AutoErase(HDC dc)
|
||||||
{
|
{
|
||||||
@ -8389,7 +8398,7 @@ LRESULT CALLBACK nsWindow::MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM l
|
|||||||
LRESULT CALLBACK nsWindow::MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK nsWindow::MozSpecialMouseProc(int code, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (sProcessHook) {
|
if (sProcessHook) {
|
||||||
switch (wParam) {
|
switch (GetNativeMessage(wParam)) {
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
@ -8590,6 +8599,7 @@ nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLPara
|
|||||||
{
|
{
|
||||||
if (sRollupListener && sRollupWidget && ::IsWindowVisible(inWnd)) {
|
if (sRollupListener && sRollupWidget && ::IsWindowVisible(inWnd)) {
|
||||||
|
|
||||||
|
inMsg = GetNativeMessage(inMsg);
|
||||||
if (inMsg == WM_LBUTTONDOWN || inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN ||
|
if (inMsg == WM_LBUTTONDOWN || inMsg == WM_RBUTTONDOWN || inMsg == WM_MBUTTONDOWN ||
|
||||||
inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL || inMsg == WM_ACTIVATE ||
|
inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL || inMsg == WM_ACTIVATE ||
|
||||||
(inMsg == WM_KILLFOCUS && IsDifferentThreadWindow((HWND)inWParam)) ||
|
(inMsg == WM_KILLFOCUS && IsDifferentThreadWindow((HWND)inWParam)) ||
|
||||||
|
@ -375,11 +375,6 @@ protected:
|
|||||||
// Convert nsEventStatus value to a windows boolean
|
// Convert nsEventStatus value to a windows boolean
|
||||||
static PRBool ConvertStatus(nsEventStatus aStatus);
|
static PRBool ConvertStatus(nsEventStatus aStatus);
|
||||||
static void PostSleepWakeNotification(const char* aNotification);
|
static void PostSleepWakeNotification(const char* aNotification);
|
||||||
PRBool HandleScrollingPlugins(UINT aMsg, WPARAM aWParam,
|
|
||||||
LPARAM aLParam,
|
|
||||||
PRBool& aResult,
|
|
||||||
LRESULT* aRetValue,
|
|
||||||
PRBool& aQuitProcessing);
|
|
||||||
PRInt32 ClientMarginHitTestPoint(PRInt32 mx, PRInt32 my);
|
PRInt32 ClientMarginHitTestPoint(PRInt32 mx, PRInt32 my);
|
||||||
static WORD GetScanCode(LPARAM aLParam)
|
static WORD GetScanCode(LPARAM aLParam)
|
||||||
{
|
{
|
||||||
@ -417,7 +412,9 @@ protected:
|
|||||||
PRUint32 aFlags = 0,
|
PRUint32 aFlags = 0,
|
||||||
const MSG *aMsg = nsnull,
|
const MSG *aMsg = nsnull,
|
||||||
PRBool *aEventDispatched = nsnull);
|
PRBool *aEventDispatched = nsnull);
|
||||||
virtual PRBool OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam);
|
PRBool OnScroll(UINT aMsg, WPARAM aWParam, LPARAM aLParam);
|
||||||
|
void OnScrollInternal(UINT aMsg, WPARAM aWParam,
|
||||||
|
LPARAM aLParam);
|
||||||
PRBool OnGesture(WPARAM wParam, LPARAM lParam);
|
PRBool OnGesture(WPARAM wParam, LPARAM lParam);
|
||||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
|
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
|
||||||
PRBool OnTouch(WPARAM wParam, LPARAM lParam);
|
PRBool OnTouch(WPARAM wParam, LPARAM lParam);
|
||||||
@ -426,9 +423,13 @@ protected:
|
|||||||
BOOL OnInputLangChange(HKL aHKL);
|
BOOL OnInputLangChange(HKL aHKL);
|
||||||
PRBool OnPaint(HDC aDC, PRUint32 aNestingLevel);
|
PRBool OnPaint(HDC aDC, PRUint32 aNestingLevel);
|
||||||
void OnWindowPosChanged(WINDOWPOS *wp, PRBool& aResult);
|
void OnWindowPosChanged(WINDOWPOS *wp, PRBool& aResult);
|
||||||
PRBool OnMouseWheel(UINT aMessage, WPARAM aWParam,
|
static UINT GetInternalMessage(UINT aNativeMessage);
|
||||||
LPARAM aLParam, PRBool& aHandled,
|
static UINT GetNativeMessage(UINT aInternalMessage);
|
||||||
LRESULT *aRetValue);
|
void OnMouseWheel(UINT aMsg, WPARAM aWParam,
|
||||||
|
LPARAM aLParam, LRESULT *aRetValue);
|
||||||
|
void OnMouseWheelInternal(UINT aMessage, WPARAM aWParam,
|
||||||
|
LPARAM aLParam,
|
||||||
|
LRESULT *aRetValue);
|
||||||
void OnWindowPosChanging(LPWINDOWPOS& info);
|
void OnWindowPosChanging(LPWINDOWPOS& info);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,6 +58,12 @@
|
|||||||
#define MOZ_WM_APP_QUIT (WM_APP+0x0300)
|
#define MOZ_WM_APP_QUIT (WM_APP+0x0300)
|
||||||
// Used as a "tracer" event to probe event loop latency.
|
// Used as a "tracer" event to probe event loop latency.
|
||||||
#define MOZ_WM_TRACE (WM_APP+0x0301)
|
#define MOZ_WM_TRACE (WM_APP+0x0301)
|
||||||
|
// Our internal message for WM_MOUSEWHEEL, WM_MOUSEHWHEEL, WM_VSCROLL and
|
||||||
|
// WM_HSCROLL
|
||||||
|
#define MOZ_WM_MOUSEVWHEEL (WM_APP+0x0310)
|
||||||
|
#define MOZ_WM_MOUSEHWHEEL (WM_APP+0x0311)
|
||||||
|
#define MOZ_WM_VSCROLL (WM_APP+0x0312)
|
||||||
|
#define MOZ_WM_HSCROLL (WM_APP+0x0313)
|
||||||
|
|
||||||
// GetWindowsVersion constants
|
// GetWindowsVersion constants
|
||||||
#define WIN2K_VERSION 0x500
|
#define WIN2K_VERSION 0x500
|
||||||
|
@ -1118,6 +1118,42 @@ class Typelib(object):
|
|||||||
if isinstance(m.result, InterfaceType) and m.result.iface not in self.interfaces:
|
if isinstance(m.result, InterfaceType) and m.result.iface not in self.interfaces:
|
||||||
raise DataError, "Interface method %s::%s, result references interface %s not present in typelib!" % (i.name, m.name, m.result.iface.name)
|
raise DataError, "Interface method %s::%s, result references interface %s not present in typelib!" % (i.name, m.name, m.result.iface.name)
|
||||||
|
|
||||||
|
def writefd(self, fd):
|
||||||
|
# write out space for a header + one empty annotation,
|
||||||
|
# padded to 4-byte alignment.
|
||||||
|
headersize = (Typelib._header.size + 1)
|
||||||
|
if headersize % 4:
|
||||||
|
headersize += 4 - headersize % 4
|
||||||
|
fd.write("\x00" * headersize)
|
||||||
|
# save this offset, it's the interface directory offset.
|
||||||
|
interface_directory_offset = fd.tell()
|
||||||
|
# write out space for an interface directory
|
||||||
|
fd.write("\x00" * Interface._direntry.size * len(self.interfaces))
|
||||||
|
# save this offset, it's the data pool offset.
|
||||||
|
data_pool_offset = fd.tell()
|
||||||
|
# write out all the interface descriptors to the data pool
|
||||||
|
for i in self.interfaces:
|
||||||
|
i.write_names(fd, data_pool_offset)
|
||||||
|
i.write(self, fd, data_pool_offset)
|
||||||
|
# now, seek back and write the header
|
||||||
|
file_len = fd.tell()
|
||||||
|
fd.seek(0)
|
||||||
|
fd.write(Typelib._header.pack(XPT_MAGIC,
|
||||||
|
TYPELIB_VERSION[0],
|
||||||
|
TYPELIB_VERSION[1],
|
||||||
|
len(self.interfaces),
|
||||||
|
file_len,
|
||||||
|
interface_directory_offset,
|
||||||
|
data_pool_offset))
|
||||||
|
# write an empty annotation
|
||||||
|
fd.write(struct.pack(">B", 0x80))
|
||||||
|
# now write the interface directory
|
||||||
|
#XXX: bug-compatible with existing xpt lib, put it one byte
|
||||||
|
# ahead of where it's supposed to be.
|
||||||
|
fd.seek(interface_directory_offset - 1)
|
||||||
|
for i in self.interfaces:
|
||||||
|
i.write_directory_entry(fd)
|
||||||
|
|
||||||
def write(self, filename):
|
def write(self, filename):
|
||||||
"""
|
"""
|
||||||
Write the contents of this typelib to the file named |filename|.
|
Write the contents of this typelib to the file named |filename|.
|
||||||
@ -1125,40 +1161,7 @@ class Typelib(object):
|
|||||||
"""
|
"""
|
||||||
self._sanityCheck()
|
self._sanityCheck()
|
||||||
with open(filename, "wb") as f:
|
with open(filename, "wb") as f:
|
||||||
# write out space for a header + one empty annotation,
|
self.writefd(f)
|
||||||
# padded to 4-byte alignment.
|
|
||||||
headersize = (Typelib._header.size + 1)
|
|
||||||
if headersize % 4:
|
|
||||||
headersize += 4 - headersize % 4
|
|
||||||
f.write("\x00" * headersize)
|
|
||||||
# save this offset, it's the interface directory offset.
|
|
||||||
interface_directory_offset = f.tell()
|
|
||||||
# write out space for an interface directory
|
|
||||||
f.write("\x00" * Interface._direntry.size * len(self.interfaces))
|
|
||||||
# save this offset, it's the data pool offset.
|
|
||||||
data_pool_offset = f.tell()
|
|
||||||
# write out all the interface descriptors to the data pool
|
|
||||||
for i in self.interfaces:
|
|
||||||
i.write_names(f, data_pool_offset)
|
|
||||||
i.write(self, f, data_pool_offset)
|
|
||||||
# now, seek back and write the header
|
|
||||||
file_len = f.tell()
|
|
||||||
f.seek(0)
|
|
||||||
f.write(Typelib._header.pack(XPT_MAGIC,
|
|
||||||
TYPELIB_VERSION[0],
|
|
||||||
TYPELIB_VERSION[1],
|
|
||||||
len(self.interfaces),
|
|
||||||
file_len,
|
|
||||||
interface_directory_offset,
|
|
||||||
data_pool_offset))
|
|
||||||
# write an empty annotation
|
|
||||||
f.write(struct.pack(">B", 0x80))
|
|
||||||
# now write the interface directory
|
|
||||||
#XXX: bug-compatible with existing xpt lib, put it one byte
|
|
||||||
# ahead of where it's supposed to be.
|
|
||||||
f.seek(interface_directory_offset - 1)
|
|
||||||
for i in self.interfaces:
|
|
||||||
i.write_directory_entry(f)
|
|
||||||
|
|
||||||
def merge(self, other, sanitycheck=True):
|
def merge(self, other, sanitycheck=True):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user