From 8d530e8707069a0cb030df07696c223522b1f990 Mon Sep 17 00:00:00 2001
From: rambetter
Date: Thu, 3 Mar 2011 15:51:44 +0000
Subject: [PATCH] - Updated Windows build doc, very slight revision. Changed
37 targets to 38. - Added plugins/imagehl to list of modules built (both
Windows and Linux). Not really sure what this does, but it's the only
module (as defined by stuff in plugins/ or contrib/) that exists and
isn't currently part of the build. - The code to disable desktop
composition in Windows has been moved from start of main() to an option
in Preferences. The pref reads as follows: "NVIDIA/Aero bug - disable
Windows composition". It is enabled by default. - Color themes controlled by
"Misc" -> "Colors" -> "Themes" options are now saved as soon as you
select them. The color theme is no longer clobbered when opening
Preferences. - The ATI broken driver (bug #802) pref has been reworded since
it applies to Intel cards as well. Before: "ATI cards with broken
drivers - bug #802". After: "ATI and Intel cards w/ buggy drivers
(disappearing polygons)".
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@479 8a3a26a2-13c4-0310-b231-cf6edde360e5
---
config.py | 1 +
plugins/imagehl/imagehl.def | 1 -
plugins/imagehl/imagehl.vcproj | 189 +++++++++++++++++++++
plugins/imagehl/imagehl.vcproj.out-of-date | 75 --------
radiant.sln | 9 +
radiant/main.cpp | 26 ---
radiant/mainframe.cpp | 4 +
radiant/preferences.cpp | 81 ++++++++-
radiant/preferences.h | 15 +-
windows_compile_guide/index.html | 2 +-
10 files changed, 290 insertions(+), 113 deletions(-)
create mode 100644 plugins/imagehl/imagehl.vcproj
delete mode 100644 plugins/imagehl/imagehl.vcproj.out-of-date
diff --git a/config.py b/config.py
index ae94c878..fa042a7e 100644
--- a/config.py
+++ b/config.py
@@ -105,6 +105,7 @@ class Config:
'plugins/model/model.vcproj',
'plugins/imagepng/imagepng.vcproj',
'plugins/imagewal/imagewal.vcproj',
+ 'plugins/imagehl/imagehl.vcproj',
'plugins/imagem8/imagem8.vcproj',
'plugins/spritemodel/spritemodel.vcproj',
'plugins/textool/textool.vcproj',
diff --git a/plugins/imagehl/imagehl.def b/plugins/imagehl/imagehl.def
index 0e4eb081..518667f3 100644
--- a/plugins/imagehl/imagehl.def
+++ b/plugins/imagehl/imagehl.def
@@ -1,7 +1,6 @@
; hlimage.def : Declares the module parameters for the DLL.
LIBRARY "ImageHL"
-DESCRIPTION 'ImageHL Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
diff --git a/plugins/imagehl/imagehl.vcproj b/plugins/imagehl/imagehl.vcproj
new file mode 100644
index 00000000..e30ec135
--- /dev/null
+++ b/plugins/imagehl/imagehl.vcproj
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/imagehl/imagehl.vcproj.out-of-date b/plugins/imagehl/imagehl.vcproj.out-of-date
deleted file mode 100644
index 82301e06..00000000
--- a/plugins/imagehl/imagehl.vcproj.out-of-date
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/radiant.sln b/radiant.sln
index 9561a1db..430e2bd5 100644
--- a/radiant.sln
+++ b/radiant.sln
@@ -112,6 +112,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imagewal", "plugins\imagewa
{E13CCFB0-A366-4EF3-A66F-C374B563E4DF} = {E13CCFB0-A366-4EF3-A66F-C374B563E4DF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imagehl", "plugins\imagehl\imagehl.vcproj", "{BA1BC409-744B-4270-8E47-BA10872313AD}"
+ ProjectSection(ProjectDependencies) = postProject
+ {E13CCFB0-A366-4EF3-A66F-C374B563E4DF} = {E13CCFB0-A366-4EF3-A66F-C374B563E4DF}
+ EndProjectSection
+EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imagem8", "plugins\imagem8\imagem8.vcproj", "{C6FA63AA-5F37-4D43-BE6B-09903E70C9E1}"
ProjectSection(ProjectDependencies) = postProject
{E13CCFB0-A366-4EF3-A66F-C374B563E4DF} = {E13CCFB0-A366-4EF3-A66F-C374B563E4DF}
@@ -274,6 +279,10 @@ Global
{8D3160AB-B386-4970-8146-826BC293CCB1}.Debug|Win32.Build.0 = Debug|Win32
{8D3160AB-B386-4970-8146-826BC293CCB1}.Release|Win32.ActiveCfg = Release|Win32
{8D3160AB-B386-4970-8146-826BC293CCB1}.Release|Win32.Build.0 = Release|Win32
+ {BA1BC409-744B-4270-8E47-BA10872313AD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {BA1BC409-744B-4270-8E47-BA10872313AD}.Debug|Win32.Build.0 = Debug|Win32
+ {BA1BC409-744B-4270-8E47-BA10872313AD}.Release|Win32.ActiveCfg = Release|Win32
+ {BA1BC409-744B-4270-8E47-BA10872313AD}.Release|Win32.Build.0 = Release|Win32
{C6FA63AA-5F37-4D43-BE6B-09903E70C9E1}.Debug|Win32.ActiveCfg = Debug|Win32
{C6FA63AA-5F37-4D43-BE6B-09903E70C9E1}.Debug|Win32.Build.0 = Debug|Win32
{C6FA63AA-5F37-4D43-BE6B-09903E70C9E1}.Release|Win32.ActiveCfg = Release|Win32
diff --git a/radiant/main.cpp b/radiant/main.cpp
index a6e19296..0d6d5668 100644
--- a/radiant/main.cpp
+++ b/radiant/main.cpp
@@ -429,32 +429,6 @@ int main( int argc, char* argv[] ) {
char *libgl, *ptr;
int i, j, k;
- /*
- Rambetter on Fri Jan 21, 2011:
-
- People with recent NVIDIA cards and Windows 7 (Aero) are complaining about "hall of mirrors"
- effect in the OpenGL viewports. The code below is borrowed from NetRadiant to address
- this issue. This change turns off desktop compositing (globally) while Radiant is running.
- It's a real hack but the "correct" fix is very involving, so until the underlying problem
- is addressed we need this code here. I don't know for sure what the underlying problem is,
- but I have a hunch it's the version of gtkglext.dll we're using.
- */
-
-#ifdef _WIN32
- HMODULE lib;
- lib = LoadLibrary("dwmapi.dll");
- if (lib != 0)
- {
- void (WINAPI *qDwmEnableComposition) (bool bEnable) =
- (void (WINAPI *) (bool bEnable)) GetProcAddress(lib, "DwmEnableComposition");
- if (qDwmEnableComposition)
- {
- qDwmEnableComposition(FALSE);
- }
- FreeLibrary(lib);
- }
-#endif
-
/*
Rambetter on Sat Nov 13, 2010:
diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp
index b3d75c88..5c05dae9 100644
--- a/radiant/mainframe.cpp
+++ b/radiant/mainframe.cpp
@@ -5960,6 +5960,7 @@ void MainFrame::OnColorSetoriginal()
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][2] = 0.0f;
+ g_PrefsDlg.SavePrefs();
Sys_UpdateWindows (W_ALL);
}
@@ -6002,6 +6003,7 @@ void MainFrame::OnColorSetqer()
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][2] = 0.0f;
+ g_PrefsDlg.SavePrefs();
Sys_UpdateWindows (W_ALL);
}
@@ -6047,6 +6049,7 @@ void MainFrame::OnColorSetblack()
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][2] = 0.0f;
+ g_PrefsDlg.SavePrefs();
Sys_UpdateWindows (W_ALL);
}
@@ -6090,6 +6093,7 @@ void MainFrame::OnColorSetydnar()
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][1] = 0.0f;
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES3D][2] = 0.0f;
+ g_PrefsDlg.SavePrefs();
Sys_UpdateWindows (W_ALL);
}
diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp
index 3ac20c26..f85075bd 100644
--- a/radiant/preferences.cpp
+++ b/radiant/preferences.cpp
@@ -148,7 +148,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
#define LIGHTRADIUS_KEY "LightRadiuses"
#define Q3MAP2TEX_KEY "Q3Map2Tex"
+
+#ifdef ATIHACK_812
#define ATIHACK_KEY "ATIHack"
+#endif
+
+#ifdef NVIDIA_AERO_HACK
+#define NVAEROHACK_KEY "NvidiaAeroHack"
+#endif
// window stuff
#define ENTITYSPLIT1_KEY "EntitySplit1"
@@ -687,7 +694,11 @@ PrefsDlg::PrefsDlg ()
m_nLightRadiuses = 1;
m_bQ3Map2Texturing = TRUE;
#ifdef ATIHACK_812
- m_bGlATIHack = FALSE;
+ m_bGlATIHack = FALSE;
+#endif
+#ifdef NVIDIA_AERO_HACK
+ m_bGlNvidiaAeroHack = TRUE;
+ m_bGlNvidiaAeroHackPrevState = -1; // -1 is uninitialized, 0 is FALSE, 1 is TRUE
#endif
}
@@ -1818,11 +1829,18 @@ void PrefsDlg::BuildDialog ()
g_list_free (combo_list);
#ifdef ATIHACK_812
- // ATI bugs
- check = gtk_check_button_new_with_label (_("ATI cards with broken drivers - bug #802"));
- gtk_widget_show(check);
- gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
- AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
+ // ATI bugs
+ check = gtk_check_button_new_with_label (_("ATI and Intel cards w/ buggy drivers (disappearing polygons)"));
+ gtk_widget_show(check);
+ gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
+ AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
+#endif
+
+#ifdef NVIDIA_AERO_HACK
+ check = gtk_check_button_new_with_label (_("NVIDIA/Aero bug - disable Windows composition"));
+ gtk_widget_show(check);
+ gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
+ AddDialogData(check, &m_bGlNvidiaAeroHack, DLG_CHECK_BOOL);
#endif
// Add the page to the notebook
@@ -2859,6 +2877,40 @@ void PrefsDlg::UpdateATIHack() {
}
#endif
+#ifdef NVIDIA_AERO_HACK
+void PrefsDlg::UpdateNvidiaAeroHack() {
+ if (m_bGlNvidiaAeroHack && m_bGlNvidiaAeroHackPrevState == 1) { return; }
+ if ((!m_bGlNvidiaAeroHack) && m_bGlNvidiaAeroHackPrevState == 0) { return; }
+ if ((!m_bGlNvidiaAeroHack) && m_bGlNvidiaAeroHackPrevState < 0) {
+ // The hack state is uninitialized, meaning that this is the first call
+ // to this function. I prefer not to explicitly enable composition because
+ // the user may have set the application to disable it, and I don't want to
+ // override that. Leave the state of composition as-is if the hack checkbox
+ // isn't checked.
+ m_bGlNvidiaAeroHackPrevState = 0;
+ return;
+ }
+ HMODULE lib = LoadLibrary("dwmapi.dll");
+ if (lib) {
+ void (WINAPI *qDwmEnableComposition) (bool bEnable) =
+ (void (WINAPI *) (bool bEnable)) GetProcAddress(lib, "DwmEnableComposition");
+ if (qDwmEnableComposition) {
+ if (m_bGlNvidiaAeroHack) {
+ Sys_Printf("Disabling Windows composition\n");
+ qDwmEnableComposition(0);
+ m_bGlNvidiaAeroHackPrevState = 1;
+ }
+ else {
+ Sys_Printf("Enabling Windows composition\n");
+ qDwmEnableComposition(1);
+ m_bGlNvidiaAeroHackPrevState = 0;
+ }
+ }
+ FreeLibrary(lib);
+ }
+}
+#endif
+
// TTimo: m_strEnginePath has a special status, if not found in registry we need to
// initiliaze it for sure. It is not totally failsafe but we can use the same
// code than in q3map, expecting to find some "quake" above us. If not, we prompt
@@ -3139,6 +3191,10 @@ void PrefsDlg::LoadPrefs ()
mLocalPrefs.GetPref(ATIHACK_KEY, &m_bGlATIHack, FALSE);
#endif
+#ifdef NVIDIA_AERO_HACK
+ mLocalPrefs.GetPref(NVAEROHACK_KEY, &m_bGlNvidiaAeroHack, TRUE);
+#endif
+
Undo_SetMaxSize(m_nUndoLevels); // set it internally as well / FIXME: why not just have one global value?
UpdateTextureCompression();
@@ -3147,6 +3203,10 @@ void PrefsDlg::LoadPrefs ()
UpdateATIHack();
#endif
+#ifdef NVIDIA_AERO_HACK
+ UpdateNvidiaAeroHack();
+#endif
+
if (mLocalPrefs.mbEmpty)
{
mLocalPrefs.mbEmpty = false;
@@ -3191,9 +3251,12 @@ void PrefsDlg::PostModal (int code)
SavePrefs();
// make sure the logfile is ok
Sys_LogFile();
- #ifdef ATIHACK_812
- UpdateATIHack();
- #endif
+#ifdef ATIHACK_812
+ UpdateATIHack();
+#endif
+#ifdef NVIDIA_AERO_HACK
+ UpdateNvidiaAeroHack();
+#endif
if (g_pParentWnd)
g_pParentWnd->SetGridStatus();
Sys_UpdateWindows(W_ALL);
diff --git a/radiant/preferences.h b/radiant/preferences.h
index 1b2e0469..51c9ccb4 100644
--- a/radiant/preferences.h
+++ b/radiant/preferences.h
@@ -26,6 +26,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "gtkr_list.h"
//#include "profile.h"
+#ifdef _WIN32
+#define NVIDIA_AERO_HACK
+#endif
+
#define MAX_TEXTURE_QUALITY 3
enum PrefTypes_t
@@ -485,6 +489,10 @@ public:
void UpdateATIHack();
#endif
+#ifdef NVIDIA_AERO_HACK
+ void UpdateNvidiaAeroHack();
+#endif
+
void LoadPrefs();
void SavePrefs();
void LoadTexdefPref(texdef_t* pTexdef, char* pName);
@@ -687,7 +695,12 @@ public:
bool m_bQ3Map2Texturing;
#ifdef ATIHACK_812
- bool m_bGlATIHack;
+ bool m_bGlATIHack;
+#endif
+
+#ifdef NVIDIA_AERO_HACK
+ bool m_bGlNvidiaAeroHack;
+ int m_bGlNvidiaAeroHackPrevState;
#endif
void UpdateData (bool retrieve);
diff --git a/windows_compile_guide/index.html b/windows_compile_guide/index.html
index ece766a9..bb850bc3 100644
--- a/windows_compile_guide/index.html
+++ b/windows_compile_guide/index.html
@@ -313,7 +313,7 @@ $ scons target=setup
of Visual C++:
radiant - 0 error(s), 0 warning(s)
-========== Build: 37 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
+========== Build: 38 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
--
2.39.2