Uso cairo-dock e ho trovato un programma in C per fare lo Show Desktop, allego il codice:
- Codice: Seleziona tutto
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
Display *d;
Window root;
Atom _NET_SHOWING_DESKTOP, actual_type;
int actual_format, error, current;
unsigned long nitems, after;
unsigned char *data = NULL;
/* Open the default display */
if(!(d = XOpenDisplay(NULL))) {
fprintf(stderr, "Cannot open display \"%s\".\n", XDisplayName(NULL));
exit(EXIT_FAILURE);
}
/* This is the default root window */
root = DefaultRootWindow(d);
/* find the Atom for _NET_SHOWING_DESKTOP */
_NET_SHOWING_DESKTOP = XInternAtom(d, "_NET_SHOWING_DESKTOP", False);
/* Obtain the current state of _NET_SHOWING_DESKTOP on the default root window */
error = XGetWindowProperty(d, root, _NET_SHOWING_DESKTOP, 0, 1, False, XA_CARDINAL,
&actual_type, &actual_format, &nitems, &after, &data);
if(error != Success) {
fprintf(stderr, "Received error %d!\n", error);
XCloseDisplay(d);
exit(EXIT_FAILURE);
}
/* The current state should be in data[0] */
if(data) {
current = data[0];
XFree(data);
data = NULL;
}
/* If nitems is 0, forget about data[0] and assume that current should be False */
if(!nitems) {
fprintf(stderr, "Unexpected result.\n");
fprintf(stderr, "Assuming unshown desktop!\n");
current = False;
}
/* Initialize Xevent struct */
XEvent xev = {
.xclient = {
.type = ClientMessage,
.send_event = True,
.display = d,
.window = root,
.message_type = _NET_SHOWING_DESKTOP,
.format = 32,
.data.l[0] = !current /* That's what we want the new state to be */
}
};
/* Send the event to the window manager */
XSendEvent(d, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
XCloseDisplay(d);
exit(EXIT_SUCCESS);
return 0;
}
Lo compilo così come l'avevo compilato quando avevo la Slackware 12:
- Codice: Seleziona tutto
gcc -c show-desk.c -o show-desk
lo rendo eseguibile,
vado per lanciarlo e ... :
- Codice: Seleziona tutto
bash: ./show-desk: cannot execute binary file
Per pignoleria ho voluto ricompilarlo con le "nuove" glib, la versione compilata con le glib della 12 funzionava anche con la 12.1.
Idee?
rock

.