Fix composition extension detection

(cherry picked from commit 41ea89f79d)
v3.5.13-sru
Timothy Pearson 13 years ago committed by Slávek Banko
parent efbb0a575b
commit 89bb0f3329

@ -1802,9 +1802,7 @@ bool KApplication::isCompositionManagerAvailable() {
// Now that we did all that by way of introduction...read the file! // Now that we did all that by way of introduction...read the file!
FILE *pFile; FILE *pFile;
char buffer[255];
pFile = fopen(filename, "r"); pFile = fopen(filename, "r");
int kompmgrpid = 0;
if (pFile) { if (pFile) {
have_manager = true; have_manager = true;
fclose(pFile); fclose(pFile);
@ -1838,6 +1836,7 @@ bool KApplication::detectCompositionManagerAvailable(bool force_available, bool
compositing_manager_available = false; compositing_manager_available = false;
} }
else { else {
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); Window root_window = XDefaultRootWindow(dpy);
XCompositeRedirectSubwindows(dpy, root_window, CompositeRedirectManual); XCompositeRedirectSubwindows(dpy, root_window, CompositeRedirectManual);
XSync(dpy, false); XSync(dpy, false);
@ -1851,6 +1850,10 @@ bool KApplication::detectCompositionManagerAvailable(bool force_available, bool
XSetErrorHandler(NULL); XSetErrorHandler(NULL);
XCloseDisplay(dpy); XCloseDisplay(dpy);
} }
else {
compositing_manager_available = true;
}
}
} }
const char *home; const char *home;
@ -1911,7 +1914,7 @@ Qt::HANDLE KApplication::getX11RGBAVisual(Display *dpy) {
return argb_x11_visual; return argb_x11_visual;
} }
else { else {
return NULL; return (Qt::HANDLE)NULL;
} }
} }
@ -1921,7 +1924,7 @@ Qt::HANDLE KApplication::getX11RGBAColormap(Display *dpy) {
return argb_x11_colormap; return argb_x11_colormap;
} }
else { else {
return NULL; return (Qt::HANDLE)NULL;
} }
} }
@ -1995,8 +1998,20 @@ bool KApplication::detectCompositionManagerAvailable(bool force_available) {
strcat(filename, home); strcat(filename, home);
strcat(filename, configfile); strcat(filename, configfile);
/* now that we did all that by way of introduction...remove the file! */ /* 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); unlink(filename);
}
free(filename); free(filename);
filename = NULL; filename = NULL;
@ -2884,13 +2899,16 @@ void KApplication::invokeMailer(const TQString &_to, const TQString &_cc, const
TQString error; TQString error;
// TODO this should check if cmd has a .desktop file, and use data from it, together // TODO this should check if cmd has a .desktop file, and use data from it, together
// with sending more ASN data // with sending more ASN data
if (kdeinitExec(cmd, cmdTokens, &error, NULL, startup_id )) if (kdeinitExec(cmd, cmdTokens, &error, NULL, startup_id )) {
if (Tty != kapp->type()) if (Tty != kapp->type()) {
TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Mail Client"), TQMessageBox::critical(kapp->mainWidget(), i18n("Could not Launch Mail Client"),
i18n("Could not launch the mail client:\n\n%1").arg(error), i18n("&OK")); 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; kdWarning() << "Could not launch mail client:\n" << error << endl;
} }
}
}
#endif #endif
void KApplication::invokeBrowser( const TQString &url ) void KApplication::invokeBrowser( const TQString &url )
@ -3595,7 +3613,9 @@ void KApplication::sigpipeHandler(int)
#ifndef NDEBUG #ifndef NDEBUG
char msg[1000]; char msg[1000];
sprintf(msg, "*** SIGPIPE *** (ignored, pid = %ld)\n", (long) getpid()); sprintf(msg, "*** SIGPIPE *** (ignored, pid = %ld)\n", (long) getpid());
write(2, msg, strlen(msg)); if (write(2, msg, strlen(msg)) < 0) {
// ERROR
}
#endif #endif
// Do nothing. // Do nothing.

@ -84,7 +84,6 @@ int main(int argc, char **argv)
if (lSize > 254) if (lSize > 254)
lSize = 254; lSize = 254;
rewind (pFile); rewind (pFile);
size_t result = fread (buffer, 1, lSize, pFile);
fclose(pFile); fclose(pFile);
kompmgrpid = atoi(buffer); kompmgrpid = atoi(buffer);
} }
@ -97,9 +96,7 @@ int main(int argc, char **argv)
} }
} }
// app.detectCompositionManagerAvailable(); if (app.detectCompositionManagerAvailable(false, false)) { // Perform a shallow check for the composite extension (a deep check would cause noticeable flicker)
// if (!app.isCompositionManagerAvailable()) {
KConfig config2("kwinrc", true); KConfig config2("kwinrc", true);
config2.setGroup( "Notification Messages" ); config2.setGroup( "Notification Messages" );
if (config2.readBoolEntry("UseTranslucency",false)) { if (config2.readBoolEntry("UseTranslucency",false)) {
@ -110,6 +107,10 @@ int main(int argc, char **argv)
app.detectCompositionManagerAvailable(true, false); app.detectCompositionManagerAvailable(true, false);
return 0; return 0;
} }
// } }
else {
app.detectCompositionManagerAvailable(true, false);
return 1;
}
} }

Loading…
Cancel
Save