[gtk+/client-side-windows] Handle gdk_window_beep on offscreen windows



commit 56dfbd997e536b5a752707b7c1867d42dab0c3ae
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 11 22:11:48 2009 +0200

    Handle gdk_window_beep on offscreen windows

 gdk/gdk.symbols         |    2 +-
 gdk/gdkinternals.h      |    5 +++--
 gdk/gdkwindow.c         |   30 ++++++++++++++++++++++++++++++
 gdk/x11/gdkwindow-x11.c |   15 +--------------
 4 files changed, 35 insertions(+), 17 deletions(-)
---
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index d7ec27c..b94a4dc 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -715,6 +715,7 @@ gdk_window_thaw_toplevel_updates_libgtk_only
 gdk_window_thaw_updates
 gdk_window_set_composited
 gdk_pointer_grab
+gdk_window_beep
 #endif
 #endif
 
@@ -758,7 +759,6 @@ gdk_window_set_focus_on_map
 gdk_window_set_icon_list
 gdk_window_set_icon
 gdk_window_set_icon_name
-gdk_window_beep
 gdk_window_set_opacity
 gdk_window_iconify
 gdk_window_deiconify
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index cb14006..4f0d666 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -438,11 +438,12 @@ gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
 
 gulong   _gdk_windowing_window_get_next_serial  (GdkDisplay *display);
 void     _gdk_windowing_window_get_offsets      (GdkWindow  *window,
-												 gint       *x_offset,
-												 gint       *y_offset);
+						 gint       *x_offset,
+						 gint       *y_offset);
 GdkRegion *_gdk_windowing_window_get_shape      (GdkWindow  *window);
 GdkRegion *_gdk_windowing_window_get_input_shape(GdkWindow  *window);
 GdkRegion *_gdk_windowing_get_shape_for_mask    (GdkBitmap *mask);
+void     _gdk_windowing_window_beep             (GdkWindow *window);
 
 
 void       _gdk_windowing_get_pointer        (GdkDisplay       *display,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index b843b08..2b6adc7 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -8089,6 +8089,36 @@ _gdk_window_find_descendant_at (GdkWindow *toplevel,
   return (GdkWindow *)private;
 }
 
+/**
+ * gdk_window_beep:
+ * @window: a toplevel #GdkWindow
+ *
+ * Emits a short beep associated to @window in the appropriate
+ * display, if supported. Otherwise, emits a short beep on
+ * the display just as gdk_display_beep().
+ *
+ * Since: 2.12
+ **/
+void
+gdk_window_beep (GdkWindow *window)
+{
+  GdkDisplay *display;
+  GdkWindow *toplevel;
+
+  g_return_if_fail (GDK_IS_WINDOW (window));
+
+  if (GDK_WINDOW_DESTROYED (window))
+    return;
+
+  toplevel = get_event_toplevel (window);
+  display = gdk_drawable_get_display (GDK_DRAWABLE (window));
+
+  if (toplevel && gdk_window_is_offscreen ((GdkWindowObject *)toplevel))
+    _gdk_windowing_window_beep (toplevel);
+  else
+    gdk_display_beep (display);
+}
+
 static const guint type_masks[] = {
   GDK_SUBSTRUCTURE_MASK, /* GDK_DELETE                 = 0  */
   GDK_STRUCTURE_MASK, /* GDK_DESTROY                   = 1  */
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 2d57c76..291d25d 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -5423,26 +5423,13 @@ gdk_window_configure_finished (GdkWindow *window)
 #endif
 }
 
-/**
- * gdk_window_beep:
- * @window: a toplevel #GdkWindow
- *
- * Emits a short beep associated to @window in the appropriate
- * display, if supported. Otherwise, emits a short beep on
- * the display just as gdk_display_beep().
- *
- * Since: 2.12
- **/
 void
-gdk_window_beep (GdkWindow *window)
+_gdk_windowing_window_beep (GdkWindow *window)
 {
   GdkDisplay *display;
 
   g_return_if_fail (GDK_IS_WINDOW (window));
 
-  if (GDK_WINDOW_DESTROYED (window))
-    return;
-  
   display = GDK_WINDOW_DISPLAY (window);
 
 #ifdef HAVE_XKB



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]