New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / rom / intuition / setiprefs_aros.c
blob88155a5adf7e09956a6e827be60fc6502b6f1ec2
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/exec.h>
8 #include <intuition/iprefs.h>
10 #include "intuition_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/intuition.h>
17 AROS_LH3(ULONG, SetIPrefs,
19 /* SYNOPSIS */
20 AROS_LHA(APTR , data, A0),
21 AROS_LHA(ULONG, length, D0),
22 AROS_LHA(ULONG, type, D1),
24 /* LOCATION */
25 struct IntuitionBase *, IntuitionBase, 96, Intuition)
27 /* FUNCTION
29 INPUTS
31 RESULT
32 Depending on the operation
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 HISTORY
46 *****************************************************************************/
48 AROS_LIBFUNC_INIT
49 AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
51 ULONG Result = TRUE;
52 ULONG lock = LockIBase(0);
54 DEBUG_SETIPREFS(bug("SetIPrefs: data %p length %lu type %lu\n", data, length, type));
56 switch (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);
63 break;
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)
75 break;
77 old_prefs = GetPrivIBase(IntuitionBase)->ScreenModePrefs;
78 GetPrivIBase(IntuitionBase)->ScreenModePrefs = *(struct IScreenModePrefs *)data;
80 if (GetPrivIBase(IntuitionBase)->WorkBench)
82 BOOL try = TRUE, closed;
84 UnlockIBase(lock);
86 while (try && !(closed = CloseWorkBench()))
88 struct EasyStruct es =
90 sizeof(struct EasyStruct),
92 "System Request",
93 "Intuition is attempting to reset the screen,\n"
94 "please close all windows except Wanderer's ones.",
95 "Retry|Cancel"
98 try = EasyRequestArgs(NULL, &es, NULL, NULL) == 1;
101 if (closed)
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
105 at all? */
106 OpenWorkBench();
107 else
109 lock = LockIBase(0);
110 GetPrivIBase(IntuitionBase)->ScreenModePrefs = old_prefs;
111 UnlockIBase(lock);
112 Result = FALSE;
115 return Result;
119 break;
122 default:
123 DEBUG_SETIPREFS(bug("SetIPrefs: Unknown Prefs Type\n"));
124 Result = FALSE;
125 break;
128 UnlockIBase(lock);
130 DEBUG_SETIPREFS(bug("SetIPrefs: Result 0x%lx\n",Result));
132 return(Result);
134 AROS_LIBFUNC_EXIT
135 } /* private1 */