2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
6 Classes for window decor stuff, like dragbar, close etc.
9 /***********************************************************************************/
13 #include <proto/exec.h>
14 #include <proto/intuition.h>
15 #include <proto/graphics.h>
16 #include <proto/utility.h>
17 #include <proto/layers.h>
19 #include <intuition/classes.h>
20 #include <intuition/gadgetclass.h>
21 #include <intuition/cghooks.h>
22 #include <intuition/imageclass.h>
23 #include <intuition/extensions.h>
24 #include <aros/asmcall.h>
28 #include "intuition_intern.h"
29 #include "inputhandler.h"
30 #include "inputhandler_support.h"
31 #include "inputhandler_actions.h"
34 #include "intuition_customizesupport.h"
35 #include "renderwindowframe.h"
43 #include <aros/debug.h>
47 jDc: opaque resize code is NOT suitable for other apps than MUI, I have no intentions in fixing it so that
48 it would work with all apps out there. Use mui or die :)
50 The idea behind the trick is that we use a func that checks if apps reply to idcmps in some period
51 of time. As long as they are replying fast we can do another layer resize, send idcmp to app.
52 If they do not then we wait for a while and after some time, if one or more apps don't reply
53 we do the resize again (the timeout is also useful when we have some dead app with windows
59 # define OPAQUESIZE (w->MoreFlags & WMFLG_IAMMUI)
67 /***********************************************************************************/
69 #define WSIG_MOVE SIGF_INTUITION
70 #define WSIG_DIE SIGF_ABORT
72 /***********************************************************************************/
74 void MoveTask(struct dragbar_data
*data
,struct Window
*w
,struct Screen
*screen
,struct IntuitionBase
*IntuitionBase
)
76 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
81 signals
= Wait(WSIG_DIE
|WSIG_MOVE
);
83 if (signals
& WSIG_DIE
)
88 WindowAction(w
,WAC_CHANGEWINDOWBOX
,0);
92 if (signals
& WSIG_MOVE
)
96 LockLayers(&screen
->LayerInfo
);
98 for (L
= screen
->LayerInfo
.top_layer
; L
; L
= L
->back
)
102 //window not closed yet!
103 if (data
->curleft
!= w
->LeftEdge
|| data
->curtop
!= w
->TopEdge
)
105 struct Requester
*req
;
109 /* move outer window first */
110 MoveSizeLayer(BLAYER(w
), data
->curleft
- w
->LeftEdge
, data
->curtop
- w
->TopEdge
, 0, 0);
113 MoveSizeLayer(WLAYER(w
), data
->curleft
- w
->LeftEdge
, data
->curtop
- w
->TopEdge
, 0, 0);
115 for (req
= w
->FirstRequest
; req
; req
= req
->OlderRequest
)
117 struct Layer
*layer
= req
->ReqLayer
;
122 int left
, top
, right
, bottom
;
124 left
= data
->curleft
+ req
->LeftEdge
;
125 top
= data
->curtop
+ req
->TopEdge
;
126 right
= left
+ req
->Width
- 1;
127 bottom
= top
+ req
->Height
- 1;
129 if (left
> data
->curleft
+ w
->Width
- 1)
130 left
= data
->curleft
+ w
->Width
- 1;
132 if (top
> data
->curtop
+ w
->Height
- 1)
133 top
= data
->curtop
+ w
->Height
- 1;
135 if (right
> data
->curleft
+ w
->Width
- 1)
136 right
= data
->curleft
+ w
->Width
- 1;
138 if (bottom
> data
->curtop
+ w
->Height
- 1)
139 bottom
= data
->curtop
+ w
->Height
- 1;
141 dx
= left
- layer
->bounds
.MinX
;
142 dy
= top
- layer
->bounds
.MinY
;
143 dw
= right
- left
- layer
->bounds
.MaxX
+ layer
->bounds
.MinX
;
144 dh
= bottom
- top
- layer
->bounds
.MaxY
+ layer
->bounds
.MinY
;
146 MoveSizeLayer(layer
, dx
, dy
, dw
, dh
);
150 w
->LeftEdge
= data
->curleft
;
151 w
->TopEdge
= data
->curtop
;
152 UpdateMouseCoords(w
);
159 RecordDamage(screen
,IntuitionBase
);
161 data
->drag_refreshed
= FALSE
;
163 UnlockLayers(&screen
->LayerInfo
);
168 /***********************************************************************************/
170 /* drawwindowframe is used when the user drags or resizes a window */
172 #define DWF_THICK_X 2
173 #define DWF_THICK_Y 2
175 /***********************************************************************************/
177 static void cliprectfill(struct Screen
*scr
, struct RastPort
*rp
,
178 WORD x1
, WORD y1
, WORD x2
, WORD y2
,
179 struct IntuitionBase
*IntuitionBase
)
181 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
182 WORD scrx2
= scr
->Width
- 1;
183 WORD scry2
= scr
->Height
- 1;
185 /* Check if inside at all */
187 if (!((x1
> scrx2
) || (x2
< 0) || (y1
> scry2
) || (y2
< 0)))
191 if (x2
> scrx2
) x2
= scrx2
;
192 if (y2
> scry2
) y2
= scry2
;
196 if ((x2
>= x1
) && (y2
>= y1
))
198 RectFill(rp
, x1
, y1
, x2
, y2
);
204 /***********************************************************************************/
206 static void drawwindowframe(struct Screen
*scr
, struct RastPort
*rp
,
207 WORD x1
, WORD y1
, WORD x2
, WORD y2
,
208 struct IntuitionBase
*IntuitionBase
)
210 /* this checks should not be necessary, but just to be sure */
228 if (((x2
- x1
) < (DWF_THICK_X
* 2)) ||
229 ((y2
- y1
) < (DWF_THICK_Y
* 2)))
231 cliprectfill(scr
, rp
, x1
, y1
, x2
, y2
, IntuitionBase
);
235 cliprectfill(scr
, rp
, x1
, y1
, x2
, y1
+ DWF_THICK_Y
- 1, IntuitionBase
);
236 cliprectfill(scr
, rp
, x2
- DWF_THICK_X
+ 1, y1
+ DWF_THICK_Y
, x2
, y2
, IntuitionBase
);
237 cliprectfill(scr
, rp
, x1
, y2
- DWF_THICK_Y
+ 1, x2
- DWF_THICK_X
, y2
, IntuitionBase
);
238 cliprectfill(scr
, rp
, x1
, y1
+ DWF_THICK_Y
, x1
+ DWF_THICK_X
- 1, y2
- DWF_THICK_Y
, IntuitionBase
);
242 /***********************************************************************************/
245 IPTR
DragBarClass__GM_RENDER(Class
*cl
, struct Gadget
*g
, struct gpRender
* msg
)
247 EnterFunc(bug("DragBar::Render()\n"));
248 /* We will let the AROS gadgetclass test if it is safe to render */
250 if ( DoSuperMethodA(cl
, (Object
*)g
, (Msg
)msg
) != 0)
252 struct DrawInfo
*dri
= msg
->gpr_GInfo
->gi_DrInfo
;
253 UWORD
*pens
= dri
->dri_Pens
;
254 struct RastPort
*rp
= msg
->gpr_RPort
;
255 struct IBox container
;
256 struct Window
*win
= msg
->gpr_GInfo
->gi_Window
;
257 struct TextExtent te
;
259 GetGadgetIBox(g
, msg
->gpr_GInfo
, &container
);
261 if (container
.Width
<= 1 || container
.Height
<= 1)
265 /* Clear the dragbar */
267 SetAPen(rp
, (win
->Flags
& WFLG_WINDOWACTIVE
) ?
268 pens
[FILLPEN
] : pens
[BACKGROUNDPEN
]);
272 D(bug("Filling from (%d, %d) to (%d, %d)\n",
275 container
.Left
+ container
.Width
- 1,
276 container
.Top
+ container
.Height
- 1));
281 container
.Left
+ container
.Width
- 1,
282 container
.Top
+ container
.Height
- 2);
284 /* Draw a thin dark line around the bar */
286 SetAPen(rp
, pens
[SHINEPEN
]);
287 RectFill(rp
,container
.Left
,
290 container
.Top
+ container
.Height
- 1 - ((container
.Left
== 0) ? 0 : 1));
291 RectFill(rp
,container
.Left
+ 1,
293 container
.Left
+ container
.Width
- 1,
296 SetAPen(rp
,pens
[SHADOWPEN
]);
297 RectFill(rp
,container
.Left
+ container
.Width
- 1,
299 container
.Left
+ container
.Width
- 1,
300 container
.Top
+ container
.Height
- 1);
301 RectFill(rp
,container
.Left
+ ((container
.Left
== 0) ? 1 : 0),
302 container
.Top
+ container
.Height
- 1,
303 container
.Left
+ container
.Width
- 2,
304 container
.Top
+ container
.Height
- 1);
306 /* Render the titlebar */
307 if (NULL
!= win
->Title
)
309 ULONG textlen
, titlelen
;
311 SetFont(rp
, dri
->dri_Font
);
313 titlelen
= strlen(win
->Title
);
320 , container
.Width
- 6
323 SetAPen(rp
, pens
[(win
->Flags
& WFLG_WINDOWACTIVE
) ? FILLTEXTPEN
: TEXTPEN
]);
324 Move(rp
, container
.Left
+ 3, container
.Top
+ dri
->dri_Font
->tf_Baseline
+ 2);
326 Text(rp
, win
->Title
, textlen
);
329 } /* if (allowed to render) */
335 /***********************************************************************************/
337 IPTR
DragBarClass__GM_GOACTIVE(Class
*cl
, struct Gadget
*g
, struct gpInput
*msg
)
339 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
340 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
341 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
342 struct InputEvent
*ie
= msg
->gpi_IEvent
;
343 IPTR retval
= GMR_NOREUSE
;
347 /* The gadget was activated via mouse input */
348 struct dragbar_data
*data
;
351 /* There is no point in rerendering ourseleves here, as this is done
352 by a call to RefreshWindowFrame() in the intuition inputhandler
355 w
= msg
->gpi_GInfo
->gi_Window
;
357 data
= INST_DATA(cl
, g
);
360 /* do NOT ObtainSemaphore here since this would lead to deadlocks!!! */
361 /* when the semaphore can not be obtained we simply ignore gadget activation */
363 /* in movehack the task that locks windowlock is the one that calls MoveWindow*/
364 if (!(AttemptSemaphore(&GetPrivIBase(IntuitionBase
)->WindowLock
)))
368 data
->drag_windowlock
= TRUE
;
371 data
->curleft
= w
->LeftEdge
;
372 data
->curtop
= w
->TopEdge
;
374 data
->startleft
= w
->LeftEdge
;
375 data
->starttop
= w
->TopEdge
;
377 data
->mousex
= w
->WScreen
->MouseX
- data
->curleft
;
378 data
->mousey
= w
->WScreen
->MouseY
- data
->curtop
;
380 data
->drag_refreshed
= TRUE
;
382 data
->rp
= CloneRastPort(&w
->WScreen
->RastPort
);
386 /* Lock all layers while the window is dragged.
387 * Get the gadget lock first to avoid deadlocks
388 * with ObtainGIRPort. */
390 D(bug("locking all layers\n"));
392 if (!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
))
395 ObtainSemaphore(&GetPrivIBase(IntuitionBase
)->InputHandlerLock
);
396 data
->drag_inputhandlerlock
= TRUE
;
398 if (AttemptSemaphore(&GetPrivIBase(IntuitionBase
)->GadgetLock
))
400 data
->drag_gadgetlock
= TRUE
;
408 LockLayers(&w
->WScreen
->LayerInfo
);
409 data
->drag_layerlock
= TRUE
;
413 if (GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_PRIVILEDGEDREFRESH
)
417 NewCreateTask(TASKTAG_CODETYPE
, CODETYPE_PPC
, TASKTAG_PC
, (ULONG
)MoveTask
,
419 TASKTAG_PPC_ARG1
,(ULONG
)data
,
420 TASKTAG_PPC_ARG2
,(ULONG
)w
,
421 TASKTAG_PPC_ARG3
,(ULONG
)w
->WScreen
,
422 TASKTAG_PPC_ARG4
,(ULONG
)IntuitionBase
,
426 /* FIXME: Implemente MOVEHACK support for AROS (?) */
431 SetDrMd(data
->rp
, COMPLEMENT
);
434 if (!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
))
435 drawwindowframe(w
->WScreen
439 , data
->curleft
+ w
->Width
- 1
440 , data
->curtop
+ w
->Height
- 1
444 data
->isrendered
= TRUE
;
447 data
->drag_canceled
= FALSE
;
452 currenttime
= ie
->ie_TimeStamp
.tv_secs
;
453 currenttime
= currenttime
* 50;
454 currenttime
+= ie
->ie_TimeStamp
.tv_micro
/ 20000;
456 data
->lasteventtime
= currenttime
;
459 /* size mouse bounds such that mouse pointer cannot move if window cannot move, if offscreenlayers is turned off */
460 if (!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OFFSCREENLAYERS
)) {
461 struct IIHData
*iihd
= (struct IIHData
*)GetPrivIBase(IntuitionBase
)->InputHandler
->is_Data
;
462 iihd
->MouseBoundsActiveFlag
= TRUE
;
463 iihd
->MouseBoundsLeft
= data
->mousex
;
464 iihd
->MouseBoundsRight
= w
->WScreen
->Width
- (w
->Width
- data
->mousex
);
465 iihd
->MouseBoundsTop
= data
->mousey
;
466 iihd
->MouseBoundsBottom
= w
->WScreen
->Height
- (w
->Height
- data
->mousey
);
473 if (data
->drag_layerlock
)
475 UnlockLayers(&w
->WScreen
->LayerInfo
);
476 data
->drag_layerlock
= FALSE
;
481 if (data
->drag_gadgetlock
)
483 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->GadgetLock
);
484 data
->drag_gadgetlock
= FALSE
;
487 if (data
->drag_inputhandlerlock
)
489 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->InputHandlerLock
);
490 data
->drag_inputhandlerlock
= FALSE
;
495 if (data
->drag_windowlock
)
497 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->WindowLock
);
498 data
->drag_windowlock
= FALSE
;
507 /***********************************************************************************/
509 IPTR
DragBarClass__GM_MOVETEST(Class
*cl
, struct Gadget
*g
, struct gpInput
*msg
)
511 IPTR retval
= MOVETEST_MOVE
;
513 struct dragbar_data
*data
= INST_DATA(cl
, g
);
514 struct Window
*w
= msg
->gpi_GInfo
->gi_Window
;
515 struct InputEvent myie
;
519 CopyMem(msg
->gpi_IEvent
,&myie
,sizeof (struct InputEvent
));
520 myie
.ie_Code
= 0x68; //mouse_leftpress
522 /* Can we move to the new position, or is window at edge of display ? */
523 new_left
= msg
->gpi_Mouse
.X
- data
->mousex
;
524 new_top
= msg
->gpi_Mouse
.Y
- data
->mousey
;
526 if ((!((GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OFFSCREENLAYERS
) && (w
->WScreen
->LayerInfo
.Flags
& LIFLG_SUPPORTS_OFFSCREEN_LAYERS
))) ||
527 MatchHotkey(&myie
,IA_TOGGLEOFFSCREEN
,IntuitionBase
))
531 msg
->gpi_Mouse
.X
-= new_left
;
532 retval
= MOVETEST_ADJUSTPOS
;
537 msg
->gpi_Mouse
.Y
-= new_top
;
538 retval
= MOVETEST_ADJUSTPOS
;
541 if (new_left
+ w
->Width
> w
->WScreen
->Width
)
543 msg
->gpi_Mouse
.X
-= new_left
- (w
->WScreen
->Width
- w
->Width
);
544 retval
= MOVETEST_ADJUSTPOS
;
547 if (new_top
+ w
->Height
> w
->WScreen
->Height
)
549 msg
->gpi_Mouse
.Y
-= new_top
- (w
->WScreen
->Height
- w
->Height
);
550 retval
= MOVETEST_ADJUSTPOS
;
559 /***********************************************************************************/
561 IPTR
DragBarClass__GM_HANDLEINPUT(Class
*cl
, struct Gadget
*g
, struct gpInput
*msg
)
563 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
564 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
565 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
566 struct GadgetInfo
*gi
= msg
->gpi_GInfo
;
567 IPTR retval
= GMR_MEACTIVE
;
571 struct InputEvent
*ie
= msg
->gpi_IEvent
;
572 struct dragbar_data
*data
= INST_DATA(cl
, g
);
573 struct Window
*w
= msg
->gpi_GInfo
->gi_Window
;
575 switch (ie
->ie_Class
)
577 case IECLASS_RAWMOUSE
:
581 retval
= GMR_NOREUSE
;
582 data
->drag_canceled
= TRUE
;
586 retval
= GMR_NOREUSE
;
590 case IECODE_NOBUTTON
:
592 struct Screen
*scr
= w
->WScreen
;
593 struct InputEvent myie
;
597 /* Can we move to the new position, or is window at edge of display ? */
598 new_left
= scr
->MouseX
- data
->mousex
;
599 new_top
= scr
->MouseY
- data
->mousey
;
601 CopyMem(ie
,&myie
,sizeof (struct InputEvent
));
602 myie
.ie_Code
= SELECTDOWN
; //mouse_leftpress
605 if ((!((GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OFFSCREENLAYERS
) && (w
->WScreen
->LayerInfo
.Flags
& LIFLG_SUPPORTS_OFFSCREEN_LAYERS
))) ||
606 MatchHotkey(&myie
,IA_TOGGLEOFFSCREEN
,IntuitionBase
))
608 if (!((GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OFFSCREENLAYERS
) && (w
->WScreen
->LayerInfo
.Flags
& LIFLG_SUPPORTS_OFFSCREEN_LAYERS
)))
613 data
->mousex
+= new_left
;
619 data
->mousey
+= new_top
;
623 if (new_left
+ w
->Width
> scr
->Width
)
626 correct_left
= scr
->Width
- w
->Width
; /* align to screen border */
627 data
->mousex
+= new_left
- correct_left
;
628 new_left
= correct_left
;
631 if (new_top
+ w
->Height
> scr
->Height
)
634 correct_top
= scr
->Height
- w
->Height
; /* align to screen border */
635 data
->mousey
+= new_top
- correct_top
;
636 new_top
= correct_top
;
640 if (data
->curleft
!= new_left
|| data
->curtop
!= new_top
)
642 SetDrMd(data
->rp
, COMPLEMENT
);
644 if ((data
->isrendered
) && (!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
)))
646 /* Erase old frame */
647 drawwindowframe(w
->WScreen
651 , data
->curleft
+ w
->Width
- 1
652 , data
->curtop
+ w
->Height
- 1
657 data
->curleft
= new_left
;
658 data
->curtop
= new_top
;
660 if (GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
)
662 WORD newx
= new_left
- w
->LeftEdge
, newy
= new_top
- w
->TopEdge
;
668 currenttime
= ie
->ie_TimeStamp
.tv_secs
;
669 currenttime
= currenttime
* 50;
670 currenttime
+= ie
->ie_TimeStamp
.tv_micro
/ 20000;
672 if (currenttime
> data
->lasteventtime
+ 10) //10 delay should result in intuitick freq
674 ih_fire_intuimessage(w
,
679 data
->lasteventtime
= currenttime
;
685 Signal(data
->movetask
,WSIG_MOVE
);
688 CheckLayers(w
->WScreen
, IntuitionBase
);
692 struct Requester
*req
;
694 LockLayers(&w
->WScreen
->LayerInfo
);
701 MoveSizeLayer(BLAYER(w
), newx
, newy
, 0, 0);
704 MoveSizeLayer(WLAYER(w
), newx
, newy
, 0, 0);
706 for (req
= w
->FirstRequest
; req
; req
= req
->OlderRequest
)
708 struct Layer
*layer
= req
->ReqLayer
;
713 int left
, top
, right
, bottom
;
715 left
= data
->curleft
+ req
->LeftEdge
;
716 top
= data
->curtop
+ req
->TopEdge
;
717 right
= left
+ req
->Width
- 1;
718 bottom
= top
+ req
->Height
- 1;
720 if (left
> data
->curleft
+ w
->Width
- 1)
721 left
= data
->curleft
+ w
->Width
- 1;
723 if (top
> data
->curtop
+ w
->Height
- 1)
724 top
= data
->curtop
+ w
->Height
- 1;
726 if (right
> data
->curleft
+ w
->Width
- 1)
727 right
= data
->curleft
+ w
->Width
- 1;
729 if (bottom
> data
->curtop
+ w
->Height
- 1)
730 bottom
= data
->curtop
+ w
->Height
- 1;
732 dx
= left
- layer
->bounds
.MinX
;
733 dy
= top
- layer
->bounds
.MinY
;
734 dw
= right
- left
- layer
->bounds
.MaxX
+ layer
->bounds
.MinX
;
735 dh
= bottom
- top
- layer
->bounds
.MaxY
+ layer
->bounds
.MinY
;
737 MoveSizeLayer(layer
, dx
, dy
, dw
, dh
);
741 CheckLayers(w
->WScreen
, IntuitionBase
);
743 UnlockLayers(&w
->WScreen
->LayerInfo
);
750 if ((!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
)) && (!data
->drag_layerlock
))
752 LockLayers(&w
->WScreen
->LayerInfo
);
753 data
->drag_layerlock
= TRUE
;
756 /* Rerender the window frame */
757 drawwindowframe(w
->WScreen
761 , data
->curleft
+ w
->Width
- 1
762 , data
->curtop
+ w
->Height
- 1
764 data
->isrendered
= TRUE
;
769 retval
= GMR_MEACTIVE
;
775 retval
= GMR_NOREUSE
;
776 if (!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
)) data
->drag_canceled
= TRUE
;
779 } /* switch (ie->ie_Code) */
784 if ((!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
)) && (!data
->drag_layerlock
))
788 currenttime
= ie
->ie_TimeStamp
.tv_secs
;
789 currenttime
= currenttime
* 50;
790 currenttime
+= ie
->ie_TimeStamp
.tv_micro
/ 20000;
792 if (currenttime
> data
->lasteventtime
+ 10)
794 LockLayers(&w
->WScreen
->LayerInfo
);
795 data
->drag_layerlock
= TRUE
;
797 drawwindowframe(w
->WScreen
801 , data
->curleft
+ w
->Width
- 1
802 , data
->curtop
+ w
->Height
- 1
805 data
->lasteventtime
= currenttime
;
806 data
->isrendered
= TRUE
;
815 currenttime
= ie
->ie_TimeStamp
.tv_secs
;
816 currenttime
= currenttime
* 50;
817 currenttime
+= ie
->ie_TimeStamp
.tv_micro
/ 20000;
819 if ((!data
->drag_refreshed
) && currenttime
> data
->lasteventtime
+ 10) //10 delay should result in intuitick freq
821 ih_fire_intuimessage( w
,
826 data
->drag_refreshed
= TRUE
;
827 data
->lasteventtime
= currenttime
;
829 CheckLayers(w
->WScreen
,IntuitionBase
);
832 } /* switch (ie->ie_Class) */
839 /***********************************************************************************/
841 IPTR
DragBarClass__GM_GOINACTIVE(Class
*cl
, struct Gadget
*g
, struct gpGoInactive
*msg
)
843 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
844 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
845 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
846 struct dragbar_data
*data
;
849 data
= INST_DATA(cl
, g
);
851 w
= msg
->gpgi_GInfo
->gi_Window
;
853 /* Always clear last drawn frame */
855 if (data
->isrendered
&& data
->rp
&& (!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
)))
858 SetDrMd(data
->rp
, COMPLEMENT
);
860 /* Erase old frame */
861 drawwindowframe(w
->WScreen
865 , data
->curleft
+ w
->Width
- 1
866 , data
->curtop
+ w
->Height
- 1
872 data
->isrendered
= FALSE
;
874 if (!data
->drag_refreshed
) CheckLayers(w
->WScreen
, IntuitionBase
);
879 Signal(data
->movetask
,WSIG_DIE
);
884 if (!data
->drag_canceled
)// && !(GetPrivIBase(IntuitionBase)->IControlPrefs.ic_Flags & ICF_OPAQUEMOVE))
887 , data
->curleft
- w
->LeftEdge
/* dx */
888 , data
->curtop
- w
->TopEdge
/* dy */
893 if (data
->drag_canceled
&& (GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OPAQUEMOVE
))
896 , data
->startleft
- w
->LeftEdge
/* dx */
897 , data
->starttop
- w
->TopEdge
/* dy */
902 ih_fire_intuimessage(w
,
908 data
->drag_canceled
= TRUE
;
910 if (data
->drag_layerlock
)
912 UnlockLayers(&w
->WScreen
->LayerInfo
);
913 data
->drag_layerlock
= FALSE
;
917 if (data
->drag_gadgetlock
)
919 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->GadgetLock
);
920 data
->drag_gadgetlock
= FALSE
;
923 if (data
->drag_inputhandlerlock
)
925 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->InputHandlerLock
);
926 data
->drag_inputhandlerlock
= FALSE
;
931 if (data
->drag_windowlock
)
933 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->WindowLock
);
934 data
->drag_windowlock
= FALSE
;
938 /* User through with drag operation. Unlock layers and free
944 FreeRastPort(data
->rp
);
948 /* shut off mouse bounds checking. */
949 struct IIHData
*iihd
= (struct IIHData
*)GetPrivIBase(IntuitionBase
)->InputHandler
->is_Data
;
950 iihd
->MouseBoundsActiveFlag
= FALSE
;
957 /***********************************************************************************/
959 IPTR
DragBarClass__NOP(Class
*cl
, Object
*o
, Msg msg
)
964 /***********************************************************************************/
966 IPTR
DragBarClass__GM_HITTEST(Class
*cl
, Object
*o
, Msg msg
)
971 /***********************************************************************************/
973 IPTR
DragBarClass__OM_NEW(Class
*cl
, Object
*o
, Msg msg
)
975 struct Gadget
*g
= (struct Gadget
*)DoSuperMethodA(cl
, o
, msg
);
978 g
->GadgetType
|= GTYP_SYSGADGET
| GTYP_WDRAGGING
;
984 /***********************************************************************************/
986 /*********************
987 ** The SizeButtonClass
988 *********************/
991 #define SIZETYPE_RIGHTBOTTOM 1
992 #define SIZETYPE_RIGHT 2
993 #define SIZETYPE_BOTTOM 3
994 #define SIZETYPE_LEFTBOTTOM 4
995 #define SIZETYPE_LEFT 5
996 #define SIZETYPE_LEFTTOP 6
997 #define SIZETYPE_TOP 7
998 #define SIZETYPE_RIGHTTOP 8
1001 /***********************************************************************************/
1003 void smartresize(struct Window
*w
,struct sizebutton_data
*data
,Class
*cl
)
1005 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1006 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
1007 struct IIHData
*iihdata
= (struct IIHData
*)GetPrivIBase(IntuitionBase
)->InputHandler
->is_Data
;
1009 LockLayers(&w
->WScreen
->LayerInfo
);
1013 struct Hook
*backfill
;
1015 backfill
= BLAYER(w
)->BackFill
;
1016 BLAYER(w
)->BackFill
= LAYERS_NOBACKFILL
;
1018 /* move outer window first */
1019 MoveSizeLayer(BLAYER(w
), data
->left
- w
->LeftEdge
, data
->top
- w
->TopEdge
, data
->width
- w
->Width
, data
->height
- w
->Height
);
1021 BLAYER(w
)->BackFill
= backfill
;
1025 struct Hook
*backfill
;
1027 backfill
= WLAYER(w
)->BackFill
;
1028 WLAYER(w
)->BackFill
= LAYERS_NOBACKFILL
;
1029 MoveSizeLayer(WLAYER(w
), data
->left
- w
->LeftEdge
, data
->top
- w
->TopEdge
, data
->width
- w
->Width
, data
->height
- w
->Height
);
1030 WLAYER(w
)->BackFill
= backfill
;
1033 w
->TopEdge
= data
->top
;
1034 w
->LeftEdge
= data
->left
;
1035 w
->Width
= data
->width
;
1036 w
->Height
= data
->height
;
1038 IW(w
)->specialflags
|= SPFLAG_LAYERRESIZED
;
1040 if ((iihdata
->ActiveGadget
) && (w
== iihdata
->GadgetInfo
.gi_Window
))
1042 GetGadgetDomain(iihdata
->ActiveGadget
,
1043 iihdata
->GadgetInfo
.gi_Screen
,
1044 iihdata
->GadgetInfo
.gi_Window
,
1046 &iihdata
->GadgetInfo
.gi_Domain
);
1049 /* Relayout GFLG_REL??? gadgets */
1050 DoGMLayout(w
->FirstGadget
, w
, NULL
, -1, FALSE
, IntuitionBase
);
1052 ih_fire_intuimessage(w
,
1058 CheckLayers(w
->WScreen
, IntuitionBase
);
1060 UnlockLayers(&w
->WScreen
->LayerInfo
);
1063 /***********************************************************************************/
1065 IPTR
SizeButtonClass__GM_GOACTIVE(Class
*cl
, struct Gadget
*g
, struct gpInput
*msg
)
1067 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1068 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
1069 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
1070 struct InputEvent
*ie
= msg
->gpi_IEvent
;
1071 IPTR retval
= GMR_NOREUSE
;
1075 /* The gadget was activated via mouse input */
1076 struct sizebutton_data
*data
;
1079 /* There is no point in rerendering ourseleves her, as this
1080 is done by a call to RefreshWindowFrame() in the intuition inputhandler
1083 w
= msg
->gpi_GInfo
->gi_Window
;
1085 data
= INST_DATA(cl
, g
);
1087 #ifdef USEWINDOWLOCK
1088 /* do NOT ObtainSemaphore here since this would lead to deadlocks!!! */
1089 /* when the semaphore can not be obtained we simply ignore gadget activation */
1090 if (!(AttemptSemaphore(&GetPrivIBase(IntuitionBase
)->WindowLock
)))
1094 data
->drag_windowlock
= TRUE
;
1097 data
->height
= data
->Height
= w
->Height
;
1098 data
->width
= data
->Width
= w
->Width
;
1099 data
->left
= data
->LeftEdge
= w
->LeftEdge
;
1100 data
->top
= data
->TopEdge
= w
->TopEdge
;
1102 data
->mouseoffsetx
= w
->WScreen
->MouseX
;
1103 data
->mouseoffsety
= w
->WScreen
->MouseY
;
1105 data
->drag_refreshed
= TRUE
;
1106 data
->drag_ticks
= 2;
1109 data
->drag_type
= 0;
1111 if (w
->MouseX
< IW(w
)->sizeimage_width
)
1113 if (w
->MouseY
< IW(w
)->sizeimage_height
) data
->drag_type
= SIZETYPE_LEFTTOP
;
1114 if (w
->MouseY
> w
->Height
- IW(w
)->sizeimage_height
- 1) data
->drag_type
= SIZETYPE_LEFTBOTTOM
;
1115 if (!data
->drag_type
) data
->drag_type
= SIZETYPE_LEFT
;
1118 if ((!data
->drag_type
) && (w
->MouseX
>= IW(w
)->sizeimage_width
) && (w
->MouseX
<= w
->Width
- 1 - IW(w
)->sizeimage_width
))
1120 if (w
->MouseY
< w
->BorderTop
)
1122 data
->drag_type
= SIZETYPE_TOP
;
1124 data
->drag_type
= SIZETYPE_BOTTOM
;
1128 if ((!data
->drag_type
) && (w
->MouseX
> IW(w
)->sizeimage_width
))
1130 if (w
->MouseY
< IW(w
)->sizeimage_height
) data
->drag_type
= SIZETYPE_RIGHTTOP
;
1131 if (w
->MouseY
> w
->Height
- IW(w
)->sizeimage_height
- 1) data
->drag_type
= SIZETYPE_RIGHTBOTTOM
;
1132 if (!data
->drag_type
) data
->drag_type
= SIZETYPE_RIGHT
;
1135 if (!data
->drag_type
) goto fail
;
1138 data
->rp
= CloneRastPort(&w
->WScreen
->RastPort
);
1141 /* Lock all layers while the window is resized.
1142 * Get the gadget lock first to avoid deadlocks
1143 * with ObtainGIRPort. */
1147 #ifdef USEGADGETLOCK
1148 ObtainSemaphore(&GetPrivIBase(IntuitionBase
)->InputHandlerLock
);
1149 data
->drag_inputhandlerlock
= TRUE
;
1151 if (AttemptSemaphore(&GetPrivIBase(IntuitionBase
)->GadgetLock
))
1153 data
->drag_gadgetlock
= TRUE
;
1161 LockLayers(&w
->WScreen
->LayerInfo
);
1162 data
->drag_layerlock
= TRUE
;
1166 SetDrMd(data
->rp
, COMPLEMENT
);
1170 drawwindowframe(w
->WScreen
1174 , data
->left
+ data
->width
- 1
1175 , data
->top
+ data
->height
- 1
1179 data
->isrendered
= TRUE
;
1185 currenttime
= ie
->ie_TimeStamp
.tv_secs
;
1186 currenttime
= currenttime
* 50;
1187 currenttime
+= ie
->ie_TimeStamp
.tv_micro
/ 20000;
1188 data
->lasteventtime
= currenttime
;
1191 data
->drag_canceled
= FALSE
;
1193 /* size mouse bounds such that mouse pointer cannot move if window cannot size, if offscreenlayers is turned off */
1194 if (!(GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OFFSCREENLAYERS
)) {
1195 struct IIHData
*iihd
= (struct IIHData
*)GetPrivIBase(IntuitionBase
)->InputHandler
->is_Data
;
1196 LONG mousex
= data
->mouseoffsetx
- data
->LeftEdge
;
1197 LONG mousey
= data
->mouseoffsety
- data
->TopEdge
;
1199 iihd
->MouseBoundsActiveFlag
= TRUE
;
1200 iihd
->MouseBoundsLeft
= 0;
1201 iihd
->MouseBoundsRight
= w
->WScreen
->Width
- (w
->Width
- mousex
);
1202 iihd
->MouseBoundsTop
= 0;
1203 iihd
->MouseBoundsBottom
= w
->WScreen
->Height
- (w
->Height
- mousey
);
1206 return GMR_MEACTIVE
;
1210 if (data
->drag_layerlock
)
1212 UnlockLayers(&w
->WScreen
->LayerInfo
);
1213 data
->drag_layerlock
= FALSE
;
1217 #ifdef USEGADGETLOCK
1218 if (data
->drag_gadgetlock
)
1220 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->GadgetLock
);
1221 data
->drag_gadgetlock
= FALSE
;
1224 if (data
->drag_inputhandlerlock
)
1226 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->InputHandlerLock
);
1227 data
->drag_inputhandlerlock
= FALSE
;
1231 #ifdef USEWINDOWLOCK
1232 if (data
->drag_windowlock
)
1234 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->WindowLock
);
1235 data
->drag_windowlock
= FALSE
;
1244 /***********************************************************************************/
1246 IPTR
SizeButtonClass__GM_HANDLEINPUT(Class
*cl
, struct Gadget
*g
, struct gpInput
*msg
)
1248 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1250 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
1252 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
1253 struct GadgetInfo
*gi
= msg
->gpi_GInfo
;
1254 IPTR retval
= GMR_MEACTIVE
;
1258 struct InputEvent
*ie
= msg
->gpi_IEvent
;
1259 struct sizebutton_data
*data
= INST_DATA(cl
, g
);
1260 struct Window
*w
= msg
->gpi_GInfo
->gi_Window
;
1262 switch (ie
->ie_Class
)
1264 case IECLASS_RAWMOUSE
:
1265 switch (ie
->ie_Code
)
1268 retval
= GMR_NOREUSE
;
1272 case IECODE_NOBUTTON
:
1274 struct Screen
*scr
= w
->WScreen
;
1276 LONG new_height
= 0;
1278 /* Can we move to the new position, or is window at edge of display ? */
1280 switch(data
->drag_type
)
1282 case SIZETYPE_BOTTOM
:
1283 new_height
= data
->Height
+ scr
->MouseY
- data
->mouseoffsety
;
1284 new_width
= data
->Width
;
1288 new_height
= data
->Height
+ data
->mouseoffsety
- scr
->MouseY
;
1289 new_width
= data
->Width
;
1292 case SIZETYPE_RIGHTBOTTOM
:
1293 new_width
= data
->Width
+ scr
->MouseX
- data
->mouseoffsetx
;
1294 new_height
= data
->Height
+ scr
->MouseY
- data
->mouseoffsety
;
1297 case SIZETYPE_LEFTTOP
:
1298 new_width
= data
->Width
+ data
->mouseoffsetx
- scr
->MouseX
;
1299 new_height
= data
->Height
+ data
->mouseoffsety
- scr
->MouseY
;
1302 case SIZETYPE_RIGHTTOP
:
1303 new_width
= data
->Width
+ scr
->MouseX
- data
->mouseoffsetx
;
1304 new_height
= data
->Height
+ data
->mouseoffsety
- scr
->MouseY
;
1307 case SIZETYPE_LEFTBOTTOM
:
1308 new_width
= data
->Width
+ data
->mouseoffsetx
- scr
->MouseX
;
1309 new_height
= data
->Height
+ scr
->MouseY
- data
->mouseoffsety
;
1313 new_width
= data
->Width
+ data
->mouseoffsetx
- scr
->MouseX
;
1314 new_height
= data
->Height
;
1317 case SIZETYPE_RIGHT
:
1318 new_width
= data
->Width
+ scr
->MouseX
- data
->mouseoffsetx
;
1319 new_height
= data
->Height
;
1323 new_width
= data
->Width
+ scr
->MouseX
- data
->mouseoffsetx
;
1324 new_height
= data
->Height
+ scr
->MouseY
- data
->mouseoffsety
;
1329 if (w
->MinWidth
!= 0 && new_width
< (ULONG
)w
->MinWidth
)
1330 new_width
= w
->MinWidth
;
1332 if (w
->MaxWidth
!= 0 && new_width
> (ULONG
)w
->MaxWidth
)
1333 new_width
= w
->MaxWidth
;
1338 if (w
->MinHeight
!= 0 && new_height
< (ULONG
)w
->MinHeight
)
1339 new_height
= w
->MinHeight
;
1341 if (w
->MaxHeight
!= 0 && new_height
> (ULONG
)w
->MaxHeight
)
1342 new_height
= w
->MaxHeight
;
1346 if (!((GetPrivIBase(IntuitionBase
)->IControlPrefs
.ic_Flags
& ICF_OFFSCREENLAYERS
) && (w
->WScreen
->LayerInfo
.Flags
& LIFLG_SUPPORTS_OFFSCREEN_LAYERS
)))
1348 /* limit dimensions so window fits on the screen */
1349 switch (data
->drag_type
)
1351 case SIZETYPE_RIGHT
:
1352 case SIZETYPE_RIGHTTOP
:
1353 case SIZETYPE_RIGHTBOTTOM
:
1354 if (data
->left
+ new_width
> scr
->Width
)
1355 new_width
= scr
->Width
- data
->left
;
1359 case SIZETYPE_LEFTBOTTOM
:
1360 case SIZETYPE_LEFTTOP
:
1361 if (data
->LeftEdge
+ data
->Width
- new_width
< 0)
1362 new_width
+= (data
->LeftEdge
+ data
->Width
- new_width
);
1366 switch (data
->drag_type
)
1368 case SIZETYPE_LEFTBOTTOM
:
1369 case SIZETYPE_BOTTOM
:
1370 case SIZETYPE_RIGHTBOTTOM
:
1371 if (data
->top
+ new_height
> scr
->Height
)
1372 new_height
= scr
->Height
- data
->top
;
1376 case SIZETYPE_LEFTTOP
:
1377 case SIZETYPE_RIGHTTOP
:
1378 if (data
->TopEdge
+ data
->Height
- new_height
< 0)
1379 new_height
+= (data
->TopEdge
+ data
->Height
- new_height
);
1385 if (data
->height
!= new_height
|| data
->width
!= new_width
)
1387 SetDrMd(data
->rp
, COMPLEMENT
);
1389 if (data
->isrendered
&& !OPAQUESIZE
)
1391 /* Erase old frame */
1392 drawwindowframe(w
->WScreen
1396 , data
->left
+ data
->width
- 1
1397 , data
->top
+ data
->height
- 1
1404 switch(data
->drag_type
)
1407 data
->left
= data
->LeftEdge
+ data
->Width
- new_width
;
1410 case SIZETYPE_LEFTTOP
:
1411 data
->left
= data
->LeftEdge
+ data
->Width
- new_width
;
1412 data
->top
= data
->TopEdge
+ data
->Height
- new_height
;
1415 case SIZETYPE_LEFTBOTTOM
:
1416 data
->left
= data
->LeftEdge
+ data
->Width
- new_width
;
1419 case SIZETYPE_RIGHTTOP
:
1420 data
->top
= data
->TopEdge
+ data
->Height
- new_height
;
1424 data
->top
= data
->TopEdge
+ data
->Height
- new_height
;
1429 data
->width
= new_width
;
1430 data
->height
= new_height
;
1432 /* Rerender the window frame */
1435 if (!data
->drag_layerlock
&& !OPAQUESIZE
)
1437 LockLayers(&w
->WScreen
->LayerInfo
);
1438 data
->drag_layerlock
= TRUE
;
1442 data
->drag_refreshed
= FALSE
;
1443 data
->drag_ticks
= 2;
1446 drawwindowframe(w
->WScreen
1450 , data
->left
+ data
->width
- 1
1451 , data
->top
+ data
->height
- 1
1455 data
->isrendered
= TRUE
;
1459 retval
= GMR_MEACTIVE
;
1465 retval
= GMR_NOREUSE
;
1466 data
->drag_canceled
= TRUE
;
1471 } /* switch (ie->ie_Code) */
1476 if (!data
->drag_layerlock
&& !OPAQUESIZE
)
1479 currenttime
= ie
->ie_TimeStamp
.tv_secs
;
1480 currenttime
= currenttime
* 50;
1481 currenttime
+= ie
->ie_TimeStamp
.tv_micro
/ 20000;
1483 if (currenttime
> data
->lasteventtime
+ 10)
1485 LockLayers(&w
->WScreen
->LayerInfo
);
1486 data
->drag_layerlock
= TRUE
;
1488 drawwindowframe(w
->WScreen
1492 , data
->left
+ data
->width
- 1
1493 , data
->top
+ data
->height
- 1
1496 data
->lasteventtime
= currenttime
;
1497 data
->isrendered
= TRUE
;
1505 data
->drag_ticks
--;
1506 if (!data
->drag_refreshed
&& !data
->drag_ticks
&& WindowsReplied(w
->WScreen
,IntuitionBase
))
1508 smartresize(w
,data
,cl
);
1509 data
->drag_refreshed
= TRUE
;
1510 data
->drag_ticks
= 2;
1513 #endif /* USE_OPAQUESIZE */
1518 case IECLASS_NEWTIMER
:
1519 if (OPAQUESIZE
&& !data
->drag_refreshed
&& WindowsReplied(w
->WScreen
,IntuitionBase
))
1521 smartresize(w
,data
,cl
);
1522 data
->drag_refreshed
= TRUE
;
1523 data
->drag_ticks
= 2;
1526 #endif /* __MORPHOS__ */
1528 } /* switch (ie->ie_Class) */
1535 /***********************************************************************************/
1537 IPTR
SizeButtonClass__GM_GOINACTIVE(Class
*cl
, struct Gadget
*g
, struct gpGoInactive
*msg
)
1539 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1540 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
1541 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
1542 struct sizebutton_data
*data
;
1545 data
= INST_DATA(cl
, g
);
1546 w
= msg
->gpgi_GInfo
->gi_Window
;
1548 /* Allways clear last drawn frame */
1550 if (data
->isrendered
&& data
->rp
)
1553 SetDrMd(data
->rp
, COMPLEMENT
);
1555 /* Erase old frame */
1557 drawwindowframe(w
->WScreen
1561 , data
->left
+ data
->width
- 1
1562 , data
->top
+ data
->height
- 1
1571 data
->drag_canceled
= TRUE
;
1574 data
->isrendered
= FALSE
;
1576 if (data
->drag_layerlock
)
1578 UnlockLayers(&w
->WScreen
->LayerInfo
);
1579 data
->drag_layerlock
= FALSE
;
1582 #ifdef USEGADGETLOCK
1583 if (data
->drag_gadgetlock
)
1585 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->GadgetLock
);
1586 data
->drag_gadgetlock
= FALSE
;
1589 if (data
->drag_inputhandlerlock
)
1591 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->InputHandlerLock
);
1592 data
->drag_inputhandlerlock
= FALSE
;
1596 #ifdef USEWINDOWLOCK
1597 if (data
->drag_windowlock
)
1599 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->WindowLock
);
1600 data
->drag_windowlock
= FALSE
;
1604 //jDc: workarounds refresh pb on GZZ window resize
1605 ((struct IIHData
*)GetPrivIBase(IntuitionBase
)->InputHandler
->is_Data
)->ActiveSysGadget
->Flags
&= ~GFLG_SELECTED
;
1607 if (!data
->drag_canceled
|| OPAQUESIZE
)
1609 if (OPAQUESIZE
&& data
->drag_canceled
)
1611 DoMoveSizeWindow(w
,data
->LeftEdge
,data
->TopEdge
,data
->Width
,data
->Height
,TRUE
,IntuitionBase
);
1615 DoMoveSizeWindow(w
,data
->left
,data
->top
,data
->width
,data
->height
,TRUE
,IntuitionBase
);
1617 //ChangeWindowBox(w,data->left,data->top,data->width,data->height);
1619 data
->drag_canceled
= TRUE
;
1621 /* User through with drag operation. Unlock layers and free
1626 FreeRastPort(data
->rp
);
1630 /* shut off mouse bounds checking. */
1631 ((struct IIHData
*)GetPrivIBase(IntuitionBase
)->InputHandler
->is_Data
)->MouseBoundsActiveFlag
= FALSE
;
1636 /***********************************************************************************/
1638 IPTR
SizeButtonClass__OM_NEW(Class
*cl
, Object
*o
, Msg msg
)
1640 struct Gadget
*g
= (struct Gadget
*)DoSuperMethodA(cl
, o
, msg
);
1643 g
->GadgetType
|= GTYP_SYSGADGET
| GTYP_SIZING
;
1649 /***********************************************************************************/