nsgenjsbind: branch master updated. a1486c92cdefe045619b5ced38b3368c8f4457cf
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/a1486c92cdefe0456...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/a1486c92cdefe045619...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/a1486c92cdefe045619b5...
The branch, master has been updated
via a1486c92cdefe045619b5ced38b3368c8f4457cf (commit)
from 81e6f212a13bb6a3984e962e466864db97e95fc8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/a1486c92cdefe04...
commit a1486c92cdefe045619b5ced38b3368c8f4457cf
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
make property type getters/setetrs extract the property name
diff --git a/src/jsapi-libdom-property.c b/src/jsapi-libdom-property.c
index 4ce6984..4e67120 100644
--- a/src/jsapi-libdom-property.c
+++ b/src/jsapi-libdom-property.c
@@ -21,6 +21,53 @@ static int generate_property_spec(struct binding *binding, const char *interface
static int generate_property_body(struct binding *binding, const char *interface);
+/* generate context data fetcher if the binding has private data */
+static inline int
+output_private_get(struct binding *binding, const char *argname)
+{
+ if (!binding->has_private) {
+ return 0;
+ }
+
+ return fprintf(binding->outfile,
+ "\tstruct jsclass_private *%s;\n"
+ "\n"
+ "\t%s = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n"
+ "\tif (%s == NULL) {\n"
+ "\t\treturn JS_FALSE;\n"
+ "\t}\n\n",
+ argname, argname, binding->interface, argname);
+}
+
+/* generate vars for property name getter */
+static inline int
+output_property_name_get_vars(struct binding *binding, const char *argname)
+{
+ /* get property name */
+ return fprintf(binding->outfile,
+ "\tjsval %s_jsval;\n"
+ "\tJSString *%s_jsstr = NULL;\n"
+ "\tint %s_len = 0;\n"
+ "\tchar *%s = NULL;\n",
+ argname, argname, argname, argname);
+}
+
+/* generate property name getter */
+static inline int
+output_property_name_get(struct binding *binding, const char *argname)
+{
+ /* get property name */
+ return fprintf(binding->outfile,
+ "\t /* obtain property name */\n"
+ "\tJSAPI_PROP_IDVAL(cx, &%s_jsval);\n"
+ "\t%s_jsstr = JS_ValueToString(cx, %s_jsval);\n"
+ "\tif (%s_jsstr != NULL) {\n"
+ "\t\tJSString_to_char(%s_jsstr, %s, %s_len);\n"
+ "\t}\n\n",
+ argname,argname,argname,argname,argname,argname,argname);
+}
+
+
/* search binding for property sharing modifier */
static enum genbind_type_modifier
get_binding_shared_modifier(struct binding *binding, const char *type, const char *ident)
@@ -488,19 +535,7 @@ static int output_property_getter(struct binding *binding,
/* return value declaration */
output_return_declaration(binding, "jsret", node);
- if (binding->has_private) {
- /* get context */
- fprintf(binding->outfile,
- "\tstruct jsclass_private *private;\n"
- "\n"
- "\tprivate = JS_GetInstancePrivate(cx,\n"
- "\t\tobj,\n"
- "\t\t&JSClass_%s,\n"
- "\t\tNULL);\n"
- "\tif (private == NULL)\n"
- "\t\treturn JS_FALSE;\n\n",
- binding->interface);
- }
+ output_private_get(binding, "private");
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
@@ -696,8 +731,8 @@ generate_property_body(struct binding *binding, const char *interface)
return res;
}
- /* setter for type handler */
+/* setter for type handler */
static int output_property_type_setter(struct binding *binding, struct genbind_node *node, const char *type)
{
struct genbind_node *property_node;
@@ -707,20 +742,14 @@ static int output_property_type_setter(struct binding *binding, struct genbind_n
"{\n",
type);
- if (binding->has_private) {
- /* get context */
- fprintf(binding->outfile,
- "\tstruct jsclass_private *private;\n"
- "\n"
- "\tprivate = JS_GetInstancePrivate(cx,\n"
- "\t\tobj,\n"
- "\t\t&JSClass_%s,\n"
- "\t\tNULL);\n"
- "\tif (private == NULL)\n"
- "\t\treturn JS_FALSE;\n\n",
- binding->interface);
- }
+ /* property name vars */
+ output_property_name_get_vars(binding, "propname");
+ /* context data */
+ output_private_get(binding, "private");
+ /* property name */
+ output_property_name_get(binding, "propname");
+ /* output binding code block */
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_SETTER,
@@ -732,7 +761,7 @@ static int output_property_type_setter(struct binding *binding, struct genbind_n
}
fprintf(binding->outfile,
- " return JS_TRUE;\n"
+ "\treturn JS_TRUE;\n"
"}\n\n");
return 0;
@@ -749,20 +778,14 @@ static int output_property_type_getter(struct binding *binding, struct genbind_n
"{\n",
type);
- if (binding->has_private) {
- /* get context */
- fprintf(binding->outfile,
- "\tstruct jsclass_private *private;\n"
- "\n"
- "\tprivate = JS_GetInstancePrivate(cx,\n"
- "\t\tobj,\n"
- "\t\t&JSClass_%s,\n"
- "\t\tNULL);\n"
- "\tif (private == NULL)\n"
- "\t\treturn JS_FALSE;\n\n",
- binding->interface);
- }
+ /* property name vars */
+ output_property_name_get_vars(binding, "propname");
+ /* context data */
+ output_private_get(binding, "private");
+ /* property name */
+ output_property_name_get(binding, "propname");
+ /* output binding code block */
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_GETTER,
-----------------------------------------------------------------------
Summary of changes:
src/jsapi-libdom-property.c | 105 ++++++++++++++++++++++++++-----------------
1 files changed, 64 insertions(+), 41 deletions(-)
diff --git a/src/jsapi-libdom-property.c b/src/jsapi-libdom-property.c
index 4ce6984..4e67120 100644
--- a/src/jsapi-libdom-property.c
+++ b/src/jsapi-libdom-property.c
@@ -21,6 +21,53 @@ static int generate_property_spec(struct binding *binding, const char *interface
static int generate_property_body(struct binding *binding, const char *interface);
+/* generate context data fetcher if the binding has private data */
+static inline int
+output_private_get(struct binding *binding, const char *argname)
+{
+ if (!binding->has_private) {
+ return 0;
+ }
+
+ return fprintf(binding->outfile,
+ "\tstruct jsclass_private *%s;\n"
+ "\n"
+ "\t%s = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n"
+ "\tif (%s == NULL) {\n"
+ "\t\treturn JS_FALSE;\n"
+ "\t}\n\n",
+ argname, argname, binding->interface, argname);
+}
+
+/* generate vars for property name getter */
+static inline int
+output_property_name_get_vars(struct binding *binding, const char *argname)
+{
+ /* get property name */
+ return fprintf(binding->outfile,
+ "\tjsval %s_jsval;\n"
+ "\tJSString *%s_jsstr = NULL;\n"
+ "\tint %s_len = 0;\n"
+ "\tchar *%s = NULL;\n",
+ argname, argname, argname, argname);
+}
+
+/* generate property name getter */
+static inline int
+output_property_name_get(struct binding *binding, const char *argname)
+{
+ /* get property name */
+ return fprintf(binding->outfile,
+ "\t /* obtain property name */\n"
+ "\tJSAPI_PROP_IDVAL(cx, &%s_jsval);\n"
+ "\t%s_jsstr = JS_ValueToString(cx, %s_jsval);\n"
+ "\tif (%s_jsstr != NULL) {\n"
+ "\t\tJSString_to_char(%s_jsstr, %s, %s_len);\n"
+ "\t}\n\n",
+ argname,argname,argname,argname,argname,argname,argname);
+}
+
+
/* search binding for property sharing modifier */
static enum genbind_type_modifier
get_binding_shared_modifier(struct binding *binding, const char *type, const char *ident)
@@ -488,19 +535,7 @@ static int output_property_getter(struct binding *binding,
/* return value declaration */
output_return_declaration(binding, "jsret", node);
- if (binding->has_private) {
- /* get context */
- fprintf(binding->outfile,
- "\tstruct jsclass_private *private;\n"
- "\n"
- "\tprivate = JS_GetInstancePrivate(cx,\n"
- "\t\tobj,\n"
- "\t\t&JSClass_%s,\n"
- "\t\tNULL);\n"
- "\tif (private == NULL)\n"
- "\t\treturn JS_FALSE;\n\n",
- binding->interface);
- }
+ output_private_get(binding, "private");
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
@@ -696,8 +731,8 @@ generate_property_body(struct binding *binding, const char *interface)
return res;
}
- /* setter for type handler */
+/* setter for type handler */
static int output_property_type_setter(struct binding *binding, struct genbind_node *node, const char *type)
{
struct genbind_node *property_node;
@@ -707,20 +742,14 @@ static int output_property_type_setter(struct binding *binding, struct genbind_n
"{\n",
type);
- if (binding->has_private) {
- /* get context */
- fprintf(binding->outfile,
- "\tstruct jsclass_private *private;\n"
- "\n"
- "\tprivate = JS_GetInstancePrivate(cx,\n"
- "\t\tobj,\n"
- "\t\t&JSClass_%s,\n"
- "\t\tNULL);\n"
- "\tif (private == NULL)\n"
- "\t\treturn JS_FALSE;\n\n",
- binding->interface);
- }
+ /* property name vars */
+ output_property_name_get_vars(binding, "propname");
+ /* context data */
+ output_private_get(binding, "private");
+ /* property name */
+ output_property_name_get(binding, "propname");
+ /* output binding code block */
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_SETTER,
@@ -732,7 +761,7 @@ static int output_property_type_setter(struct binding *binding, struct genbind_n
}
fprintf(binding->outfile,
- " return JS_TRUE;\n"
+ "\treturn JS_TRUE;\n"
"}\n\n");
return 0;
@@ -749,20 +778,14 @@ static int output_property_type_getter(struct binding *binding, struct genbind_n
"{\n",
type);
- if (binding->has_private) {
- /* get context */
- fprintf(binding->outfile,
- "\tstruct jsclass_private *private;\n"
- "\n"
- "\tprivate = JS_GetInstancePrivate(cx,\n"
- "\t\tobj,\n"
- "\t\t&JSClass_%s,\n"
- "\t\tNULL);\n"
- "\tif (private == NULL)\n"
- "\t\treturn JS_FALSE;\n\n",
- binding->interface);
- }
+ /* property name vars */
+ output_property_name_get_vars(binding, "propname");
+ /* context data */
+ output_private_get(binding, "private");
+ /* property name */
+ output_property_name_get(binding, "propname");
+ /* output binding code block */
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_GETTER,
--
NetSurf Generator for JavaScript bindings
11 years
netsurf: branch master updated. 8bccf1615876f7c0ddf62c05f1b9fbc78b011b94
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/8bccf1615876f7c0ddf62...
...commit http://git.netsurf-browser.org/netsurf.git/commit/8bccf1615876f7c0ddf62c0...
...tree http://git.netsurf-browser.org/netsurf.git/tree/8bccf1615876f7c0ddf62c05f...
The branch, master has been updated
via 8bccf1615876f7c0ddf62c05f1b9fbc78b011b94 (commit)
from 7d83151d1adb03eaa28df9ae05d0d8e8fb7e7f54 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/8bccf1615876f7c0ddf...
commit 8bccf1615876f7c0ddf62c05f1b9fbc78b011b94
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Check if box with imagemap at point has area at point.
diff --git a/render/html.c b/render/html.c
index f6e3fda..6c6dcdf 100644
--- a/render/html.c
+++ b/render/html.c
@@ -2622,9 +2622,12 @@ html_get_contextual_content(struct content *c,
if (box->usemap) {
const char *target = NULL;
- data->link_url = nsurl_access(imagemap_get(html,
- box->usemap, box_x, box_y, x, y,
- &target));
+ nsurl *url = imagemap_get(html, box->usemap, box_x,
+ box_y, x, y, &target);
+ /* Box might have imagemap, but no actual link area
+ * at point */
+ if (url != NULL)
+ data->link_url = nsurl_access(url);
}
if (box->gadget) {
switch (box->gadget->type) {
diff --git a/utils/nsurl.c b/utils/nsurl.c
index eeaf202..18577b6 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -1564,9 +1564,7 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part)
/* exported interface, documented in nsurl.h */
const char *nsurl_access(const nsurl *url)
{
- if (url == NULL) {
- return NULL;
- }
+ assert(url != NULL);
return url->string;
}
-----------------------------------------------------------------------
Summary of changes:
render/html.c | 9 ++++++---
utils/nsurl.c | 4 +---
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/render/html.c b/render/html.c
index f6e3fda..6c6dcdf 100644
--- a/render/html.c
+++ b/render/html.c
@@ -2622,9 +2622,12 @@ html_get_contextual_content(struct content *c,
if (box->usemap) {
const char *target = NULL;
- data->link_url = nsurl_access(imagemap_get(html,
- box->usemap, box_x, box_y, x, y,
- &target));
+ nsurl *url = imagemap_get(html, box->usemap, box_x,
+ box_y, x, y, &target);
+ /* Box might have imagemap, but no actual link area
+ * at point */
+ if (url != NULL)
+ data->link_url = nsurl_access(url);
}
if (box->gadget) {
switch (box->gadget->type) {
diff --git a/utils/nsurl.c b/utils/nsurl.c
index eeaf202..18577b6 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -1564,9 +1564,7 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part)
/* exported interface, documented in nsurl.h */
const char *nsurl_access(const nsurl *url)
{
- if (url == NULL) {
- return NULL;
- }
+ assert(url != NULL);
return url->string;
}
--
NetSurf Browser
11 years
netsurf: branch master updated. 7d83151d1adb03eaa28df9ae05d0d8e8fb7e7f54
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7d83151d1adb03eaa28df...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7d83151d1adb03eaa28df9a...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7d83151d1adb03eaa28df9ae0...
The branch, master has been updated
via 7d83151d1adb03eaa28df9ae05d0d8e8fb7e7f54 (commit)
from 966fb9f215915567d44cff97a73cf3730dd8c431 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/7d83151d1adb03eaa28...
commit 7d83151d1adb03eaa28df9ae05d0d8e8fb7e7f54
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
make nsurl_access() not assert with being passed a NULL url as it is assumed elsewhere this will never fail.
diff --git a/utils/nsurl.c b/utils/nsurl.c
index 18577b6..eeaf202 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -1564,7 +1564,9 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part)
/* exported interface, documented in nsurl.h */
const char *nsurl_access(const nsurl *url)
{
- assert(url != NULL);
+ if (url == NULL) {
+ return NULL;
+ }
return url->string;
}
-----------------------------------------------------------------------
Summary of changes:
utils/nsurl.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/utils/nsurl.c b/utils/nsurl.c
index 18577b6..eeaf202 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -1564,7 +1564,9 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part)
/* exported interface, documented in nsurl.h */
const char *nsurl_access(const nsurl *url)
{
- assert(url != NULL);
+ if (url == NULL) {
+ return NULL;
+ }
return url->string;
}
--
NetSurf Browser
11 years
netsurf: branch master updated. 966fb9f215915567d44cff97a73cf3730dd8c431
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/966fb9f215915567d44cf...
...commit http://git.netsurf-browser.org/netsurf.git/commit/966fb9f215915567d44cff9...
...tree http://git.netsurf-browser.org/netsurf.git/tree/966fb9f215915567d44cff97a...
The branch, master has been updated
via 966fb9f215915567d44cff97a73cf3730dd8c431 (commit)
from 054984099fd8867da92fa685dce728e1cc665fd0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/966fb9f215915567d44...
commit 966fb9f215915567d44cff97a73cf3730dd8c431
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
rationalise the JSAPI macro usage requires nsgenbind changes
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index c100291..718dd20 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -47,24 +47,24 @@
*/
/* native function definition with five parameters */
-#define JSAPI_NATIVE(name, cx, argc, vp) \
- jsapi_native_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
+#define JSAPI_FUNC(name, cx, argc, vp) \
+ jsapi_func_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
-/* native function return value */
-#define JSAPI_RVAL(cx, vp) (jsapi_rval)
+/* native function return value - No macro available */
+#define JSAPI_FUNC_RVAL(cx, vp) (jsapi_rval)
-/* native function return value setter with no JS_SET_RVAL */
-#define JSAPI_SET_RVAL(cx, vp, v) (*jsapi_rval = (v))
+/* native function return value setter - No macro available */
+#define JSAPI_FUNC_SET_RVAL(cx, vp, v) (*jsapi_rval = (v))
/* arguments */
-#define JSAPI_ARGV(cx, vp) (vp)
+#define JSAPI_FUNC_ARGV(cx, vp) (vp)
/* check if a jsval is an object */
#define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v)
/* native function specifier with five parameters and no JS_FS macro */
#define JSAPI_FS(name, nargs, flags) \
- { #name, jsapi_native_##name, nargs, flags, 0 }
+ { #name, jsapi_func_##name, nargs, flags, 0 }
/* native function specifier list end */
#define JSAPI_FS_END { NULL, NULL, 0, 0, 0 }
@@ -73,13 +73,16 @@
/* native proprty definition */
-#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
+#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsval id, vp)
-#define JSAPI_PROPERTYSET(name, cx, obj, vp) \
+#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
jsapi_property_##name##_set(cx, obj, jsval id, vp)
+/* native property return value */
+#define JSAPI_PROP_RVAL(cx, vp) (vp)
+
/* native property getter return value */
-#define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
+#define JSAPI_PROP_SET_RVAL(cx, vp, v) (*(vp) = (v))
/* native property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) \
@@ -155,12 +158,12 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
*/
/* five parameter jsapi native call */
-#define JSAPI_NATIVE(name, cx, argc, vp) \
- jsapi_native_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
+#define JSAPI_FUNC(name, cx, argc, vp) \
+ jsapi_func_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
/* five parameter function descriptor */
#define JSAPI_FS(name, nargs, flags) \
- JS_FS(#name, jsapi_native_##name, nargs, flags, 0)
+ JS_FS(#name, jsapi_func_##name, nargs, flags, 0)
/* function descriptor end */
#define JSAPI_FS_END JS_FS_END
@@ -169,10 +172,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_RVAL(cx, vp) JS_RVAL(cx, jsapi_rval)
/* return value setter */
-#define JSAPI_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsapi_rval, v)
+#define JSAPI_FUNC_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsapi_rval, v)
/* arguments */
-#define JSAPI_ARGV(cx, vp) (vp)
+#define JSAPI_FUNC_ARGV(cx, vp) (vp)
/* check if a jsval is an object */
#define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v)
@@ -181,11 +184,17 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_THIS_OBJECT(cx,vp) jsapi_this
/* proprty native calls */
-#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
+#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsval id, vp)
-#define JSAPI_PROPERTYSET(name, cx, obj, vp) \
+#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
jsapi_property_##name##_set(cx, obj, jsval id, vp)
+/* native property return value */
+#define JSAPI_PROP_RVAL JS_RVAL
+
+/* native property return value setter */
+#define JSAPI_PROP_SET_RVAL JS_SET_RVAL
+
/* property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) \
{ name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set }
@@ -248,11 +257,11 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
/************************** Spidermonkey 1.8.5 **************************/
/* three parameter jsapi native call */
-#define JSAPI_NATIVE(name, cx, argc, vp) jsapi_native_##name(cx, argc, vp)
+#define JSAPI_FUNC(name, cx, argc, vp) jsapi_func_##name(cx, argc, vp)
/* three parameter function descriptor */
#define JSAPI_FS(name, nargs, flags) \
- JS_FS(#name, jsapi_native_##name, nargs, flags)
+ JS_FS(#name, jsapi_func_##name, nargs, flags)
/* function descriptor end */
#define JSAPI_FS_END JS_FS_END
@@ -261,10 +270,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_RVAL JS_RVAL
/* return value setter */
-#define JSAPI_SET_RVAL JS_SET_RVAL
+#define JSAPI_FUNC_SET_RVAL JS_SET_RVAL
/* arguments */
-#define JSAPI_ARGV(cx, vp) JS_ARGV(cx,vp)
+#define JSAPI_FUNC_ARGV(cx, vp) JS_ARGV(cx,vp)
/* check if a jsval is an object */
#define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v)
@@ -278,11 +287,17 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_THIS_OBJECT(cx,vp) JS_THIS_OBJECT(cx,vp)
/* proprty native calls */
-#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
+#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsid id, vp)
-#define JSAPI_PROPERTYSET(name, cx, obj, vp) \
+#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
jsapi_property_##name##_set(cx, obj, jsid id, JSBool strict, vp)
+/* native property return value */
+#define JSAPI_PROP_RVAL JS_RVAL
+
+/* native property getter return value */
+#define JSAPI_PROP_SET_RVAL JS_SET_RVAL
+
/* property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) { \
name, \
-----------------------------------------------------------------------
Summary of changes:
javascript/jsapi.h | 63 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 39 insertions(+), 24 deletions(-)
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index c100291..718dd20 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -47,24 +47,24 @@
*/
/* native function definition with five parameters */
-#define JSAPI_NATIVE(name, cx, argc, vp) \
- jsapi_native_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
+#define JSAPI_FUNC(name, cx, argc, vp) \
+ jsapi_func_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
-/* native function return value */
-#define JSAPI_RVAL(cx, vp) (jsapi_rval)
+/* native function return value - No macro available */
+#define JSAPI_FUNC_RVAL(cx, vp) (jsapi_rval)
-/* native function return value setter with no JS_SET_RVAL */
-#define JSAPI_SET_RVAL(cx, vp, v) (*jsapi_rval = (v))
+/* native function return value setter - No macro available */
+#define JSAPI_FUNC_SET_RVAL(cx, vp, v) (*jsapi_rval = (v))
/* arguments */
-#define JSAPI_ARGV(cx, vp) (vp)
+#define JSAPI_FUNC_ARGV(cx, vp) (vp)
/* check if a jsval is an object */
#define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v)
/* native function specifier with five parameters and no JS_FS macro */
#define JSAPI_FS(name, nargs, flags) \
- { #name, jsapi_native_##name, nargs, flags, 0 }
+ { #name, jsapi_func_##name, nargs, flags, 0 }
/* native function specifier list end */
#define JSAPI_FS_END { NULL, NULL, 0, 0, 0 }
@@ -73,13 +73,16 @@
/* native proprty definition */
-#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
+#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsval id, vp)
-#define JSAPI_PROPERTYSET(name, cx, obj, vp) \
+#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
jsapi_property_##name##_set(cx, obj, jsval id, vp)
+/* native property return value */
+#define JSAPI_PROP_RVAL(cx, vp) (vp)
+
/* native property getter return value */
-#define JS_SET_RVAL(cx, vp, v) (*(vp) = (v))
+#define JSAPI_PROP_SET_RVAL(cx, vp, v) (*(vp) = (v))
/* native property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) \
@@ -155,12 +158,12 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
*/
/* five parameter jsapi native call */
-#define JSAPI_NATIVE(name, cx, argc, vp) \
- jsapi_native_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
+#define JSAPI_FUNC(name, cx, argc, vp) \
+ jsapi_func_##name(cx, JSObject *jsapi_this, argc, vp, jsval *jsapi_rval)
/* five parameter function descriptor */
#define JSAPI_FS(name, nargs, flags) \
- JS_FS(#name, jsapi_native_##name, nargs, flags, 0)
+ JS_FS(#name, jsapi_func_##name, nargs, flags, 0)
/* function descriptor end */
#define JSAPI_FS_END JS_FS_END
@@ -169,10 +172,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_RVAL(cx, vp) JS_RVAL(cx, jsapi_rval)
/* return value setter */
-#define JSAPI_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsapi_rval, v)
+#define JSAPI_FUNC_SET_RVAL(cx, vp, v) JS_SET_RVAL(cx, jsapi_rval, v)
/* arguments */
-#define JSAPI_ARGV(cx, vp) (vp)
+#define JSAPI_FUNC_ARGV(cx, vp) (vp)
/* check if a jsval is an object */
#define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v)
@@ -181,11 +184,17 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_THIS_OBJECT(cx,vp) jsapi_this
/* proprty native calls */
-#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
+#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsval id, vp)
-#define JSAPI_PROPERTYSET(name, cx, obj, vp) \
+#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
jsapi_property_##name##_set(cx, obj, jsval id, vp)
+/* native property return value */
+#define JSAPI_PROP_RVAL JS_RVAL
+
+/* native property return value setter */
+#define JSAPI_PROP_SET_RVAL JS_SET_RVAL
+
/* property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) \
{ name , tinyid , flags , jsapi_property_##fnname##_get , jsapi_property_##fnname##_set }
@@ -248,11 +257,11 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
/************************** Spidermonkey 1.8.5 **************************/
/* three parameter jsapi native call */
-#define JSAPI_NATIVE(name, cx, argc, vp) jsapi_native_##name(cx, argc, vp)
+#define JSAPI_FUNC(name, cx, argc, vp) jsapi_func_##name(cx, argc, vp)
/* three parameter function descriptor */
#define JSAPI_FS(name, nargs, flags) \
- JS_FS(#name, jsapi_native_##name, nargs, flags)
+ JS_FS(#name, jsapi_func_##name, nargs, flags)
/* function descriptor end */
#define JSAPI_FS_END JS_FS_END
@@ -261,10 +270,10 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_RVAL JS_RVAL
/* return value setter */
-#define JSAPI_SET_RVAL JS_SET_RVAL
+#define JSAPI_FUNC_SET_RVAL JS_SET_RVAL
/* arguments */
-#define JSAPI_ARGV(cx, vp) JS_ARGV(cx,vp)
+#define JSAPI_FUNC_ARGV(cx, vp) JS_ARGV(cx,vp)
/* check if a jsval is an object */
#define JSAPI_JSVAL_IS_OBJECT(v) JSVAL_IS_OBJECT(v)
@@ -278,11 +287,17 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
#define JSAPI_THIS_OBJECT(cx,vp) JS_THIS_OBJECT(cx,vp)
/* proprty native calls */
-#define JSAPI_PROPERTYGET(name, cx, obj, vp) \
+#define JSAPI_PROP_GETTER(name, cx, obj, vp) \
jsapi_property_##name##_get(cx, obj, jsid id, vp)
-#define JSAPI_PROPERTYSET(name, cx, obj, vp) \
+#define JSAPI_PROP_SETTER(name, cx, obj, vp) \
jsapi_property_##name##_set(cx, obj, jsid id, JSBool strict, vp)
+/* native property return value */
+#define JSAPI_PROP_RVAL JS_RVAL
+
+/* native property getter return value */
+#define JSAPI_PROP_SET_RVAL JS_SET_RVAL
+
/* property specifier */
#define JSAPI_PS(name, fnname, tinyid, flags) { \
name, \
--
NetSurf Browser
11 years
nsgenjsbind: branch master updated. 81e6f212a13bb6a3984e962e466864db97e95fc8
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/nsgenjsbind.git/shortlog/81e6f212a13bb6a39...
...commit http://git.netsurf-browser.org/nsgenjsbind.git/commit/81e6f212a13bb6a3984...
...tree http://git.netsurf-browser.org/nsgenjsbind.git/tree/81e6f212a13bb6a3984e9...
The branch, master has been updated
via 81e6f212a13bb6a3984e962e466864db97e95fc8 (commit)
from 2bfd4d2720b55df0141189633ef6fae530663d04 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/nsgenjsbind.git/commitdiff/81e6f212a13bb6a...
commit 81e6f212a13bb6a3984e962e466864db97e95fc8
Author: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
Commit: Vincent Sanders <vincent.sanders(a)collabora.co.uk>
rename JSAPI macro usage to be consistant and unambiguous
diff --git a/src/jsapi-libdom-operator.c b/src/jsapi-libdom-operator.c
index 2aaf114..9560019 100644
--- a/src/jsapi-libdom-operator.c
+++ b/src/jsapi-libdom-operator.c
@@ -157,7 +157,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_USER:
/* User type are represented with jsobject */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -165,7 +165,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_BOOL:
/* JSBool */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
ident);
break;
@@ -182,7 +182,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_DOUBLE:
/* double */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
ident);
break;
@@ -198,14 +198,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_LONG:
/* int32_t */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
ident);
break;
case WEBIDL_TYPE_STRING:
/* JSString * */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
ident);
break;
@@ -217,7 +217,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_OBJECT:
/* JSObject * */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -393,7 +393,7 @@ output_variable_definitions(struct binding *binding,
/* at least one argument or private need to generate argv variable */
if ((arg_node != NULL) || binding->has_private) {
fprintf(binding->outfile,
- "\tjsval *argv = JSAPI_ARGV(cx, vp);\n");
+ "\tjsval *argv = JSAPI_FUNC_ARGV(cx, vp);\n");
}
while (arg_node != NULL) {
@@ -733,7 +733,7 @@ static int webidl_operator_body_cb(struct webidl_node *node, void *ctx)
/* normal operation with identifier */
fprintf(binding->outfile,
- "static JSBool JSAPI_NATIVE(%s, JSContext *cx, uintN argc, jsval *vp)\n",
+ "static JSBool JSAPI_FUNC(%s, JSContext *cx, uintN argc, jsval *vp)\n",
webidl_node_gettext(ident_node));
fprintf(binding->outfile,
"{\n");
diff --git a/src/jsapi-libdom-property.c b/src/jsapi-libdom-property.c
index 2bfb591..4ce6984 100644
--- a/src/jsapi-libdom-property.c
+++ b/src/jsapi-libdom-property.c
@@ -249,7 +249,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_USER:
/* User type are represented with jsobject */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -257,7 +257,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_BOOL:
/* JSBool */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
ident);
break;
@@ -274,14 +274,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_DOUBLE:
/* double */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
ident);
break;
case WEBIDL_TYPE_SHORT:
/* int16_t */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
ident);
break;
@@ -292,14 +292,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_LONG:
/* int32_t */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
ident);
break;
case WEBIDL_TYPE_STRING:
/* JSString * */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
ident);
break;
@@ -310,7 +310,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_OBJECT:
/* JSObject * */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -481,7 +481,7 @@ static int output_property_getter(struct binding *binding,
struct genbind_node *property_node;
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYGET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "static JSBool JSAPI_PROP_GETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
"{\n",
ident);
@@ -565,7 +565,7 @@ static int output_property_setter(struct binding *binding,
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYSET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
+ "static JSBool JSAPI_PROP_SETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
ident);
fprintf(binding->outfile,
@@ -696,39 +696,31 @@ generate_property_body(struct binding *binding, const char *interface)
return res;
}
-/* callback to emit property handlers for whole types */
-static int typehandler_property_cb(struct genbind_node *node, void *ctx)
+ /* setter for type handler */
+
+static int output_property_type_setter(struct binding *binding, struct genbind_node *node, const char *type)
{
- struct binding *binding = ctx;
- struct genbind_node *ident_node;
struct genbind_node *property_node;
- const char *type;
- struct genbind_node *mod_node;
- enum genbind_type_modifier share_mod;
-
- mod_node = genbind_node_find_type(genbind_node_getnode(node),
- NULL,
- GENBIND_NODE_TYPE_MODIFIER);
- share_mod = genbind_node_getint(mod_node);
- if ((share_mod & GENBIND_TYPE_TYPE) != GENBIND_TYPE_TYPE) {
- /* not a type handler */
- return 0;
- }
-
- ident_node = genbind_node_find_type(genbind_node_getnode(node),
- NULL,
- GENBIND_NODE_TYPE_IDENT);
- type = genbind_node_gettext(ident_node);
- if (type == NULL) {
- return 0;
- }
- /* setter for unshared types */
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYSET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "static JSBool JSAPI_PROP_SETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
"{\n",
type);
+ if (binding->has_private) {
+ /* get context */
+ fprintf(binding->outfile,
+ "\tstruct jsclass_private *private;\n"
+ "\n"
+ "\tprivate = JS_GetInstancePrivate(cx,\n"
+ "\t\tobj,\n"
+ "\t\t&JSClass_%s,\n"
+ "\t\tNULL);\n"
+ "\tif (private == NULL)\n"
+ "\t\treturn JS_FALSE;\n\n",
+ binding->interface);
+ }
+
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_SETTER,
@@ -742,15 +734,35 @@ static int typehandler_property_cb(struct genbind_node *node, void *ctx)
fprintf(binding->outfile,
" return JS_TRUE;\n"
"}\n\n");
+ return 0;
+}
- /* getter for unshared types */
+
+/* getter for type handlers */
+static int output_property_type_getter(struct binding *binding, struct genbind_node *node, const char *type)
+{
+ struct genbind_node *property_node;
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYGET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "static JSBool JSAPI_PROP_GETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
"{\n",
type);
+ if (binding->has_private) {
+ /* get context */
+ fprintf(binding->outfile,
+ "\tstruct jsclass_private *private;\n"
+ "\n"
+ "\tprivate = JS_GetInstancePrivate(cx,\n"
+ "\t\tobj,\n"
+ "\t\t&JSClass_%s,\n"
+ "\t\tNULL);\n"
+ "\tif (private == NULL)\n"
+ "\t\treturn JS_FALSE;\n\n",
+ binding->interface);
+ }
+
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_GETTER,
@@ -764,9 +776,42 @@ static int typehandler_property_cb(struct genbind_node *node, void *ctx)
fprintf(binding->outfile,
" return JS_TRUE;\n"
"}\n\n");
+ return 0;
+}
- return 0;
+/* callback to emit property handlers for whole types */
+static int typehandler_property_cb(struct genbind_node *node, void *ctx)
+{
+ struct binding *binding = ctx;
+ struct genbind_node *ident_node;
+ const char *type;
+ struct genbind_node *mod_node;
+ enum genbind_type_modifier share_mod;
+ int ret = 0;
+
+ mod_node = genbind_node_find_type(genbind_node_getnode(node),
+ NULL,
+ GENBIND_NODE_TYPE_MODIFIER);
+ share_mod = genbind_node_getint(mod_node);
+ if ((share_mod & GENBIND_TYPE_TYPE) == GENBIND_TYPE_TYPE) {
+ /* type handler */
+
+ ident_node = genbind_node_find_type(genbind_node_getnode(node),
+ NULL,
+ GENBIND_NODE_TYPE_IDENT);
+ type = genbind_node_gettext(ident_node);
+ if (type != NULL) {
+ ret = output_property_type_setter(binding, node, type);
+ if (ret == 0) {
+ /* property getter */
+ ret = output_property_type_getter(binding,
+ node,
+ type);
+ }
+ }
+ }
+ return ret;
}
/* exported interface documented in jsapi-libdom.h */
-----------------------------------------------------------------------
Summary of changes:
src/jsapi-libdom-operator.c | 16 +++---
src/jsapi-libdom-property.c | 121 +++++++++++++++++++++++++++++-------------
2 files changed, 91 insertions(+), 46 deletions(-)
diff --git a/src/jsapi-libdom-operator.c b/src/jsapi-libdom-operator.c
index 2aaf114..9560019 100644
--- a/src/jsapi-libdom-operator.c
+++ b/src/jsapi-libdom-operator.c
@@ -157,7 +157,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_USER:
/* User type are represented with jsobject */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -165,7 +165,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_BOOL:
/* JSBool */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
ident);
break;
@@ -182,7 +182,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_DOUBLE:
/* double */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
ident);
break;
@@ -198,14 +198,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_LONG:
/* int32_t */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
ident);
break;
case WEBIDL_TYPE_STRING:
/* JSString * */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
ident);
break;
@@ -217,7 +217,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_OBJECT:
/* JSObject * */
fprintf(binding->outfile,
- "\tJSAPI_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_FUNC_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -393,7 +393,7 @@ output_variable_definitions(struct binding *binding,
/* at least one argument or private need to generate argv variable */
if ((arg_node != NULL) || binding->has_private) {
fprintf(binding->outfile,
- "\tjsval *argv = JSAPI_ARGV(cx, vp);\n");
+ "\tjsval *argv = JSAPI_FUNC_ARGV(cx, vp);\n");
}
while (arg_node != NULL) {
@@ -733,7 +733,7 @@ static int webidl_operator_body_cb(struct webidl_node *node, void *ctx)
/* normal operation with identifier */
fprintf(binding->outfile,
- "static JSBool JSAPI_NATIVE(%s, JSContext *cx, uintN argc, jsval *vp)\n",
+ "static JSBool JSAPI_FUNC(%s, JSContext *cx, uintN argc, jsval *vp)\n",
webidl_node_gettext(ident_node));
fprintf(binding->outfile,
"{\n");
diff --git a/src/jsapi-libdom-property.c b/src/jsapi-libdom-property.c
index 2bfb591..4ce6984 100644
--- a/src/jsapi-libdom-property.c
+++ b/src/jsapi-libdom-property.c
@@ -249,7 +249,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_USER:
/* User type are represented with jsobject */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -257,7 +257,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_BOOL:
/* JSBool */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n",
ident);
break;
@@ -274,14 +274,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_DOUBLE:
/* double */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n",
ident);
break;
case WEBIDL_TYPE_SHORT:
/* int16_t */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
ident);
break;
@@ -292,14 +292,14 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_LONG:
/* int32_t */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n",
ident);
break;
case WEBIDL_TYPE_STRING:
/* JSString * */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n",
ident);
break;
@@ -310,7 +310,7 @@ static int output_return(struct binding *binding,
case WEBIDL_TYPE_OBJECT:
/* JSObject * */
fprintf(binding->outfile,
- "\tJS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
+ "\tJSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n",
ident);
break;
@@ -481,7 +481,7 @@ static int output_property_getter(struct binding *binding,
struct genbind_node *property_node;
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYGET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "static JSBool JSAPI_PROP_GETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
"{\n",
ident);
@@ -565,7 +565,7 @@ static int output_property_setter(struct binding *binding,
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYSET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
+ "static JSBool JSAPI_PROP_SETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n",
ident);
fprintf(binding->outfile,
@@ -696,39 +696,31 @@ generate_property_body(struct binding *binding, const char *interface)
return res;
}
-/* callback to emit property handlers for whole types */
-static int typehandler_property_cb(struct genbind_node *node, void *ctx)
+ /* setter for type handler */
+
+static int output_property_type_setter(struct binding *binding, struct genbind_node *node, const char *type)
{
- struct binding *binding = ctx;
- struct genbind_node *ident_node;
struct genbind_node *property_node;
- const char *type;
- struct genbind_node *mod_node;
- enum genbind_type_modifier share_mod;
-
- mod_node = genbind_node_find_type(genbind_node_getnode(node),
- NULL,
- GENBIND_NODE_TYPE_MODIFIER);
- share_mod = genbind_node_getint(mod_node);
- if ((share_mod & GENBIND_TYPE_TYPE) != GENBIND_TYPE_TYPE) {
- /* not a type handler */
- return 0;
- }
-
- ident_node = genbind_node_find_type(genbind_node_getnode(node),
- NULL,
- GENBIND_NODE_TYPE_IDENT);
- type = genbind_node_gettext(ident_node);
- if (type == NULL) {
- return 0;
- }
- /* setter for unshared types */
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYSET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "static JSBool JSAPI_PROP_SETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
"{\n",
type);
+ if (binding->has_private) {
+ /* get context */
+ fprintf(binding->outfile,
+ "\tstruct jsclass_private *private;\n"
+ "\n"
+ "\tprivate = JS_GetInstancePrivate(cx,\n"
+ "\t\tobj,\n"
+ "\t\t&JSClass_%s,\n"
+ "\t\tNULL);\n"
+ "\tif (private == NULL)\n"
+ "\t\treturn JS_FALSE;\n\n",
+ binding->interface);
+ }
+
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_SETTER,
@@ -742,15 +734,35 @@ static int typehandler_property_cb(struct genbind_node *node, void *ctx)
fprintf(binding->outfile,
" return JS_TRUE;\n"
"}\n\n");
+ return 0;
+}
- /* getter for unshared types */
+
+/* getter for type handlers */
+static int output_property_type_getter(struct binding *binding, struct genbind_node *node, const char *type)
+{
+ struct genbind_node *property_node;
fprintf(binding->outfile,
- "static JSBool JSAPI_PROPERTYGET(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
+ "static JSBool JSAPI_PROP_GETTER(%s, JSContext *cx, JSObject *obj, jsval *vp)\n"
"{\n",
type);
+ if (binding->has_private) {
+ /* get context */
+ fprintf(binding->outfile,
+ "\tstruct jsclass_private *private;\n"
+ "\n"
+ "\tprivate = JS_GetInstancePrivate(cx,\n"
+ "\t\tobj,\n"
+ "\t\t&JSClass_%s,\n"
+ "\t\tNULL);\n"
+ "\tif (private == NULL)\n"
+ "\t\treturn JS_FALSE;\n\n",
+ binding->interface);
+ }
+
property_node = genbind_node_find_type_ident(binding->gb_ast,
NULL,
GENBIND_NODE_TYPE_GETTER,
@@ -764,9 +776,42 @@ static int typehandler_property_cb(struct genbind_node *node, void *ctx)
fprintf(binding->outfile,
" return JS_TRUE;\n"
"}\n\n");
+ return 0;
+}
- return 0;
+/* callback to emit property handlers for whole types */
+static int typehandler_property_cb(struct genbind_node *node, void *ctx)
+{
+ struct binding *binding = ctx;
+ struct genbind_node *ident_node;
+ const char *type;
+ struct genbind_node *mod_node;
+ enum genbind_type_modifier share_mod;
+ int ret = 0;
+
+ mod_node = genbind_node_find_type(genbind_node_getnode(node),
+ NULL,
+ GENBIND_NODE_TYPE_MODIFIER);
+ share_mod = genbind_node_getint(mod_node);
+ if ((share_mod & GENBIND_TYPE_TYPE) == GENBIND_TYPE_TYPE) {
+ /* type handler */
+
+ ident_node = genbind_node_find_type(genbind_node_getnode(node),
+ NULL,
+ GENBIND_NODE_TYPE_IDENT);
+ type = genbind_node_gettext(ident_node);
+ if (type != NULL) {
+ ret = output_property_type_setter(binding, node, type);
+ if (ret == 0) {
+ /* property getter */
+ ret = output_property_type_getter(binding,
+ node,
+ type);
+ }
+ }
+ }
+ return ret;
}
/* exported interface documented in jsapi-libdom.h */
--
NetSurf Generator for JavaScript bindings
11 years
netsurf: branch mono/removing-windom-dependency updated. 6ea22068aa50dfa15807e80277b1ad843146a76c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6ea22068aa50dfa15807e...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6ea22068aa50dfa15807e80...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6ea22068aa50dfa15807e8027...
The branch, mono/removing-windom-dependency has been updated
via 6ea22068aa50dfa15807e80277b1ad843146a76c (commit)
from 407389668b4806de585c5ab26b9e49d1bd92afab (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/6ea22068aa50dfa1580...
commit 6ea22068aa50dfa15807e80277b1ad843146a76c
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Fixed typo, caused small scroll bug.
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index aeace7c..cf47c46 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -151,12 +151,12 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
wind_set(gw->handle, WF_HSLIDE, msg[4], 0, 0, 0);
slid = guiwin_get_scroll_info(gw);
val = (float)(slid->x_units-(g.g_w/slid->x_unit_px))/1000*(float)msg[4];
- if(val != slid->y_pos) {
+ if(val != slid->x_pos) {
if (val < slid->x_pos) {
- val = -(slid->x_pos - val);
+ val = -(MAX(0, slid->x_pos-val));
}
else {
- val = val -slid->x_pos;
+ val = val-slid->x_pos;
}
preproc_scroll(gw, GUIWIN_HSLIDER, val, false);
}
-----------------------------------------------------------------------
Summary of changes:
atari/gemtk/guiwin.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index aeace7c..cf47c46 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -151,12 +151,12 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
wind_set(gw->handle, WF_HSLIDE, msg[4], 0, 0, 0);
slid = guiwin_get_scroll_info(gw);
val = (float)(slid->x_units-(g.g_w/slid->x_unit_px))/1000*(float)msg[4];
- if(val != slid->y_pos) {
+ if(val != slid->x_pos) {
if (val < slid->x_pos) {
- val = -(slid->x_pos - val);
+ val = -(MAX(0, slid->x_pos-val));
}
else {
- val = val -slid->x_pos;
+ val = val-slid->x_pos;
}
preproc_scroll(gw, GUIWIN_HSLIDER, val, false);
}
--
NetSurf Browser
11 years
netsurf: branch mono/removing-windom-dependency updated. 407389668b4806de585c5ab26b9e49d1bd92afab
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/407389668b4806de585c5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/407389668b4806de585c5ab...
...tree http://git.netsurf-browser.org/netsurf.git/tree/407389668b4806de585c5ab26...
The branch, mono/removing-windom-dependency has been updated
via 407389668b4806de585c5ab26b9e49d1bd92afab (commit)
from 42cb583842ccc33b71cf0f9304ceebde1b51eaa3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/407389668b4806de585...
commit 407389668b4806de585c5ab26b9e49d1bd92afab
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Hotlist now works without windom.
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 5184451..6c590b5 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -62,6 +62,8 @@ short msg_box_show(short type, const char * msg);
#define GW_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling
#define GW_FLAG_CUSTOM_SCROLLING 0x10 // no internal scroller handling
+#define GW_FLAG_DEFAULTS (GW_FLAG_PREPROC_WM | GW_FLAG_RECV_PREPROC_WM)
+
#define GW_STATUS_ICONIFIED 0x01
#define GW_STATUS_SHADED 0x02
@@ -78,8 +80,8 @@ struct guiwin_scroll_info_s {
int y_unit_px;
int x_pos;
int y_pos;
- int x_pos_max;
- int y_pos_max;
+ int x_units;
+ int y_units;
};
enum guwin_area_e {
@@ -110,7 +112,7 @@ bool guiwin_update_slider(GUIWIN *win, short mode);
void guiwin_send_redraw(GUIWIN *win, GRECT *area);
VdiHdl guiwin_get_vdi_handle(GUIWIN *win);
bool guiwin_has_intersection(GUIWIN *win, GRECT *work);
-
+void guiwin_toolbar_redraw(GUIWIN *gw, GRECT *clip);
/*
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 1725850..aeace7c 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -314,6 +314,7 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
{
GUIWIN *dest;
short retval = 0;
+ bool handler_called = false;
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
DEBUG_PRINT(("guiwin_handle_event_multi_fast: %d\n", msg[0]));
@@ -346,10 +347,12 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
retval = preproc_wm(dest, ev_out, msg);
if(((retval == 0)||(dest->flags&GW_FLAG_RECV_PREPROC_WM))) {
retval = dest->handler_func(dest, ev_out, msg);
+ handler_called = true;
}
} else {
if (dest->handler_func) {
retval = dest->handler_func(dest, ev_out, msg);
+ handler_called = true;
}
}
@@ -396,13 +399,13 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
short oldevents = ev_out->emo_events;
ev_out->emo_events = MU_MESAG;
dest->handler_func(dest, ev_out, msg_out);
+ handler_called=true;
ev_out->emo_events = oldevents;
retval = 1;
- } else {
- dest->handler_func(dest, ev_out, msg);
}
}
- } else if(ev_out->emo_events & MU_KEYBD) {
+ }
+ if (handler_called==false) {
dest->handler_func(dest, ev_out, msg);
}
}
@@ -457,11 +460,10 @@ GUIWIN * guiwin_add(short handle, uint32_t flags, guiwin_event_handler_f cb)
GUIWIN *guiwin_find(short handle)
{
GUIWIN *g;
- DEBUG_PRINT(("guiwin_find: handle: %d\n", handle));
+ DEBUG_PRINT(("guiwin search handle: %d\n", handle));
for( g = winlist; g != NULL; g=g->next ) {
- DEBUG_PRINT(("guiwin search: %d\n", g->handle));
if(g->handle == handle) {
- DEBUG_PRINT(("guiwin_find: %p\n", g));
+ DEBUG_PRINT(("guiwin found handle: %p\n", g));
return(g);
}
}
@@ -496,7 +498,7 @@ short guiwin_remove(GUIWIN *win)
if (win->next != NULL) {
win->next->prev = win->prev;
}
-
+ DEBUG_PRINT(("guiwin free: %p\n", win));
free(win);
return(0);
}
diff --git a/atari/gui.c b/atari/gui.c
index 7204705..889e4f2 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -165,7 +165,9 @@ void gui_poll(bool active)
gui_poll_repeat = false;
- evnt.timer = schedule_run();
+ aes_event_in.emi_tlow = schedule_run();
+
+ //printf("time: ");
if(active || rendering)
aes_event_in.emi_tlow = 0;
@@ -203,7 +205,7 @@ void gui_poll(bool active)
/* this suits for stuff with lower priority */
/* TBD: really be spare on redraws??? */
hotlist_redraw();
- //global_history_redraw();
+ global_history_redraw();
}
}
diff --git a/atari/history.c b/atari/history.c
index 0df7ec4..6e84ad3 100755
--- a/atari/history.c
+++ b/atari/history.c
@@ -45,76 +45,87 @@ struct s_atari_global_history gl_history;
void global_history_open( void )
{
- GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2};
-
if (gl_history.init == false ) {
- printf("history not init");
return;
}
if( gl_history.open == false ) {
- WindOpen( gl_history.window, pos.g_x, pos.g_y, pos.g_w, pos.g_h);
+
+ GRECT pos;
+ wind_get_grect(0, WF_FULLXYWH, &pos);
+ pos.g_x = pos.g_w - pos.g_w / 4;
+ pos.g_y = pos.g_y;
+ pos.g_w = pos.g_w / 4;
+ pos.g_h = pos.g_h;
+
+ wind_open(guiwin_get_handle(gl_history.window), pos.g_x, pos.g_y,
+ pos.g_w, pos.g_h);
gl_history.open = true;
- atari_treeview_open( gl_history.tv );
+ atari_treeview_open(gl_history.tv);
} else {
- WindTop( gl_history.window );
+ wind_set(guiwin_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
}
}
void global_history_close( void )
{
- WindClose(gl_history.window);
+ wind_close(guiwin_get_handle(gl_history.window));
gl_history.open = false;
- atari_treeview_close( gl_history.tv );
+ atari_treeview_close(gl_history.tv);
}
-
-static void __CDECL evnt_history_close( WINDOW *win, short buff[8] )
+static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- global_history_close();
-}
+ NSTREEVIEW tv=NULL;
+ printf("Hotlist event %d, open: %d\n", ev_out->emo_events, gl_history.open);
-static void __CDECL evnt_history_mbutton( WINDOW *win, short buff[8] )
-{
- /* todo: implement popup?
- if(evnt.mbut & 2) {
+ if(ev_out->emo_events & MU_MESAG){
+ switch (msg[0]) {
+
+ case WM_CLOSED:
+ global_history_close();
+ break;
+ default: break;
+ }
}
- */
+
+ // TODO: implement selectable objects in toolbar API:
+ // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
}
bool global_history_init( void )
{
- return(true);
-// if( gl_history.init == false ) {
-//
-// int flags = ATARI_TREEVIEW_WIDGETS;
-// gl_history.open = false;
-// gl_history.window = WindCreate( flags, 40, 40, app.w, app.h );
-// if( gl_history.window == NULL ) {
-// LOG(("Failed to allocate history window"));
-// return( false );
-// }
-// WindSetStr(gl_history.window, WF_NAME, messages_get("GlobalHistory"));
-// //WindSetPtr( gl_history.window, WF_TOOLBAR, tree, evnt_history_toolbar );
-// EvntAttach( gl_history.window, WM_CLOSED, evnt_history_close );
-// EvntAttach( gl_history.window, WM_XBUTTON,evnt_history_mbutton );
-//
-// gl_history.tv = atari_treeview_create(
-// history_global_get_tree_flags(),
-// gl_history.window,
-// NULL
-// );
-// if (gl_history.tv == NULL) {
-// /* handle it properly, clean up previous allocs */
-// LOG(("Failed to allocate history treeview"));
-// return( false );
-// }
-//
-// history_global_initialise( gl_history.tv->tree, "dir.png" );
-// gl_history.init = true;
-// }
+ if( gl_history.init == false ) {
+
+ short handle;
+ GRECT desk;
+ int flags = ATARI_TREEVIEW_WIDGETS;
+
+ wind_get_grect(0, WF_FULLXYWH, &desk);
+
+ gl_history.open = false;
+ handle = wind_create(flags, 40, 40, desk.g_w, desk.g_h);
+ gl_history.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
+ if( gl_history.window == NULL ) {
+ LOG(("Failed to allocate history window"));
+ return( false );
+ }
+ wind_set_str(handle, WF_NAME, (char*)messages_get("GlobalHistory"));
+
+ gl_history.tv = atari_treeview_create(history_global_get_tree_flags(),
+ gl_history.window, handle_event);
+
+ if (gl_history.tv == NULL) {
+ /* TODO: handle it properly, clean up previous allocs */
+ LOG(("Failed to allocate history treeview"));
+ return( false );
+ }
+
+ history_global_initialise(gl_history.tv->tree, "dir.png");
+ gl_history.init = true;
+ }
return( true );
}
@@ -128,9 +139,10 @@ void global_history_destroy( void )
history_global_cleanup();
if( gl_history.open )
global_history_close();
- WindDelete( gl_history.window );
+ wind_delete(guiwin_get_handle(gl_history.window));
+ guiwin_remove(gl_history.window);
gl_history.window = NULL;
- atari_treeview_destroy( gl_history.tv );
+ atari_treeview_destroy(gl_history.tv);
gl_history.init = false;
}
LOG(("done"));
diff --git a/atari/history.h b/atari/history.h
index bfea9ec..2935793 100755
--- a/atari/history.h
+++ b/atari/history.h
@@ -23,9 +23,10 @@
#include <windom.h>
#include "desktop/tree.h"
#include "atari/treeview.h"
+#include "atari/gemtk/gemtk.h"
struct s_atari_global_history {
- WINDOW * window;
+ GUIWIN *window; /*< The GEMTK window ref */
NSTREEVIEW tv; /*< The history treeview handle. */
bool open;
bool init;
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 6685ba5..72d3445 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -23,8 +23,6 @@
#include <stdlib.h>
#include <time.h>
-#include <windom.h>
-
#include "desktop/browser.h"
#include "content/content.h"
#include "content/hlcache.h"
@@ -112,13 +110,15 @@ void hotlist_init(void)
if( hl.window == NULL ){
int flags = ATARI_TREEVIEW_WIDGETS;
short handle = -1;
+ GRECT desk;
OBJECT * tree = get_tree(TOOLBAR_HOTLIST);
assert( tree );
hl.open = false;
- handle = wind_create(flags, 0, 0, app.w, app.h);
- hl.window = guiwin_add(handle,
- GW_FLAG_PREPROC_WM|GW_FLAG_RECV_PREPROC_WM,
- NULL);
+
+ wind_get_grect(0, WF_FULLXYWH, &desk);
+
+ handle = wind_create(flags, 0, 0, desk.g_w, desk.g_h);
+ hl.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
if( hl.window == NULL ) {
LOG(("Failed to allocate Hotlist"));
return;
@@ -151,13 +151,19 @@ void hotlist_init(void)
void hotlist_open(void)
{
- GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2};
-
if( hl.init == false ) {
return;
}
if( hl.open == false ) {
+
+ GRECT pos;
+ wind_get_grect(0, WF_FULLXYWH, &pos);
+ pos.g_x = pos.g_w - pos.g_w / 4;
+ pos.g_y = pos.g_y;
+ pos.g_w = pos.g_w / 4;
+ pos.g_h = pos.g_h;
+
wind_open_grect(guiwin_get_handle(hl.window), &pos);
hl.open = true;
atari_treeview_open( hl.tv );
diff --git a/atari/treeview.c b/atari/treeview.c
index 6b45fb0..7144d21 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -453,7 +453,7 @@ void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw)
tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
}
- //dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
+ dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
}
}
-----------------------------------------------------------------------
Summary of changes:
atari/gemtk/gemtk.h | 8 ++-
atari/gemtk/guiwin.c | 16 ++++---
atari/gui.c | 6 ++-
atari/history.c | 108 ++++++++++++++++++++++++++++----------------------
atari/history.h | 3 +-
atari/hotlist.c | 22 ++++++----
atari/treeview.c | 2 +-
7 files changed, 95 insertions(+), 70 deletions(-)
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 5184451..6c590b5 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -62,6 +62,8 @@ short msg_box_show(short type, const char * msg);
#define GW_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling
#define GW_FLAG_CUSTOM_SCROLLING 0x10 // no internal scroller handling
+#define GW_FLAG_DEFAULTS (GW_FLAG_PREPROC_WM | GW_FLAG_RECV_PREPROC_WM)
+
#define GW_STATUS_ICONIFIED 0x01
#define GW_STATUS_SHADED 0x02
@@ -78,8 +80,8 @@ struct guiwin_scroll_info_s {
int y_unit_px;
int x_pos;
int y_pos;
- int x_pos_max;
- int y_pos_max;
+ int x_units;
+ int y_units;
};
enum guwin_area_e {
@@ -110,7 +112,7 @@ bool guiwin_update_slider(GUIWIN *win, short mode);
void guiwin_send_redraw(GUIWIN *win, GRECT *area);
VdiHdl guiwin_get_vdi_handle(GUIWIN *win);
bool guiwin_has_intersection(GUIWIN *win, GRECT *work);
-
+void guiwin_toolbar_redraw(GUIWIN *gw, GRECT *clip);
/*
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 1725850..aeace7c 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -314,6 +314,7 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
{
GUIWIN *dest;
short retval = 0;
+ bool handler_called = false;
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
DEBUG_PRINT(("guiwin_handle_event_multi_fast: %d\n", msg[0]));
@@ -346,10 +347,12 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
retval = preproc_wm(dest, ev_out, msg);
if(((retval == 0)||(dest->flags&GW_FLAG_RECV_PREPROC_WM))) {
retval = dest->handler_func(dest, ev_out, msg);
+ handler_called = true;
}
} else {
if (dest->handler_func) {
retval = dest->handler_func(dest, ev_out, msg);
+ handler_called = true;
}
}
@@ -396,13 +399,13 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
short oldevents = ev_out->emo_events;
ev_out->emo_events = MU_MESAG;
dest->handler_func(dest, ev_out, msg_out);
+ handler_called=true;
ev_out->emo_events = oldevents;
retval = 1;
- } else {
- dest->handler_func(dest, ev_out, msg);
}
}
- } else if(ev_out->emo_events & MU_KEYBD) {
+ }
+ if (handler_called==false) {
dest->handler_func(dest, ev_out, msg);
}
}
@@ -457,11 +460,10 @@ GUIWIN * guiwin_add(short handle, uint32_t flags, guiwin_event_handler_f cb)
GUIWIN *guiwin_find(short handle)
{
GUIWIN *g;
- DEBUG_PRINT(("guiwin_find: handle: %d\n", handle));
+ DEBUG_PRINT(("guiwin search handle: %d\n", handle));
for( g = winlist; g != NULL; g=g->next ) {
- DEBUG_PRINT(("guiwin search: %d\n", g->handle));
if(g->handle == handle) {
- DEBUG_PRINT(("guiwin_find: %p\n", g));
+ DEBUG_PRINT(("guiwin found handle: %p\n", g));
return(g);
}
}
@@ -496,7 +498,7 @@ short guiwin_remove(GUIWIN *win)
if (win->next != NULL) {
win->next->prev = win->prev;
}
-
+ DEBUG_PRINT(("guiwin free: %p\n", win));
free(win);
return(0);
}
diff --git a/atari/gui.c b/atari/gui.c
index 7204705..889e4f2 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -165,7 +165,9 @@ void gui_poll(bool active)
gui_poll_repeat = false;
- evnt.timer = schedule_run();
+ aes_event_in.emi_tlow = schedule_run();
+
+ //printf("time: ");
if(active || rendering)
aes_event_in.emi_tlow = 0;
@@ -203,7 +205,7 @@ void gui_poll(bool active)
/* this suits for stuff with lower priority */
/* TBD: really be spare on redraws??? */
hotlist_redraw();
- //global_history_redraw();
+ global_history_redraw();
}
}
diff --git a/atari/history.c b/atari/history.c
index 0df7ec4..6e84ad3 100755
--- a/atari/history.c
+++ b/atari/history.c
@@ -45,76 +45,87 @@ struct s_atari_global_history gl_history;
void global_history_open( void )
{
- GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2};
-
if (gl_history.init == false ) {
- printf("history not init");
return;
}
if( gl_history.open == false ) {
- WindOpen( gl_history.window, pos.g_x, pos.g_y, pos.g_w, pos.g_h);
+
+ GRECT pos;
+ wind_get_grect(0, WF_FULLXYWH, &pos);
+ pos.g_x = pos.g_w - pos.g_w / 4;
+ pos.g_y = pos.g_y;
+ pos.g_w = pos.g_w / 4;
+ pos.g_h = pos.g_h;
+
+ wind_open(guiwin_get_handle(gl_history.window), pos.g_x, pos.g_y,
+ pos.g_w, pos.g_h);
gl_history.open = true;
- atari_treeview_open( gl_history.tv );
+ atari_treeview_open(gl_history.tv);
} else {
- WindTop( gl_history.window );
+ wind_set(guiwin_get_handle(gl_history.window), WF_TOP, 1, 0, 0, 0);
}
}
void global_history_close( void )
{
- WindClose(gl_history.window);
+ wind_close(guiwin_get_handle(gl_history.window));
gl_history.open = false;
- atari_treeview_close( gl_history.tv );
+ atari_treeview_close(gl_history.tv);
}
-
-static void __CDECL evnt_history_close( WINDOW *win, short buff[8] )
+static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
- global_history_close();
-}
+ NSTREEVIEW tv=NULL;
+ printf("Hotlist event %d, open: %d\n", ev_out->emo_events, gl_history.open);
-static void __CDECL evnt_history_mbutton( WINDOW *win, short buff[8] )
-{
- /* todo: implement popup?
- if(evnt.mbut & 2) {
+ if(ev_out->emo_events & MU_MESAG){
+ switch (msg[0]) {
+
+ case WM_CLOSED:
+ global_history_close();
+ break;
+ default: break;
+ }
}
- */
+
+ // TODO: implement selectable objects in toolbar API:
+ // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG );
}
bool global_history_init( void )
{
- return(true);
-// if( gl_history.init == false ) {
-//
-// int flags = ATARI_TREEVIEW_WIDGETS;
-// gl_history.open = false;
-// gl_history.window = WindCreate( flags, 40, 40, app.w, app.h );
-// if( gl_history.window == NULL ) {
-// LOG(("Failed to allocate history window"));
-// return( false );
-// }
-// WindSetStr(gl_history.window, WF_NAME, messages_get("GlobalHistory"));
-// //WindSetPtr( gl_history.window, WF_TOOLBAR, tree, evnt_history_toolbar );
-// EvntAttach( gl_history.window, WM_CLOSED, evnt_history_close );
-// EvntAttach( gl_history.window, WM_XBUTTON,evnt_history_mbutton );
-//
-// gl_history.tv = atari_treeview_create(
-// history_global_get_tree_flags(),
-// gl_history.window,
-// NULL
-// );
-// if (gl_history.tv == NULL) {
-// /* handle it properly, clean up previous allocs */
-// LOG(("Failed to allocate history treeview"));
-// return( false );
-// }
-//
-// history_global_initialise( gl_history.tv->tree, "dir.png" );
-// gl_history.init = true;
-// }
+ if( gl_history.init == false ) {
+
+ short handle;
+ GRECT desk;
+ int flags = ATARI_TREEVIEW_WIDGETS;
+
+ wind_get_grect(0, WF_FULLXYWH, &desk);
+
+ gl_history.open = false;
+ handle = wind_create(flags, 40, 40, desk.g_w, desk.g_h);
+ gl_history.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
+ if( gl_history.window == NULL ) {
+ LOG(("Failed to allocate history window"));
+ return( false );
+ }
+ wind_set_str(handle, WF_NAME, (char*)messages_get("GlobalHistory"));
+
+ gl_history.tv = atari_treeview_create(history_global_get_tree_flags(),
+ gl_history.window, handle_event);
+
+ if (gl_history.tv == NULL) {
+ /* TODO: handle it properly, clean up previous allocs */
+ LOG(("Failed to allocate history treeview"));
+ return( false );
+ }
+
+ history_global_initialise(gl_history.tv->tree, "dir.png");
+ gl_history.init = true;
+ }
return( true );
}
@@ -128,9 +139,10 @@ void global_history_destroy( void )
history_global_cleanup();
if( gl_history.open )
global_history_close();
- WindDelete( gl_history.window );
+ wind_delete(guiwin_get_handle(gl_history.window));
+ guiwin_remove(gl_history.window);
gl_history.window = NULL;
- atari_treeview_destroy( gl_history.tv );
+ atari_treeview_destroy(gl_history.tv);
gl_history.init = false;
}
LOG(("done"));
diff --git a/atari/history.h b/atari/history.h
index bfea9ec..2935793 100755
--- a/atari/history.h
+++ b/atari/history.h
@@ -23,9 +23,10 @@
#include <windom.h>
#include "desktop/tree.h"
#include "atari/treeview.h"
+#include "atari/gemtk/gemtk.h"
struct s_atari_global_history {
- WINDOW * window;
+ GUIWIN *window; /*< The GEMTK window ref */
NSTREEVIEW tv; /*< The history treeview handle. */
bool open;
bool init;
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 6685ba5..72d3445 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -23,8 +23,6 @@
#include <stdlib.h>
#include <time.h>
-#include <windom.h>
-
#include "desktop/browser.h"
#include "content/content.h"
#include "content/hlcache.h"
@@ -112,13 +110,15 @@ void hotlist_init(void)
if( hl.window == NULL ){
int flags = ATARI_TREEVIEW_WIDGETS;
short handle = -1;
+ GRECT desk;
OBJECT * tree = get_tree(TOOLBAR_HOTLIST);
assert( tree );
hl.open = false;
- handle = wind_create(flags, 0, 0, app.w, app.h);
- hl.window = guiwin_add(handle,
- GW_FLAG_PREPROC_WM|GW_FLAG_RECV_PREPROC_WM,
- NULL);
+
+ wind_get_grect(0, WF_FULLXYWH, &desk);
+
+ handle = wind_create(flags, 0, 0, desk.g_w, desk.g_h);
+ hl.window = guiwin_add(handle, GW_FLAG_DEFAULTS, NULL);
if( hl.window == NULL ) {
LOG(("Failed to allocate Hotlist"));
return;
@@ -151,13 +151,19 @@ void hotlist_init(void)
void hotlist_open(void)
{
- GRECT pos = {app.w - (app.w/3), app.y, app.w/3, app.h/2};
-
if( hl.init == false ) {
return;
}
if( hl.open == false ) {
+
+ GRECT pos;
+ wind_get_grect(0, WF_FULLXYWH, &pos);
+ pos.g_x = pos.g_w - pos.g_w / 4;
+ pos.g_y = pos.g_y;
+ pos.g_w = pos.g_w / 4;
+ pos.g_h = pos.g_h;
+
wind_open_grect(guiwin_get_handle(hl.window), &pos);
hl.open = true;
atari_treeview_open( hl.tv );
diff --git a/atari/treeview.c b/atari/treeview.c
index 6b45fb0..7144d21 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -453,7 +453,7 @@ void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw)
tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
}
- //dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
+ dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
}
}
--
NetSurf Browser
11 years
netsurf: branch mono/removing-windom-dependency updated. 42cb583842ccc33b71cf0f9304ceebde1b51eaa3
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/42cb583842ccc33b71cf0...
...commit http://git.netsurf-browser.org/netsurf.git/commit/42cb583842ccc33b71cf0f9...
...tree http://git.netsurf-browser.org/netsurf.git/tree/42cb583842ccc33b71cf0f930...
The branch, mono/removing-windom-dependency has been updated
via 42cb583842ccc33b71cf0f9304ceebde1b51eaa3 (commit)
from ccdab30c9a93989df986def422c1ff68d0b80a18 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/42cb583842ccc33b71c...
commit 42cb583842ccc33b71cf0f9304ceebde1b51eaa3
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Improved WM_FULLED handling (prev. size is getting restored)
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 026b18c..1725850 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -53,15 +53,131 @@ static void move_rect(GRECT *rect, int dx, int dy)
wind_update(END_UPDATE);
}
+static void preproc_scroll(GUIWIN *gw, short orientation, int units,
+ bool refresh)
+{
+ struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(gw);
+ int oldpos = 0, newpos = 0, vis_units=0, pix = 0;
+ int abs_pix = 0;
+ GRECT *redraw=NULL, g, g_ro;
+
+ guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ g_ro = g;
+
+ if (orientation == GUIWIN_VSLIDER) {
+ pix = units*slid->y_unit_px;
+ abs_pix = abs(pix);
+ oldpos = slid->y_pos;
+ vis_units = g.g_h/slid->y_unit_px;
+ newpos = slid->y_pos = MIN(slid->y_units-vis_units,
+ MAX(0, slid->y_pos+units));
+ if(oldpos == newpos)
+ return;
+ if (units>=vis_units || guiwin_has_intersection(gw, &g_ro)) {
+ // send complete redraw
+ redraw = &g_ro;
+ } else {
+ // only adjust ypos when scrolling down:
+ if(pix < 0 ) {
+ // blit screen area:
+ g.g_h -= abs_pix;
+ move_rect(&g, 0, abs_pix);
+ g.g_y = g_ro.g_y;
+ g.g_h = abs_pix;
+ redraw = &g;
+ } else {
+ // blit screen area:
+ g.g_y += abs_pix;
+ g.g_h -= abs_pix;
+ move_rect(&g, 0, -abs_pix);
+ g.g_y = g_ro.g_y + g_ro.g_h - abs_pix;
+ g.g_h = abs_pix;
+ redraw = &g;
+ }
+ }
+ } else {
+ pix = units*slid->x_unit_px;
+ abs_pix = abs(pix);
+ oldpos = slid->x_pos;
+ vis_units = g.g_w/slid->x_unit_px;
+ newpos = slid->x_pos = MIN(slid->x_units-vis_units,
+ MAX(0, slid->x_pos+units));
+ if(oldpos == newpos)
+ return;
+ if (units>=vis_units || guiwin_has_intersection(gw, &g_ro)) {
+ // send complete redraw
+ redraw = &g_ro;
+ } else {
+ // only adjust ypos when scrolling down:
+ if(pix < 0 ) {
+ // blit screen area:
+ g.g_w -= abs_pix;
+ move_rect(&g, abs_pix, 0);
+ g.g_x = g_ro.g_x;
+ g.g_w = abs_pix;
+ redraw = &g;
+ } else {
+ // blit screen area:
+ g.g_x += abs_pix;
+ g.g_w -= abs_pix;
+ move_rect(&g, -abs_pix, 0);
+ g.g_x = g_ro.g_x + g_ro.g_w - abs_pix;
+ g.g_w = abs_pix;
+ redraw = &g;
+ }
+ }
+ }
+
+ if (refresh) {
+ guiwin_update_slider(gw, orientation);
+ }
+
+ if ((redraw != NULL) && (redraw->g_h > 0)) {
+ guiwin_send_redraw(gw, redraw);
+ }
+}
+
static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
{
- GRECT g, g_ro, tb_area, tb_area_ro;
+ GRECT g, g_ro, g2;
short retval = 1;
- int val = 1;
+ int val = 1, old_val;
struct guiwin_scroll_info_s *slid;
switch(msg[0]) {
+ case WM_HSLID:
+ guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ wind_set(gw->handle, WF_HSLIDE, msg[4], 0, 0, 0);
+ slid = guiwin_get_scroll_info(gw);
+ val = (float)(slid->x_units-(g.g_w/slid->x_unit_px))/1000*(float)msg[4];
+ if(val != slid->y_pos) {
+ if (val < slid->x_pos) {
+ val = -(slid->x_pos - val);
+ }
+ else {
+ val = val -slid->x_pos;
+ }
+ preproc_scroll(gw, GUIWIN_HSLIDER, val, false);
+ }
+ break;
+
+ case WM_VSLID:
+ guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ wind_set(gw->handle, WF_VSLIDE, msg[4], 0, 0, 0);
+ slid = guiwin_get_scroll_info(gw);
+ val = (float)(slid->y_units-(g.g_h/slid->y_unit_px))/1000*(float)msg[4];
+ if(val != slid->y_pos) {
+ if (val < slid->y_pos) {
+ val = -(slid->y_pos - val);
+ }
+ else {
+ val = val -slid->y_pos;
+ }
+ preproc_scroll(gw, GUIWIN_VSLIDER, val, false);
+ }
+ break;
+
case WM_ARROWED:
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
@@ -71,103 +187,50 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
switch(msg[4]) {
- case WA_UPPAGE:
- val = g.g_h/slid->y_unit_px;
- slid->y_pos = MAX(0, slid->y_pos-val);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- guiwin_send_redraw(gw, &g_ro);
- break;
+ case WA_UPPAGE:
+ /* scroll page up */
+ preproc_scroll(gw, GUIWIN_VSLIDER, -(g.g_h/slid->y_unit_px),
+ true);
+ break;
case WA_UPLINE:
- slid->y_pos = MAX(0, slid->y_pos-1);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit screen area:
- g.g_h -= slid->y_unit_px;
- move_rect(&g, 0, +slid->y_unit_px);
- g.g_y = g_ro.g_y;
- g.g_h = slid->y_unit_px;
- // redraw new content:
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
+ /* scroll line up */
+ preproc_scroll(gw, GUIWIN_VSLIDER, -1, true);
break;
case WA_DNPAGE:
- val = g.g_h/slid->y_unit_px;
- slid->y_pos = MIN(slid->y_pos_max, slid->y_pos+val);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- guiwin_send_redraw(gw, &g_ro);
+ /* scroll page down */
+ preproc_scroll(gw, GUIWIN_VSLIDER, g.g_h/slid->y_unit_px,
+ true);
break;
case WA_DNLINE:
- slid->y_pos = MIN(slid->y_pos_max, slid->y_pos+1);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit screen area:
- g.g_y += slid->y_unit_px;
- g.g_h -= slid->y_unit_px;
- move_rect(&g, 0, -slid->y_unit_px);
- g.g_y = g_ro.g_y + g_ro.g_h - slid->y_unit_px;
- g.g_h = slid->y_unit_px;
- // redraw new content:
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
+ /* scroll line down */
+ preproc_scroll(gw, GUIWIN_VSLIDER, +1, true);
break;
case WA_LFPAGE:
- val = g.g_w/slid->x_unit_px;
- slid->x_pos = MAX(0, slid->x_pos-val);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- guiwin_send_redraw(gw, &g_ro);
+ /* scroll page left */
+ preproc_scroll(gw, GUIWIN_HSLIDER, -(g.g_w/slid->x_unit_px),
+ true);
break;
case WA_LFLINE:
- slid->x_pos = MAX(0, slid->x_pos-1);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit screen area:
- g.g_x -= slid->x_unit_px;
- move_rect(&g, 0, +slid->x_unit_px);
- // redraw new content:
- g.g_x = g_ro.g_x;
- g.g_w = slid->x_unit_px;
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
- // partial redraw
+ /* scroll line left */
+ preproc_scroll(gw, GUIWIN_HSLIDER, -1,
+ true);
break;
case WA_RTPAGE:
- val = g.g_w/slid->x_unit_px;
- slid->x_pos = MIN(slid->x_pos_max, slid->x_pos+val);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- guiwin_send_redraw(gw, &g_ro);
- break;
+ /* scroll page right */
+ preproc_scroll(gw, GUIWIN_HSLIDER, (g.g_w/slid->x_unit_px),
+ true);
+ break;
case WA_RTLINE:
- slid->x_pos = MIN(slid->x_pos_max, slid->x_pos+1);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit remaining area:
- g.g_x += slid->x_unit_px;
- g.g_w -= slid->y_unit_px;
- move_rect(&g, 0, -slid->x_unit_px);
- // redraw new content:
- g.g_x = g_ro.g_x + g_ro.g_w - slid->x_unit_px;
- g.g_h = slid->x_unit_px;
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
+ /* scroll line right */
+ preproc_scroll(gw, GUIWIN_HSLIDER, 1,
+ true);
break;
default:
@@ -190,19 +253,23 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
wind_get_grect(gw->handle, WF_CURRXYWH, &g);
wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, msg[6], msg[7]);
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)){
- guiwin_send_redraw(gw, NULL);
- }
+ if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
+ guiwin_send_redraw(gw, NULL);
+ }
}
break;
case WM_FULLED:
wind_get_grect(gw->handle, WF_FULLXYWH, &g);
+ wind_get_grect(gw->handle, WF_CURRXYWH, &g2);
+ if(g.g_w == g2.g_w && g.g_h == g2.g_h){
+ wind_get_grect(gw->handle, WF_PREVXYWH, &g);
+ }
wind_set_grect(gw->handle, WF_CURRXYWH, &g);
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)){
- guiwin_send_redraw(gw, NULL);
- }
+ if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
+ guiwin_send_redraw(gw, NULL);
+ }
}
break;
@@ -226,26 +293,11 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
case WM_REDRAW:
if ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0) {
- guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area_ro);
- tb_area = tb_area_ro;
- if(rc_intersect((GRECT*)&msg[4], &tb_area)) {
-
- gw->toolbar[gw->toolbar_idx].ob_x = tb_area_ro.g_x;
- gw->toolbar[gw->toolbar_idx].ob_width = tb_area_ro.g_w;
- gw->toolbar[gw->toolbar_idx].ob_y = tb_area_ro.g_y;
- gw->toolbar[gw->toolbar_idx].ob_height = tb_area_ro.g_h;
-
- wind_get_grect(gw->handle, WF_FIRSTXYWH, &g);
- while (g.g_h > 0 || g.g_w > 0) {
- if(rc_intersect(&tb_area_ro, &g)) {
- objc_draw(gw->toolbar, gw->toolbar_idx, 8, g.g_x, g.g_y,
- g.g_w, g.g_h);
-
- }
- wind_get_grect(gw->handle, WF_NEXTXYWH, &g);
- }
-
- }
+ g.g_x = msg[4];
+ g.g_y = msg[5];
+ g.g_w = msg[6];
+ g.g_h = msg[7];
+ guiwin_toolbar_redraw(gw, &g);
}
break;
@@ -336,6 +388,11 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
short msg_out[8] = {WM_TOOLBAR, gl_apid, 0, dest->handle,
obj_idx, ev_out->emo_mclicks, ev_out->emo_kmeta, 0
};
+ if (((dest->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0)
+ && obj_idx > 0) {
+ dest->toolbar[obj_idx].ob_state |= OS_SELECTED;
+ guiwin_toolbar_redraw(dest, NULL);
+ }
short oldevents = ev_out->emo_events;
ev_out->emo_events = MU_MESAG;
dest->handler_func(dest, ev_out, msg_out);
@@ -486,16 +543,16 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
old_y = slid->y_pos;
if((mode & GUIWIN_VSLIDER) && (slid->y_unit_px > 0)) {
- if ( slid->y_pos_max < (long)viewport.g_h/slid->y_unit_px)
+ if ( slid->y_units < (long)viewport.g_h/slid->y_unit_px) {
size = 1000L;
- else
+ } else
size = MAX( 50L, (unsigned long)viewport.g_h*1000L/
- (unsigned long)(slid->y_unit_px*slid->y_pos_max));
+ (unsigned long)(slid->y_unit_px*slid->y_units));
wind_set(handle, WF_VSLSIZE, (int)size, 0, 0, 0);
- if (slid->y_pos_max > (long)viewport.g_h/slid->y_unit_px) {
+ if (slid->y_units > (long)viewport.g_h/slid->y_unit_px) {
pos = (unsigned long)slid->y_pos *1000L/
- (unsigned long)(slid->y_pos_max-viewport.g_h/slid->y_unit_px);
+ (unsigned long)(slid->y_units-viewport.g_h/slid->y_unit_px);
wind_set(handle, WF_VSLIDE, (int)pos, 0, 0, 0);
} else if (slid->y_pos) {
slid->y_pos = 0;
@@ -503,16 +560,16 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
}
}
if((mode & GUIWIN_HSLIDER) && (slid->x_unit_px > 0)) {
- if ( slid->x_pos_max < (long)viewport.g_w/slid->x_unit_px)
+ if ( slid->x_units < (long)viewport.g_w/slid->x_unit_px)
size = 1000L;
else
size = MAX( 50L, (unsigned long)viewport.g_w*1000L/
- (unsigned long)(slid->x_unit_px*slid->x_pos_max));
+ (unsigned long)(slid->x_unit_px*slid->x_units));
wind_set(handle, WF_HSLSIZE, (int)size, 0, 0, 0);
- if( slid->x_pos_max > (long)viewport.g_w/slid->x_unit_px) {
+ if( slid->x_units > (long)viewport.g_w/slid->x_unit_px) {
pos = (unsigned long)slid->x_pos*1000L/
- (unsigned long)(slid->x_pos_max-viewport.g_w/slid->x_unit_px);
+ (unsigned long)(slid->x_units-viewport.g_w/slid->x_unit_px);
wind_set(handle, WF_HSLIDE, (int)pos, 0, 0, 0);
} else if (slid->x_pos) {
slid->x_pos = 0;
@@ -520,8 +577,8 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
}
}
- if(old_x != slid->x_pos || old_y != slid->y_pos){
- return(true);
+ if(old_x != slid->x_pos || old_y != slid->y_pos) {
+ return(true);
}
return(false);
}
@@ -586,24 +643,72 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
appl_write(gl_apid, 16, &msg);
}
+
+
bool guiwin_has_intersection(GUIWIN *win, GRECT *work)
{
- GRECT area, mywork;
- bool retval = false;
-
- if (work == NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &mywork);
- work = &mywork;
- }
-
- wind_get_grect(win->handle, WF_FIRSTXYWH, &area);
- while (area.g_w && area.g_w) {
- if (rc_intersect(work, &area)) {
- retval = true;
- }
- wind_get_grect(win->handle, WF_NEXTXYWH, &area);
- }
- return(retval);
+
+#define RC_WITHIN(a,b) \
+ (((a)->g_x >= (b)->g_x) \
+ && (((a)->g_x + (a)->g_w) <= ((b)->g_x + (b)->g_w))) \
+ && (((a)->g_y >= (b)->g_y) \
+ && (((a)->g_y + (a)->g_h) <= ((b)->g_y + (b)->g_h)))
+
+ GRECT area, mywork;
+ bool retval = true;
+
+ if (work == NULL) {
+ guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &mywork);
+ work = &mywork;
+ }
+
+ wind_get_grect(win->handle, WF_FIRSTXYWH, &area);
+ while (area.g_w && area.g_w) {
+ //GRECT * ptr = &area;
+ if (RC_WITHIN(work, &area)) {
+ retval = false;
+ }
+ wind_get_grect(win->handle, WF_NEXTXYWH, &area);
+ }
+
+ return(retval);
+
+#undef RC_WITHIN
+
+}
+
+void guiwin_toolbar_redraw(GUIWIN *gw, GRECT *clip)
+{
+ GRECT tb_area, tb_area_ro, g;
+
+ guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area_ro);
+ if(tb_area_ro.g_h <= 0 || tb_area_ro.g_w <= 0) {
+ return;
+ }
+
+ if(clip == NULL) {
+ clip = &tb_area_ro;
+ }
+
+ tb_area = tb_area_ro;
+
+ if(rc_intersect(clip, &tb_area)) {
+ // Update object position:
+ gw->toolbar[gw->toolbar_idx].ob_x = tb_area_ro.g_x;
+ gw->toolbar[gw->toolbar_idx].ob_width = tb_area_ro.g_w;
+ gw->toolbar[gw->toolbar_idx].ob_y = tb_area_ro.g_y;
+ gw->toolbar[gw->toolbar_idx].ob_height = tb_area_ro.g_h;
+
+ wind_get_grect(gw->handle, WF_FIRSTXYWH, &g);
+ while (g.g_h > 0 || g.g_w > 0) {
+ if(rc_intersect(&tb_area, &g)) {
+ objc_draw(gw->toolbar, gw->toolbar_idx, 8, g.g_x, g.g_y,
+ g.g_w, g.g_h);
+
+ }
+ wind_get_grect(gw->handle, WF_NEXTXYWH, &g);
+ }
+ }
}
/*
void guiwin_exec_redraw(){
-----------------------------------------------------------------------
Summary of changes:
atari/gemtk/guiwin.c | 371 ++++++++++++++++++++++++++++++++------------------
1 files changed, 238 insertions(+), 133 deletions(-)
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index 026b18c..1725850 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -53,15 +53,131 @@ static void move_rect(GRECT *rect, int dx, int dy)
wind_update(END_UPDATE);
}
+static void preproc_scroll(GUIWIN *gw, short orientation, int units,
+ bool refresh)
+{
+ struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(gw);
+ int oldpos = 0, newpos = 0, vis_units=0, pix = 0;
+ int abs_pix = 0;
+ GRECT *redraw=NULL, g, g_ro;
+
+ guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ g_ro = g;
+
+ if (orientation == GUIWIN_VSLIDER) {
+ pix = units*slid->y_unit_px;
+ abs_pix = abs(pix);
+ oldpos = slid->y_pos;
+ vis_units = g.g_h/slid->y_unit_px;
+ newpos = slid->y_pos = MIN(slid->y_units-vis_units,
+ MAX(0, slid->y_pos+units));
+ if(oldpos == newpos)
+ return;
+ if (units>=vis_units || guiwin_has_intersection(gw, &g_ro)) {
+ // send complete redraw
+ redraw = &g_ro;
+ } else {
+ // only adjust ypos when scrolling down:
+ if(pix < 0 ) {
+ // blit screen area:
+ g.g_h -= abs_pix;
+ move_rect(&g, 0, abs_pix);
+ g.g_y = g_ro.g_y;
+ g.g_h = abs_pix;
+ redraw = &g;
+ } else {
+ // blit screen area:
+ g.g_y += abs_pix;
+ g.g_h -= abs_pix;
+ move_rect(&g, 0, -abs_pix);
+ g.g_y = g_ro.g_y + g_ro.g_h - abs_pix;
+ g.g_h = abs_pix;
+ redraw = &g;
+ }
+ }
+ } else {
+ pix = units*slid->x_unit_px;
+ abs_pix = abs(pix);
+ oldpos = slid->x_pos;
+ vis_units = g.g_w/slid->x_unit_px;
+ newpos = slid->x_pos = MIN(slid->x_units-vis_units,
+ MAX(0, slid->x_pos+units));
+ if(oldpos == newpos)
+ return;
+ if (units>=vis_units || guiwin_has_intersection(gw, &g_ro)) {
+ // send complete redraw
+ redraw = &g_ro;
+ } else {
+ // only adjust ypos when scrolling down:
+ if(pix < 0 ) {
+ // blit screen area:
+ g.g_w -= abs_pix;
+ move_rect(&g, abs_pix, 0);
+ g.g_x = g_ro.g_x;
+ g.g_w = abs_pix;
+ redraw = &g;
+ } else {
+ // blit screen area:
+ g.g_x += abs_pix;
+ g.g_w -= abs_pix;
+ move_rect(&g, -abs_pix, 0);
+ g.g_x = g_ro.g_x + g_ro.g_w - abs_pix;
+ g.g_w = abs_pix;
+ redraw = &g;
+ }
+ }
+ }
+
+ if (refresh) {
+ guiwin_update_slider(gw, orientation);
+ }
+
+ if ((redraw != NULL) && (redraw->g_h > 0)) {
+ guiwin_send_redraw(gw, redraw);
+ }
+}
+
static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
{
- GRECT g, g_ro, tb_area, tb_area_ro;
+ GRECT g, g_ro, g2;
short retval = 1;
- int val = 1;
+ int val = 1, old_val;
struct guiwin_scroll_info_s *slid;
switch(msg[0]) {
+ case WM_HSLID:
+ guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ wind_set(gw->handle, WF_HSLIDE, msg[4], 0, 0, 0);
+ slid = guiwin_get_scroll_info(gw);
+ val = (float)(slid->x_units-(g.g_w/slid->x_unit_px))/1000*(float)msg[4];
+ if(val != slid->y_pos) {
+ if (val < slid->x_pos) {
+ val = -(slid->x_pos - val);
+ }
+ else {
+ val = val -slid->x_pos;
+ }
+ preproc_scroll(gw, GUIWIN_HSLIDER, val, false);
+ }
+ break;
+
+ case WM_VSLID:
+ guiwin_get_grect(gw, GUIWIN_AREA_CONTENT, &g);
+ wind_set(gw->handle, WF_VSLIDE, msg[4], 0, 0, 0);
+ slid = guiwin_get_scroll_info(gw);
+ val = (float)(slid->y_units-(g.g_h/slid->y_unit_px))/1000*(float)msg[4];
+ if(val != slid->y_pos) {
+ if (val < slid->y_pos) {
+ val = -(slid->y_pos - val);
+ }
+ else {
+ val = val -slid->y_pos;
+ }
+ preproc_scroll(gw, GUIWIN_VSLIDER, val, false);
+ }
+ break;
+
case WM_ARROWED:
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
@@ -71,103 +187,50 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
switch(msg[4]) {
- case WA_UPPAGE:
- val = g.g_h/slid->y_unit_px;
- slid->y_pos = MAX(0, slid->y_pos-val);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- guiwin_send_redraw(gw, &g_ro);
- break;
+ case WA_UPPAGE:
+ /* scroll page up */
+ preproc_scroll(gw, GUIWIN_VSLIDER, -(g.g_h/slid->y_unit_px),
+ true);
+ break;
case WA_UPLINE:
- slid->y_pos = MAX(0, slid->y_pos-1);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit screen area:
- g.g_h -= slid->y_unit_px;
- move_rect(&g, 0, +slid->y_unit_px);
- g.g_y = g_ro.g_y;
- g.g_h = slid->y_unit_px;
- // redraw new content:
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
+ /* scroll line up */
+ preproc_scroll(gw, GUIWIN_VSLIDER, -1, true);
break;
case WA_DNPAGE:
- val = g.g_h/slid->y_unit_px;
- slid->y_pos = MIN(slid->y_pos_max, slid->y_pos+val);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- guiwin_send_redraw(gw, &g_ro);
+ /* scroll page down */
+ preproc_scroll(gw, GUIWIN_VSLIDER, g.g_h/slid->y_unit_px,
+ true);
break;
case WA_DNLINE:
- slid->y_pos = MIN(slid->y_pos_max, slid->y_pos+1);
- guiwin_update_slider(gw, GUIWIN_VSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit screen area:
- g.g_y += slid->y_unit_px;
- g.g_h -= slid->y_unit_px;
- move_rect(&g, 0, -slid->y_unit_px);
- g.g_y = g_ro.g_y + g_ro.g_h - slid->y_unit_px;
- g.g_h = slid->y_unit_px;
- // redraw new content:
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
+ /* scroll line down */
+ preproc_scroll(gw, GUIWIN_VSLIDER, +1, true);
break;
case WA_LFPAGE:
- val = g.g_w/slid->x_unit_px;
- slid->x_pos = MAX(0, slid->x_pos-val);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- guiwin_send_redraw(gw, &g_ro);
+ /* scroll page left */
+ preproc_scroll(gw, GUIWIN_HSLIDER, -(g.g_w/slid->x_unit_px),
+ true);
break;
case WA_LFLINE:
- slid->x_pos = MAX(0, slid->x_pos-1);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit screen area:
- g.g_x -= slid->x_unit_px;
- move_rect(&g, 0, +slid->x_unit_px);
- // redraw new content:
- g.g_x = g_ro.g_x;
- g.g_w = slid->x_unit_px;
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
- // partial redraw
+ /* scroll line left */
+ preproc_scroll(gw, GUIWIN_HSLIDER, -1,
+ true);
break;
case WA_RTPAGE:
- val = g.g_w/slid->x_unit_px;
- slid->x_pos = MIN(slid->x_pos_max, slid->x_pos+val);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- guiwin_send_redraw(gw, &g_ro);
- break;
+ /* scroll page right */
+ preproc_scroll(gw, GUIWIN_HSLIDER, (g.g_w/slid->x_unit_px),
+ true);
+ break;
case WA_RTLINE:
- slid->x_pos = MIN(slid->x_pos_max, slid->x_pos+1);
- guiwin_update_slider(gw, GUIWIN_HSLIDER);
- if(!guiwin_has_intersection(gw, NULL)){
- // blit remaining area:
- g.g_x += slid->x_unit_px;
- g.g_w -= slid->y_unit_px;
- move_rect(&g, 0, -slid->x_unit_px);
- // redraw new content:
- g.g_x = g_ro.g_x + g_ro.g_w - slid->x_unit_px;
- g.g_h = slid->x_unit_px;
- guiwin_send_redraw(gw, &g);
- } else {
- // let the draw implementation handle intersections:
- guiwin_send_redraw(gw, &g_ro);
- }
+ /* scroll line right */
+ preproc_scroll(gw, GUIWIN_HSLIDER, 1,
+ true);
break;
default:
@@ -190,19 +253,23 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
wind_get_grect(gw->handle, WF_CURRXYWH, &g);
wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, msg[6], msg[7]);
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)){
- guiwin_send_redraw(gw, NULL);
- }
+ if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
+ guiwin_send_redraw(gw, NULL);
+ }
}
break;
case WM_FULLED:
wind_get_grect(gw->handle, WF_FULLXYWH, &g);
+ wind_get_grect(gw->handle, WF_CURRXYWH, &g2);
+ if(g.g_w == g2.g_w && g.g_h == g2.g_h){
+ wind_get_grect(gw->handle, WF_PREVXYWH, &g);
+ }
wind_set_grect(gw->handle, WF_CURRXYWH, &g);
if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
- if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)){
- guiwin_send_redraw(gw, NULL);
- }
+ if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)) {
+ guiwin_send_redraw(gw, NULL);
+ }
}
break;
@@ -226,26 +293,11 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
case WM_REDRAW:
if ((gw->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0) {
- guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area_ro);
- tb_area = tb_area_ro;
- if(rc_intersect((GRECT*)&msg[4], &tb_area)) {
-
- gw->toolbar[gw->toolbar_idx].ob_x = tb_area_ro.g_x;
- gw->toolbar[gw->toolbar_idx].ob_width = tb_area_ro.g_w;
- gw->toolbar[gw->toolbar_idx].ob_y = tb_area_ro.g_y;
- gw->toolbar[gw->toolbar_idx].ob_height = tb_area_ro.g_h;
-
- wind_get_grect(gw->handle, WF_FIRSTXYWH, &g);
- while (g.g_h > 0 || g.g_w > 0) {
- if(rc_intersect(&tb_area_ro, &g)) {
- objc_draw(gw->toolbar, gw->toolbar_idx, 8, g.g_x, g.g_y,
- g.g_w, g.g_h);
-
- }
- wind_get_grect(gw->handle, WF_NEXTXYWH, &g);
- }
-
- }
+ g.g_x = msg[4];
+ g.g_y = msg[5];
+ g.g_w = msg[6];
+ g.g_h = msg[7];
+ guiwin_toolbar_redraw(gw, &g);
}
break;
@@ -336,6 +388,11 @@ short guiwin_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8])
short msg_out[8] = {WM_TOOLBAR, gl_apid, 0, dest->handle,
obj_idx, ev_out->emo_mclicks, ev_out->emo_kmeta, 0
};
+ if (((dest->flags & GW_FLAG_CUSTOM_TOOLBAR) == 0)
+ && obj_idx > 0) {
+ dest->toolbar[obj_idx].ob_state |= OS_SELECTED;
+ guiwin_toolbar_redraw(dest, NULL);
+ }
short oldevents = ev_out->emo_events;
ev_out->emo_events = MU_MESAG;
dest->handler_func(dest, ev_out, msg_out);
@@ -486,16 +543,16 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
old_y = slid->y_pos;
if((mode & GUIWIN_VSLIDER) && (slid->y_unit_px > 0)) {
- if ( slid->y_pos_max < (long)viewport.g_h/slid->y_unit_px)
+ if ( slid->y_units < (long)viewport.g_h/slid->y_unit_px) {
size = 1000L;
- else
+ } else
size = MAX( 50L, (unsigned long)viewport.g_h*1000L/
- (unsigned long)(slid->y_unit_px*slid->y_pos_max));
+ (unsigned long)(slid->y_unit_px*slid->y_units));
wind_set(handle, WF_VSLSIZE, (int)size, 0, 0, 0);
- if (slid->y_pos_max > (long)viewport.g_h/slid->y_unit_px) {
+ if (slid->y_units > (long)viewport.g_h/slid->y_unit_px) {
pos = (unsigned long)slid->y_pos *1000L/
- (unsigned long)(slid->y_pos_max-viewport.g_h/slid->y_unit_px);
+ (unsigned long)(slid->y_units-viewport.g_h/slid->y_unit_px);
wind_set(handle, WF_VSLIDE, (int)pos, 0, 0, 0);
} else if (slid->y_pos) {
slid->y_pos = 0;
@@ -503,16 +560,16 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
}
}
if((mode & GUIWIN_HSLIDER) && (slid->x_unit_px > 0)) {
- if ( slid->x_pos_max < (long)viewport.g_w/slid->x_unit_px)
+ if ( slid->x_units < (long)viewport.g_w/slid->x_unit_px)
size = 1000L;
else
size = MAX( 50L, (unsigned long)viewport.g_w*1000L/
- (unsigned long)(slid->x_unit_px*slid->x_pos_max));
+ (unsigned long)(slid->x_unit_px*slid->x_units));
wind_set(handle, WF_HSLSIZE, (int)size, 0, 0, 0);
- if( slid->x_pos_max > (long)viewport.g_w/slid->x_unit_px) {
+ if( slid->x_units > (long)viewport.g_w/slid->x_unit_px) {
pos = (unsigned long)slid->x_pos*1000L/
- (unsigned long)(slid->x_pos_max-viewport.g_w/slid->x_unit_px);
+ (unsigned long)(slid->x_units-viewport.g_w/slid->x_unit_px);
wind_set(handle, WF_HSLIDE, (int)pos, 0, 0, 0);
} else if (slid->x_pos) {
slid->x_pos = 0;
@@ -520,8 +577,8 @@ bool guiwin_update_slider(GUIWIN *win, short mode)
}
}
- if(old_x != slid->x_pos || old_y != slid->y_pos){
- return(true);
+ if(old_x != slid->x_pos || old_y != slid->y_pos) {
+ return(true);
}
return(false);
}
@@ -586,24 +643,72 @@ void guiwin_send_redraw(GUIWIN *win, GRECT *area)
appl_write(gl_apid, 16, &msg);
}
+
+
bool guiwin_has_intersection(GUIWIN *win, GRECT *work)
{
- GRECT area, mywork;
- bool retval = false;
-
- if (work == NULL) {
- guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &mywork);
- work = &mywork;
- }
-
- wind_get_grect(win->handle, WF_FIRSTXYWH, &area);
- while (area.g_w && area.g_w) {
- if (rc_intersect(work, &area)) {
- retval = true;
- }
- wind_get_grect(win->handle, WF_NEXTXYWH, &area);
- }
- return(retval);
+
+#define RC_WITHIN(a,b) \
+ (((a)->g_x >= (b)->g_x) \
+ && (((a)->g_x + (a)->g_w) <= ((b)->g_x + (b)->g_w))) \
+ && (((a)->g_y >= (b)->g_y) \
+ && (((a)->g_y + (a)->g_h) <= ((b)->g_y + (b)->g_h)))
+
+ GRECT area, mywork;
+ bool retval = true;
+
+ if (work == NULL) {
+ guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &mywork);
+ work = &mywork;
+ }
+
+ wind_get_grect(win->handle, WF_FIRSTXYWH, &area);
+ while (area.g_w && area.g_w) {
+ //GRECT * ptr = &area;
+ if (RC_WITHIN(work, &area)) {
+ retval = false;
+ }
+ wind_get_grect(win->handle, WF_NEXTXYWH, &area);
+ }
+
+ return(retval);
+
+#undef RC_WITHIN
+
+}
+
+void guiwin_toolbar_redraw(GUIWIN *gw, GRECT *clip)
+{
+ GRECT tb_area, tb_area_ro, g;
+
+ guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area_ro);
+ if(tb_area_ro.g_h <= 0 || tb_area_ro.g_w <= 0) {
+ return;
+ }
+
+ if(clip == NULL) {
+ clip = &tb_area_ro;
+ }
+
+ tb_area = tb_area_ro;
+
+ if(rc_intersect(clip, &tb_area)) {
+ // Update object position:
+ gw->toolbar[gw->toolbar_idx].ob_x = tb_area_ro.g_x;
+ gw->toolbar[gw->toolbar_idx].ob_width = tb_area_ro.g_w;
+ gw->toolbar[gw->toolbar_idx].ob_y = tb_area_ro.g_y;
+ gw->toolbar[gw->toolbar_idx].ob_height = tb_area_ro.g_h;
+
+ wind_get_grect(gw->handle, WF_FIRSTXYWH, &g);
+ while (g.g_h > 0 || g.g_w > 0) {
+ if(rc_intersect(&tb_area, &g)) {
+ objc_draw(gw->toolbar, gw->toolbar_idx, 8, g.g_x, g.g_y,
+ g.g_w, g.g_h);
+
+ }
+ wind_get_grect(gw->handle, WF_NEXTXYWH, &g);
+ }
+ }
}
/*
void guiwin_exec_redraw(){
--
NetSurf Browser
11 years
netsurf: branch mono/removing-windom-dependency updated. ccdab30c9a93989df986def422c1ff68d0b80a18
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/ccdab30c9a93989df986d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/ccdab30c9a93989df986def...
...tree http://git.netsurf-browser.org/netsurf.git/tree/ccdab30c9a93989df986def42...
The branch, mono/removing-windom-dependency has been updated
via ccdab30c9a93989df986def422c1ff68d0b80a18 (commit)
from 0672d5e2c9e66fc12311ad41a566e56cee30f7e3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/ccdab30c9a93989df98...
commit ccdab30c9a93989df986def422c1ff68d0b80a18
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Completet scroll preprocessing, Hotlist fully works.
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 7fbac3e..6685ba5 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -50,14 +50,17 @@ struct atari_hotlist hl;
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
+ NSTREEVIEW tv=NULL;
+ GRECT tb_area;
- printf("hotlist handle event...\n");
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
+
case WM_TOOLBAR:
- printf("toolbar event...%d\n", msg[4]);
- switch (msg[4]) {
+ tv = (NSTREEVIEW) guiwin_get_user_data(win);
+
+ switch (msg[4]) {
case TOOLBAR_HOTLIST_CREATE_FOLDER:
hotlist_add_folder(true);
break;
@@ -68,12 +71,18 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case TOOLBAR_HOTLIST_DELETE:
hotlist_delete_selected();
+ guiwin_send_redraw(tv->window, NULL);
break;
case TOOLBAR_HOTLIST_EDIT:
hotlist_edit_selected();
break;
}
+
+ get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
+ guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, &tb_area);
+ evnt_timer(150);
+ guiwin_send_redraw(tv->window, &tb_area);
break;
case WM_CLOSED:
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index ca3f2b7..9937c0b 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -1816,10 +1816,18 @@ bool plot_line(int x0, int y0, int x1, int y1,
uint32_t lt;
int sw = pstyle->stroke_width;
- pxy[0] = view.x + x0;
- pxy[1] = view.y + y0;
- pxy[2] = view.x + x1;
- pxy[3] = view.y + y1;
+ if((x0 < 0 && x1 < 0) || (y0 < 0 && y1 < 0)){
+ return(true);
+ }
+
+ pxy[0] = view.x + MAX(0,x0);
+ pxy[1] = view.y + MAX(0,y0);
+ pxy[2] = view.x + MAX(0,x1);
+ pxy[3] = view.y + MAX(0,y1);
+
+
+ //printf("view: %d,%d,%d,%d\n", view.x, view.y, view.w, view.h);
+ //printf("line: %d,%d,%d,%d\n", x0, y0, x1, y1);
plot_vdi_clip(true);
if( sw == 0)
@@ -1834,7 +1842,7 @@ bool plot_line(int x0, int y0, int x1, int y1,
vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
v_pline(atari_plot_vdi_handle, 2, (short *)&pxy );
plot_vdi_clip(false);
- return ( true );
+ return (true);
}
static bool plot_polygon(const int *p, unsigned int n,
diff --git a/atari/treeview.c b/atari/treeview.c
index 44a8630..6b45fb0 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -453,7 +453,7 @@ void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw)
tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
}
- dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
+ //dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
}
}
@@ -478,10 +478,10 @@ void atari_treeview_resized(struct tree *tree, int width, int height, void *pw)
tv->extent.y = height;
struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window);
guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &area);
- slid->x_pos_max = (width/slid->x_unit_px);//-(area.g_w/slid->x_unit_px)+1;
- slid->y_pos_max = (height/slid->y_unit_px);//-(area.g_h/slid->y_unit_px)+1;
- printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px),
- (area.g_h/slid->y_unit_px));
+ slid->x_units = (width/slid->x_unit_px);
+ slid->y_units = (height/slid->y_unit_px);
+ /*printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px),
+ (area.g_h/slid->y_unit_px));*/
guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER);
}
}
diff --git a/atari/treeview.h b/atari/treeview.h
index 41d1cf5..8683bc3 100755
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -1,55 +1,56 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_TREEVIEW_H
-#define NS_ATARI_TREEVIEW_H
-
-#include <stdbool.h>
-#include <windom.h>
-#include "desktop/tree.h"
+/*
+ * Copyright 2010 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NS_ATARI_TREEVIEW_H
+#define NS_ATARI_TREEVIEW_H
+
+#include <stdbool.h>
+#include <windom.h>
+#include "desktop/tree.h"
#include "atari/gui.h"
-#include "atari/gemtk/gemtk.h"
-
-#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW)
-
-struct atari_treeview
-{
- struct tree * tree;
- GUIWIN * window;
- bool disposing;
- bool redraw;
- GRECT rdw_area;
- POINT click;
+#include "atari/gemtk/gemtk.h"
+
+#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW)
+
+struct atari_treeview
+{
+ struct tree * tree;
+ GUIWIN * window;
+ bool disposing;
+ bool redraw;
+ GRECT rdw_area;
+ POINT extent;
+ POINT click;
POINT startdrag;
- guiwin_event_handler_f user_func;
-};
-
-typedef struct atari_treeview * NSTREEVIEW;
-
+ guiwin_event_handler_f user_func;
+};
+
+typedef struct atari_treeview * NSTREEVIEW;
+
NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win,
- guiwin_event_handler_f user_func);
-void atari_treeview_destroy( NSTREEVIEW tv );
-void atari_treeview_open( NSTREEVIEW tv );
-void atari_treeview_close( NSTREEVIEW tv );
-void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw);
-void atari_treeview_redraw( NSTREEVIEW tv );
-bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y);
-
-
-
+ guiwin_event_handler_f user_func);
+void atari_treeview_destroy( NSTREEVIEW tv );
+void atari_treeview_open( NSTREEVIEW tv );
+void atari_treeview_close( NSTREEVIEW tv );
+void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw);
+void atari_treeview_redraw( NSTREEVIEW tv );
+bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y);
+
+
+
#endif
-----------------------------------------------------------------------
Summary of changes:
atari/hotlist.c | 15 ++++++--
atari/plot/plot.c | 18 +++++++---
atari/treeview.c | 10 +++---
atari/treeview.h | 103 +++++++++++++++++++++++++++--------------------------
4 files changed, 82 insertions(+), 64 deletions(-)
diff --git a/atari/hotlist.c b/atari/hotlist.c
index 7fbac3e..6685ba5 100755
--- a/atari/hotlist.c
+++ b/atari/hotlist.c
@@ -50,14 +50,17 @@ struct atari_hotlist hl;
static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
{
+ NSTREEVIEW tv=NULL;
+ GRECT tb_area;
- printf("hotlist handle event...\n");
if(ev_out->emo_events & MU_MESAG){
switch (msg[0]) {
+
case WM_TOOLBAR:
- printf("toolbar event...%d\n", msg[4]);
- switch (msg[4]) {
+ tv = (NSTREEVIEW) guiwin_get_user_data(win);
+
+ switch (msg[4]) {
case TOOLBAR_HOTLIST_CREATE_FOLDER:
hotlist_add_folder(true);
break;
@@ -68,12 +71,18 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case TOOLBAR_HOTLIST_DELETE:
hotlist_delete_selected();
+ guiwin_send_redraw(tv->window, NULL);
break;
case TOOLBAR_HOTLIST_EDIT:
hotlist_edit_selected();
break;
}
+
+ get_tree(TOOLBAR_HOTLIST)[msg[4]].ob_state &= ~OS_SELECTED;
+ guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, &tb_area);
+ evnt_timer(150);
+ guiwin_send_redraw(tv->window, &tb_area);
break;
case WM_CLOSED:
diff --git a/atari/plot/plot.c b/atari/plot/plot.c
index ca3f2b7..9937c0b 100755
--- a/atari/plot/plot.c
+++ b/atari/plot/plot.c
@@ -1816,10 +1816,18 @@ bool plot_line(int x0, int y0, int x1, int y1,
uint32_t lt;
int sw = pstyle->stroke_width;
- pxy[0] = view.x + x0;
- pxy[1] = view.y + y0;
- pxy[2] = view.x + x1;
- pxy[3] = view.y + y1;
+ if((x0 < 0 && x1 < 0) || (y0 < 0 && y1 < 0)){
+ return(true);
+ }
+
+ pxy[0] = view.x + MAX(0,x0);
+ pxy[1] = view.y + MAX(0,y0);
+ pxy[2] = view.x + MAX(0,x1);
+ pxy[3] = view.y + MAX(0,y1);
+
+
+ //printf("view: %d,%d,%d,%d\n", view.x, view.y, view.w, view.h);
+ //printf("line: %d,%d,%d,%d\n", x0, y0, x1, y1);
plot_vdi_clip(true);
if( sw == 0)
@@ -1834,7 +1842,7 @@ bool plot_line(int x0, int y0, int x1, int y1,
vsl_rgbcolor(atari_plot_vdi_handle, pstyle->stroke_colour);
v_pline(atari_plot_vdi_handle, 2, (short *)&pxy );
plot_vdi_clip(false);
- return ( true );
+ return (true);
}
static bool plot_polygon(const int *p, unsigned int n,
diff --git a/atari/treeview.c b/atari/treeview.c
index 44a8630..6b45fb0 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -453,7 +453,7 @@ void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw)
tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
}
- dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
+ //dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
}
}
@@ -478,10 +478,10 @@ void atari_treeview_resized(struct tree *tree, int width, int height, void *pw)
tv->extent.y = height;
struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window);
guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &area);
- slid->x_pos_max = (width/slid->x_unit_px);//-(area.g_w/slid->x_unit_px)+1;
- slid->y_pos_max = (height/slid->y_unit_px);//-(area.g_h/slid->y_unit_px)+1;
- printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px),
- (area.g_h/slid->y_unit_px));
+ slid->x_units = (width/slid->x_unit_px);
+ slid->y_units = (height/slid->y_unit_px);
+ /*printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px),
+ (area.g_h/slid->y_unit_px));*/
guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER);
}
}
diff --git a/atari/treeview.h b/atari/treeview.h
index 41d1cf5..8683bc3 100755
--- a/atari/treeview.h
+++ b/atari/treeview.h
@@ -1,55 +1,56 @@
-/*
- * Copyright 2010 Ole Loots <ole(a)monochrom.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NS_ATARI_TREEVIEW_H
-#define NS_ATARI_TREEVIEW_H
-
-#include <stdbool.h>
-#include <windom.h>
-#include "desktop/tree.h"
+/*
+ * Copyright 2010 Ole Loots <ole(a)monochrom.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NS_ATARI_TREEVIEW_H
+#define NS_ATARI_TREEVIEW_H
+
+#include <stdbool.h>
+#include <windom.h>
+#include "desktop/tree.h"
#include "atari/gui.h"
-#include "atari/gemtk/gemtk.h"
-
-#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW)
-
-struct atari_treeview
-{
- struct tree * tree;
- GUIWIN * window;
- bool disposing;
- bool redraw;
- GRECT rdw_area;
- POINT click;
+#include "atari/gemtk/gemtk.h"
+
+#define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW | LFARROW | RTARROW)
+
+struct atari_treeview
+{
+ struct tree * tree;
+ GUIWIN * window;
+ bool disposing;
+ bool redraw;
+ GRECT rdw_area;
+ POINT extent;
+ POINT click;
POINT startdrag;
- guiwin_event_handler_f user_func;
-};
-
-typedef struct atari_treeview * NSTREEVIEW;
-
+ guiwin_event_handler_f user_func;
+};
+
+typedef struct atari_treeview * NSTREEVIEW;
+
NSTREEVIEW atari_treeview_create( uint32_t flags, GUIWIN *win,
- guiwin_event_handler_f user_func);
-void atari_treeview_destroy( NSTREEVIEW tv );
-void atari_treeview_open( NSTREEVIEW tv );
-void atari_treeview_close( NSTREEVIEW tv );
-void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw);
-void atari_treeview_redraw( NSTREEVIEW tv );
-bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y);
-
-
-
+ guiwin_event_handler_f user_func);
+void atari_treeview_destroy( NSTREEVIEW tv );
+void atari_treeview_open( NSTREEVIEW tv );
+void atari_treeview_close( NSTREEVIEW tv );
+void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw);
+void atari_treeview_redraw( NSTREEVIEW tv );
+bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y);
+
+
+
#endif
--
NetSurf Browser
11 years
netsurf: branch master updated. 054984099fd8867da92fa685dce728e1cc665fd0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/054984099fd8867da92fa...
...commit http://git.netsurf-browser.org/netsurf.git/commit/054984099fd8867da92fa68...
...tree http://git.netsurf-browser.org/netsurf.git/tree/054984099fd8867da92fa685d...
The branch, master has been updated
via 054984099fd8867da92fa685dce728e1cc665fd0 (commit)
from c2cd36fda86b9bdfbb36cc340e35cfbc6609fd32 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/054984099fd8867da92...
commit 054984099fd8867da92fa685dce728e1cc665fd0
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
use correct unref functions
diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd
index e91094f..a381db1 100644
--- a/javascript/jsapi/location.bnd
+++ b/javascript/jsapi/location.bnd
@@ -58,7 +58,7 @@ getter protocol %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -69,7 +69,7 @@ getter host %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -80,7 +80,7 @@ getter hostname %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -92,7 +92,7 @@ getter port %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -104,7 +104,7 @@ getter pathname %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -116,7 +116,7 @@ getter search %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -128,6 +128,6 @@ getter hash %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
-----------------------------------------------------------------------
Summary of changes:
javascript/jsapi/location.bnd | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/javascript/jsapi/location.bnd b/javascript/jsapi/location.bnd
index e91094f..a381db1 100644
--- a/javascript/jsapi/location.bnd
+++ b/javascript/jsapi/location.bnd
@@ -58,7 +58,7 @@ getter protocol %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -69,7 +69,7 @@ getter host %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -80,7 +80,7 @@ getter hostname %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -92,7 +92,7 @@ getter port %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -104,7 +104,7 @@ getter pathname %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -116,7 +116,7 @@ getter search %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
@@ -128,6 +128,6 @@ getter hash %{
jsret = JS_NewStringCopyN(cx,
lwc_string_data(component),
lwc_string_length(component));
- dom_string_unref(component);
+ lwc_string_unref(component);
}
%}
--
NetSurf Browser
11 years