grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / intuition / beginrefresh.c
blob2c95428b966117ca166e5b59da569b1b36317a50
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/layers.h>
8 #include <proto/graphics.h>
9 #include "intuition_intern.h"
10 #include "inputhandler_actions.h"
11 #include "inputhandler_support.h"
13 #ifdef SKINS
14 # include "renderwindowframe.h"
15 #endif
17 /*****************************************************************************
19 NAME */
20 #include <proto/intuition.h>
22 AROS_LH1(void, BeginRefresh,
24 /* SYNOPSIS */
25 AROS_LHA(struct Window *, window, A0),
27 /* LOCATION */
28 struct IntuitionBase *, IntuitionBase, 59, Intuition)
30 /* FUNCTION
31 Initializes optimized refreshing. It restricts redrawing to areas which
32 need refreshing after a window has been moved or has changed size.
34 INPUTS
35 window - window which needs refreshing
37 RESULT
39 NOTES
40 Only simple graphics.library functions are allowed between
41 BeginRefresh() and EndRefresh().
43 BeginRefresh()/EndRefresh() should always be called when an
44 IDCMP_REFRESHWINDOW message happens.
46 EXAMPLE
47 Somewhere in your window's event handling loop:
49 case IDCMP_REFRESHWINDOW:
50 BeginRefresh(mywindow);
51 EndRefresh(mywindow, TRUE);
52 break;
54 BUGS
56 SEE ALSO
57 EndRefresh()
59 INTERNALS
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
65 struct LayersBase *LayersBase = GetPrivIBase(IntuitionBase)->LayersBase;
67 #if 0 /* unused */
68 ULONG mode = NO_DOUBLEBUFFER;
69 #endif
71 #ifdef BEGINUPDATEGADGETREFRESH
72 BOOL gadgetrefresh = FALSE;
73 #endif
75 DEBUG_REFRESH(dprintf("BeginRefresh: Window 0x%lx\n", window));
77 SANITY_CHECK(window)
79 //jDc: makes sure we've got 1 refresing window at a time
80 LockLayerInfo(&window->WScreen->LayerInfo);
82 /* Find out whether it's a GimmeZeroZero window with an extra layer to lock */
83 if (BLAYER(window))
84 LockLayer(0, BLAYER(window));
86 /* jDc: in actual implementation border layer is created as the 1st one. this means it's added to
87 ** screens layer semaphore list at the end (layers use AddTail), so here we also need to lock it
88 ** as 1st one, otherwise we run into a deadlock with LockLayers() !!!
91 LockLayer(0, WLAYER(window));
93 #if 0 /* unused */
94 /* jDc: in current opaque implementation the damaged regions are added to
95 ** window's internal damage list and matched against actual damage here
98 if (IW(window)->specialflags & SPFLAG_WANTBUFFER) mode = DOUBLEBUFFER;
99 #endif
101 /* I don't think I ever have to update the BorderRPort's layer */
102 if (!BeginUpdate(WLAYER(window)))
104 EndUpdate(WLAYER(window), FALSE);
106 //dprintf("%s :BeginUpdate returned FALSE!->Aborting BeginUpdate()\n",__FUNCTION__);
107 return;
110 /* jDc: because with opaque move window borders/gadgets are not refreshed to
111 ** speed things up we do this here - this reduces cpu time spent in inputhandler
114 /* let the user know that we're currently doing a refresh */
115 AROS_ATOMIC_OR(window->Flags, WFLG_WINDOWREFRESH);
117 AROS_LIBFUNC_EXIT
118 } /* BeginRefresh */