--- sourceforge.net/trunk/rdesktop/ewmhints.c 2003/01/30 11:20:30 300 +++ sourceforge.net/trunk/rdesktop/ewmhints.c 2003/09/15 07:59:36 468 @@ -4,7 +4,7 @@ Support functions for Extended Window Manager Hints, http://www.freedesktop.org/standards/wm-spec.html - Copyright (C) Matthew Chapman 1999-2002 + Copyright (C) Peter Astrand 2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include #include "rdesktop.h" -extern Display *display; +extern Display *g_display; /* Get window property value (32 bit format) @@ -40,14 +40,14 @@ int actual_format_return; unsigned long bytes_after_return; - property = XInternAtom(display, propname, True); + property = XInternAtom(g_display, propname, True); if (property == None) { fprintf(stderr, "Atom %s does not exist\n", propname); return (-1); } - result = XGetWindowProperty(display, DefaultRootWindow(display), property, 0, /* long_offset */ + result = XGetWindowProperty(g_display, DefaultRootWindow(g_display), property, 0, /* long_offset */ max_length, /* long_length */ False, /* delete */ AnyPropertyType, /* req_type */ @@ -90,11 +90,10 @@ get_current_desktop(void) { unsigned long nitems_return; - uint32 *prop_return; + unsigned char *prop_return; int current_desktop; - if (get_property_value("_NET_CURRENT_DESKTOP", 1, &nitems_return, - (unsigned char **) &prop_return) < 0) + if (get_property_value("_NET_CURRENT_DESKTOP", 1, &nitems_return, &prop_return) < 0) return (-1); if (nitems_return != 1) @@ -118,15 +117,15 @@ { int current_desktop; unsigned long nitems_return; - uint32 *prop_return; + unsigned char *prop_return; + uint32 *return_words; const uint32 net_workarea_x_offset = 0; const uint32 net_workarea_y_offset = 1; const uint32 net_workarea_width_offset = 2; const uint32 net_workarea_height_offset = 3; const uint32 max_prop_length = 32 * 4; /* Max 32 desktops */ - if (get_property_value("_NET_WORKAREA", max_prop_length, &nitems_return, - (unsigned char **) &prop_return) < 0) + if (get_property_value("_NET_WORKAREA", max_prop_length, &nitems_return, &prop_return) < 0) return (-1); if (nitems_return % 4) @@ -140,10 +139,12 @@ if (current_desktop < 0) return -1; - *x = prop_return[current_desktop * 4 + net_workarea_x_offset]; - *y = prop_return[current_desktop * 4 + net_workarea_y_offset]; - *width = prop_return[current_desktop * 4 + net_workarea_width_offset]; - *height = prop_return[current_desktop * 4 + net_workarea_height_offset]; + return_words = (uint32 *) prop_return; + + *x = return_words[current_desktop * 4 + net_workarea_x_offset]; + *y = return_words[current_desktop * 4 + net_workarea_y_offset]; + *width = return_words[current_desktop * 4 + net_workarea_width_offset]; + *height = return_words[current_desktop * 4 + net_workarea_height_offset]; XFree(prop_return);