2 Copyright © 1995-2007, 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 *****************************************************************************/
51 ULONG lock
= LockIBase(0);
53 DEBUG_SETIPREFS(bug("SetIPrefs: data %p length %lu type %lu\n", data
, length
, type
));
57 case IPREFS_TYPE_ICONTROL
:
58 DEBUG_SETIPREFS(bug("SetIPrefs: IPREFS_TYPE_ICONTROL\n"));
59 if (length
> sizeof(struct IIControlPrefs
))
60 length
= sizeof(struct IIControlPrefs
);
61 CopyMem(data
, &GetPrivIBase(IntuitionBase
)->IControlPrefs
, length
);
64 case IPREFS_TYPE_SCREENMODE
:
66 struct IScreenModePrefs old_prefs
;
68 DEBUG_SETIPREFS(bug("SetIPrefs: IP_SCREENMODE\n"));
69 if (length
> sizeof(struct IScreenModePrefs
))
70 length
= sizeof(struct IScreenModePrefs
);
72 if (memcmp(&GetPrivIBase(IntuitionBase
)->ScreenModePrefs
, data
,
73 sizeof(struct IScreenModePrefs
)) == 0)
76 old_prefs
= GetPrivIBase(IntuitionBase
)->ScreenModePrefs
;
77 GetPrivIBase(IntuitionBase
)->ScreenModePrefs
= *(struct IScreenModePrefs
*)data
;
79 if (GetPrivIBase(IntuitionBase
)->WorkBench
)
81 BOOL
try = TRUE
, closed
;
85 while (try && !(closed
= CloseWorkBench()))
87 struct EasyStruct es
=
89 sizeof(struct EasyStruct
),
92 "Intuition is attempting to reset the screen,\n"
93 "please close all windows except Wanderer's ones.",
97 try = EasyRequestArgs(NULL
, &es
, NULL
, NULL
) == 1;
101 #warning FIXME: handle the error condition!
102 /* What to do if OpenWorkBench() fails? Try until it succeeds?
103 Try for a finite amount of times? Don't try and do nothing
109 GetPrivIBase(IntuitionBase
)->ScreenModePrefs
= old_prefs
;
122 DEBUG_SETIPREFS(bug("SetIPrefs: Unknown Prefs Type\n"));
129 DEBUG_SETIPREFS(bug("SetIPrefs: Result 0x%lx\n",Result
));