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

« back to all changes in this revision

Viewing changes to gdk/gdkwindow.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-06-13 10:00:13 UTC
  • mto: (72.2.1 lenny) (1.5.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20070613100013-qstao3cwpm6xdlxc
Tags: upstream-2.11.2
ImportĀ upstreamĀ versionĀ 2.11.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "gdk.h"                /* For gdk_rectangle_union() */
31
31
#include "gdkpixmap.h"
32
32
#include "gdkdrawable.h"
33
 
#include "gdkpixmap.h"
34
33
#include "gdkscreen.h"
35
34
#include "gdkalias.h"
36
35
 
676
675
 * easy to break GDK and/or GTK+, so you have to know what you're
677
676
 * doing. Pass %NULL for @window to get all events for all windows,
678
677
 * instead of events for a specific window.
679
 
 * 
 
678
 *
 
679
 * See gdk_display_add_client_message_filter() if you are interested
 
680
 * in X ClientMessage events.
680
681
 **/
681
682
void          
682
683
gdk_window_add_filter (GdkWindow     *window,
1041
1042
{
1042
1043
#ifdef USE_BACKING_STORE
1043
1044
  GdkWindowObject *private = (GdkWindowObject *)window;
 
1045
  GdkWindowObject *composited;
1044
1046
  GdkWindowPaint *paint;
1045
1047
  GdkGC *tmp_gc;
1046
1048
  GdkRectangle clip_box;
1093
1095
  g_object_unref (paint->pixmap);
1094
1096
  gdk_region_destroy (paint->region);
1095
1097
  g_free (paint);
 
1098
 
 
1099
  /* find a composited window in our hierarchy to signal its
 
1100
   * parent to redraw, calculating the clip box as we go...
 
1101
   *
 
1102
   * stop if parent becomes NULL since then we'd have nowhere
 
1103
   * to draw (ie: 'composited' will always be non-NULL here).
 
1104
   */
 
1105
  for (composited = private;
 
1106
       composited->parent;
 
1107
       composited = composited->parent)
 
1108
    {
 
1109
      int width, height;
 
1110
 
 
1111
      gdk_drawable_get_size (GDK_DRAWABLE (composited->parent),
 
1112
                             &width, &height);
 
1113
 
 
1114
      clip_box.x += composited->x;
 
1115
      clip_box.y += composited->y;
 
1116
      clip_box.width = MIN (clip_box.width, width - clip_box.x);
 
1117
      clip_box.height = MIN (clip_box.height, height - clip_box.y);
 
1118
 
 
1119
      if (composited->composited)
 
1120
        {
 
1121
          gdk_window_invalidate_rect (GDK_WINDOW (composited->parent),
 
1122
                                      &clip_box, FALSE);
 
1123
          break;
 
1124
        }
 
1125
    }
1096
1126
#endif /* USE_BACKING_STORE */
1097
1127
}
1098
1128
 
2131
2161
  else
2132
2162
    gdk_draw_trapezoids (private->impl, gc, trapezoids, n_trapezoids);
2133
2163
  
2134
 
  if (new_trapezoids)
2135
 
    g_free (new_trapezoids);
 
2164
  g_free (new_trapezoids);
2136
2165
 
2137
2166
  RESTORE_GC (gc);
2138
2167
}
2255
2284
static gboolean
2256
2285
gdk_window_update_idle (gpointer data)
2257
2286
{
2258
 
  GDK_THREADS_ENTER ();
2259
2287
  gdk_window_process_all_updates ();
2260
 
  GDK_THREADS_LEAVE ();
2261
2288
  
2262
2289
  return FALSE;
2263
2290
}
2270
2297
 
2271
2298
  if (!update_idle)
2272
2299
    {
2273
 
      update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
 
2300
      update_idle = gdk_threads_add_idle_full (GDK_PRIORITY_REDRAW,
2274
2301
                                     gdk_window_update_idle, NULL, NULL);
2275
2302
    }
2276
2303
}
2603
2630
          child_region = gdk_region_rectangle (&child_rect);
2604
2631
          
2605
2632
          /* remove child area from the invalid area of the parent */
2606
 
          if (GDK_WINDOW_IS_MAPPED (child) && !child->shaped)
 
2633
          if (GDK_WINDOW_IS_MAPPED (child) && !child->shaped &&
 
2634
              !child->composited)
2607
2635
            gdk_region_subtract (visible_region, child_region);
2608
2636
          
2609
2637
          if (child_func && (*child_func) ((GdkWindow *)child, user_data))
3058
3086
  return gdk_window_foreign_new_for_display (gdk_display_get_default (), anid);
3059
3087
}
3060
3088
 
 
3089
/**
 
3090
 * gdk_window_set_composited:
 
3091
 * @window: a #GdkWindow
 
3092
 * @composited: %TRUE to set the window as composited
 
3093
 *
 
3094
 * Sets a #GdkWindow as composited, or unsets it. Composited 
 
3095
 * windows do not automatically have their contents drawn to 
 
3096
 * the screen. Drawing is redirected to an offscreen buffer 
 
3097
 * and an expose event is emitted on the parent of the composited 
 
3098
 * window. It is the responsibility of the parent's expose handler
 
3099
 * to manually merge the off-screen content onto the screen in
 
3100
 * whatever way it sees fit. See <xref linkend="composited-window-example"/>
 
3101
 * for an example.
 
3102
 *
 
3103
 * It only makes sense for child windows to be composited; see
 
3104
 * gdk_window_set_opacity() if you need translucent toplevel
 
3105
 * windows.
 
3106
 *
 
3107
 * An additional effect of this call is that the area of this
 
3108
 * window is no longer clipped from regions marked for
 
3109
 * invalidation on its parent. Draws done on the parent
 
3110
 * window are also no longer clipped by the child.
 
3111
 *
 
3112
 * This call is only supported on some systems (currently,
 
3113
 * only X11 with new enough Xcomposite and Xdamage extensions). 
 
3114
 * You must call gdk_display_supports_composite() to check if
 
3115
 * setting a window as composited is supported before
 
3116
 * attempting to do so.
 
3117
 *
 
3118
 * Since: 2.12
 
3119
 */
 
3120
void
 
3121
gdk_window_set_composited (GdkWindow *window,
 
3122
                           gboolean   composited)
 
3123
{
 
3124
  GdkWindowObject *private = (GdkWindowObject *)window;
 
3125
  GdkDisplay *display;
 
3126
 
 
3127
  g_return_if_fail (window != NULL);
 
3128
  g_return_if_fail (GDK_IS_WINDOW (window));
 
3129
 
 
3130
  composited = composited != FALSE;
 
3131
 
 
3132
  if (private->composited == composited)
 
3133
    return;
 
3134
 
 
3135
  display = gdk_drawable_get_display (GDK_DRAWABLE (window));
 
3136
 
 
3137
  if (!gdk_display_supports_composite (display) && composited)
 
3138
    {
 
3139
      g_warning ("gdk_window_set_composited called but "
 
3140
                 "compositing is not supported");
 
3141
      return;
 
3142
    }
 
3143
 
 
3144
  _gdk_windowing_window_set_composited (window, composited);
 
3145
 
 
3146
  private->composited = composited;
 
3147
}
 
3148
 
3061
3149
#define __GDK_WINDOW_C__
3062
3150
#include "gdkaliasdef.c"