Exemplo n.º 1
0
static gulong
wnck_check_window_for_pid (Screen *screen,
                           Window  win,
                           XID     match_xid,
                           XID     mask)
{
  if ((win & ~mask) == match_xid) {
    return _wnck_get_pid (screen, win);
  }

  return 0;
}
Exemplo n.º 2
0
/* xwindow is a group leader */
WnckApplication*
_wnck_application_create (Window      xwindow,
                          WnckScreen *screen)
{
  WnckApplication *application;
  Screen          *xscreen;

  if (app_hash == NULL)
    app_hash = g_hash_table_new_full (_wnck_xid_hash, _wnck_xid_equal,
                                      NULL, g_object_unref);

  g_return_val_if_fail (g_hash_table_lookup (app_hash, &xwindow) == NULL,
                        NULL);

  xscreen = WNCK_SCREEN_XSCREEN (screen);

  application = g_object_new (WNCK_TYPE_APPLICATION, NULL);
  application->priv->xwindow = xwindow;
  application->priv->screen = screen;

  application->priv->name = _wnck_get_name (xscreen, xwindow);

  if (application->priv->name == NULL)
    application->priv->name = _wnck_get_res_class_utf8 (xscreen, xwindow);

  if (application->priv->name)
    application->priv->name_from_leader = TRUE;

  application->priv->pid = _wnck_get_pid (xscreen,
                                          application->priv->xwindow);

  application->priv->startup_id = _wnck_get_utf8_property (xscreen,
                                                           application->priv->xwindow,
                                                           _wnck_atom_get ("_NET_STARTUP_ID"));

  g_hash_table_insert (app_hash, &application->priv->xwindow, application);

  /* Hash now owns one ref, caller gets none */

  /* Note that xwindow may correspond to a WnckWindow's xwindow,
   * so we select events needed by either
   */
  application->priv->orig_event_mask = _wnck_select_input (xscreen,
                                                           application->priv->xwindow,
                                                           WNCK_APP_WINDOW_EVENT_MASK,
                                                           TRUE);

  return application;
}