90 |
get_current_desktop(void) |
get_current_desktop(void) |
91 |
{ |
{ |
92 |
unsigned long nitems_return; |
unsigned long nitems_return; |
93 |
uint32 *prop_return; |
unsigned char *prop_return; |
94 |
int current_desktop; |
int current_desktop; |
95 |
|
|
96 |
if (get_property_value("_NET_CURRENT_DESKTOP", 1, &nitems_return, |
if (get_property_value("_NET_CURRENT_DESKTOP", 1, &nitems_return, |
97 |
(unsigned char **) &prop_return) < 0) |
&prop_return) < 0) |
98 |
return (-1); |
return (-1); |
99 |
|
|
100 |
if (nitems_return != 1) |
if (nitems_return != 1) |
118 |
{ |
{ |
119 |
int current_desktop; |
int current_desktop; |
120 |
unsigned long nitems_return; |
unsigned long nitems_return; |
121 |
uint32 *prop_return; |
unsigned char *prop_return; |
122 |
|
uint32 *return_words; |
123 |
const uint32 net_workarea_x_offset = 0; |
const uint32 net_workarea_x_offset = 0; |
124 |
const uint32 net_workarea_y_offset = 1; |
const uint32 net_workarea_y_offset = 1; |
125 |
const uint32 net_workarea_width_offset = 2; |
const uint32 net_workarea_width_offset = 2; |
127 |
const uint32 max_prop_length = 32 * 4; /* Max 32 desktops */ |
const uint32 max_prop_length = 32 * 4; /* Max 32 desktops */ |
128 |
|
|
129 |
if (get_property_value("_NET_WORKAREA", max_prop_length, &nitems_return, |
if (get_property_value("_NET_WORKAREA", max_prop_length, &nitems_return, |
130 |
(unsigned char **) &prop_return) < 0) |
&prop_return) < 0) |
131 |
return (-1); |
return (-1); |
132 |
|
|
133 |
if (nitems_return % 4) |
if (nitems_return % 4) |
141 |
if (current_desktop < 0) |
if (current_desktop < 0) |
142 |
return -1; |
return -1; |
143 |
|
|
144 |
*x = prop_return[current_desktop * 4 + net_workarea_x_offset]; |
return_words = (uint32 *)prop_return; |
145 |
*y = prop_return[current_desktop * 4 + net_workarea_y_offset]; |
|
146 |
*width = prop_return[current_desktop * 4 + net_workarea_width_offset]; |
*x = return_words[current_desktop * 4 + net_workarea_x_offset]; |
147 |
*height = prop_return[current_desktop * 4 + net_workarea_height_offset]; |
*y = return_words[current_desktop * 4 + net_workarea_y_offset]; |
148 |
|
*width = return_words[current_desktop * 4 + net_workarea_width_offset]; |
149 |
|
*height = return_words[current_desktop * 4 + net_workarea_height_offset]; |
150 |
|
|
151 |
XFree(prop_return); |
XFree(prop_return); |
152 |
|
|