summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2010-02-20 00:48:50 +0100
committerSamuel Lidén Borell <samuel@slbdata.se>2010-02-20 00:48:50 +0100
commit3e95ab256185edd4b05e1325a3422102b0067a08 (patch)
tree6b1bee56f1a6c1b212de686693ff0bf95e649a0e /plugin
parent044097f7d6857b8bc91e216ab8a3503a93c89e1d (diff)
downloadfribid-3e95ab256185edd4b05e1325a3422102b0067a08.tar.gz
fribid-3e95ab256185edd4b05e1325a3422102b0067a08.tar.bz2
fribid-3e95ab256185edd4b05e1325a3422102b0067a08.zip
Fixed a few more window id problems on 64-bit platforms
This commit fixes the code outside of the plugin to work properly with 64-bit windows ids. I also simplified the plugin code a bit by using the None value instead of having a separate parameter and a boolean return value.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/ipc.c4
-rw-r--r--plugin/npobject.c18
2 files changed, 9 insertions, 13 deletions
diff --git a/plugin/ipc.c b/plugin/ipc.c
index efd68d5..3d618f2 100644
--- a/plugin/ipc.c
+++ b/plugin/ipc.c
@@ -93,12 +93,12 @@ static void openVersionPipes(PipeInfo *pipeinfo) {
}
static void openInteractivePipes(PipeInfo *pipeinfo, Plugin *plugin) {
- char windowId[11]; // This holds a native window id (such as an XID)
+ char windowId[21]; // This holds a native window id (such as an XID)
const char *argv[] = {
mainBinary, ipcOption, windowIdOption, windowId, (char *)NULL,
};
- snprintf(windowId, 11, "%d", plugin->windowId);
+ snprintf(windowId, 21, "%ld", plugin->windowId);
openPipes(pipeinfo, argv);
}
diff --git a/plugin/npobject.c b/plugin/npobject.c
index d25706a..17688f7 100644
--- a/plugin/npobject.c
+++ b/plugin/npobject.c
@@ -155,16 +155,14 @@ static char *getDocumentIP(NPP instance) {
}
/**
- * Returns the native ID of the browser window, or -1 on error.
+ * Returns the native ID of the browser window, or None (= 0) on error.
*/
-static bool getWindowId(NPP instance, Window *id) {
- if (id == NULL) {
- return false;
- }
- if (NPN_GetValue(instance, NPNVnetscapeWindow, id) == NPERR_NO_ERROR) {
- return true;
+static Window getWindowId(NPP instance) {
+ Window id;
+ if (NPN_GetValue(instance, NPNVnetscapeWindow, &id) == NPERR_NO_ERROR) {
+ return id;
} else {
- return false;
+ return None;
}
}
@@ -336,7 +334,6 @@ static NPClass baseClass = {
/* Object construction */
static NPObject *npobject_new(NPP instance, PluginType pluginType) {
PluginObject *obj;
- Window windowId;
obj = (PluginObject*)NPN_CreateObject(instance, &baseClass);
if (!obj) return NULL;
@@ -345,13 +342,12 @@ static NPObject *npobject_new(NPP instance, PluginType pluginType) {
char *url = getDocumentURL(instance);
char *hostname = getDocumentHostname(instance);
char *ip = getDocumentIP(instance);
- getWindowId(instance, &windowId);
obj->plugin = plugin_new(pluginType,
(url != NULL ? url : ""),
(hostname != NULL ? hostname : ""),
(ip != NULL ? ip : ""),
- windowId);
+ getWindowId(instance));
free(ip);
free(hostname);
free(url);