~om26er/ubuntu/oneiric/bamf/sru-943192

« back to all changes in this revision

Viewing changes to src/bamf-matcher.c

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2011-09-22 15:15:28 UTC
  • mfrom: (1.1.37 upstream)
  • Revision ID: package-import@ubuntu.com-20110922151528-c6eewp8gdys1vdp8
Tags: 0.2.100-0ubuntu1
* New upstream release.
  - Fix unity confused with chrome web apps (LP: #692462)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1332
1332
  return result;
1333
1333
}
1334
1334
 
 
1335
static gboolean
 
1336
is_web_app_window (BamfMatcher *self, BamfLegacyWindow *window)
 
1337
{
 
1338
  const char *window_class = bamf_legacy_window_get_class_name (window);
 
1339
  // chromium uses crx_foo wm_class strings to represent its web apps. These apps
 
1340
  // will still have the same parent pid and hints as the main chrome window, so we
 
1341
  // skip the hint check.
 
1342
  return g_str_has_prefix(window_class, "crx_");
 
1343
}
 
1344
 
1335
1345
static GList *
1336
1346
bamf_matcher_possible_applications_for_window (BamfMatcher *self,
1337
1347
                                               BamfWindow *bamf_window)
1350
1360
  window = bamf_window_get_window (bamf_window);
1351
1361
 
1352
1362
  hint = get_window_hint (self, window, _NET_WM_DESKTOP_FILE);
 
1363
  const char *window_class = bamf_legacy_window_get_class_name (window);
1353
1364
 
1354
 
  if (hint && strlen (hint) > 0)
 
1365
  if (hint && strlen (hint) > 0 && !is_web_app_window(self, window))
1355
1366
    {
1356
1367
      desktop_files = g_list_prepend (desktop_files, hint);
1357
1368
      /* whew, hard work, didn't even have to make a copy! */
1358
1369
    }
1359
1370
  else
1360
1371
    {
1361
 
      const char *window_class = bamf_legacy_window_get_class_name (window);
1362
1372
      
1363
1373
      char *desktop_file;
1364
1374
      char *desktop_class;
1577
1587
  g_return_if_fail (BAMF_IS_LEGACY_WINDOW (window));
1578
1588
 
1579
1589
  registered_pids = self->priv->registered_pids;
 
1590
 
 
1591
  // web apps can end up forcing their parent browsers to match on them, so remove from pid table if this is the case
 
1592
  if (is_web_app_window (self, window))
 
1593
    {
 
1594
      pid = bamf_legacy_window_get_pid (window);
 
1595
 
 
1596
      if (pid > 0)
 
1597
        {
 
1598
          key = g_new (gint, 1);
 
1599
          *key = pid;
 
1600
 
 
1601
          const char* result = g_hash_table_lookup (registered_pids, key);
 
1602
          if (result && g_str_has_prefix (result, "/home/"))
 
1603
            {
 
1604
              g_hash_table_remove (registered_pids, key);
 
1605
            }
 
1606
        }
 
1607
 
 
1608
      return;
 
1609
    }
 
1610
 
1580
1611
  window_hint = get_window_hint (self, window, _NET_WM_DESKTOP_FILE);
1581
 
 
1582
1612
  if (window_hint && strlen (window_hint) > 0)
1583
1613
    {
1584
1614
      /* already set, make sure we know about this