[byzanz] When alt-tabbing away from the area selection window, abort selecting



commit cf6b7e58bb781bd4539536c1fca703f36d248c94
Author: Benjamin Otte <otte gnome org>
Date:   Sat Aug 15 16:31:20 2009 +0200

    When alt-tabbing away from the area selection window, abort selecting

 src/byzanzselect.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/byzanzselect.c b/src/byzanzselect.c
index 135c6a6..5411581 100644
--- a/src/byzanzselect.c
+++ b/src/byzanzselect.c
@@ -1,5 +1,5 @@
 /* desktop session recorder
- * Copyright (C) 2005 Benjamin Otte <otte gnome org
+ * Copyright (C) 2005,2009 Benjamin Otte <otte gnome org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -180,6 +180,13 @@ quit_cb (gpointer datap)
   return FALSE;
 }
 
+static void
+active_cb (GtkWindow *window, GParamSpec *pspec, WindowData *data)
+{
+  if (!gtk_window_is_active (window))
+    byzanz_select_area_stop (data);
+}
+
 static GdkWindow *
 byzanz_select_area (GdkRectangle *rect)
 {
@@ -206,7 +213,8 @@ byzanz_select_area (GdkRectangle *rect)
   g_signal_connect (data->window, "button-press-event", G_CALLBACK (button_pressed_cb), data);
   g_signal_connect (data->window, "button-release-event", G_CALLBACK (button_released_cb), data);
   g_signal_connect (data->window, "motion-notify-event", G_CALLBACK (motion_notify_cb), data);
-  g_signal_connect (data->window, "delete-event", G_CALLBACK (gtk_main_quit), data);
+  g_signal_connect_swapped (data->window, "delete-event", G_CALLBACK (byzanz_select_area_stop), data);
+  g_signal_connect (data->window, "notify::is-active", G_CALLBACK (active_cb), data);
   g_signal_connect_after (data->window, "realize", G_CALLBACK (realize_cb), data);
   gtk_widget_show_all (data->window);
 



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