|
Lines 1147-1196
_wnck_get_session_id (Screen *screen,
Link Here
|
| 1147 |
|
1147 |
|
| 1148 |
#ifdef HAVE_XRES |
1148 |
#ifdef HAVE_XRES |
| 1149 |
static int |
1149 |
static int |
| 1150 |
xres_get_pid (Screen *screen, |
1150 |
xres_get_pid (WnckScreen *screen, |
| 1151 |
Window xwindow) |
1151 |
Window xwindow) |
| 1152 |
{ |
1152 |
{ |
| 1153 |
int pid = -1; |
1153 |
int pid = -1; |
|
|
1154 |
Screen *xscreen; |
| 1154 |
XResClientIdSpec client_spec; |
1155 |
XResClientIdSpec client_spec; |
| 1155 |
long client_id_count = 0; |
1156 |
long client_id_count = 0; |
| 1156 |
XResClientIdValue *client_ids = NULL; |
1157 |
XResClientIdValue *client_ids = NULL; |
| 1157 |
|
1158 |
|
|
|
1159 |
xscreen = _wnck_screen_get_xscreen (screen); |
| 1160 |
|
| 1158 |
client_spec.client = xwindow; |
1161 |
client_spec.client = xwindow; |
| 1159 |
client_spec.mask = XRES_CLIENT_ID_PID_MASK; |
1162 |
client_spec.mask = XRES_CLIENT_ID_PID_MASK; |
| 1160 |
|
1163 |
|
| 1161 |
if (XResQueryClientIds (DisplayOfScreen (screen), 1, &client_spec, |
1164 |
if (XResQueryClientIds (DisplayOfScreen (xscreen), 1, &client_spec, |
| 1162 |
&client_id_count, &client_ids) == Success) |
1165 |
&client_id_count, &client_ids) == Success) |
| 1163 |
{ |
1166 |
{ |
| 1164 |
long i; |
1167 |
long i; |
| 1165 |
|
1168 |
|
| 1166 |
for (i = 0; i < client_id_count; i++) |
1169 |
for (i = 0; i < client_id_count; i++) |
| 1167 |
{ |
1170 |
{ |
| 1168 |
pid = XResGetClientPid (&client_ids[i]); |
1171 |
pid = XResGetClientPid (&client_ids[i]); |
| 1169 |
if (pid != -1) |
1172 |
if (pid != -1) |
| 1170 |
break; |
1173 |
break; |
| 1171 |
} |
1174 |
} |
| 1172 |
|
1175 |
|
| 1173 |
XResClientIdsDestroy (client_id_count, client_ids); |
1176 |
XResClientIdsDestroy (client_id_count, client_ids); |
| 1174 |
} |
1177 |
} |
| 1175 |
|
1178 |
|
| 1176 |
return pid; |
1179 |
return pid; |
| 1177 |
} |
1180 |
} |
| 1178 |
#endif |
1181 |
#endif |
| 1179 |
|
1182 |
|
| 1180 |
int |
1183 |
int |
| 1181 |
_wnck_get_pid (Screen *screen, |
1184 |
_wnck_get_pid (WnckScreen *screen, |
| 1182 |
Window xwindow) |
1185 |
Window xwindow) |
| 1183 |
{ |
1186 |
{ |
| 1184 |
int pid = -1; |
1187 |
int pid = -1; |
| 1185 |
|
1188 |
|
| 1186 |
#ifdef HAVE_XRES |
1189 |
#ifdef HAVE_XRES |
| 1187 |
pid = xres_get_pid (screen, xwindow); |
1190 |
pid = xres_get_pid (screen, xwindow); |
| 1188 |
|
1191 |
|
| 1189 |
if (pid != -1) |
1192 |
if (pid != -1) |
| 1190 |
return pid; |
1193 |
return pid; |
| 1191 |
#endif |
1194 |
#endif |
| 1192 |
|
1195 |
|
| 1193 |
if (!_wnck_get_cardinal (screen, xwindow, |
1196 |
if (!_wnck_get_cardinal (_wnck_screen_get_xscreen (screen), |
|
|
1197 |
xwindow, |
| 1194 |
_wnck_atom_get ("_NET_WM_PID"), |
1198 |
_wnck_atom_get ("_NET_WM_PID"), |
| 1195 |
&pid)) |
1199 |
&pid)) |
| 1196 |
return 0; |
1200 |
return 0; |