summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-05-08 20:39:53 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-05-08 20:39:53 +0100
commitb42662325858d98d66e81a92f5730915f3263b65 (patch)
tree3d5aa62e0fbd18c804a354a917d327deec8aa3be
parentb39db1dac4873fc56d6f7dbe191ec571c383a321 (diff)
downloadnetsurf-b42662325858d98d66e81a92f5730915f3263b65.tar.gz
netsurf-b42662325858d98d66e81a92f5730915f3263b65.tar.bz2
page-info: Provide support to indicate if action did something
Some mouse actions perform a positive action (such as opening the SSL certificate viewer). As such, provide an out param which will be set to true if the action did something. This parameter is not touched in the case of nothing happening in case it is used in alternating logic in the caller. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r--desktop/page-info.c11
-rw-r--r--desktop/page-info.h4
2 files changed, 11 insertions, 4 deletions
diff --git a/desktop/page-info.c b/desktop/page-info.c
index db14b6955..79701d2f7 100644
--- a/desktop/page-info.c
+++ b/desktop/page-info.c
@@ -664,12 +664,14 @@ cleanup:
* \param[in] pi The page info window handle.
* \param[in] mouse The current mouse state.
* \param[in] clicked The page info window entry to consider clicks on.
+ * \param[out] did_something Set to true if this click did something
* \return NSERROR_OK on success, appropriate error code otherwise.
*/
static nserror page_info__handle_item_click(
struct page_info *pi,
enum browser_mouse_state mouse,
- enum pi_entry clicked)
+ enum pi_entry clicked,
+ bool *did_something)
{
nserror err;
@@ -680,9 +682,11 @@ static nserror page_info__handle_item_click(
switch (clicked) {
case PI_ENTRY_CERT:
err = browser_window_show_certificates(pi->bw);
+ *did_something = true;
break;
case PI_ENTRY_COOKIES:
err = browser_window_show_cookies(pi->bw);
+ *did_something = true;
break;
default:
err = NSERROR_OK;
@@ -697,7 +701,8 @@ nserror page_info_mouse_action(
struct page_info *pi,
enum browser_mouse_state mouse,
int x,
- int y)
+ int y,
+ bool *did_something)
{
int cur_y = 0;
nserror err;
@@ -722,7 +727,7 @@ nserror page_info_mouse_action(
if (y >= cur_y && y < cur_y + height) {
hovering = true;
err = page_info__handle_item_click(
- pi, mouse, i);
+ pi, mouse, i, did_something);
if (err != NSERROR_OK) {
return err;
}
diff --git a/desktop/page-info.h b/desktop/page-info.h
index d4437fd2e..4504e578b 100644
--- a/desktop/page-info.h
+++ b/desktop/page-info.h
@@ -106,13 +106,15 @@ nserror page_info_redraw(
* \param[in] mouse The current mouse state
* \param[in] x The current mouse X coordinate
* \param[in] y The current mouse Y coordinate
+ * \param[out] did_something Set to true if this resulted in some action
* \return NSERROR_OK on success, appropriate error code otherwise.
*/
nserror page_info_mouse_action(
struct page_info *pi,
enum browser_mouse_state mouse,
int x,
- int y);
+ int y,
+ bool *did_something);
/**
* Key press handling.