some fixes to accented characters
[tangerine.git] / rom / intuition / setiprefs_aros.c
blob2352f8ce1b0f3c4f984bfcafed2c8a80c93e015c
1 /*
2 Copyright © 1995-2007, 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
50 ULONG Result = TRUE;
51 ULONG lock = LockIBase(0);
53 DEBUG_SETIPREFS(bug("SetIPrefs: data %p length %lu type %lu\n", data, length, type));
55 switch (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);
62 break;
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)
74 break;
76 old_prefs = GetPrivIBase(IntuitionBase)->ScreenModePrefs;
77 GetPrivIBase(IntuitionBase)->ScreenModePrefs = *(struct IScreenModePrefs *)data;
79 if (GetPrivIBase(IntuitionBase)->WorkBench)
81 BOOL try = TRUE, closed;
83 UnlockIBase(lock);
85 while (try && !(closed = CloseWorkBench()))
87 struct EasyStruct es =
89 sizeof(struct EasyStruct),
91 "System Request",
92 "Intuition is attempting to reset the screen,\n"
93 "please close all windows except Wanderer's ones.",
94 "Retry|Cancel"
97 try = EasyRequestArgs(NULL, &es, NULL, NULL) == 1;
100 if (closed)
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
104 at all? */
105 OpenWorkBench();
106 else
108 lock = LockIBase(0);
109 GetPrivIBase(IntuitionBase)->ScreenModePrefs = old_prefs;
110 UnlockIBase(lock);
111 Result = FALSE;
114 return Result;
118 break;
121 default:
122 DEBUG_SETIPREFS(bug("SetIPrefs: Unknown Prefs Type\n"));
123 Result = FALSE;
124 break;
127 UnlockIBase(lock);
129 DEBUG_SETIPREFS(bug("SetIPrefs: Result 0x%lx\n",Result));
131 return(Result);
133 AROS_LIBFUNC_EXIT
134 } /* private1 */