2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <proto/exec.h>
8 #include <intuition/iprefs.h>
10 #include "intuition_intern.h"
12 /*****************************************************************************
15 #include <proto/intuition.h>
17 AROS_LH3(ULONG
, SetIPrefs
,
20 AROS_LHA(APTR
, data
, A0
),
21 AROS_LHA(ULONG
, length
, D0
),
22 AROS_LHA(ULONG
, type
, D1
),
25 struct IntuitionBase
*, IntuitionBase
, 96, Intuition
)
32 Depending on the operation
46 *****************************************************************************/
49 AROS_LIBBASE_EXT_DECL(struct IntuitionBase
*,IntuitionBase
)
52 ULONG lock
= LockIBase(0);
54 DEBUG_SETIPREFS(bug("SetIPrefs: data %p length %lu type %lu\n", data
, length
, type
));
58 case IPREFS_TYPE_ICONTROL
:
59 DEBUG_SETIPREFS(bug("SetIPrefs: IPREFS_TYPE_ICONTROL\n"));
60 if (length
> sizeof(struct IIControlPrefs
))
61 length
= sizeof(struct IIControlPrefs
);
62 CopyMem(data
, &GetPrivIBase(IntuitionBase
)->IControlPrefs
, length
);
65 case IPREFS_TYPE_SCREENMODE
:
67 struct IScreenModePrefs old_prefs
;
69 DEBUG_SETIPREFS(bug("SetIPrefs: IP_SCREENMODE\n"));
70 if (length
> sizeof(struct IScreenModePrefs
))
71 length
= sizeof(struct IScreenModePrefs
);
73 if (memcmp(&GetPrivIBase(IntuitionBase
)->ScreenModePrefs
, data
,
74 sizeof(struct IScreenModePrefs
)) == 0)
77 old_prefs
= GetPrivIBase(IntuitionBase
)->ScreenModePrefs
;
78 GetPrivIBase(IntuitionBase
)->ScreenModePrefs
= *(struct IScreenModePrefs
*)data
;
80 if (GetPrivIBase(IntuitionBase
)->WorkBench
)
82 BOOL
try = TRUE
, closed
;
86 while (try && !(closed
= CloseWorkBench()))
88 struct EasyStruct es
=
90 sizeof(struct EasyStruct
),
93 "Intuition is attempting to reset the screen,\n"
94 "please close all windows except Wanderer's ones.",
98 try = EasyRequestArgs(NULL
, &es
, NULL
, NULL
) == 1;
102 #warning FIXME: handle the error condition!
103 /* What to do if OpenWorkBench() fails? Try until it succeeds?
104 Try for a finite amount of times? Don't try and do nothing
110 GetPrivIBase(IntuitionBase
)->ScreenModePrefs
= old_prefs
;
123 DEBUG_SETIPREFS(bug("SetIPrefs: Unknown Prefs Type\n"));
130 DEBUG_SETIPREFS(bug("SetIPrefs: Result 0x%lx\n",Result
));