void _wnck_application_destroy (WnckApplication *application) { g_return_if_fail (wnck_application_get (application->priv->xwindow) == application); g_hash_table_remove (app_hash, &application->priv->xwindow); g_return_if_fail (wnck_application_get (application->priv->xwindow) == NULL); /* remove hash's ref on the application */ g_object_unref (G_OBJECT (application)); }
void _wnck_application_destroy (WnckApplication *application) { Window xwindow = application->priv->xwindow; g_return_if_fail (wnck_application_get (xwindow) == application); g_hash_table_remove (app_hash, &xwindow); /* Removing from hash also removes the only ref WnckApplication had */ g_return_if_fail (wnck_application_get (xwindow) == NULL); }
static void on_active_window_changed(WnckScreen *screen, WnckWindow *previously_active_window, gpointer user_data) { GList *window_l; WnckWindow *active_window = wnck_screen_get_active_window(screen); WnckWorkspace *active_workspace = wnck_screen_get_active_workspace(screen); GList *pids_current = NULL; GList *pids_other = NULL; for (window_l = wnck_screen_get_windows(screen); window_l != NULL; window_l = window_l->next) { WnckWindow *window = WNCK_WINDOW(window_l->data); WnckApplication *app = wnck_application_get(wnck_window_get_group_leader(window)); WnckWorkspace *w_workspace = wnck_window_get_workspace(window); if (!w_workspace) continue; GList *app_window_l; int w_pid = wnck_application_get_pid(app); if (w_workspace == active_workspace) { GList *g = g_list_find(pids_current, GINT_TO_POINTER(w_pid)); if (!g) pids_current = g_list_append(pids_current, GINT_TO_POINTER(w_pid)); } else { GList *g = g_list_find(pids_other, GINT_TO_POINTER(w_pid)); if (!g) pids_other = g_list_append(pids_other, GINT_TO_POINTER(w_pid)); } } for (; pids_other != NULL; pids_other = pids_other->next) { GList *g = g_list_find(pids_current, pids_other->data); if (g) g_print("Another window of this application is active\n"); else g_print("PID: %d\n", stop_pid(GPOINTER_TO_INT(pids_other->data))); } for (; pids_current != NULL; pids_current = pids_current->next) { cont_pid(GPOINTER_TO_INT(pids_current->data)); } g_print("-----\n"); }