Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | * System metrics functions |
| 3 | * |
| 4 | * Copyright 1994 Alexandre Julliard |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 5 | * |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 6 | */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 7 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 8 | #include <stdio.h> |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 9 | #include "gdi.h" |
Patrik Stridvall | 8d8703c | 1999-02-04 14:05:38 +0000 | [diff] [blame] | 10 | #include "monitor.h" |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 11 | #include "options.h" |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 12 | #include "sysmetrics.h" |
Patrik Stridvall | 8d8703c | 1999-02-04 14:05:38 +0000 | [diff] [blame] | 13 | #include "tweak.h" |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 14 | |
Alexandre Julliard | 902da69 | 1995-11-05 14:39:02 +0000 | [diff] [blame] | 15 | short sysMetrics[SM_CMETRICS+1]; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 16 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 17 | /*********************************************************************** |
| 18 | * SYSMETRICS_Init |
| 19 | * |
| 20 | * Initialisation of the system metrics array. |
Alexandre Julliard | 638f169 | 1999-01-17 16:32:32 +0000 | [diff] [blame] | 21 | * |
| 22 | * Differences in return values between 3.1 and 95 apps under Win95 (FIXME ?): |
| 23 | * SM_CXVSCROLL x+1 x |
| 24 | * SM_CYHSCROLL x+1 x |
| 25 | * SM_CXDLGFRAME x-1 x |
| 26 | * SM_CYDLGFRAME x-1 x |
| 27 | * SM_CYCAPTION x+1 x |
| 28 | * SM_CYMENU x-1 x |
| 29 | * SM_CYFULLSCREEN x-1 x |
| 30 | * |
| 31 | * (collides with TWEAK_WineLook sometimes, |
| 32 | * so changing anything might be difficult) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 33 | */ |
Alexandre Julliard | 234bc24 | 1994-12-10 13:02:28 +0000 | [diff] [blame] | 34 | void SYSMETRICS_Init(void) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 35 | { |
Alexandre Julliard | 03468f7 | 1998-02-15 19:40:49 +0000 | [diff] [blame] | 36 | sysMetrics[SM_CXCURSOR] = 32; |
| 37 | sysMetrics[SM_CYCURSOR] = 32; |
Patrik Stridvall | 8d8703c | 1999-02-04 14:05:38 +0000 | [diff] [blame] | 38 | sysMetrics[SM_CXSCREEN] = MONITOR_GetWidth(&MONITOR_PrimaryMonitor); |
| 39 | sysMetrics[SM_CYSCREEN] = MONITOR_GetHeight(&MONITOR_PrimaryMonitor); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 40 | sysMetrics[SM_CXVSCROLL] = |
| 41 | PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16) + 1; |
| 42 | sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL]; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 43 | if (TWEAK_WineLook > WIN31_LOOK) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 44 | sysMetrics[SM_CYCAPTION] = |
| 45 | PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 19); |
| 46 | else |
| 47 | sysMetrics[SM_CYCAPTION] = 2 + |
| 48 | PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 18); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 49 | sysMetrics[SM_CXBORDER] = 1; |
| 50 | sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER]; |
| 51 | sysMetrics[SM_CXDLGFRAME] = |
| 52 | PROFILE_GetWineIniInt("Tweak.Layout", "DialogFrameWidth", |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 53 | (TWEAK_WineLook > WIN31_LOOK) ? 3 : 4); |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 54 | sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME]; |
| 55 | sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL] - 1; |
| 56 | sysMetrics[SM_CXHTHUMB] = sysMetrics[SM_CYVTHUMB]; |
| 57 | sysMetrics[SM_CXICON] = 32; |
| 58 | sysMetrics[SM_CYICON] = 32; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 59 | if (TWEAK_WineLook > WIN31_LOOK) |
Alexandre Julliard | ebfc0fe | 1998-06-28 18:40:26 +0000 | [diff] [blame] | 60 | sysMetrics[SM_CYMENU] = |
| 61 | PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 19); |
| 62 | else |
| 63 | sysMetrics[SM_CYMENU] = |
| 64 | PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 18); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 65 | sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN]; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 66 | sysMetrics[SM_CYFULLSCREEN] = |
| 67 | sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION]; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 68 | sysMetrics[SM_CYKANJIWINDOW] = 0; |
| 69 | sysMetrics[SM_MOUSEPRESENT] = 1; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 70 | sysMetrics[SM_CYVSCROLL] = sysMetrics[SM_CYVTHUMB]; |
| 71 | sysMetrics[SM_CXHSCROLL] = sysMetrics[SM_CXHTHUMB]; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 72 | sysMetrics[SM_DEBUG] = 0; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 73 | |
| 74 | /* FIXME: The following should look for the registry key to see if the |
| 75 | buttons should be swapped. */ |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 76 | sysMetrics[SM_SWAPBUTTON] = 0; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 77 | |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 78 | sysMetrics[SM_RESERVED1] = 0; |
| 79 | sysMetrics[SM_RESERVED2] = 0; |
| 80 | sysMetrics[SM_RESERVED3] = 0; |
| 81 | sysMetrics[SM_RESERVED4] = 0; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 82 | |
| 83 | /* FIXME: The following two are calculated, but how? */ |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 84 | sysMetrics[SM_CXMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 112 : 100; |
| 85 | sysMetrics[SM_CYMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 27 : 28; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 86 | |
| 87 | sysMetrics[SM_CXSIZE] = sysMetrics[SM_CYCAPTION] - 2; |
| 88 | sysMetrics[SM_CYSIZE] = sysMetrics[SM_CXSIZE]; |
| 89 | sysMetrics[SM_CXFRAME] = GetProfileInt32A("Windows", "BorderWidth", 4); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 90 | sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME]; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 91 | sysMetrics[SM_CXMINTRACK] = sysMetrics[SM_CXMIN]; |
| 92 | sysMetrics[SM_CYMINTRACK] = sysMetrics[SM_CYMIN]; |
| 93 | sysMetrics[SM_CXDOUBLECLK] = |
| 94 | (GetProfileInt32A("Windows", "DoubleClickWidth", 4) + 1) & ~1; |
| 95 | sysMetrics[SM_CYDOUBLECLK] = |
| 96 | (GetProfileInt32A("Windows","DoubleClickHeight", 4) + 1) & ~1; |
| 97 | sysMetrics[SM_CXICONSPACING] = |
| 98 | GetProfileInt32A("Desktop","IconSpacing", 75); |
| 99 | sysMetrics[SM_CYICONSPACING] = |
| 100 | GetProfileInt32A("Desktop", "IconVerticalSpacing", 75); |
| 101 | sysMetrics[SM_MENUDROPALIGNMENT] = |
| 102 | GetProfileInt32A("Windows", "MenuDropAlignment", 0); |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 103 | sysMetrics[SM_PENWINDOWS] = 0; |
| 104 | sysMetrics[SM_DBCSENABLED] = 0; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 105 | |
| 106 | /* FIXME: Need to query X for the following */ |
| 107 | sysMetrics[SM_CMOUSEBUTTONS] = 3; |
| 108 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 109 | sysMetrics[SM_SECURE] = 0; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 110 | sysMetrics[SM_CXEDGE] = sysMetrics[SM_CXBORDER] + 1; |
| 111 | sysMetrics[SM_CYEDGE] = sysMetrics[SM_CXEDGE]; |
| 112 | sysMetrics[SM_CXMINSPACING] = 160; |
| 113 | sysMetrics[SM_CYMINSPACING] = 24; |
| 114 | sysMetrics[SM_CXSMICON] = |
| 115 | sysMetrics[SM_CYSIZE] - (sysMetrics[SM_CYSIZE] % 2) - 2; |
| 116 | sysMetrics[SM_CYSMICON] = sysMetrics[SM_CXSMICON]; |
| 117 | sysMetrics[SM_CYSMCAPTION] = 16; |
| 118 | sysMetrics[SM_CXSMSIZE] = 15; |
| 119 | sysMetrics[SM_CYSMSIZE] = sysMetrics[SM_CXSMSIZE]; |
| 120 | sysMetrics[SM_CXMENUSIZE] = sysMetrics[SM_CYMENU]; |
| 121 | sysMetrics[SM_CYMENUSIZE] = sysMetrics[SM_CXMENUSIZE]; |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 122 | |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 123 | /* FIXME: What do these mean? */ |
| 124 | sysMetrics[SM_ARRANGE] = 8; |
| 125 | sysMetrics[SM_CXMINIMIZED] = 160; |
| 126 | sysMetrics[SM_CYMINIMIZED] = 24; |
| 127 | |
| 128 | /* FIXME: How do I calculate these? */ |
| 129 | sysMetrics[SM_CXMAXTRACK] = |
| 130 | sysMetrics[SM_CXSCREEN] + 4 + 2 * sysMetrics[SM_CXFRAME]; |
| 131 | sysMetrics[SM_CYMAXTRACK] = |
| 132 | sysMetrics[SM_CYSCREEN] + 4 + 2 * sysMetrics[SM_CYFRAME]; |
| 133 | sysMetrics[SM_CXMAXIMIZED] = |
| 134 | sysMetrics[SM_CXSCREEN] + 2 * sysMetrics[SM_CXFRAME]; |
| 135 | sysMetrics[SM_CYMAXIMIZED] = |
| 136 | sysMetrics[SM_CYSCREEN] - 45; |
| 137 | sysMetrics[SM_NETWORK] = 3; |
| 138 | |
| 139 | /* For the following: 0 = ok, 1 = failsafe, 2 = failsafe + network */ |
| 140 | sysMetrics[SM_CLEANBOOT] = 0; |
| 141 | |
Alexandre Julliard | f90efa9 | 1998-06-14 15:24:15 +0000 | [diff] [blame] | 142 | sysMetrics[SM_CXDRAG] = 2; |
| 143 | sysMetrics[SM_CYDRAG] = 2; |
Alexandre Julliard | d37eb36 | 1997-07-20 16:23:21 +0000 | [diff] [blame] | 144 | sysMetrics[SM_SHOWSOUNDS] = 0; |
| 145 | sysMetrics[SM_CXMENUCHECK] = 2; |
| 146 | sysMetrics[SM_CYMENUCHECK] = 2; |
| 147 | |
| 148 | /* FIXME: Should check the type of processor for the following */ |
| 149 | sysMetrics[SM_SLOWMACHINE] = 0; |
| 150 | |
| 151 | /* FIXME: Should perform a check */ |
| 152 | sysMetrics[SM_MIDEASTENABLED] = 0; |
| 153 | |
| 154 | sysMetrics[SM_MOUSEWHEELPRESENT] = 0; |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 155 | |
| 156 | sysMetrics[SM_CXVIRTUALSCREEN] = sysMetrics[SM_CXSCREEN]; |
| 157 | sysMetrics[SM_CYVIRTUALSCREEN] = sysMetrics[SM_CYSCREEN]; |
| 158 | sysMetrics[SM_XVIRTUALSCREEN] = 0; |
| 159 | sysMetrics[SM_YVIRTUALSCREEN] = 0; |
| 160 | sysMetrics[SM_CMONITORS] = 1; |
| 161 | sysMetrics[SM_SAMEDISPLAYFORMAT] = 1; |
Alexandre Julliard | 902da69 | 1995-11-05 14:39:02 +0000 | [diff] [blame] | 162 | sysMetrics[SM_CMETRICS] = SM_CMETRICS; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | |
| 166 | /*********************************************************************** |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 167 | * GetSystemMetrics16 (USER.179) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 168 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 169 | INT16 WINAPI GetSystemMetrics16( INT16 index ) |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 170 | { |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 171 | return (INT16)GetSystemMetrics32(index); |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | |
| 175 | /*********************************************************************** |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 176 | * GetSystemMetrics32 (USER32.292) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 177 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 178 | INT32 WINAPI GetSystemMetrics32( INT32 index ) |
Alexandre Julliard | f0cbfa0 | 1997-02-15 14:29:56 +0000 | [diff] [blame] | 179 | { |
| 180 | if ((index < 0) || (index > SM_CMETRICS)) return 0; |
Alexandre Julliard | cdd0923 | 1994-01-12 11:12:51 +0000 | [diff] [blame] | 181 | else return sysMetrics[index]; |
| 182 | } |