summaryrefslogtreecommitdiffstats
path: root/redhat/tdelibs/kdelibs-3.5.13-fix_composition_extension_detection.patch
blob: 1192b8616a92f1ba91a1212f5975f078df56bd0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
commit 41ea89f79d28c456b296e8ddcce0a12c21e13f94
Author: Timothy Pearson <[email protected]>
Date:   1337872714 -0500

    Fix composition extension detection

diff --git a/kdecore/kapplication.cpp b/kdecore/kapplication.cpp
index 5c60e6f..b4caefc 100644
--- a/kdecore/kapplication.cpp
+++ b/kdecore/kapplication.cpp
@@ -1804,9 +1804,7 @@ bool KApplication::isCompositionManagerAvailable() {
 
         // Now that we did all that by way of introduction...read the file!
 	FILE *pFile;
-	char buffer[255];
 	pFile = fopen(filename, "r");
-	int kompmgrpid = 0;
 	if (pFile) {
 		have_manager = true;
 		fclose(pFile);
@@ -1840,18 +1838,23 @@ bool KApplication::detectCompositionManagerAvailable(bool force_available, bool
 			compositing_manager_available = false;
 		}
 		else {
-			Window root_window = XDefaultRootWindow(dpy);
-			XCompositeRedirectSubwindows(dpy, root_window, CompositeRedirectManual);
-			XSync(dpy, false);
-			if (x11_composite_error_generated == true) {
-				compositing_manager_available = true;
+			if (available) {		// FIXME This variable does double duty to avoid breaking the ABI for R14.0.  In reality it should be called perform_deep_check
+				Window root_window = XDefaultRootWindow(dpy);
+				XCompositeRedirectSubwindows(dpy, root_window, CompositeRedirectManual);
+				XSync(dpy, false);
+				if (x11_composite_error_generated == true) {
+					compositing_manager_available = true;
+				}
+				else {
+					XCompositeUnredirectSubwindows(dpy, root_window, CompositeRedirectManual);
+					compositing_manager_available = false;
+				}
+				XSetErrorHandler(NULL);
+				XCloseDisplay(dpy);
 			}
 			else {
-				XCompositeUnredirectSubwindows(dpy, root_window, CompositeRedirectManual);
-				compositing_manager_available = false;
+				compositing_manager_available = true;
 			}
-			XSetErrorHandler(NULL);
-			XCloseDisplay(dpy);
 		}
 	}
 	
@@ -1913,7 +1916,7 @@ Qt::HANDLE KApplication::getX11RGBAVisual(Display *dpy) {
 		return argb_x11_visual;
 	}
 	else {
-		return NULL;
+		return (Qt::HANDLE)NULL;
 	}
 }
 
@@ -1923,7 +1926,7 @@ Qt::HANDLE KApplication::getX11RGBAColormap(Display *dpy) {
 		return argb_x11_colormap;
 	}
 	else {
-		return NULL;
+		return (Qt::HANDLE)NULL;
 	}
 }
 
@@ -1997,8 +2000,20 @@ bool KApplication::detectCompositionManagerAvailable(bool force_available) {
 	strcat(filename, home);
 	strcat(filename, configfile);
 
-	/* now that we did all that by way of introduction...remove the file! */
-	unlink(filename);
+	/* now that we did all that by way of introduction...create or remove the file! */
+	if (force_available) {
+		FILE *pFile;
+		char buffer[255];
+		sprintf(buffer, "available");
+		pFile = fopen(filename, "w");
+		if (pFile) {
+			fwrite(buffer,1,strlen(buffer), pFile);
+			fclose(pFile);
+		}
+	}
+	else {
+		unlink(filename);
+	}
 
 	free(filename);
 	filename = NULL;
@@ -2886,12 +2901,15 @@ void KApplication::invokeMailer(const TQString &_to, const TQString &_cc, const
    TQString error;
    // TODO this should check if cmd has a .desktop file, and use data from it, together
    // with sending more ASN data
-   if (kdeinitExec(cmd, cmdTokens, &error, NULL, startup_id ))
-     if (Tty != kapp->type())
+   if (kdeinitExec(cmd, cmdTokens, &error, NULL, startup_id )) {
+     if (Tty != kapp->type()) {
        TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Mail Client"),
              i18n("Could not launch the mail client:\n\n%1").arg(error), i18n("&OK"));
-     else
+       }
+     else {
        kdWarning() << "Could not launch mail client:\n" << error << endl;
+     }
+   }
 }
 #endif
 
@@ -3597,7 +3615,9 @@ void KApplication::sigpipeHandler(int)
 #ifndef NDEBUG
     char msg[1000];
     sprintf(msg, "*** SIGPIPE *** (ignored, pid = %ld)\n", (long) getpid());
-    write(2, msg, strlen(msg));
+    if (write(2, msg, strlen(msg)) < 0) {
+      // ERROR
+    }
 #endif
 
     // Do nothing.
diff --git a/kdecore/kdetcompmgr.cpp b/kdecore/kdetcompmgr.cpp
index bfc3ac6..8b9b480 100644
--- a/kdecore/kdetcompmgr.cpp
+++ b/kdecore/kdetcompmgr.cpp
@@ -84,7 +84,6 @@ int main(int argc, char **argv)
             if (lSize > 254)
                 lSize = 254;
             rewind (pFile);
-            size_t result = fread (buffer, 1, lSize, pFile);
             fclose(pFile);
             kompmgrpid = atoi(buffer);
         }
@@ -97,9 +96,7 @@ int main(int argc, char **argv)
         }
     }
 
-//     app.detectCompositionManagerAvailable();
-
-//    if (!app.isCompositionManagerAvailable()) {
+     if (app.detectCompositionManagerAvailable(false, false)) {		// Perform a shallow check for the composite extension (a deep check would cause noticeable flicker)
 	KConfig config2("kwinrc", true);
 	config2.setGroup( "Notification Messages" );
 	if (config2.readBoolEntry("UseTranslucency",false)) {
@@ -110,6 +107,10 @@ int main(int argc, char **argv)
 		app.detectCompositionManagerAvailable(true, false);
 		return 0;
 	}
-//    }
+     }
+     else {
+	app.detectCompositionManagerAvailable(true, false);
+	return 1;
+     }
 }