home *** CD-ROM | disk | FTP | other *** search
- /* > $.CLIB.C.pollmouse
- *
- * HASWIN Graphics Library
- * =========================
- *
- * Copyright (C) H.A.Shaw 1990.
- * Howard A. Shaw.
- * The Unit for Space Sciences,
- * Room 165,
- * Physics Building,
- * University of Kent at Canterbury.
- * Canterbury.
- * Kent. CT2 7NJ
- * You may use and distribute this code freely, however please leave
- * it alone. If you find bugs (and there will be many) please contact
- * me and the master source can be modified. If you keep me informed
- * of who you give copies of this to then I can get release upgrades
- * to them.
- *
- * routine to perform mouse related reason code returns from
- * SWI(Wimp_Poll)
- */
- #include "c.poll_h"
-
- int haswin_poll_drag(int (*user)(int, buffer *), buffer *pbuf) {
-
- _kernel_swi_regs regs;
-
- if (!(haswin_flags & HASWIN_FLAGS_DRAG)) {
- haswin_internalerror("A drag request while not dragging is inconsistant!");
- return(HASWIN_FALSE);
- }
- if (haswin_dragwindow)
- pbuf->i[4] = haswin_dragwindow->handle;
- else
- pbuf->i[4] = -1;
- if (haswin_dragicon)
- pbuf->i[5] = haswin_dragicon->ihandle;
- else
- pbuf->i[5] = -1;
- pbuf->i[6] = (int)haswin_dragwindow;
- pbuf->i[7] = (int)haswin_dragicon;
- if ((haswin_dragicon) && (haswin_dragicon->dragroutine)) {
- if (!((*haswin_dragicon->dragroutine)(haswin_dragwindow, haswin_dragicon, &haswin_dragmouse, pbuf)))
- return(HASWIN_TRUE);
- if ((user) && (!((*user)(HASWIN_POLL_Drag, pbuf))))
- return(HASWIN_FALSE);
- regs.r[1] = 0;
- return(haswin_swi(HASWIN_Drag_box, ®s));
- }
- if ((haswin_dragwindow) && (haswin_dragwindow->dragroutine) && (!((*haswin_dragwindow->dragroutine)(haswin_dragwindow, haswin_dragicon, &haswin_dragmouse, pbuf))))
- return(HASWIN_TRUE);
- if ((user) && (!((*user)(HASWIN_POLL_Drag, pbuf))))
- return(HASWIN_FALSE);
- regs.r[1] = 0;
- return(haswin_swi(HASWIN_Drag_box, ®s));
- }
-
- /*
- * this small piece of code handles HASWINs attempts to drag an
- * object from a mouse click. It should be called *ONLY* from
- * "haswin_poll_mouse()" below
- */
- static int tryrightdrag(window *wptr, icon *iptr, buffer *pbuf, int err) {
-
- int adjx, adjy;
- _kernel_swi_regs regs;
- buffer buff;
-
- /* right ADJUST button dragged */
- if (((int)wptr > 0) && (pbuf->i[4] == -1) &&
- (!(wptr->flags & WINDOW_DRAGADJ))) {
- if (err)
- haswin_internalerror("dragging is not allowed in this window");
- return(HASWIN_FALSE);
- }
- if (((int)iptr > 0) && (!(iptr->flags & ICON_DRAGADJ))) {
- if (err)
- haswin_internalerror("dragging is not allowed in this icon");
- return(HASWIN_FALSE);
- }
- if (haswin_flags & HASWIN_FLAGS_DRAG) {
- regs.r[1] = 0;
- haswin_swi(HASWIN_Drag_box, ®s);
- }
- haswin_getpointerinfo(&haswin_dragmouse);
- if (((int)iptr > 0) && (iptr->dragroutine) && (!((*iptr->dragroutine)(wptr, iptr, &haswin_dragmouse, 0))))
- return(HASWIN_TRUE);
- else if (((int)wptr > 0) && (wptr->dragroutine) && (!((*wptr->dragroutine)(wptr, iptr, &haswin_dragmouse, 0))))
- return(HASWIN_TRUE);
- haswin_flags &= ~HASWIN_FLAGS_DRAG;
- haswin_dragwindow = wptr;
- haswin_dragicon = iptr;
- if (pbuf->i[4] == -1) {
- buff.i[0] = pbuf->i[3];
- buff.i[1] = 6;
- buff.i[2] = pbuf->i[0];
- buff.i[3] = pbuf->i[1];
- buff.i[4] = pbuf->i[0]+1;
- buff.i[5] = pbuf->i[1]+1;
- buff.i[6] = 0;
- buff.i[7] = 0;
- buff.i[8] = haswin_readvduvariable(VDUVAR_ScreenXsize);
- buff.i[9] = haswin_readvduvariable(VDUVAR_ScreenYsize);
- regs.r[1] = (int)&buff;
- if (haswin_swi(HASWIN_Drag_box, ®s))
- haswin_flags |= HASWIN_FLAGS_DRAG;
- else
- return(HASWIN_FALSE);
- } else if ((int)wptr > 0) {
- adjx = ((int *)(wptr->win))[0] -
- ((int *)(wptr->win))[4];
- adjy = ((int *)(wptr->win))[3] -
- ((int *)(wptr->win))[5];
- buff.i[0] = pbuf->i[3];
- buff.i[1] = pbuf->i[4];
- regs.r[1] = (int)&buff;
- haswin_swi(HASWIN_Get_icon_state, ®s);
- buff.i[0] = pbuf->i[3];
- buff.i[1] = 5;
- buff.i[2] += adjx;
- buff.i[3] += adjy;
- buff.i[4] += adjx;
- buff.i[5] += adjy;
- buff.i[6] = 0;
- buff.i[7] = 0;
- buff.i[8] = haswin_readvduvariable(VDUVAR_ScreenXsize);
- buff.i[9] = haswin_readvduvariable(VDUVAR_ScreenYsize);
- regs.r[1] = (int)&buff;
- if (haswin_swi(HASWIN_Drag_box, ®s))
- haswin_flags |= HASWIN_FLAGS_DRAG;
- else
- return(HASWIN_FALSE);
- }
- return(HASWIN_TRUE);
- }
-
- /*
- * this small piece of code handles HASWINs attempts to drag an
- * object from a mouse click. It should be called *ONLY* from
- * "haswin_poll_mouse()" below.
- */
- static int tryleftdrag(window *wptr, icon *iptr, buffer *pbuf, int err) {
-
- int adjx, adjy;
- _kernel_swi_regs regs;
- buffer buff;
-
- /* left SELECT button dragged */
- if (((int)wptr > 0) && (pbuf->i[4] == -1) &&
- (!(wptr->flags & WINDOW_DRAGSEL)) &&
- (!(wptr->flags & WINDOW_AUTOTEXT)) ) {
- if (err)
- haswin_internalerror("dragging is not allowed in this window");
- return(HASWIN_FALSE);
- }
- if (((int)iptr > 0) && (!(iptr->flags & ICON_DRAGSEL))) {
- if (err)
- haswin_internalerror("dragging is not allowed in this icon");
- return(HASWIN_FALSE);
- }
- if (haswin_flags & HASWIN_FLAGS_DRAG) {
- regs.r[1] = 0;
- haswin_swi(HASWIN_Drag_box, ®s);
- }
- haswin_getpointerinfo(&haswin_dragmouse);
- if (((int)iptr > 0) && (iptr->dragroutine) && (!((*iptr->dragroutine)(wptr, iptr, &haswin_dragmouse, 0))))
- return(HASWIN_TRUE);
- else if (((int)wptr > 0) && (wptr->dragroutine) && (!((*wptr->dragroutine)(wptr, iptr, &haswin_dragmouse, 0))))
- return(HASWIN_TRUE);
- haswin_flags &= ~HASWIN_FLAGS_DRAG;
- haswin_dragwindow = wptr;
- haswin_dragicon = iptr;
- if (pbuf->i[4] == -1) {
- buff.i[0] = pbuf->i[3];
- buff.i[1] = 6;
- buff.i[2] = pbuf->i[0];
- buff.i[3] = pbuf->i[1];
- buff.i[4] = pbuf->i[0]+1;
- buff.i[5] = pbuf->i[1]+1;
- buff.i[6] = 0;
- buff.i[7] = 0;
- buff.i[8] = haswin_readvduvariable(VDUVAR_ScreenXsize);
- buff.i[9] = haswin_readvduvariable(VDUVAR_ScreenYsize);
- regs.r[1] = (int)&buff;
- if (haswin_swi(HASWIN_Drag_box, ®s))
- haswin_flags |= HASWIN_FLAGS_DRAG;
- else
- return(HASWIN_FALSE);
- } else if ((int)wptr > 0) {
- adjx = ((int *)(wptr->win))[0] -
- ((int *)(wptr->win))[4];
- adjy = ((int *)(wptr->win))[3] -
- ((int *)(wptr->win))[5];
- buff.i[0] = pbuf->i[3];
- buff.i[1] = pbuf->i[4];
- regs.r[1] = (int)&buff;
- haswin_swi(HASWIN_Get_icon_state, ®s);
- buff.i[0] = pbuf->i[3];
- buff.i[1] = 5;
- buff.i[2] += adjx;
- buff.i[3] += adjy;
- buff.i[4] += adjx;
- buff.i[5] += adjy;
- buff.i[6] = 0;
- buff.i[7] = 0;
- buff.i[8] = haswin_readvduvariable(VDUVAR_ScreenXsize);
- buff.i[9] = haswin_readvduvariable(VDUVAR_ScreenYsize);
- regs.r[1] = (int)&buff;
- if (haswin_swi(HASWIN_Drag_box, ®s))
- haswin_flags |= HASWIN_FLAGS_DRAG;
- else
- return(HASWIN_FALSE);
- }
- return(HASWIN_TRUE);
- }
-
- /*
- * Mouse click routine.
- */
- int haswin_poll_mouse(int (*user)(int, buffer *), buffer *pbuf) {
-
- window *wptr;
- icon *iptr;
- pointer *mouse;
- buffer buff;
-
- wptr = haswin_findwindowhandle(pbuf->i[3]);
- iptr = haswin_findiconhandle(wptr, pbuf->i[4]);
- pbuf->i[6] = (int)wptr;
- pbuf->i[7] = (int)iptr;
- pbuf->i[8] = haswin_buttonWIMPtoHASWIN(wptr, iptr, pbuf->i[2]);
- /* first try to get around the whole process by passing it on
- to the user routine */
- if ((user) && (!((*user)(HASWIN_POLL_Mouse, pbuf))))
- return(HASWIN_TRUE); /* user processed it, so complete */
- if ((pbuf->i[3] == -1) && (pbuf->i[4] == -1)) {
- haswin_internalerror("cannot handle mouse press, no window or icon");
- return(HASWIN_TRUE); /* cannot process it, so complete */
- }
- switch (pbuf->i[8]) {
- case HASWIN_MOUSE_L:
- /*
- * select action (fall through items until "return" is done)
- *
- * mouse in icon...
- * if window to open
- * open or close it
- * if ICON_DOCODE flag == 0 return
- * if icon routine to do
- * do it
- * try to drag icon, if successful return.
- * mouse in window...
- * if text flag on in window and not in icon as well
- * move text cursor.
- * if WINDOW_DOCODE flag == 0 return
- * else if caret to move and not in icon as well
- * move it
- * if WINDOW_DOCODE flag == 0 return
- * if window routine to do
- * do it, return
- * try to drag window, if successful return.
- * display error message.
- * return.
- */
- if ((int)iptr > 0) {
- /* mouse on icon in icon bar or window */
- if (iptr->window) {
- /* we have a window, so open it */
- /* inform the userpoll routine that a window is about to be opened */
- haswin_updatewindowinfo(iptr->window);
- buff.i[0]=iptr->window->handle;
- buff.i[1]=haswin_getwindowxmin(iptr->window);
- buff.i[2]=haswin_getwindowymin(iptr->window);
- buff.i[3]=haswin_getwindowxmax(iptr->window);
- buff.i[4]=haswin_getwindowymax(iptr->window);
- buff.i[5]=haswin_getwindowxscroll(iptr->window);
- buff.i[6]=haswin_getwindowyscroll(iptr->window);
- buff.i[7]=haswin_getwindowbhandle(iptr->window);
- buff.i[8]=(int)iptr->window;
- if (haswin_getwindowflags(iptr->window) & WINDOW_OPEN) {
- if ((user) && (!(*user)(HASWIN_POLL_poll_Close, &buff)))
- return(HASWIN_FALSE);
- haswin_closewindow(iptr->window);
- } else {
- if ((user) && (!(*user)(HASWIN_POLL_poll_Open, &buff)))
- return(HASWIN_FALSE);
- haswin_openwindow(iptr->window, buff.i[1], buff.i[2], buff.i[3], buff.i[4], buff.i[5], buff.i[6], buff.i[7]);
- }
- if (!(haswin_geticonflags(iptr)&ICON_DOCODE))
- return(HASWIN_TRUE);
- if (iptr->mousebutton)
- return((*iptr->mousebutton)(iptr, pbuf));
- return(HASWIN_TRUE);
- }
- if (iptr->mousebutton) {
- if ((*iptr->mousebutton)(iptr, pbuf))
- return(HASWIN_TRUE);
- }
- if (tryleftdrag(wptr, iptr, pbuf, HASWIN_FALSE))
- return(HASWIN_TRUE);
- }
- /* try an action for the window, no icon */
- if ((int)wptr > 0) {
- if ((wptr->text) && (!iptr) && (haswin_getwindowflags(wptr)&WINDOW_AUTOTEXT) && (wptr->text->text)) {
- mouse = haswin_getpointerinfo(0);
- haswin_textmove(wptr,
- haswin_convertscrxtotxt(wptr,mouse->mx),
- haswin_convertscrytotxt(wptr,mouse->my));
- haswin_freeptr(&mouse);
- if (!(haswin_getwindowflags(wptr) & WINDOW_DOCODE))
- return(HASWIN_TRUE);
- } else if ((wptr->caret) && (!iptr)) {
- /* we have a caret so move it to the
- mouse (only if not under an icon) */
- mouse = haswin_getpointerinfo(0);
- wptr->caret->win = mouse->win;
- wptr->caret->ic = (icon *)(-1);
- wptr->caret->x = haswin_convertscrxtowin(wptr, mouse->mx);
- wptr->caret->y = haswin_convertscrytowin(wptr, mouse->my);
- haswin_freeptr(&mouse);
- haswin_setcaret(wptr->caret);
- if (!(haswin_getwindowflags(wptr) & WINDOW_DOCODE))
- return(HASWIN_TRUE);
- }
- if (wptr->mousebutton) {
- if ((*wptr->mousebutton)(wptr, pbuf))
- return(HASWIN_TRUE);
- }
- if (tryleftdrag(wptr, iptr, pbuf, HASWIN_FALSE))
- return(HASWIN_TRUE);
- if (((int)iptr > 0) && (iptr->mousebutton))
- return(HASWIN_TRUE);
- if ((int)iptr > 0)
- haswin_internalerror("this icon has no select action");
- else
- haswin_internalerror("this window has no select action");
- return(HASWIN_FALSE);
- }
- haswin_internalerror("this non HASWIN window has no select action");
- break;
- case HASWIN_MOUSE_M:
- /*
- * menu action (fall through items until "return" is done)
- * mouse in icon...
- * if menu to open
- * open it
- * if ICON_DOCODE flag == 0 return
- * if icon routine to do
- * do it and if successful return
- * try to create a menu for the icon automatically
- * (Help, Quit, Window, Info, Files, etc. fields)
- * and if this is successful return.
- * mouse in window...
- * if menu to open
- * open it
- * if WINDOW_DOCODE flag == 0 return
- * if window routine to do
- * do it and if successful return
- * try to create a menu for the window automatically
- * (Help, Quit, Window, Info, Files, etc. fields)
- * and if this is successful return.
- * display error message.
- * return.
- */
- /* inform the userpoll routine that a menu is about to be opened */
- if ((user) && (!(*user)(HASWIN_POLL_poll_Menu, pbuf)))
- return(HASWIN_TRUE);
- if ((int)iptr > 0) {
- /* icon on icon bar or window */
- if (iptr->menu) {
- /* we have a menu */
- iptr->menu->wfrom=pbuf->i[3];
- iptr->menu->ifrom=pbuf->i[4];
- if ((iptr->menu->makemenu) &&
- (!(*iptr->menu->makemenu)(iptr->menu)))
- return(HASWIN_TRUE);
- if (haswin_createmenu(wptr, iptr, 0, 0,
- pbuf->i[0]-iptr->menu->x,
- pbuf->i[1]+iptr->menu->y))
- if (!(haswin_geticonflags(iptr)&ICON_DOCODE))
- return(HASWIN_TRUE);
- }
- if (iptr->mousebutton) {
- if ((*iptr->mousebutton)(iptr, pbuf))
- return(HASWIN_TRUE);
- }
- if (haswin_createmenu(wptr, iptr, 0, 0, pbuf->i[0],
- pbuf->i[1]))
- return(HASWIN_TRUE);
- }
- /* try an action for the window, no icon */
- if ((int)wptr > 0) {
- if (wptr->menu) {
- wptr->menu->wfrom = pbuf->i[3];
- wptr->menu->ifrom = -1;
- if ((wptr->menu->makemenu) &&
- (!(*wptr->menu->makemenu)(wptr->menu)))
- return(HASWIN_TRUE);
- if (haswin_createmenu(wptr, 0, 0, 0,
- pbuf->i[0]-wptr->menu->x,
- pbuf->i[1]+wptr->menu->y))
- if (!(haswin_geticonflags(iptr)&ICON_DOCODE))
- return(HASWIN_TRUE);
- }
- if (wptr->mousebutton) {
- if ((*wptr->mousebutton)(wptr, pbuf))
- return(HASWIN_TRUE);
- }
- if (haswin_createmenu(wptr, 0, 0, 0, pbuf->i[0],
- pbuf->i[1]))
- return(HASWIN_TRUE);
- if ((((int)iptr > 0) && (iptr->mousebutton)) ||
- (wptr->mousebutton))
- return(HASWIN_TRUE);
- if (iptr)
- haswin_internalerror("this icon has no menu action");
- else
- haswin_internalerror("this window has no menu action");
- return(HASWIN_FALSE);
- }
- haswin_internalerror("this non HASWIN window has no menu action");
- return(HASWIN_FALSE);
- break;
- case HASWIN_MOUSE_R:
- /*
- * adjust action (fall through items until "return" is done)
- * mouse in icon...
- * if icon routine to do
- * do it and if successful return
- * try to drag icon, if successful return.
- * mouse in window...
- * if window routine to do
- * do it and if successful return
- * try to drag window, if successful return.
- * display error message.
- * return.
- */
- if ((int)iptr > 0) {
- if (iptr->mousebutton) {
- if ((*iptr->mousebutton)(iptr, pbuf))
- return(HASWIN_TRUE);
- }
- if (tryrightdrag(wptr, iptr, pbuf, HASWIN_FALSE))
- return(HASWIN_TRUE);
- }
- /* try an action for the window, no icon */
- if ((int)wptr > 0) {
- if ((wptr->mousebutton) &&
- (!(*wptr->mousebutton)(wptr, pbuf)))
- return(HASWIN_TRUE);
- if (tryrightdrag(wptr, iptr, pbuf, HASWIN_FALSE))
- return(HASWIN_TRUE);
- if (((iptr) && (iptr->mousebutton)) ||
- (wptr->mousebutton))
- return(HASWIN_TRUE);
- if ((int)iptr > 0)
- haswin_internalerror("this icon has no adjust action");
- else
- haswin_internalerror("this window has no adjust action");
- return(HASWIN_FALSE);
- }
- break;
- case HASWIN_MOUSE_LDRAG:
- /*
- * select drag action, call the dragging routine
- */
- return(tryleftdrag(wptr, iptr, pbuf, HASWIN_TRUE));
- break;
- case HASWIN_MOUSE_RDRAG:
- return(tryrightdrag(wptr, iptr, pbuf, HASWIN_TRUE));
- /*
- * adjust drag action, call the dragging routine
- */
- break;
- case HASWIN_MOUSE_LDOUB:
- /*
- * select double-click action (fall through items until
- * "return" is done)
- * mouse in icon...
- * if icon routine to do
- * do it and if successful return
- * mouse in window...
- * if window routine to do
- * do it and if successful return
- * display error message.
- * return.
- */
- if (((int)iptr > 0) && (iptr->mousebutton)) {
- if ((*iptr->mousebutton)(iptr, pbuf))
- return(HASWIN_TRUE);
- }
- /* try an action for the window, no icon */
- if ((int)wptr > 0) {
- if (wptr->mousebutton) {
- if ((*wptr->mousebutton)(wptr, pbuf))
- return(HASWIN_TRUE);
- }
- if (((iptr) && (iptr->mousebutton)) ||
- (wptr->mousebutton))
- return(HASWIN_TRUE);
- if ((int)iptr > 0)
- haswin_internalerror("this icon has no select double-click action");
- else
- haswin_internalerror("this window has no select double-click action");
- return(HASWIN_FALSE);
- }
- break;
- case HASWIN_MOUSE_RDOUB:
- /*
- * adjust double-click action (fall through items until
- * "return" is done)
- * mouse in icon...
- * if icon routine to do
- * do it and if successful return
- * mouse in window...
- * if window routine to do
- * do it and if successful return
- * display error message.
- * return.
- */
- if (((int)iptr > 0) && (iptr->mousebutton)) {
- if ((*iptr->mousebutton)(iptr, pbuf))
- return(HASWIN_TRUE);
- }
- /* try an action for the window, no icon */
- if ((int)wptr > 0) {
- if (wptr->mousebutton) {
- if ((*wptr->mousebutton)(wptr, pbuf))
- return(HASWIN_TRUE);
- }
- if (((iptr) && (iptr->mousebutton)) ||
- (wptr->mousebutton))
- return(HASWIN_TRUE);
- if ((int)iptr > 0)
- haswin_internalerror("this icon has no adjust double-click action");
- else
- haswin_internalerror("this window has no adjust double-click action");
- return(HASWIN_FALSE);
- }
- break;
- case 0:
- /*
- * position report action (fall through items until
- * "return" is done)
- * mouse in icon...
- * if icon routine to do
- * do it and if successful return
- * mouse in window...
- * if window routine to do
- * do it and if successful return
- * return.
- */
- if (((int)iptr > 0) && (iptr->mousebutton)) {
- if ((*iptr->mousebutton)(iptr, pbuf))
- return(HASWIN_TRUE);
- }
- /* try an action for the window, no icon */
- if ((int)wptr > 0) {
- if (wptr->mousebutton) {
- if ((*wptr->mousebutton)(wptr, pbuf))
- return(HASWIN_TRUE);
- }
- return(HASWIN_FALSE);
- }
- break;
- default:
- haswin_interrorprintf("illegal mouse button action %4.4X", pbuf->i[2]);
- return(HASWIN_TRUE);
- break;
- }
- return(HASWIN_TRUE);
- }
-
- int haswin_poll_scroll(int (*user)(int, buffer *), buffer *pbuf) {
-
- int charx, chary;
- window *wptr;
- _kernel_swi_regs regs;
-
- charx = haswin_readvduvariable(VDUVAR_CharXsize);
- chary = haswin_readvduvariable(VDUVAR_CharYsize);
- wptr = haswin_findwindowhandle(pbuf->i[0]);
- pbuf->i[10] = (int)wptr;
- if ((user) && (!((*user)(HASWIN_POLL_Scroll, pbuf))))
- return(HASWIN_FALSE);
- if ((int)wptr <= 0) {
- switch (pbuf->i[8]) { /* perform the X scroll */
- case -2:
- pbuf->i[5] -= pbuf->i[3]-pbuf->i[1];
- break;
- case -1:
- pbuf->i[5] -= charx;
- break;
- case 1:
- pbuf->i[5] += charx;
- break;
- case 2:
- pbuf->i[5] += pbuf->i[3]-pbuf->i[1];
- break;
- }
- switch (pbuf->i[9]) { /* perform the Y scroll */
- case -2:
- pbuf->i[6] -= pbuf->i[4]-pbuf->i[2];
- break;
- case -1:
- pbuf->i[6] -= chary;
- break;
- case 1:
- pbuf->i[6] += chary;
- break;
- case 2:
- pbuf->i[6] += pbuf->i[4]-pbuf->i[2];
- break;
- }
- } else {
- switch (pbuf->i[8]) { /* perform the X scroll */
- case -2:
- if (wptr->pagex)
- pbuf->i[5] -= wptr->pagex;
- else
- pbuf->i[5] -= pbuf->i[3]-pbuf->i[1];
- break;
- case -1:
- if (wptr->scrollx)
- pbuf->i[5] -= wptr->scrollx;
- else
- pbuf->i[5] -= charx;
- break;
- case 1:
- if (wptr->scrollx)
- pbuf->i[5] += wptr->scrollx;
- else
- pbuf->i[5] += charx;
- break;
- case 2:
- if (wptr->pagex)
- pbuf->i[5] += wptr->pagex;
- else
- pbuf->i[5] += pbuf->i[3]-pbuf->i[1];
- break;
- }
- switch (pbuf->i[9]) { /* perform the Y scroll */
- case -2:
- if (wptr->pagey)
- pbuf->i[6] -= wptr->pagey;
- else
- pbuf->i[6] -= pbuf->i[4]-pbuf->i[2];
- break;
- case -1:
- if (wptr->scrolly)
- pbuf->i[6] -= wptr->scrolly;
- else
- pbuf->i[6] -= chary;
- break;
- case 1:
- if (wptr->scrolly)
- pbuf->i[6] += wptr->scrolly;
- else
- pbuf->i[6] += chary;
- break;
- case 2:
- if (wptr->pagey)
- pbuf->i[6] += wptr->pagey;
- else
- pbuf->i[6] += pbuf->i[4]-pbuf->i[2];
- break;
- }
- }
- if ((user) && (!((*user)(HASWIN_POLL_Scrolled, pbuf))))
- return(HASWIN_FALSE);
- if (((int)wptr > 0) && (*wptr->openroutine) &&
- (!((*wptr->openroutine)(wptr, pbuf))))
- return(HASWIN_FALSE);
- if ((int)wptr > 0) {
- regs.r[1] = (int)pbuf;
- return(haswin_swi(HASWIN_Open_window, ®s));
- }
- return(HASWIN_TRUE);
- }
-
-