From a41b2cfdd0c06077c7c81b94f55d75757cec92e6 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 15 Jan 2001 20:12:55 +0000 Subject: [PATCH] Moved tweak support to USER dll. Removed tweak.h and cache.h. --- controls/button.c | 2 +- controls/combo.c | 1 - controls/edit.c | 2 +- controls/listbox.c | 2 +- controls/menu.c | 1 - controls/scroll.c | 14 +------ controls/static.c | 2 +- controls/uitools.c | 2 +- dlls/gdi/gdi_main.c | 3 -- dlls/user/cache.c | 18 +++------ dlls/user/text.c | 2 +- dlls/user/user_main.c | 35 ++++++++++++++++ graphics/x11drv/oembitmap.c | 2 +- graphics/x11drv/xfont.c | 2 +- include/cache.h | 17 -------- include/tweak.h | 26 ------------ include/user.h | 14 +++++++ misc/Makefile.in | 1 - misc/tweak.c | 80 ------------------------------------- objects/gdiobj.c | 6 +-- windows/defwnd.c | 2 - windows/mdi.c | 1 - windows/msgbox.c | 2 +- windows/nonclient.c | 2 - windows/painting.c | 2 +- windows/syscolor.c | 2 +- windows/sysmetrics.c | 2 +- windows/sysparams.c | 1 - 28 files changed, 70 insertions(+), 176 deletions(-) delete mode 100644 include/cache.h delete mode 100644 include/tweak.h delete mode 100644 misc/tweak.c diff --git a/controls/button.c b/controls/button.c index d75004defeb..1983dd17ceb 100644 --- a/controls/button.c +++ b/controls/button.c @@ -13,7 +13,7 @@ #include "wingdi.h" #include "wine/winuser16.h" #include "controls.h" -#include "tweak.h" +#include "user.h" /* Note: under MS-Windows, state is a BYTE and this structure is * only 3 bytes long. I don't think there are programs out there diff --git a/controls/combo.c b/controls/combo.c index f50e88a7b39..a26824c0453 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -19,7 +19,6 @@ #include "heap.h" #include "controls.h" #include "debugtools.h" -#include "tweak.h" DEFAULT_DEBUG_CHANNEL(combo); diff --git a/controls/edit.c b/controls/edit.c index e0c4d274440..cd2b5dcd489 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -24,8 +24,8 @@ #include "wine/unicode.h" #include "controls.h" #include "local.h" +#include "user.h" #include "debugtools.h" -#include "tweak.h" DEFAULT_DEBUG_CHANNEL(edit); DECLARE_DEBUG_CHANNEL(combo); diff --git a/controls/listbox.c b/controls/listbox.c index 24920d791db..a7da000acc7 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -16,9 +16,9 @@ #include "winerror.h" #include "spy.h" #include "win.h" +#include "user.h" #include "controls.h" #include "debugtools.h" -#include "tweak.h" DEFAULT_DEBUG_CHANNEL(listbox); DECLARE_DEBUG_CHANNEL(combo); diff --git a/controls/menu.c b/controls/menu.c index 56886769ae2..43936be1c2f 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -32,7 +32,6 @@ #include "user.h" #include "message.h" #include "queue.h" -#include "tweak.h" #include "debugtools.h" diff --git a/controls/scroll.c b/controls/scroll.c index ec7049fed2a..bc0706b97d0 100644 --- a/controls/scroll.c +++ b/controls/scroll.c @@ -12,8 +12,7 @@ #include "heap.h" #include "win.h" #include "debugtools.h" -#include "cache.h" -#include "tweak.h" +#include "user.h" DEFAULT_DEBUG_CHANNEL(scroll); @@ -673,16 +672,7 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, INT nBar, if (TWEAK_WineLook == WIN31_LOOK && (flags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH) { /* This ought to be the color of the parent window */ - if (TWEAK_WineLook == WIN31_LOOK) { - hBrush = GetSysColorBrush(COLOR_WINDOW); - } else { - /* Under Win9x look & feel, scrollbars don't have a solid border. - * To make scrollbar's background different from the window - * background, we need to apply a gray 0x55aa pattern brush. - * Otherwise it won't look good. - */ - hBrush = CACHE_GetPattern55AABrush(); - } + hBrush = GetSysColorBrush(COLOR_WINDOW); } else { diff --git a/controls/static.c b/controls/static.c index a5b1ca127b2..fa127b6163d 100644 --- a/controls/static.c +++ b/controls/static.c @@ -12,8 +12,8 @@ #include "cursoricon.h" #include "controls.h" #include "heap.h" +#include "user.h" #include "debugtools.h" -#include "tweak.h" DEFAULT_DEBUG_CHANNEL(static); diff --git a/controls/uitools.c b/controls/uitools.c index 820bb36450a..e2aadd2ed37 100644 --- a/controls/uitools.c +++ b/controls/uitools.c @@ -9,8 +9,8 @@ #include "wingdi.h" #include "wine/winuser16.h" #include "winuser.h" +#include "user.h" #include "debugtools.h" -#include "tweak.h" DEFAULT_DEBUG_CHANNEL(graphics); diff --git a/dlls/gdi/gdi_main.c b/dlls/gdi/gdi_main.c index f468a72fc34..ae89c0ee35d 100644 --- a/dlls/gdi/gdi_main.c +++ b/dlls/gdi/gdi_main.c @@ -7,7 +7,6 @@ #include "wine/winbase16.h" #include "gdi.h" -#include "tweak.h" #include "win16drv.h" #include "winbase.h" @@ -18,8 +17,6 @@ BOOL WINAPI MAIN_GdiInit(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) { if (reason != DLL_PROCESS_ATTACH) return TRUE; - if (!TWEAK_Init()) return FALSE; - /* GDI initialisation */ if(!GDI_Init()) return FALSE; diff --git a/dlls/user/cache.c b/dlls/user/cache.c index 54090b89411..2724e5cbe37 100644 --- a/dlls/user/cache.c +++ b/dlls/user/cache.c @@ -8,7 +8,7 @@ #include "windef.h" #include "wingdi.h" -#include "cache.h" +#include "user.h" static const WORD wPattern55AA[] = { @@ -26,17 +26,9 @@ static HBITMAP hPattern55AABitmap = 0; HBRUSH CACHE_GetPattern55AABrush(void) { if (!hPattern55AABrush) - hPattern55AABrush = CreatePatternBrush(CACHE_GetPattern55AABitmap()); + { + hPattern55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA ); + hPattern55AABrush = CreatePatternBrush( hPattern55AABitmap ); + } return hPattern55AABrush; } - - -/********************************************************************* - * CACHE_GetPattern55AABitmap - */ -HBITMAP CACHE_GetPattern55AABitmap(void) -{ - if (!hPattern55AABitmap) - hPattern55AABitmap = CreateBitmap( 8, 8, 1, 1, wPattern55AA ); - return hPattern55AABitmap; -} diff --git a/dlls/user/text.c b/dlls/user/text.c index 1463c6d5c23..7e3c379813c 100644 --- a/dlls/user/text.c +++ b/dlls/user/text.c @@ -14,7 +14,7 @@ #include "winbase.h" #include "winerror.h" #include "winnls.h" -#include "cache.h" +#include "user.h" #include "debugtools.h" DEFAULT_DEBUG_CHANNEL(text); diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c index 5e8052bb88d..36a909d3414 100644 --- a/dlls/user/user_main.c +++ b/dlls/user/user_main.c @@ -27,6 +27,8 @@ DEFAULT_DEBUG_CHANNEL(graphics); USER_DRIVER USER_Driver; +WINE_LOOK TWEAK_WineLook = WIN31_LOOK; + static HMODULE graphics_driver; #define GET_USER_FUNC(name) \ @@ -150,6 +152,38 @@ static void palette_init(void) } +/*********************************************************************** + * tweak_init + */ +static void tweak_init(void) +{ + static const char *OS = "Win3.1"; + char buffer[80]; + HKEY hkey; + DWORD type, count = sizeof(buffer); + + if (RegCreateKeyExA( HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\Tweak.Layout", 0, NULL, + REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL )) + return; + if (RegQueryValueExA( hkey, "WineLook", 0, &type, buffer, &count )) + strcpy( buffer, "Win31" ); /* default value */ + RegCloseKey( hkey ); + + /* WIN31_LOOK is default */ + if (!strncasecmp( buffer, "Win95", 5 )) + { + TWEAK_WineLook = WIN95_LOOK; + OS = "Win95"; + } + else if (!strncasecmp( buffer, "Win98", 5 )) + { + TWEAK_WineLook = WIN98_LOOK; + OS = "Win98"; + } + TRACE("Using %s look and feel.\n", OS); +} + + /*********************************************************************** * USER initialisation routine */ @@ -168,6 +202,7 @@ BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) if (!ATOM_Init( USER_HeapSel )) return FALSE; /* Load the graphics driver */ + tweak_init(); if (!load_driver()) return FALSE; /* Initialize system colors and metrics*/ diff --git a/graphics/x11drv/oembitmap.c b/graphics/x11drv/oembitmap.c index 8970e17cc1c..696d6997ca8 100644 --- a/graphics/x11drv/oembitmap.c +++ b/graphics/x11drv/oembitmap.c @@ -26,7 +26,7 @@ typedef unsigned long Pixel; #include "debugtools.h" #include "gdi.h" #include "heap.h" -#include "tweak.h" +#include "user.h" /* for TWEAK_WineLook (FIXME) */ #include "x11drv.h" /* Include OEM pixmaps */ diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index 6b690404063..88acae127c3 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -31,7 +31,7 @@ #include "options.h" #include "font.h" #include "debugtools.h" -#include "tweak.h" +#include "user.h" /* for TWEAK_WineLook (FIXME) */ #include "x11font.h" #include "server.h" diff --git a/include/cache.h b/include/cache.h deleted file mode 100644 index d8537e5c644..00000000000 --- a/include/cache.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Wine internally cached objects to speedup some things and prevent - * infinite duplication of trivial code and data. - * - * Copyright 1997 Bertho A. Stultiens - * - */ - -#ifndef __WINE_CACHE_H -#define __WINE_CACHE_H - -#include "windef.h" - -HBRUSH CACHE_GetPattern55AABrush(void); -HBITMAP CACHE_GetPattern55AABitmap(void); - -#endif /* __WINE_CACHE_H */ diff --git a/include/tweak.h b/include/tweak.h deleted file mode 100644 index 7eab50e0238..00000000000 --- a/include/tweak.h +++ /dev/null @@ -1,26 +0,0 @@ -/****************************************************************************** - * - * Wine Windows 95 interface tweaks - * - * Copyright (c) 1997 Dave Cuthbert (dacut@ece.cmu.edu) - * - *****************************************************************************/ - -#ifndef __WINE_TWEAK_H -#define __WINE_TWEAK_H - -#include "windef.h" - -typedef enum -{ - WIN31_LOOK, - WIN95_LOOK, - WIN98_LOOK -} WINE_LOOK; - - -int TWEAK_Init(void); - -extern WINE_LOOK TWEAK_WineLook; - -#endif /* __WINE_TWEAK_H */ diff --git a/include/user.h b/include/user.h index eb8d2af5700..a4d16adf362 100644 --- a/include/user.h +++ b/include/user.h @@ -88,4 +88,18 @@ WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID, VOID WINAPI MOUSE_Enable(LPMOUSE_EVENT_PROC lpMouseEventProc); VOID WINAPI MOUSE_Disable(VOID); +/* Wine look */ + +typedef enum +{ + WIN31_LOOK, + WIN95_LOOK, + WIN98_LOOK +} WINE_LOOK; + +extern WINE_LOOK TWEAK_WineLook; + +/* gray brush cache */ +extern HBRUSH CACHE_GetPattern55AABrush(void); + #endif /* __WINE_USER_H */ diff --git a/misc/Makefile.in b/misc/Makefile.in index 8d951162c35..f82a079800f 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -15,7 +15,6 @@ C_SRCS = \ options.c \ registry.c \ system.c \ - tweak.c \ version.c all: $(MODULE).o diff --git a/misc/tweak.c b/misc/tweak.c deleted file mode 100644 index 146233a92af..00000000000 --- a/misc/tweak.c +++ /dev/null @@ -1,80 +0,0 @@ -/****************************************************************************** - * - * tweak.c - * - * Windows 95 style interface tweaks. - * Copyright (c) 1997 Dave Cuthbert. - * - * FIXME: This file is, unfortunately, aptly named: the method of - * displaying Win95 style windows is a tweak. Lots of stuff does not yet - * work -- and probably never will unless some of this code is - * incorporated into the mainstream Wine code. - * - * DEVELOPERS, PLEASE NOTE: Before delving into the mainstream code and - * altering it, consider how your changes will affect the Win3.1 interface - * (which has taken a major effort to create!). After you make any sort of - * non-trivial change, *test* the Wine code running in Win3.1 mode! The - * object here is to make it so that the person who tests the latest version - * of Wine without adding the tweaks into wine.conf notices nothing out of - * the ordinary. - * - * Revision history - * 03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) - * Original implementation. - * 05-Aug-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) - * Removed some unused code. - * 22-Sep-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) - * Removed more unused code. - * - *****************************************************************************/ - -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "tweak.h" -#include "options.h" -#include "debugtools.h" - -DEFAULT_DEBUG_CHANNEL(tweak); - -/****************************************************************************** - * - * int TWEAK_Init() - * - * Does the full initialization of the Win95 tweak subsystem. Return value - * indicates success. Called by loader/main.c's MAIN_Init(). - * - * Revision history - * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) - * Original implementation. - * 22-Sep-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de) - * Removed unused code and added Win98 option. - * 23-Aug-2000 Andreas Mohr (a.mohr@mailto.de) - * Speedup and code cleanup. - * - *****************************************************************************/ - -WINE_LOOK TWEAK_WineLook = WIN31_LOOK; - -int TWEAK_Init (void) -{ - static const char *OS = "Win3.1"; - char szIniString[80]; - - PROFILE_GetWineIniString ("Tweak.Layout", "WineLook", "Win31", szIniString, 80); - - /* WIN31_LOOK is default */ - if (!strncasecmp (szIniString, "Win95", 5)) { - TWEAK_WineLook = WIN95_LOOK; - OS = "Win95"; - } - else if (!strncasecmp (szIniString, "Win98", 5)) { - TWEAK_WineLook = WIN98_LOOK; - OS = "Win98"; - } - TRACE("Using %s look and feel.\n", OS); - return 1; -} diff --git a/objects/gdiobj.c b/objects/gdiobj.c index 057eda0920b..e938de84a55 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -26,7 +26,6 @@ #include "region.h" #include "debugtools.h" #include "gdi.h" -#include "tweak.h" DEFAULT_DEBUG_CHANNEL(gdi); @@ -323,7 +322,6 @@ static inline void FixStockFontSizeA( */ BOOL GDI_Init(void) { - BOOL systemIsBold = (TWEAK_WineLook == WIN31_LOOK); HPALETTE16 hpalette; HINSTANCE16 instance; @@ -344,9 +342,9 @@ BOOL GDI_Init(void) ReadFontInformation("OEMFixed", &OEMFixedFont, 0, 0, 0, 0, 0); ReadFontInformation("AnsiFixed", &AnsiFixedFont, 0, 0, 0, 0, 0); ReadFontInformation("AnsiVar", &AnsiVarFont, 0, 0, 0, 0, 0); - ReadFontInformation("System", &SystemFont, 0, systemIsBold, 0, 0, 0); + ReadFontInformation("System", &SystemFont, 0, 0, 0, 0, 0); ReadFontInformation("DeviceDefault", &DeviceDefaultFont, 0, 0, 0, 0, 0); - ReadFontInformation("SystemFixed", &SystemFixedFont, 0, systemIsBold, 0, 0, 0); + ReadFontInformation("SystemFixed", &SystemFixedFont, 0, 0, 0, 0, 0); ReadFontInformation("DefaultGui", &DefaultGuiFont, 0, 0, 0, 0, 0); /* Create default palette */ diff --git a/windows/defwnd.c b/windows/defwnd.c index 0c230d41788..91f74e4d4e1 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -15,8 +15,6 @@ #include "dce.h" #include "debugtools.h" #include "spy.h" -#include "tweak.h" -#include "cache.h" #include "windef.h" #include "wingdi.h" #include "winnls.h" diff --git a/windows/mdi.c b/windows/mdi.c index 209e9cb8471..7f66fe77ede 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -82,7 +82,6 @@ #include "controls.h" #include "user.h" #include "struct32.h" -#include "tweak.h" #include "debugtools.h" #include "dlgs.h" diff --git a/windows/msgbox.c b/windows/msgbox.c index 99edf71d99d..a80e3c661b7 100644 --- a/windows/msgbox.c +++ b/windows/msgbox.c @@ -12,8 +12,8 @@ #include "wine/winuser16.h" #include "dlgs.h" #include "heap.h" +#include "user.h" #include "debugtools.h" -#include "tweak.h" DEFAULT_DEBUG_CHANNEL(dialog); diff --git a/windows/nonclient.c b/windows/nonclient.c index 86db5b32390..979daff515f 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -20,11 +20,9 @@ #include "hook.h" #include "nonclient.h" #include "queue.h" -#include "tweak.h" #include "debugtools.h" #include "options.h" #include "shellapi.h" -#include "cache.h" #include "bitmap.h" DEFAULT_DEBUG_CHANNEL(nonclient); diff --git a/windows/painting.c b/windows/painting.c index 208aacbed4d..b6778117e01 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -10,12 +10,12 @@ #include "wine/winuser16.h" #include "wine/unicode.h" #include "region.h" +#include "user.h" #include "win.h" #include "queue.h" #include "dce.h" #include "heap.h" #include "debugtools.h" -#include "cache.h" DEFAULT_DEBUG_CHANNEL(win); DECLARE_DEBUG_CHANNEL(nonclient); diff --git a/windows/syscolor.c b/windows/syscolor.c index 9dd3915ad29..a871b54e809 100644 --- a/windows/syscolor.c +++ b/windows/syscolor.c @@ -18,9 +18,9 @@ #include "winbase.h" #include "winuser.h" #include "debugtools.h" -#include "tweak.h" #include "winreg.h" #include "local.h" +#include "user.h" #include "gdi.h" /* sic */ DEFAULT_DEBUG_CHANNEL(syscolor); diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c index c2b31406b34..9fc7fd2eb4f 100644 --- a/windows/sysmetrics.c +++ b/windows/sysmetrics.c @@ -14,8 +14,8 @@ #include "winbase.h" #include "winuser.h" #include "options.h" +#include "user.h" #include "sysmetrics.h" -#include "tweak.h" static int sysMetrics[SM_WINE_CMETRICS+1]; diff --git a/windows/sysparams.c b/windows/sysparams.c index c7c17c87d43..d435a196d0e 100644 --- a/windows/sysparams.c +++ b/windows/sysparams.c @@ -17,7 +17,6 @@ #include "controls.h" #include "keyboard.h" -#include "tweak.h" #include "user.h" #include "debugtools.h"