*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
+
+#include <config.h>
#include "dbus-launch.h"
#ifdef DBUS_BUILD_X11
user = getpwuid (getuid ());
if (user == NULL)
{
- verbose ("Could not determine the user informations; aborting X11 integration.\n");
+ verbose ("Could not determine user information; aborting X11 integration.\n");
return FALSE;
}
user_name = xstrdup(user->pw_name);
int
x11_get_address (char **paddress, pid_t *pid, long *wid)
{
+ int result;
Atom type;
Window owner;
int format;
*wid = (long) owner;
/* get the bus address */
- XGetWindowProperty (xdisplay, owner, address_atom, 0, 1024, False,
- XA_STRING, &type, &format, &items, &after,
- (unsigned char **) &data);
- if (type == None || after != 0 || data == NULL || format != 8)
+ result = XGetWindowProperty (xdisplay, owner, address_atom, 0, 1024, False,
+ XA_STRING, &type, &format, &items, &after,
+ (unsigned char **) &data);
+ if (result != Success || type == None || after != 0 || data == NULL || format != 8)
return FALSE; /* error */
*paddress = xstrdup (data);
if (pid != NULL)
{
*pid = 0;
- XGetWindowProperty (xdisplay, owner, pid_atom, 0, sizeof pid, False,
- XA_CARDINAL, &type, &format, &items, &after,
- (unsigned char **) &data);
- if (type != None && after == 0 && data != NULL && format == 32)
+ result = XGetWindowProperty (xdisplay, owner, pid_atom, 0, sizeof pid, False,
+ XA_CARDINAL, &type, &format, &items, &after,
+ (unsigned char **) &data);
+ if (result == Success && type != None && after == 0 && data != NULL && format == 32)
*pid = (pid_t) *(long*) data;
XFree (data);
}
}
/* Create our window */
- wid = XCreateSimpleWindow (xdisplay, RootWindow (xdisplay, 0), -20, -20, 10, 10,
- 0, WhitePixel (xdisplay, 0),
- BlackPixel (xdisplay, 0));
+ wid = XCreateWindow (xdisplay, RootWindow (xdisplay, 0), -20, -20, 10, 10,
+ 0, CopyFromParent, InputOnly, CopyFromParent,
+ 0, NULL);
verbose ("Created window %d\n", wid);
/* Save the property in the window */
return FALSE;
f = fopen (session_file, "w");
+ free (session_file);
if (f == NULL)
return FALSE; /* some kind of error */
fprintf (f,
address, (long)pid, (long)wid);
fclose (f);
- free (session_file);
return TRUE;
}
}
#else
+void dummy_dbus_launch_x11 (void);
+
void dummy_dbus_launch_x11 (void) { }
#endif