From 83d7e30b5d5a710c243ffadd59995b35e9c87871 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 6 Jun 2009 23:40:17 -0400 Subject: [PATCH] Petty makefile changes. --- common/Makefile.common | 5 +++-- common/Makefile.doc | 21 ++++++++++-------- common/content/buffer.js | 30 ++++++++++++------------- common/content/events.js | 47 +++++++++++++++++++--------------------- xulmus/Makefile | 3 --- 5 files changed, 51 insertions(+), 55 deletions(-) diff --git a/common/Makefile.common b/common/Makefile.common index c1458a87..d8bd2fd9 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -7,7 +7,7 @@ BASE = $(TOP)/../common LOCALEDIR = locale DOC_SRC_FILES = $(wildcard $(LOCALEDIR)/*/*.txt) -LOCALES = $(foreach locale,$(wildcard $(LOCALEDIR)/*),$(word 2,$(subst /, ,$(locale)))) +LOCALES = $(shell ls $(LOCALEDIR)) MAKE_JAR = VERSION="$(VERSION)" DATE="$(BUILD_DATE)" sh $(BASE)/make_jar.sh @@ -107,4 +107,5 @@ $(JAR): doc #### doc (see Makefile.doc) -doc: $(foreach localetgt,$(LOCALES:%=%.doc),$(addprefix $(LOCALEDIR)/,$(localetgt))) ; +doc: $(LOCALES:%=$(LOCALEDIR)/%.doc) ; + diff --git a/common/Makefile.doc b/common/Makefile.doc index e340791f..17f4652d 100644 --- a/common/Makefile.doc +++ b/common/Makefile.doc @@ -8,11 +8,11 @@ AWK = awk LOCALE = $(shell basename `pwd`) DOCLANG = $(shell basename `pwd` | $(AWK) -F- '{ print ($$1 ~ /^[a-z][a-z]$$/) ? $$1 : "en" }') -ADC_SRC_FILES = $(wildcard *.txt) -ADC_FILES = $(ADC_SRC_FILES:%.txt=%.html) -ADC_DEPS = $(wildcard asciidoc.conf lang-$(DOCLANG).conf) +SRC_FILES = $(wildcard *.txt) +FILES = $(SRC_FILES:%.txt=%.html) +DEPS = $(wildcard asciidoc.conf lang-$(DOCLANG).conf) -DOC_FILES = $(ADC_FILES) version.html +DOC_FILES = $(FILES) version.html .SILENT: @@ -50,14 +50,17 @@ check-asciidoc: @$(ASCIIDOC) --version | $(AWK) '{ exit $$2 !~ /^8\.2\./ }' || \ echo >&2 "Warning: asciidoc versions other than 8.2.x are unsupported" -version.html: ../../NEWS $(BASE)/Makefile.doc $(ADC_DEPS) +version.html: ../../NEWS $(BASE)/Makefile.doc $(DEPS) @echo "DOC locale/$(LOCALE)/$@" # NOTE: asciidoc doesn't source the conf file implicitly when processing stdin sed -e '1i\ -heading:Version{nbsp}information[version-information]' -e '/^[0-9]/d' -e '/^ \+\* version /s/.*version \+\([0-9.]\+\).*/section:Version{nbsp}\1[version-\1]\ -/' ../../NEWS | ${ASCIIDOC} -f asciidoc.conf -a doctitle=version.html -o version.html - +heading:Version{nbsp}information[version-information]' \ + -e '/^[0-9]/d' \ + -e '/^ \+\* version /s/.*version \+\([0-9.]\+\).*/section:Version{nbsp}\1[version-\1]\ +/' ../../NEWS | \ + ${ASCIIDOC} -f asciidoc.conf -a doctitle=version.html -o version.html - -$(ADC_FILES): %.html: %.txt $(BASE)/Makefile.doc $(ADC_DEPS) +$(FILES): %.html: %.txt $(BASE)/Makefile.doc $(DEPS) @echo "DOC locale/$(LOCALE)/$@" - $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(DOCLANG) -a doctitle="$(shell basename $@)" -o $@ $< + $(ASCIIDOC) --unsafe -a linkcss -a quirks! -a lang=$(DOCLANG) -a doctitle="$$(basename $@)" -o $@ $< diff --git a/common/content/buffer.js b/common/content/buffer.js index 51659195..173cfa95 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1054,13 +1054,9 @@ function Buffer() //{{{ focusElement: function (elem) { let doc = window.content.document; - let elemTagName = elem.localName.toLowerCase(); - if (elemTagName == "frame" || elemTagName == "iframe") - { - elem.contentWindow.focus(); - return; - } - else if (elemTagName == "input" && elem.type == "file") + if (elem instanceof HTMLFrameElement || elem instanceof HTMLIFrameElement) + return void elem.contentWindow.focus(); + else if (elem instanceof HTMLInputElement && elem.type == "file") { openUploadPrompt(elem); buffer.lastInputField = elem; @@ -1069,14 +1065,17 @@ function Buffer() //{{{ elem.focus(); - let x = 0; - let y = 0; // for imagemap - if (elemTagName == "area") - [x, y] = elem.getAttribute("coords").split(",").map(Number); + if (elem instanceof HTMLAreaElement) + { + try + { + let [x, y] = elem.getAttribute("coords").split(",").map(parseFloat); - let evt = events.create(doc, "mouseover", { screenX: x, screenY: y }); - elem.dispatchEvent(evt); + elem.dispatchEvent(events.create(doc, "mouseover", { screenX: x, screenY: y })); + } + catch (e) {} + } }, /** @@ -1197,11 +1196,10 @@ function Buffer() //{{{ options.withContext(function () { options.setPref("browser.tabs.loadInBackground", true); ["mousedown", "mouseup", "click"].forEach(function (event) { - let evt = events.create(doc, event, { + elem.dispatchEvent(events.create(doc, event, { screenX: offsetX, screenY: offsetY, ctrlKey: ctrlKey, shiftKey: shiftKey, metaKey: ctrlKey - }); - elem.dispatchEvent(evt); + })); }); }); }, diff --git a/common/content/events.js b/common/content/events.js index 4d8e84bf..2cabcef1 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -562,26 +562,8 @@ function Events() //{{{ } } - function wrapListener(method) - { - return function (event) { - try - { - self[method](event); - } - catch (e) - { - if (e.message == "Interrupted") - liberator.echoerr("Interrupted"); - else - liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e)); - liberator.reportError(e); - } - }; - } - // return true when load successful, or false otherwise - function waitForPageLoaded() events.waitForPageLoad(); + function waitForPageLoad() events.waitForPageLoad(); // load all macros // setTimeout needed since io. is loaded after events. @@ -1011,7 +993,7 @@ function Events() //{{{ break; // Stop feeding keys if page loading failed. - if (modes.isReplaying && !waitForPageLoaded()) + if (modes.isReplaying && !waitForPageLoad()) break; } } @@ -1560,7 +1542,7 @@ function Events() //{{{ input.pendingArgMap = null; if (key != "" && key != "") { - if (modes.isReplaying && !waitForPageLoaded()) + if (modes.isReplaying && !waitForPageLoad()) return; map.execute(null, input.count, key); } @@ -1593,7 +1575,7 @@ function Events() //{{{ } else { - if (modes.isReplaying && !waitForPageLoaded()) + if (modes.isReplaying && !waitForPageLoad()) return void killEvent(); let ret = map.execute(null, input.count); @@ -1771,10 +1753,25 @@ function Events() //{{{ } catch (e) {} - liberator.registerObserver("shutdown", function () { - self.destroy(); - }); + liberator.registerObserver("shutdown", function () { self.destroy(); }); + function wrapListener(method) + { + return function (event) { + try + { + self[method](event); + } + catch (e) + { + if (e.message == "Interrupted") + liberator.echoerr("Interrupted"); + else + liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e)); + liberator.reportError(e); + } + }; + } window.addEventListener("keypress", wrapListener("onKeyPress"), true); window.addEventListener("keydown", wrapListener("onKeyUpOrDown"), true); window.addEventListener("keyup", wrapListener("onKeyUpOrDown"), true); diff --git a/xulmus/Makefile b/xulmus/Makefile index ce4f6142..4255ad8b 100644 --- a/xulmus/Makefile +++ b/xulmus/Makefile @@ -4,6 +4,3 @@ VERSION = 0.2pre NAME = xulmus include ../common/Makefile.common - -foo: - echo $$SHELL