From c40e8197c270b1600fa7b32056a2019cd83e6f3f Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 1 Jan 2017 14:34:04 +0000 Subject: Allow for the prospect of in-window scrollbars --- frontends/amiga/corewindow.c | 32 +++++++++++++++++++------------- frontends/amiga/corewindow.h | 10 ++++++++++ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c index d8676fd50..5424b7b24 100644 --- a/frontends/amiga/corewindow.c +++ b/frontends/amiga/corewindow.c @@ -236,7 +236,7 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw) /* add the core window to our window list so we process events */ ami_gui_win_list_add(ami_cw, AMINS_COREWINDOW, &ami_cw_table); - /* attach the scrollbars for event processing */ + /* set up the IDCMP hook for event processing (extended mouse, scrollbars) */ ami_cw->idcmp_hook.h_Entry = (void *)ami_cw_idcmp_hook; ami_cw->idcmp_hook.h_Data = ami_cw; /* probably set this when defining the window @@ -244,20 +244,26 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw) WINDOW_IDCMPHook, &ami_cw->idcmp_hook, TAG_DONE); */ - GetAttr(WINDOW_HorizObject, ami_cw->objects[GID_CW_WIN], - (ULONG *)&ami_cw->objects[GID_CW_HSCROLL]); - GetAttr(WINDOW_VertObject, ami_cw->objects[GID_CW_WIN], - (ULONG *)&ami_cw->objects[GID_CW_VSCROLL]); + /* attach the scrollbars for event processing if they are in the window border */ + if(ami_cw->objects[GID_CW_HSCROLL] == NULL) { + GetAttr(WINDOW_HorizObject, ami_cw->objects[GID_CW_WIN], + (ULONG *)&ami_cw->objects[GID_CW_HSCROLL]); - RefreshSetGadgetAttrs((APTR)ami_cw->objects[GID_CW_VSCROLL], ami_cw->win, NULL, - GA_ID, GID_CW_VSCROLL, - ICA_TARGET, ICTARGET_IDCMP, - TAG_DONE); + RefreshSetGadgetAttrs((APTR)ami_cw->objects[GID_CW_HSCROLL], ami_cw->win, NULL, + GA_ID, GID_CW_HSCROLL, + ICA_TARGET, ICTARGET_IDCMP, + TAG_DONE); + } - RefreshSetGadgetAttrs((APTR)ami_cw->objects[GID_CW_HSCROLL], ami_cw->win, NULL, - GA_ID, GID_CW_HSCROLL, - ICA_TARGET, ICTARGET_IDCMP, - TAG_DONE); + if(ami_cw->objects[GID_CW_VSCROLL] == NULL) { + GetAttr(WINDOW_VertObject, ami_cw->objects[GID_CW_WIN], + (ULONG *)&ami_cw->objects[GID_CW_VSCROLL]); + + RefreshSetGadgetAttrs((APTR)ami_cw->objects[GID_CW_VSCROLL], ami_cw->win, NULL, + GA_ID, GID_CW_VSCROLL, + ICA_TARGET, ICTARGET_IDCMP, + TAG_DONE); + } return NSERROR_OK; } diff --git a/frontends/amiga/corewindow.h b/frontends/amiga/corewindow.h index d6f842aff..0729f12a1 100644 --- a/frontends/amiga/corewindow.h +++ b/frontends/amiga/corewindow.h @@ -92,6 +92,16 @@ struct ami_corewindow { */ nserror (*mouse)(struct ami_corewindow *ami_cw, browser_mouse_state mouse_state, int x, int y); + /** + * callback for unknown events on Amiga core window + * eg. buttons in the ssl cert window + * PROBABLY NEED MORE VARS! + * \param ami_cw The Amiga core window structure. + * \param id gadget id + * \return NSERROR_OK on sucess otherwise apropriate error code. + */ + nserror (*event)(struct ami_corewindow *ami_cw, ULONG id); + /** * callback to close an Amiga core window * -- cgit v1.2.3