~bratsche/ubuntu/maverick/gtk+2.0/menu-activation-fix

« back to all changes in this revision

Viewing changes to gdk/x11/gdkevents-x11.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2009-09-05 07:16:24 UTC
  • mfrom: (1.3.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 127.
  • Revision ID: james.westby@ubuntu.com-20090905071624-ehjbg50t3hvthzlm
Tags: upstream-2.17.11
Import upstream version 2.17.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
1032
1032
            }
1033
1033
        }
1034
1034
    }
1035
 
      
1036
 
  if (screen_x11 && screen_x11->wmspec_check_window != None &&
1037
 
      xwindow == screen_x11->wmspec_check_window)
 
1035
 
 
1036
  if (xevent->type == DestroyNotify)
1038
1037
    {
1039
 
      if (xevent->type == DestroyNotify)
 
1038
      int i, n;
 
1039
 
 
1040
      n = gdk_display_get_n_screens (display);
 
1041
      for (i = 0; i < n; i++)
1040
1042
        {
1041
 
          screen_x11->wmspec_check_window = None;
1042
 
          g_free (screen_x11->window_manager_name);
1043
 
          screen_x11->window_manager_name = g_strdup ("unknown");
1044
 
 
1045
 
          /* careful, reentrancy */
1046
 
          _gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11));
 
1043
          screen = gdk_display_get_screen (display, i);
 
1044
          screen_x11 = GDK_SCREEN_X11 (screen);
 
1045
 
 
1046
          if (screen_x11->wmspec_check_window == xwindow)
 
1047
            {
 
1048
              screen_x11->wmspec_check_window = None;
 
1049
              screen_x11->last_wmspec_check_time = 0;
 
1050
              g_free (screen_x11->window_manager_name);
 
1051
              screen_x11->window_manager_name = g_strdup ("unknown");
 
1052
 
 
1053
              /* careful, reentrancy */
 
1054
              _gdk_x11_screen_window_manager_changed (screen);
 
1055
 
 
1056
              return_val = FALSE;
 
1057
              goto done;
 
1058
            }
1047
1059
        }
1048
 
      
1049
 
      /* Eat events on this window unless someone had wrapped
1050
 
       * it as a foreign window
1051
 
       */
1052
 
      if (window == NULL)
1053
 
        {
1054
 
          return_val = FALSE;
1055
 
          goto done;
1056
 
        }
1057
1060
    }
1058
1061
 
1059
1062
  if (window &&
2629
2632
  guchar *data;
2630
2633
  Window *xwindow;
2631
2634
  GTimeVal tv;
2632
 
  
 
2635
  gint error;
 
2636
 
2633
2637
  screen_x11 = GDK_SCREEN_X11 (screen);
2634
2638
  display = screen_x11->display;
2635
2639
 
2636
2640
  g_return_if_fail (GDK_DISPLAY_X11 (display)->trusted_client);
2637
2641
  
2638
2642
  g_get_current_time (&tv);
2639
 
      
 
2643
 
2640
2644
  if (ABS  (tv.tv_sec - screen_x11->last_wmspec_check_time) < 15)
2641
2645
    return; /* we've checked recently */
2642
2646
 
2643
2647
  screen_x11->last_wmspec_check_time = tv.tv_sec;
2644
2648
 
2645
2649
  data = NULL;
2646
 
  XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), screen_x11->xroot_window,
 
2650
  XGetWindowProperty (screen_x11->xdisplay, screen_x11->xroot_window,
2647
2651
                      gdk_x11_get_xatom_by_name_for_display (display, "_NET_SUPPORTING_WM_CHECK"),
2648
 
                      0, G_MAXLONG, False, XA_WINDOW, &type, &format, 
 
2652
                      0, G_MAXLONG, False, XA_WINDOW, &type, &format,
2649
2653
                      &n_items, &bytes_after, &data);
2650
2654
  
2651
2655
  if (type != XA_WINDOW)
2664
2668
    }
2665
2669
 
2666
2670
  gdk_error_trap_push ();
2667
 
  
 
2671
 
2668
2672
  /* Find out if this WM goes away, so we can reset everything. */
2669
2673
  XSelectInput (screen_x11->xdisplay, *xwindow, StructureNotifyMask);
2670
2674
  gdk_display_sync (display);
2671
2675
 
2672
 
  if (gdk_error_trap_pop () == Success)
 
2676
  error = gdk_error_trap_pop ();
 
2677
  if (!error)
2673
2678
    {
2674
2679
      screen_x11->wmspec_check_window = *xwindow;
2675
2680
      screen_x11->need_refetch_net_supported = TRUE;
2676
2681
      screen_x11->need_refetch_wm_name = TRUE;
2677
 
      
 
2682
 
2678
2683
      /* Careful, reentrancy */
2679
2684
      _gdk_x11_screen_window_manager_changed (GDK_SCREEN (screen_x11));
2680
2685
    }
 
2686
  else if (error == BadWindow)
 
2687
    {
 
2688
      /* Leftover property, try again immediately, new wm may be starting up */
 
2689
      screen_x11->last_wmspec_check_time = 0;
 
2690
    }
2681
2691
 
2682
 
  XFree (xwindow);    
 
2692
  XFree (xwindow);
2683
2693
}
2684
2694
 
2685
2695
/**